From: Steven P. <n9...@n9...> - 2004-04-06 22:52:55
|
On Apr 6, 2004, at 12:12 PM, Roger Binns wrote: >> ...was that a general issue with the new fileview, > > My plan was to complete more of it in the wallpaper view, > and then the ringer view would be a quick changeover :-) Strange, I'm still digging but can't grok why the dragndrop events aren't coming through... The OnDrop() method is never called. Hmmmm.... I thought it may be due to using a subclass of a subclass of wxPanel, but that isn't it... I took the dragndrop sample and made it use a bpmedia.MediaDisplayer object and it works just fine... I'll include that below, but you also need the run.py module from the wxPython demo directory. Anyway, still working on it, but still not getting anything to trigger the OnDrop() method... import wx import guiwidgets import bpmedia #---------------------------------------------------------------------- class MyFileDropTarget(wx.FileDropTarget): def __init__(self, window, log): wx.FileDropTarget.__init__(self) self.window = window self.log = log def OnDropFiles(self, x, y, filenames): print "%d file(s) dropped at %d,%d\n" % (len(filenames), x, y) for file in filenames: print file,":", class FileDropPanel(wx.Panel): def __init__(self, parent, log): wx.Panel.__init__(self, parent, -1) dt = MyFileDropTarget(self, log) self.SetDropTarget(dt) #---------------------------------------------------------------------- #class TestPanel(wx.Panel): class TestPanel(bpmedia.MediaDisplayer): def __init__(self, parent, log): # wx.Panel.__init__(self, parent, -1) bpmedia.MediaDisplayer.__init__(self, parent) self.SetAutoLayout(True) outsideSizer = wx.BoxSizer(wx.VERTICAL) outsideSizer.Add(FileDropPanel(self, log), 1, wx.EXPAND) self.SetSizer(outsideSizer) #---------------------------------------------------------------------- def runTest(frame, nb, log): win = TestPanel(nb, log) return win #---------------------------------------------------------------------- if __name__ == '__main__': import sys,os import run run.main(['', os.path.basename(sys.argv[0])]) |