From fc4a10efe3a01493c468c989efb9e585693030e6 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Fri, 19 Apr 2019 22:57:06 +0300 Subject: [PATCH] Fix booster removal --- gui/builtinAdditionPanes/boosterView.py | 5 ++++- gui/fitCommands/gui/booster/remove.py | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gui/builtinAdditionPanes/boosterView.py b/gui/builtinAdditionPanes/boosterView.py index d6a8a00d5..79b894b30 100644 --- a/gui/builtinAdditionPanes/boosterView.py +++ b/gui/builtinAdditionPanes/boosterView.py @@ -152,7 +152,10 @@ class BoosterView(d.Display): def removeBooster(self, booster): fitID = self.mainFrame.getActiveFit() - self.mainFrame.command.Submit(cmd.GuiRemoveBoosterCommand(fitID=fitID, position=self.original.index(booster))) + if booster in self.original: + position = self.original.index(booster) + self.mainFrame.command.Submit(cmd.GuiRemoveBoosterCommand( + fitID=fitID, position=position)) def click(self, event): event.Skip() diff --git a/gui/fitCommands/gui/booster/remove.py b/gui/fitCommands/gui/booster/remove.py index 5d0b28e21..7868addf8 100644 --- a/gui/fitCommands/gui/booster/remove.py +++ b/gui/fitCommands/gui/booster/remove.py @@ -8,6 +8,7 @@ from service.fit import Fit class GuiRemoveBoosterCommand(wx.Command): + def __init__(self, fitID, position): wx.Command.__init__(self, True, 'Remove Booster') self.internalHistory = InternalCommandHistory()