I searched the Internet quite difficult, but could not find a way to do this. Even Robin Dunn says that the source code application does not know anything about the target when the data is deleted to the file system. But I realized that this is an easy way to do this, at least on Windows. We simply drag and drop a DropSource containing an empty FileDataObject into the explorer window. Since there is no data, all this leads to the fact that the Explorer window is at the top, which allows us to get the path to the folder into which the user dragged. First, be sure to bind the event to the ListCtrl element in the __init__ def of the ListCtrl parent:
self.lc.Bind(wx.EVT_LIST_BEGIN_DRAG, self.onDrag)
Then do this in the method called by the event:
def onDrag(self, event): data = wx.FileDataObject() obj = event.GetEventObject() dropSource = wx.DropSource(obj) dropSource.SetData(data)
The dloadItems method gets the selected items from ListCtrl, and then (in this application) downloads the items from the REST server to outdir.
This solution requires a pywin32 extension, of course.
good luck
Mike
source share