diff --git a/gui/fitCommands/calc/drone/localAdd.py b/gui/fitCommands/calc/drone/localAdd.py index 4b7ba3df1..a0f2aa9d9 100644 --- a/gui/fitCommands/calc/drone/localAdd.py +++ b/gui/fitCommands/calc/drone/localAdd.py @@ -13,12 +13,13 @@ pyfalog = Logger(__name__) class CalcAddLocalDroneCommand(wx.Command): - def __init__(self, fitID, droneInfo): + def __init__(self, fitID, droneInfo, forceNewStack=False): wx.Command.__init__(self, True, 'Add Drone') self.fitID = fitID self.droneInfo = droneInfo self.savedDroneInfo = None self.savedPosition = None + self.forceNewStack = forceNewStack def Do(self): pyfalog.debug('Doing addition of local drone {} to fit {}'.format(self.droneInfo, self.fitID)) @@ -26,7 +27,7 @@ class CalcAddLocalDroneCommand(wx.Command): item = Market.getInstance().getItem(self.droneInfo.itemID, eager=("attributes", "group.category")) # If we're not adding any active drones, check if there's an inactive stack # with enough space for new drones and use it - if self.droneInfo.amountActive == 0: + if not self.forceNewStack and self.droneInfo.amountActive == 0: for drone in fit.drones.find(item): if ( drone is not None and drone.amountActive == 0 and diff --git a/gui/fitCommands/gui/localDrone/changeMeta.py b/gui/fitCommands/gui/localDrone/changeMeta.py index 6f9ac21df..18e2bc6f5 100644 --- a/gui/fitCommands/gui/localDrone/changeMeta.py +++ b/gui/fitCommands/gui/localDrone/changeMeta.py @@ -27,7 +27,7 @@ class GuiChangeDroneMetaCommand(wx.Command): info = DroneInfo.fromDrone(drone) info.itemID = self.newItemID cmdRemove = CalcRemoveLocalDroneCommand(fitID=self.fitID, position=self.position, amount=math.inf) - cmdAdd = CalcAddLocalDroneCommand(fitID=self.fitID, droneInfo=info) + cmdAdd = CalcAddLocalDroneCommand(fitID=self.fitID, droneInfo=info, forceNewStack=True) success = self.internalHistory.submitBatch(cmdRemove, cmdAdd) sFit.recalc(self.fitID) wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID)) diff --git a/gui/fitCommands/gui/localFighter/remove.py b/gui/fitCommands/gui/localFighter/remove.py index f383ebb87..ed0c73020 100644 --- a/gui/fitCommands/gui/localFighter/remove.py +++ b/gui/fitCommands/gui/localFighter/remove.py @@ -17,7 +17,7 @@ class GuiRemoveLocalFighterCommand(wx.Command): def Do(self): cmd = CalcRemoveLocalFighterCommand(fitID=self.fitID, position=self.position) - success = self.internalHistory.submit() + success = self.internalHistory.submit(cmd) Fit.getInstance().recalc(self.fitID) wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID)) return success