|
From: Kevin A. <ka...@us...> - 2006-08-10 09:40:57
|
Update of /cvsroot/pythoncard/PythonCard/tools/codeEditor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16193/tools/codeEditor Modified Files: codeEditor.py Log Message: added support for save before opening drag and drop document Index: codeEditor.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/tools/codeEditor/codeEditor.py,v retrieving revision 1.127 retrieving revision 1.128 diff -C2 -d -r1.127 -r1.128 *** codeEditor.py 4 Aug 2006 20:26:32 -0000 1.127 --- codeEditor.py 10 Aug 2006 09:40:54 -0000 1.128 *************** *** 86,89 **** --- 86,115 ---- # a cursor location # in the tabcodeEditor could open tabs for each file dropped + + # KEA 2006-08-10 + # modified from on_menuFileOpen_select + # replaced self with self.window + # since codeEditor uses a single window, give the user + # a chance to save the document if it has been changed + # if the user doesn't save, then the drop operation + # won't complete do to the return below + # in tabcodeEditor.py it would probably make more sense to just + # open a new tab if the current document has been modified + if self.window.components.document.GetModify(): + save = self.window.saveChanges() + if save == "Cancel": + # don't do anything, just go back to editing + return + elif save == "No": + # any changes will be lost + pass + else: + if self.window.documentPath is None: + # if the user cancels out of the Save As then go back to editing + if not self.window.on_menuFileSaveAs_select(None): + return + else: + self.window.saveFile(self.window.documentPath) + self.window.openFile(filenames[0]) |