Accurately restore mod states on Undo(), if they were both changed manually and during state check on Do()
This commit is contained in:
@@ -61,6 +61,6 @@ class CalcChangeLocalModuleStatesCommand(wx.Command):
|
||||
mod = fit.modules[position]
|
||||
pyfalog.debug('Reverting {} to state {} for fit ID {}'.format(mod, state, self.fitID))
|
||||
mod.state = state
|
||||
restoreCheckedStates(fit, self.savedStateCheckChanges)
|
||||
restoreCheckedStates(fit, self.savedStateCheckChanges, ignoreModPoss=self.savedStates)
|
||||
eos.db.commit()
|
||||
return True
|
||||
|
||||
@@ -332,11 +332,13 @@ def droneStackLimit(fit, itemIdentity):
|
||||
return limit
|
||||
|
||||
|
||||
def restoreCheckedStates(fit, stateInfo):
|
||||
def restoreCheckedStates(fit, stateInfo, ignoreModPoss=()):
|
||||
if stateInfo is None:
|
||||
return
|
||||
changedMods, changedProjMods, changedProjDrones = stateInfo
|
||||
for pos, state in changedMods.items():
|
||||
if pos in ignoreModPoss:
|
||||
continue
|
||||
fit.modules[pos].state = state
|
||||
for pos, state in changedProjMods.items():
|
||||
fit.projectedModules[pos].state = state
|
||||
|
||||
Reference in New Issue
Block a user