Fix cargo amount change command
This commit is contained in:
@@ -20,16 +20,16 @@ class GuiChangeCargosAmountCommand(wx.Command):
|
|||||||
self.amount = amount
|
self.amount = amount
|
||||||
|
|
||||||
def Do(self):
|
def Do(self):
|
||||||
cmds = []
|
results = []
|
||||||
if self.amount > 0:
|
if self.amount > 0:
|
||||||
for itemID in self.itemIDs:
|
for itemID in self.itemIDs:
|
||||||
cmd = CalcChangeCargoAmountCommand(fitID=self.fitID, cargoInfo=CargoInfo(itemID=itemID, amount=self.amount))
|
cmd = CalcChangeCargoAmountCommand(fitID=self.fitID, cargoInfo=CargoInfo(itemID=itemID, amount=self.amount))
|
||||||
cmds.append(cmd)
|
results.append(self.internalHistory.submit(cmd))
|
||||||
else:
|
else:
|
||||||
for itemID in self.itemIDs:
|
for itemID in self.itemIDs:
|
||||||
cmd = CalcRemoveCargoCommand(fitID=self.fitID, cargoInfo=CargoInfo(itemID=itemID, amount=math.inf))
|
cmd = CalcRemoveCargoCommand(fitID=self.fitID, cargoInfo=CargoInfo(itemID=itemID, amount=math.inf))
|
||||||
cmds.append(cmd)
|
results.append(self.internalHistory.submit(cmd))
|
||||||
success = self.internalHistory.submitBatch(*cmds)
|
success = any(results)
|
||||||
eos.db.commit()
|
eos.db.commit()
|
||||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitIDs=(self.fitID,)))
|
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitIDs=(self.fitID,)))
|
||||||
return success
|
return success
|
||||||
|
|||||||
Reference in New Issue
Block a user