Rework the logic of dragging module to cargo

This commit is contained in:
Ryan Holmes
2018-08-13 17:01:16 -04:00
parent 9977866eb0
commit d74f2b2e42
3 changed files with 79 additions and 16 deletions

View File

@@ -126,22 +126,14 @@ class CargoView(d.Display):
if not result:
return
if dstRow != -1: # we're swapping with cargo
if mstate.cmdDown: # if copying, append to cargo
sFit.addCargo(self.mainFrame.getActiveFit(), module.item.ID if not module.item.isAbyssal else module.baseItemID)
else: # else, move / swap
# self.mainFrame.command.Submit(cmd.GuiCargoToModuleCommand(
# self.mainFrame.getActiveFit(),
# module.modPosition,
# dstRow))
sFit.moveCargoToModule(self.mainFrame.getActiveFit(), module.position, dstRow)
else: # dragging to blank spot, append
sFit.addCargo(self.mainFrame.getActiveFit(), module.item.ID if not module.item.isAbyssal else module.baseItemID)
cargoPos = dstRow if dstRow > -1 else None
if not mstate.cmdDown: # if not copying, remove module
sFit.removeModule(self.mainFrame.getActiveFit(), module.position)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit(), action="moddel", typeID=module.item.ID))
self.mainFrame.command.Submit(cmd.GuiModuleToCargoCommand(
self.mainFrame.getActiveFit(),
module.modPosition,
cargoPos,
mstate.cmdDown
))
def fitChanged(self, event):
sFit = Fit.getInstance()