Make sure we recalc during swaps from cargo to module

This commit is contained in:
Ryan Holmes
2018-08-13 18:50:00 -04:00
parent 646a903f18
commit efbf2e7432
3 changed files with 4 additions and 9 deletions

View File

@@ -434,19 +434,12 @@ class FittingView(d.Display):
if not isinstance(module, Module):
return
sFit = Fit.getInstance()
fit = sFit.getFit(self.activeFitID)
typeID = fit.cargo[srcIdx].item.ID
self.mainFrame.command.Submit(cmd.GuiCargoToModuleCommand(
self.mainFrame.getActiveFit(),
module.modPosition,
srcIdx,
mstate.CmdDown() and module.isEmpty))
# wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit(), action="modadd", typeID=typeID))
def swapItems(self, x, y, srcIdx):
"""Swap two modules in fitting window"""
mstate = wx.GetMouseState()

View File

@@ -34,7 +34,7 @@ class GuiCargoToModuleCommand(wx.Command):
fit = sFit.getFit(self.fitID)
module = fit.modules[self.moduleIdx]
cargo = fit.cargo[self.cargoIdx]
result = None
result = False
# We're trying to move a charge from cargo to a slot. Use SetCharge command (don't respect move vs copy)
if sFit.isAmmo(cargo.item.ID):
@@ -64,6 +64,7 @@ class GuiCargoToModuleCommand(wx.Command):
result = self.internal_history.Submit(self.removeCmd)
if result:
sFit.recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID))
return result

View File

@@ -58,9 +58,10 @@ class GuiModuleToCargoCommand(wx.Command):
if not self.copy: # if not copying, remove module
self.internal_history.Submit(FitRemoveModuleCommand(self.mainFrame.getActiveFit(), [self.moduleIdx]))
if result:
sFit.recalc(self.fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.fitID, action="moddel", typeID=module.item.ID))
return result
def Undo(self):