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:
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user