diff --git a/gui/mainFrame.py b/gui/mainFrame.py index 65a37c178..380d6df96 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -112,6 +112,9 @@ class MainFrame(wx.Frame): self.SetSizer(mainSizer) + self.addTabId = wx.NewId() + self.closeTabId = wx.NewId() + #Add menu self.SetMenuBar(MainMenuBar()) #self.SetToolBar(MainToolBar(self)) @@ -246,17 +249,16 @@ class MainFrame(wx.Frame): #Clipboard exports self.Bind(wx.EVT_MENU, self.exportToClipboard, id=wx.ID_COPY) - addTabId = wx.NewId() toggleShipMarketId = wx.NewId() # Close Tab - self.Bind(wx.EVT_MENU, self.CloseCurrentFit, id=wx.ID_CLOSE) - self.Bind(wx.EVT_MENU,self.HAddTab, id = addTabId) + self.Bind(wx.EVT_MENU, self.CloseCurrentFit, id=self.closeTabId) + self.Bind(wx.EVT_MENU,self.HAddTab, id = self.addTabId) self.Bind(wx.EVT_MENU,self.toggleShipMarket, id = toggleShipMarketId) - actb = [(wx.ACCEL_CTRL, ord('T'), addTabId), - (wx.ACCEL_CMD, ord('T'), addTabId), - (wx.ACCEL_CTRL, ord("W"), wx.ID_CLOSE), - (wx.ACCEL_CMD, ord("W"), wx.ID_CLOSE), + actb = [(wx.ACCEL_CTRL, ord('T'), self.addTabId), + (wx.ACCEL_CMD, ord('T'), self.addTabId), + (wx.ACCEL_CTRL, ord("W"), self.closeTabId), + (wx.ACCEL_CMD, ord("W"), self.closeTabId), (wx.ACCEL_CTRL, ord(" "), toggleShipMarketId), (wx.ACCEL_CMD, ord(" "), toggleShipMarketId)] atable = wx.AcceleratorTable(actb) diff --git a/gui/mainMenuBar.py b/gui/mainMenuBar.py index 8619d9ede..19c8ab029 100644 --- a/gui/mainMenuBar.py +++ b/gui/mainMenuBar.py @@ -28,21 +28,25 @@ class MainMenuBar(wx.MenuBar): self.damagePatternEditorId = wx.NewId() self.backupFitsId = wx.NewId() + self.mainFrame = gui.mainFrame.MainFrame.getInstance() + wx.MenuBar.__init__(self) # File menu fileMenu = wx.Menu() self.Append(fileMenu, "&File") - if 'wxMSW' in wx.PlatformInfo: - fileMenu.Append(wx.ID_CLOSE, "&Close\tCTRL+W", "Close the currently open fit") - else: - fileMenu.Append(wx.ID_CLOSE) - fileMenu.Append(wx.ID_EXIT) + + fileMenu.Append(self.mainFrame.addTabId, "New fitting tab\tCTRL+T", "Close the currently open fit") + fileMenu.Append(self.mainFrame.closeTabId, "Close current fitting tab\tCTRL+W", "Close the currently open fit") fileMenu.AppendSeparator() + fileMenu.Append(self.backupFitsId, "&Backup fits", "Backup all fittings to a XML file") fileMenu.Append(wx.ID_OPEN, "&Import\tCTRL+O", "Import a fit into pyfa.") fileMenu.Append(wx.ID_SAVEAS, "&Export\tCTRL+S", "Export the fit to another format.") + fileMenu.AppendSeparator() + fileMenu.Append(wx.ID_EXIT) + # Edit menu editMenu = wx.Menu() @@ -79,7 +83,7 @@ class MainMenuBar(wx.MenuBar): helpMenu.Append(911,"Open Widgets Inspect tool", "Open Widgets Inspect tool") - self.mainFrame = gui.mainFrame.MainFrame.getInstance() + self.mainFrame.Bind(gui.fittingView.FIT_CHANGED, self.fitChanged) def fitChanged(self, event):