Allow to close all tabs with one action
This commit is contained in:
@@ -206,6 +206,7 @@ class MainFrame(wx.Frame):
|
||||
# Add menu
|
||||
self.addPageId = wx.NewId()
|
||||
self.closePageId = wx.NewId()
|
||||
self.closeAllPagesId = wx.NewId()
|
||||
|
||||
self.widgetInspectMenuID = wx.NewId()
|
||||
self.SetMenuBar(MainMenuBar(self))
|
||||
@@ -328,6 +329,11 @@ class MainFrame(wx.Frame):
|
||||
if page is not None:
|
||||
ms.DeletePage(page)
|
||||
|
||||
def CloseAllPages(self, evt):
|
||||
ms = self.fitMultiSwitch
|
||||
for _ in range(ms.GetPageCount()):
|
||||
ms.DeletePage(0)
|
||||
|
||||
def OnClose(self, event):
|
||||
self.UpdateMainFrameAttribs()
|
||||
|
||||
@@ -528,6 +534,7 @@ class MainFrame(wx.Frame):
|
||||
|
||||
# Close Page
|
||||
self.Bind(wx.EVT_MENU, self.CloseCurrentPage, id=self.closePageId)
|
||||
self.Bind(wx.EVT_MENU, self.CloseAllPages, id=self.closeAllPagesId)
|
||||
self.Bind(wx.EVT_MENU, self.HAddPage, id=self.addPageId)
|
||||
self.Bind(wx.EVT_MENU, self.toggleSearchBox, id=toggleSearchBoxId)
|
||||
self.Bind(wx.EVT_MENU, self.toggleShipMarket, id=toggleShipMarketId)
|
||||
@@ -544,6 +551,10 @@ class MainFrame(wx.Frame):
|
||||
(wx.ACCEL_CTRL, wx.WXK_F4, self.closePageId),
|
||||
(wx.ACCEL_CMD, ord("W"), self.closePageId),
|
||||
|
||||
(wx.ACCEL_CTRL | wx.ACCEL_ALT, ord("W"), self.closeAllPagesId),
|
||||
(wx.ACCEL_CTRL | wx.ACCEL_ALT, wx.WXK_F4, self.closeAllPagesId),
|
||||
(wx.ACCEL_CMD | wx.ACCEL_ALT, ord("W"), self.closeAllPagesId),
|
||||
|
||||
(wx.ACCEL_CTRL, ord(" "), toggleShipMarketId),
|
||||
(wx.ACCEL_CMD, ord(" "), toggleShipMarketId),
|
||||
|
||||
|
||||
@@ -73,6 +73,7 @@ class MainMenuBar(wx.MenuBar):
|
||||
|
||||
fileMenu.Append(self.mainFrame.addPageId, "&New Tab\tCTRL+T", "Open a new fitting tab")
|
||||
fileMenu.Append(self.mainFrame.closePageId, "&Close Tab\tCTRL+W", "Close the current fit")
|
||||
fileMenu.Append(self.mainFrame.closeAllPagesId, "&Close All Tabs\tCTRL+ALT+W", "Close all open fits")
|
||||
|
||||
fileMenu.AppendSeparator()
|
||||
fileMenu.Append(self.backupFitsId, "&Backup All Fittings", "Backup all fittings to a XML file")
|
||||
|
||||
@@ -47,7 +47,6 @@ class MultiSwitch(ChromeNotebook):
|
||||
if self.GetPageCount() == 0:
|
||||
self.AddPage()
|
||||
|
||||
|
||||
class TabSpawner(object):
|
||||
tabTypes = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user