From: Kevin A. <ka...@us...> - 2006-08-04 20:26:35
|
Update of /cvsroot/pythoncard/PythonCard/tools/codeEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22173/tools/codeEditor Modified Files: codeEditor.py Log Message: added file drag and drop to codeEditor Index: codeEditor.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/codeEditor/codeEditor.py,v retrieving revision 1.126 retrieving revision 1.127 diff -C2 -d -r1.126 -r1.127 *** codeEditor.py 19 Dec 2005 23:18:04 -0000 1.126 --- codeEditor.py 4 Aug 2006 20:26:32 -0000 1.127 *************** *** 70,73 **** --- 70,92 ---- + class MyFileDropTarget(wx.FileDropTarget): + def __init__(self, window): + wx.FileDropTarget.__init__(self) + self.window = window + + def OnDropFiles(self, x, y, filenames): + print "\n%d file(s) dropped at %d,%d:\n" % (len(filenames), x, y) + for f in filenames: + print f + # KEA 2006-08-04 + # first pass support of drag and drop of files on editor + # just open the first one + # could do other stuff like insert the text of the file dropped + # at the cursor which requires converting the x, y coordinates to + # a cursor location + # in the tabcodeEditor could open tabs for each file dropped + self.window.openFile(filenames[0]) + + class CodeEditor(model.Background): *************** *** 144,147 **** --- 163,168 ---- self.visible = True self.loadShell() + dt = MyFileDropTarget(self) + self.components.document.SetDropTarget(dt) |