Check cargo command reliability
This commit is contained in:
@@ -78,9 +78,10 @@ class CargoView(d.Display):
|
||||
if data[0] == "fitting":
|
||||
self.swapModule(x, y, int(data[1]))
|
||||
elif data[0] == "market":
|
||||
fit = self.mainFrame.getActiveFit()
|
||||
if fit:
|
||||
self.mainFrame.command.Submit(cmd.GuiAddCargoCommand(fit, int(data[1]), 1))
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
if fitID:
|
||||
self.mainFrame.command.Submit(cmd.GuiAddCargoCommand(
|
||||
fitID=fitID, itemID=int(data[1]), amount=1))
|
||||
|
||||
def startDrag(self, event):
|
||||
row = event.GetIndex()
|
||||
@@ -156,7 +157,7 @@ class CargoView(d.Display):
|
||||
if col != self.getColIndex(State):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
cargo = self.cargo[self.GetItemData(row)]
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveCargoCommand(fitID, cargo.itemID))
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveCargoCommand(fitID=fitID, itemID=cargo.itemID))
|
||||
|
||||
def spawnMenu(self, event):
|
||||
sel = self.GetFirstSelected()
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user