Check cargo command reliability

This commit is contained in:
DarkPhoenix
2019-04-20 00:19:17 +03:00
parent 85b046a640
commit fda83bcb49
4 changed files with 27 additions and 12 deletions

View File

@@ -31,7 +31,8 @@ class AddToCargo(ContextMenu):
typeID = int(selection[0].ID)
self.mainFrame.command.Submit(cmd.GuiAddCargoCommand(fitID, typeID, 1))
self.mainFrame.command.Submit(cmd.GuiAddCargoCommand(
fitID=fitID, itemID=typeID, amount=1))
self.mainFrame.additionsPane.select("Cargo")

View File

@@ -25,7 +25,8 @@ class AddToCargoAmmo(ContextMenu):
def activate(self, fullContext, selection, i):
fitID = self.mainFrame.getActiveFit()
typeID = int(selection[0].ID)
self.mainFrame.command.Submit(cmd.GuiAddCargoCommand(fitID, typeID, 1000))
self.mainFrame.command.Submit(cmd.GuiAddCargoCommand(
fitID=fitID, itemID=typeID, amount=1000))
self.mainFrame.additionsPane.select("Cargo")

View File

@@ -48,19 +48,31 @@ class ChangeItemAmount(ContextMenu):
cleanInput = int(float(re.sub(r'[^0-9.]', '', dlg.input.GetLineText(0).strip())))
if isinstance(thing, es_Cargo):
self.mainFrame.command.Submit(cmd.GuiChangeCargoAmountCommand(fitID, thing.itemID, cleanInput))
self.mainFrame.command.Submit(cmd.GuiChangeCargoAmountCommand(
fitID=fitID, itemID=thing.itemID, amount=cleanInput))
elif isinstance(thing, Drone):
if srcContext == "projectedDrone":
self.mainFrame.command.Submit(cmd.GuiChangeProjectedDroneAmountCommand(fitID, thing.itemID, cleanInput))
self.mainFrame.command.Submit(cmd.GuiChangeProjectedDroneAmountCommand(
fitID=fitID, itemID=thing.itemID, amount=cleanInput))
else:
self.mainFrame.command.Submit(cmd.GuiChangeLocalDroneAmountCommand(fitID, fit.drones.index(thing), cleanInput))
if thing in fit.drones:
position = fit.drones.index(thing)
self.mainFrame.command.Submit(cmd.GuiChangeLocalDroneAmountCommand(
fitID=fitID, position=position, amount=cleanInput))
elif isinstance(thing, es_Fit):
self.mainFrame.command.Submit(cmd.GuiChangeProjectedFitAmountCommand(fitID, thing.ID, cleanInput))
self.mainFrame.command.Submit(cmd.GuiChangeProjectedFitAmountCommand(
fitID=fitID, projectedFitID=thing.ID, amount=cleanInput))
elif isinstance(thing, es_Fighter):
if srcContext == "projectedFighter":
self.mainFrame.command.Submit(cmd.GuiChangeProjectedFighterAmountCommand(fitID, fit.projectedFighters.index(thing), cleanInput))
if thing in fit.projectedFighters:
position = fit.projectedFighters.index(thing)
self.mainFrame.command.Submit(cmd.GuiChangeProjectedFighterAmountCommand(
fitID=fitID, position=position, amount=cleanInput))
else:
self.mainFrame.command.Submit(cmd.GuiChangeLocalFighterAmountCommand(fitID, fit.fighters.index(thing), cleanInput))
if thing in fit.fighters:
position = fit.fighters.index(thing)
self.mainFrame.command.Submit(cmd.GuiChangeLocalFighterAmountCommand(
fitID=fitID, position=position, amount=cleanInput))
ChangeItemAmount.register()