Update of /cvsroot/pythoncard/PythonCard/tools/oneEditor
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21929
Modified Files:
tabcodeEditor.py tabcodeEditor.rsrc.py
Log Message:
added Close Tab menu item under File menu plus experimental handler for it
added wx.FutureCall workaround for initial size event problem
Index: tabcodeEditor.py
===================================================================
RCS file: /cvsroot/pythoncard/PythonCard/tools/oneEditor/tabcodeEditor.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** tabcodeEditor.py 4 Oct 2004 00:04:00 -0000 1.2
--- tabcodeEditor.py 5 Oct 2004 00:42:27 -0000 1.3
***************
*** 164,167 ****
--- 164,175 ----
self.visible = True
self.loadShell()
+
+ # hack to get around size event being hooked up
+ # after on_initialize is called?
+ # that is the only explanation I can think of for needing
+ # to do this
+ w, h = self.size
+ wx.FutureCall(1, self.SetSize, (w, h - 1))
+ wx.FutureCall(1, self.SetSize, (w, h))
***************
*** 503,506 ****
--- 511,553 ----
return self.currentPage.on_menuFileSaveAs_select(event)
+ def on_menuFileCloseTab_select(self, event):
+ # what do we do if there is only one tab?
+ # looks like CodePage on_menuFileSaveAs_select
+ # so this handler and the ones above will throw an exception
+ # if that line is called
+ # just do a Close Tab after opening the app
+ # and typing a character
+ if self.currentPage:
+ page = self.currentPage
+ doc = page.components.document
+ # logic borrowed from doExit
+ if doc.GetModify():
+ save = self.saveChanges(page.documentPath)
+ if save == "Cancel":
+ print "Cancelled Save"
+ elif save == "No":
+ print "Didn't Save"
+ # close the document
+ # and remove the tab here
+ # unless there is only one tab left
+ # in which case I don't know what the UI
+ # should do?!
+ # so probably check the number of tabs here
+ # if len() > 1 then just remove the tab
+ # stick this functionality in another method?
+ else:
+ if page.documentPath is None:
+ if not page.on_menuFileSaveAs_select(None): print "no path, Didn't Save"
+ # this logic was borrowed from doExit
+ # user chose Yes to save on previous dialog but then
+ # cancelled the Save dialog
+ # so don't close the tab
+ else:
+ page.saveFile(page.documentPath)
+ print "Saved"
+ # close the tab
+ # if there is only one tab, what
+ # should we do?
+
def newFile(self):
win = model.childWindow(self.components.notebook, codePage.CodePage)
Index: tabcodeEditor.rsrc.py
===================================================================
RCS file: /cvsroot/pythoncard/PythonCard/tools/oneEditor/tabcodeEditor.rsrc.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** tabcodeEditor.rsrc.py 3 Oct 2004 23:58:01 -0000 1.1
--- tabcodeEditor.rsrc.py 5 Oct 2004 00:42:28 -0000 1.2
***************
*** 34,37 ****
--- 34,41 ----
},
{'type':'MenuItem',
+ 'name':'menuFileCloseTab',
+ 'label':'Close &Tab\tCtrl+W',
+ },
+ {'type':'MenuItem',
'name':'fileSep1',
'label':'-',
|