From 59fb7bcd1b736c93741c9a4d82a0d679404719db Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Mon, 15 Apr 2019 11:48:14 +0300 Subject: [PATCH] Do not show context menu item "open in new tab" for currently selected fit --- gui/builtinContextMenus/openFit.py | 9 +++++++-- gui/builtinContextMenus/tabbedFits.py | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/gui/builtinContextMenus/openFit.py b/gui/builtinContextMenus/openFit.py index 6abbc8479..8b6f6668e 100644 --- a/gui/builtinContextMenus/openFit.py +++ b/gui/builtinContextMenus/openFit.py @@ -15,8 +15,13 @@ class OpenFit(ContextMenu): def display(self, srcContext, selection): if not self.settings.get('openFit'): return False - - return srcContext in ("projectedFit", "commandFit") + if srcContext not in ("projectedFit", "commandFit"): + return False + currentFitID = self.mainFrame.getActiveFit() + selectedFitID = selection[0].ID + if currentFitID == selectedFitID: + return False + return True def getText(self, itmContext, selection): return "Open Fit in New Tab" diff --git a/gui/builtinContextMenus/tabbedFits.py b/gui/builtinContextMenus/tabbedFits.py index c913c1255..56f9539b0 100644 --- a/gui/builtinContextMenus/tabbedFits.py +++ b/gui/builtinContextMenus/tabbedFits.py @@ -14,13 +14,13 @@ class TabbedFits(ContextMenu): def display(self, srcContext, selection): - if self.mainFrame.getActiveFit() is None or srcContext not in ("projected", "commandView"): + if self.mainFrame.getActiveFit() is None or srcContext not in ('projected', 'commandView'): return False return True def getText(self, itmContext, selection): - return "Currently Open Fits" + return 'Add Currently Open Fit' def getSubMenu(self, context, selection, rootMenu, i, pitem): self.fitLookup = {}