Hi All,
I need to implement drag and drop of file onto gizmos.TreeListCtrl .
Will it be similar to that of implementing with normal tree control.
Any tips / sample code .
Thanks
Thomas
Hi All,
I need to implement drag and drop of file onto gizmos.TreeListCtrl .
Will it be similar to that of implementing with normal tree control.
Any tips / sample code .
Thanks
Thomas
Yes, although you'll probably have to set the drop target on the inner window instead of the whole widget. You can use tlc.GetMainWindow() to get that inner window.
On 9/24/09 10:41 PM, thomas wrote:
Hi All,
I need to implement drag and drop of file onto gizmos.TreeListCtrl .
Will it be similar to that of implementing with normal tree control.
--
Robin Dunn
Software Craftsman
Hi Robin,
I am getting the following error on drag and drop
tried both gizmos.TreeListCtrl And HyperTreeList
import wx.lib.agw.hypertreelist as HTL
type(HTL)
<type 'module'>
HTL.__version__
'0.7'
2009-10-01 11:10:12
Traceback (most recent call last):
File "E:\Thomas\development\python\DocsBoxWidget-v5\gui
\mainProjectFrame.py", line 97, in OnDragOver
item, flags = self.treeCtrl.HitTest((x,y))
File "C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw
\hypertreelist.py", line 3282, in delegate
return getattr(self._main_win, method)(*args, **kwargs)
File "C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw
\hypertreelist.py", line 2280, in HitTest
if point.x <0:
AttributeError: 'tuple' object has no attribute 'x'
2009-10-01 11:10:12
Traceback (most recent call last):
File "C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw
\customtreectrl.py", line 5616, in OnInternalIdle
if not self.HasFlag(TR_MULTIPLE) and not self.GetSelection():
File "C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py",
line 9223, in HasFlag
return _core_.Window_HasFlag(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "wxAssertFailure" failed at ..
\..\src\msw\ole\droptgt.cpp(567) in ConvertDragResultToEffect():
invalid value in ConvertDragResultToEffect
2009-10-01 11:10:12
on gizmos the error i got is
2009-10-01 11:15:03
Traceback (most recent call last):
File "E:\Thomas\development\python\DocsBoxWidget-v5\gui
\mainProjectFrame.py", line 97, in OnDragOver
item, flags = self.treeCtrl.HitTest((x,y))
ValueError: too many values to unpack
2009-10-01 11:15:03
Traceback (most recent call last):
File "E:\Thomas\development\python\DocsBoxWidget-v5\gui
\mainProjectFrame.py", line 94, in OnDragOver
self.frame.dragTimer.Stop()
File "C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\_misc.py",
line 1303, in Stop
return _misc_.Timer_Stop(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "wxAssertFailure" failed at ..
\..\src\msw\ole\droptgt.cpp(567) in ConvertDragResultToEffect():
invalid value in ConvertDragResultToEffect
2009-10-01 11:15:03
Will post a sample application soon.
Thanks
Thomas
On Sep 29, 7:38 am, Robin Dunn <ro...@alldunn.com> wrote:
On 9/24/09 10:41 PM, thomas wrote:
> Hi All,
> I need to implement drag and drop of file onto gizmos.TreeListCtrl .
> Will it be similar to that of implementing with normal tree control.Yes, although you'll probably have to set the drop target on the inner
window instead of the whole widget. You can use tlc.GetMainWindow() to
get that inner window.--
Robin Dunn
Software Craftsmanhttp://wxPython.org
Hi All,
The sample code for the above error below. I have tested with
gizmos,hypertreelist error on both
as you can see it works fine with normal treectrl.
robin i tried setting the droptarget on the MainWindow with no luck
same error.
##########################################################################################
import wx
import os
ID_ROOTNODE=1
wxID_FRAME2TREECTRL1=100
wxID_FRAME1TREELISTCTRL1 =101
wxID_FRAME1DRAGTIMER=102
import wx.lib.agw.hypertreelist as HTL
class MyFileDropTarget(wx.FileDropTarget):
def __init__(self, treeCtrl,frame):
wx.FileDropTarget.__init__(self)
self.treeCtrl = treeCtrl
self.frame=frame
self.selections=
def OnDropFiles(self, x, y, filenames):
self.frame.dragTimer.Stop()
selNode=self.validateSelection();
multipleFiles=False;
newFilename=None;
filename=''
filepath=''
self.reviewDate=''
if (selNode):
data = self.treeCtrl.GetPyData(selNode)
if len(filenames) >1 or os.path.isdir(filenames[0]):
multipleFiles=True;
print data,filenames
def OnDragOver(self, x, y, d):
self.frame.dragTimer.Stop()
self.frame.dragTimer.Start(100)
# provide visual feedback by selecting the item the mouse is
over
item, flags = self.treeCtrl.HitTest((x,y))
selections = self.treeCtrl.GetSelections()
if item:
if selections != [item]:
self.treeCtrl.UnselectAll()
self.treeCtrl.SelectItem(item)
elif selections:
self.treeCtrl.UnselectAll()
return d
#before dropping in the file validate the selection
def validateSelection(self):
item=self.treeCtrl.GetSelection();
print item,"here is the drop"
return item
class MainWindow(wx.Frame):
def __init__(self,parent,id,title):
wx.Frame.__init__(self,parent,wx.ID_ANY, title, size =
( 800,600),
style=wx.DEFAULT_FRAME_STYLE|
wx.NO_FULL_REPAINT_ON_RESIZE)
self.buildTree()
self.dragTimer = wx.Timer(id=wxID_FRAME1DRAGTIMER, owner=self)
self.Bind(wx.EVT_TIMER, self.OnDragTimerTimer,
id=wxID_FRAME1DRAGTIMER)
treeWindow=self.treeListCtrl1.GetMainWindow()
dt = MyFileDropTarget(self.treeListCtrl1,self)
self.treeListCtrl1.SetDropTarget(dt)
#treeWindow.SetDropTarget(dt)
self.Show(True);self.Hide();self.Show(True)
def _init_coll_treeListCtrl1_Columns(self, parent):
# generated method, don't edit
parent.AddColumn(text=u'Clients:')
parent.AddColumn(text='Recent Note:')
def OnDragTimerTimer(self, event):
pt=self.treeListCtrl1.ScreenToClient(wx.GetMousePosition())
(sizeX,SizeY)=self.treeListCtrl1.GetSize()
(x,y)=pt
if (y<0):
self.treeListCtrl1.ScrollLines(y)
if (y>SizeY):
self.treeListCtrl1.ScrollLines(y-SizeY)
event.Skip()
def buildTree(self):
self.treeListCtrl1 = wx.gizmos.TreeListCtrl
(id=wxID_FRAME1TREELISTCTRL1,
#self.treeListCtrl1 = HTL.HyperTreeList
(id=wxID_FRAME1TREELISTCTRL1,
name='treeListCtrl1', parent=self, pos=wx.Point(62, 0),
size=wx.Size(760, 544),style=wx.TR_HAS_BUTTONS|
wx.TR_ROW_LINES |wx.TR_FULL_ROW_HIGHLIGHT)
self.treeListCtrl1.SetMainColumn(1)
self._init_coll_treeListCtrl1_Columns(self.treeListCtrl1)
#self.treeListCtrl1 = wx.TreeCtrl(id=wxID_FRAME2TREECTRL1,
name='treeCtrl1',
# parent=self, pos=wx.Point(72, 56), size=wx.Size(272,
144),
# style=wx.TR_HAS_BUTTONS)
self.buildTreeList();
def buildTreeList(self):
_treeList = [
[2,'Demo Site',None,'OFFICE'],
[6,'Company 1',2,'OFFICE'],
[244,'eforms',2,'OFFICE'],
[101,'Images',2,'CATEGORY'],
[102,'Logos',2,'CATEGORY']
]
rootNode=self.treeListCtrl1.AddRoot("Upload/Download",image =
-1, data = None)
for item in _treeList:
temp=wx.TreeItemData();
temp.SetData(item)
child=self.treeListCtrl1.AppendItem(rootNode,item
[1],data=temp)
app = wx.App()
frame = MainWindow(None, -1, "DocBox Client")
app.MainLoop()
##########################################################################################
Thanks
Thomas
On Oct 1, 11:14 am, thomas <tctho...@gmail.com> wrote:
Hi Robin,
I am getting the following error on drag and drop
tried both gizmos.TreeListCtrl And HyperTreeList
>>> import wx.lib.agw.hypertreelist as HTL
>>> type(HTL)
<type 'module'>
>>> HTL.__version__'0.7'
2009-10-01 11:10:12
Traceback (most recent call last):
File "E:\Thomas\development\python\DocsBoxWidget-v5\gui
\mainProjectFrame.py", line 97, in OnDragOver
item, flags = self.treeCtrl.HitTest((x,y))
File "C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw
\hypertreelist.py", line 3282, in delegate
return getattr(self._main_win, method)(*args, **kwargs)
File "C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw
\hypertreelist.py", line 2280, in HitTest
if point.x <0:
AttributeError: 'tuple' object has no attribute 'x'
2009-10-01 11:10:12
Traceback (most recent call last):
File "C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw
\customtreectrl.py", line 5616, in OnInternalIdle
if not self.HasFlag(TR_MULTIPLE) and not self.GetSelection():
File "C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py",
line 9223, in HasFlag
return _core_.Window_HasFlag(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "wxAssertFailure" failed at ..
\..\src\msw\ole\droptgt.cpp(567) in ConvertDragResultToEffect():
invalid value in ConvertDragResultToEffect
2009-10-01 11:10:12on gizmos the error i got is
2009-10-01 11:15:03
Traceback (most recent call last):
File "E:\Thomas\development\python\DocsBoxWidget-v5\gui
\mainProjectFrame.py", line 97, in OnDragOver
item, flags = self.treeCtrl.HitTest((x,y))
ValueError: too many values to unpack
2009-10-01 11:15:03
Traceback (most recent call last):
File "E:\Thomas\development\python\DocsBoxWidget-v5\gui
\mainProjectFrame.py", line 94, in OnDragOver
self.frame.dragTimer.Stop()
File "C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\_misc.py",
line 1303, in Stop
return _misc_.Timer_Stop(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "wxAssertFailure" failed at ..
\..\src\msw\ole\droptgt.cpp(567) in ConvertDragResultToEffect():
invalid value in ConvertDragResultToEffect
2009-10-01 11:15:03Will post a sample application soon.
Thanks
ThomasOn Sep 29, 7:38 am, Robin Dunn <ro...@alldunn.com> wrote:
> On 9/24/09 10:41 PM, thomas wrote:
> > Hi All,
> > I need to implement drag and drop of file onto gizmos.TreeListCtrl .
> > Will it be similar to that of implementing with normal tree control.> Yes, although you'll probably have to set the drop target on the inner
> window instead of the whole widget. You can use tlc.GetMainWindow() to
> get that inner window.> --
> Robin Dunn
> Software Craftsmanhttp://wxPython.org
Hi,
2009/9/30 thomas:
Hi Robin,
I am getting the following error on drag and drop
tried both gizmos.TreeListCtrl And HyperTreeList
import wx.lib.agw.hypertreelist as HTL
type(HTL)<type 'module'>
HTL.__version__
'0.7'
2009-10-01 11:10:12
Traceback (most recent call last):
File "E:\Thomas\development\python\DocsBoxWidget-v5\gui
\mainProjectFrame.py", line 97, in OnDragOver
item, flags = self.treeCtrl.HitTest((x,y))
File "C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw
\hypertreelist.py", line 3282, in delegate
return getattr(self._main_win, method)(*args, **kwargs)
File "C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw
\hypertreelist.py", line 2280, in HitTest
if point.x <0:
AttributeError: 'tuple' object has no attribute 'x'
This error has now been fixed in SVN.
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
Hi Andrea,
Thanks a lot for that. Can you also advise me on how i can proceed
with updating my code to have the fix installed.
Is the fix applicable to gizmos treelist control as well.
Thanks
Thomas
On Oct 4, 8:48 am, Andrea Gavana <andrea.gav...@gmail.com> wrote:
Hi,
2009/9/30 thomas:
> Hi Robin,
> I am getting the following error on drag and drop
> tried both gizmos.TreeListCtrl And HyperTreeList
>>>> import wx.lib.agw.hypertreelist as HTL
>>>> type(HTL)
> <type 'module'>
>>>> HTL.__version__
> '0.7'> 2009-10-01 11:10:12
> Traceback (most recent call last):
> File "E:\Thomas\development\python\DocsBoxWidget-v5\gui
> \mainProjectFrame.py", line 97, in OnDragOver
> item, flags = self.treeCtrl.HitTest((x,y))
> File "C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw
> \hypertreelist.py", line 3282, in delegate
> return getattr(self._main_win, method)(*args, **kwargs)
> File "C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw
> \hypertreelist.py", line 2280, in HitTest
> if point.x <0:
> AttributeError: 'tuple' object has no attribute 'x'This error has now been fixed in SVN.
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."http://xoomer.alice.it/infinity77/http://thedoomedcity.blogspot.com/
Hi Thomas,
2009/10/4 thomas:
Hi Andrea,
Thanks a lot for that. Can you also advise me on how i can proceed
with updating my code to have the fix installed.
You should grab the code from SVN, which is currently down as Robin is
working on the servers. I'll send you the link once SVN comes up
again.
Is the fix applicable to gizmos treelist control as well.
No, just to HyperTreeList.
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
Hi,
2009/10/4 Andrea Gavana:
Hi Thomas,
2009/10/4 thomas:
Hi Andrea,
Thanks a lot for that. Can you also advise me on how i can proceed
with updating my code to have the fix installed.You should grab the code from SVN, which is currently down as Robin is
working on the servers. I'll send you the link once SVN comes up
again.
You can view the code here:
You can either copy the code and paste it over your copy of
wx.lib.agw.hypertreelist or use an SVN client to grab the whole AGW
library with this address:
http://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/AGW/
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
Hi Andrea,
Thanks a lot for that .. Now it looks to me like there was no error in
your code in the first place ..
it was my bad that i copied the code for the wx.TreeCtrl and didnt
look deeper into the actual error.
item, flags,column = self.treeCtrl.HitTest((x,y))
The HitTest routine returns a colum parameter as well as it should do.
Thanks and Sorry
Thomas
On Oct 4, 9:53 pm, Andrea Gavana <andrea.gav...@gmail.com> wrote:
Hi,
2009/10/4 Andrea Gavana:
> Hi Thomas,
> 2009/10/4 thomas:
>> Hi Andrea,
>> Thanks a lot for that. Can you also advise me on how i can proceed
>> with updating my code to have the fix installed.> You should grab the code from SVN, which is currently down as Robin is
> working on the servers. I'll send you the link once SVN comes up
> again.You can view the code here:
http://svn.wxwidgets.org/viewvc/wx/wxPython/3rdParty/AGW/agw/hypertre…
You can either copy the code and paste it over your copy of
wx.lib.agw.hypertreelist or use an SVN client to grab the whole AGW
library with this address:http://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/AGW/
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."http://xoomer.alice.it/infinity77/http://thedoomedcity.blogspot.com/
Hi All,
Now It seems to me like the ScrollLines are not moving treelistctrl up
and down . it is working fine with normal tree control.
Am i missing something here.
Thanks
Thomas
def OnDragTimerTimer(self, event):
pt=self.treeListCtrl1.ScreenToClient(wx.GetMousePosition())
(sizeX,SizeY)=self.treeListCtrl1.GetSize()
(x,y)=pt
if (y<0):
print "move down"
self.treeListCtrl1.ScrollLines(y)
if (y>SizeY):
print "move up"
self.treeListCtrl1.ScrollLines(y-SizeY)
event.Skip()
On Oct 5, 10:47 am, thomas <tctho...@gmail.com> wrote:
Hi Andrea,
Thanks a lot for that .. Now it looks to me like there was no error in
your code in the first place ..
it was my bad that i copied the code for the wx.TreeCtrl and didnt
look deeper into the actual error.>item, flags,column = self.treeCtrl.HitTest((x,y))
The HitTest routine returns a colum parameter as well as it should do.
Thanks and Sorry
Thomas
On Oct 4, 9:53 pm, Andrea Gavana <andrea.gav...@gmail.com> wrote:
> Hi,
> 2009/10/4 Andrea Gavana:
> > Hi Thomas,
> > 2009/10/4 thomas:
> >> Hi Andrea,
> >> Thanks a lot for that. Can you also advise me on how i can proceed
> >> with updating my code to have the fix installed.> > You should grab the code from SVN, which is currently down as Robin is
> > working on the servers. I'll send you the link once SVN comes up
> > again.> You can view the code here:
>http://svn.wxwidgets.org/viewvc/wx/wxPython/3rdParty/AGW/agw/hypertre…
> You can either copy the code and paste it over your copy of
> wx.lib.agw.hypertreelist or use an SVN client to grab the whole AGW
> library with this address:>http://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/AGW/
> Andrea.
> "Imagination Is The Only Weapon In The War Against Reality."http://xoomer.alice.it/infinity77/http://thedoomedcity.blogspot.com/
Its printing the move up and down correctly but its not scrolling.
Thanks
Thomas
On Nov 16, 11:57 am, thomas <tctho...@gmail.com> wrote:
Hi All,
Now It seems to me like the ScrollLines are not moving treelistctrl up
and down . it is working fine with normal tree control.Am i missing something here.
Thanks
Thomasdef OnDragTimerTimer(self, event):
pt=self.treeListCtrl1.ScreenToClient(wx.GetMousePosition())
(sizeX,SizeY)=self.treeListCtrl1.GetSize()
(x,y)=pt
if (y<0):
print "move down"
self.treeListCtrl1.ScrollLines(y)
if (y>SizeY):
print "move up"
self.treeListCtrl1.ScrollLines(y-SizeY)
event.Skip()On Oct 5, 10:47 am, thomas <tctho...@gmail.com> wrote:
> Hi Andrea,
> Thanks a lot for that .. Now it looks to me like there was no error in
> your code in the first place ..
> it was my bad that i copied the code for the wx.TreeCtrl and didnt
> look deeper into the actual error.> >item, flags,column = self.treeCtrl.HitTest((x,y))
> The HitTest routine returns a colum parameter as well as it should do.
> Thanks and Sorry
> Thomas
> On Oct 4, 9:53 pm, Andrea Gavana <andrea.gav...@gmail.com> wrote:
> > Hi,
> > 2009/10/4 Andrea Gavana:
> > > Hi Thomas,
> > > 2009/10/4 thomas:
> > >> Hi Andrea,
> > >> Thanks a lot for that. Can you also advise me on how i can proceed
> > >> with updating my code to have the fix installed.> > > You should grab the code from SVN, which is currently down as Robin is
> > > working on the servers. I'll send you the link once SVN comes up
> > > again.> > You can view the code here:
> >http://svn.wxwidgets.org/viewvc/wx/wxPython/3rdParty/AGW/agw/hypertre…
> > You can either copy the code and paste it over your copy of
> > wx.lib.agw.hypertreelist or use an SVN client to grab the whole AGW
> > library with this address:> >http://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/AGW/
> > Andrea.
> > "Imagination Is The Only Weapon In The War Against Reality."http://xoomer.alice.it/infinity77/http://thedoomedcity.blogspot.com/