drag and drop to desktop

Hi All,

Can I implement drag and drop to desktop/drive from my python app…

currently I am using “wx.PyDropTarget” and “wx.DropSource” to drag across my treecontrol

and using “wx.FileDropTarget” to drop files on to treecontrol from desktop/local-machine

I have files equivalent to each node in my treecontrol on server.

currently on wx.EVT_TREE_BEGIN_DRAG event of a tree control

def OnTreeCtrl1TreeBeginDrag(self, event):
dt = TestDropTarget(self.treeCtrl1,self)
self.treeCtrl1.SetDropTarget(dt)
curSelections=self.treeCtrl1.GetSelections()
data=[];
for selection in curSelections:
data.append(self.treeCtrl1.GetPyData(selection))
pddd = cPickle.dumps(data, 1)
cdo = wx.CustomDataObject(wx.CustomDataFormat(‘TransanaData’))
cdo.SetData(pddd)
tds = TestDropSource(self,self.treeCtrl1)
tds.SetData(cdo, data)
dragResult = tds.DoDragDrop(True)
if dragResult == wx.DragCopy:
print “Result indicated successful copy”
elif dragResult == wx.DragMove:
print “Result indicated successful move”
for selection in curSelections:
self.treeCtrl1.Delete(selection);
else:
print “Result indicated failed drop”
dt = MyFileDropTarget(self.treeCtrl1,self)
self.treeCtrl1.SetDropTarget(dt)
event.Skip()

what I want to achieve is somehow allow the user to drop nodes selected on to desktop/any location on local machine…

I can see a similar task achieved when I use winscp to connect to a remote machine.

thanks in advance

···

Thomas Thomas

phone +64 7 855 8478
fax +64 7 855 8871

Thomas Thomas wrote:

what I want to achieve is somehow allow the user to drop nodes selected on to desktop/any location on local machine..

Your drop source needs to have a wx.FileDataObject in it.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!