Fixed Windows close-tab bug (I think); refactored

This commit SHOULD fix Ctrl-W/menu-bar closing on Windows; also, the code was refactored into a new multiSwitch method
This commit is contained in:
Lucas Thode
2010-10-25 03:16:27 -05:00
parent 776f581b98
commit d7a4f5c5b8
2 changed files with 10 additions and 5 deletions

View File

@@ -114,12 +114,9 @@ class MainFrame(wx.Frame):
tab, _ = self.notebookBrowsers.HitTest(event.Position)
if tab != -1:
self.notebookBrowsers.SetSelection(tab)
def CloseCurrentFit(self, evt):
self.fitMultiSwitch.removeTab(self.fitMultiSwitch.GetSelection())
#Deleting a tab might have put us on the "+" tab, make sure we don't stay there
if self.fitMultiSwitch.GetSelection() == self.fitMultiSwitch.GetPageCount() - 1:
self.fitMultiSwitch.SetSelection(self.fitMultiSwitch.GetPageCount() - 2)
self.fitMultiSwitch.removeCurrentTab()
def ExitApp(self, evt):
try:

View File

@@ -104,6 +104,14 @@ class MultiSwitch(wx.Notebook):
self.removal = False
def removeCurrentTab(self):
self.removal = True
self.removeTab(self.GetSelection())
#Deleting a tab might have put us on the "+" tab, make sure we don't stay there
if self.GetSelection() == self.GetPageCount() - 1:
self.SetSelection(self.GetPageCount() - 2)
self.removal = False
def checkAdd(self, event):
if event.Selection == self.GetPageCount() - 1:
if "__WXMSW__" not in wx.PlatformInfo: