diff --git a/gui/auxFrame.py b/gui/auxFrame.py index 90ef09564..4f3fbedb4 100644 --- a/gui/auxFrame.py +++ b/gui/auxFrame.py @@ -53,14 +53,18 @@ class AuxiliaryFrame(wx.Frame): self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE)) @classmethod - def openOne(cls, parent, *args, **kwargs): + def openOne(cls, parent, *args, forceReopen=False, **kwargs): """If window is open and alive - raise it, open otherwise""" - if not cls._instance: + if not cls._instance or forceReopen: + if cls._instance: + cls._instance.Close() frame = cls(parent, *args, **kwargs) cls._instance = frame frame.Show() else: cls._instance.Raise() + return cls._instance + def OnSuppressedAction(self, event): return diff --git a/gui/builtinContextMenus/graphFitAmmoPicker.py b/gui/builtinContextMenus/graphFitAmmoPicker.py index 7f255d132..7ebab3d31 100644 --- a/gui/builtinContextMenus/graphFitAmmoPicker.py +++ b/gui/builtinContextMenus/graphFitAmmoPicker.py @@ -26,8 +26,7 @@ class GraphFitAmmoPicker(ContextMenuSingle): return 'Plot with Different Ammo...' def activate(self, callingWindow, fullContext, mainItem, i): - window = AmmoPickerFrame(callingWindow, mainItem.item) - window.Show() + AmmoPickerFrame.openOne(callingWindow, mainItem.item, forceReopen=True) GraphFitAmmoPicker.register()