Update of /cvsroot/pythoncard/PythonCard/tools/resourceEditor
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18240
Modified Files:
resourceEditor.py
Log Message:
Check if Dialog has been modified before doing a "preview Dialog"
Index: resourceEditor.py
===================================================================
RCS file: /cvsroot/pythoncard/PythonCard/tools/resourceEditor/resourceEditor.py,v
retrieving revision 1.222
retrieving revision 1.223
diff -C2 -d -r1.222 -r1.223
*** resourceEditor.py 9 Aug 2005 13:56:51 -0000 1.222
--- resourceEditor.py 13 Aug 2005 14:53:48 -0000 1.223
***************
*** 1494,1504 ****
dlg.destroy()
! def on_filePreviewDialog_command(self, event):
! # we should prompt to save the .rsrc.py file if needed
! # or in the case of a new file, do a save as before attempting
! # to do a preview
! self.previewDialog()
!
! def runScript(self, useInterpreter):
# KEA 2004-05-08
# auto-save code taken from codeEditor
--- 1494,1498 ----
dlg.destroy()
! def autoSaveFile(self):
# KEA 2004-05-08
# auto-save code taken from codeEditor
***************
*** 1507,1520 ****
if save == "Cancel" or save == "No":
# don't do anything, just go back to editing
! return
else:
if not self.on_menuFileSaveAs_select(None):
# they didn't actually save, just go back
# to editing
! return
elif self.documentChanged:
# auto-save
self.saveFile()
if self.filename is None:
# KEA 2002-03-25
--- 1501,1529 ----
if save == "Cancel" or save == "No":
# don't do anything, just go back to editing
! return False
else:
if not self.on_menuFileSaveAs_select(None):
# they didn't actually save, just go back
# to editing
! return False
elif self.documentChanged:
# auto-save
self.saveFile()
+ return True
+ return True
+
+ def on_filePreviewDialog_command(self, event):
+ # we should prompt to save the .rsrc.py file if needed
+ # or in the case of a new file, do a save as before attempting
+ # to do a preview
+ if not self.autoSaveFile(): return
+ if self.filename is None:
+ # KEA 2002-03-25
+ # should probably present an error dialog here
+ return
+ self.previewDialog()
+ def runScript(self, useInterpreter):
+ if not self.autoSaveFile(): return
if self.filename is None:
# KEA 2002-03-25
|