Save all the info about mutations into command cache
This commit is contained in:
@@ -29,7 +29,14 @@ class FitRemoveModuleCommand(wx.Command):
|
||||
mod = fit.modules[x]
|
||||
if not mod.isEmpty:
|
||||
pyfalog.debug(" -- Removing {}", mod)
|
||||
self.modCache.append(ModuleInfoCache(mod.modPosition, mod.item.ID, mod.state, mod.charge, mod.baseItemID, mod.mutaplasmidID))
|
||||
self.modCache.append(ModuleInfoCache(
|
||||
mod.modPosition,
|
||||
mod.item.ID,
|
||||
mod.state,
|
||||
mod.charge,
|
||||
mod.baseItemID,
|
||||
mod.mutaplasmidID,
|
||||
{m.attrID: m.value for m in mod.mutators.values()}))
|
||||
fit.modules.toDummy(x)
|
||||
|
||||
# if no modules have changes, skip command
|
||||
|
||||
@@ -27,8 +27,14 @@ class FitReplaceModuleCommand(wx.Command):
|
||||
|
||||
mod = fit.modules[self.position]
|
||||
if not mod.isEmpty:
|
||||
self.old_module = ModuleInfoCache(mod.modPosition, mod.item.ID, mod.state, mod.charge, mod.baseItemID,
|
||||
mod.mutaplasmidID)
|
||||
self.old_module = ModuleInfoCache(
|
||||
mod.modPosition,
|
||||
mod.item.ID,
|
||||
mod.state,
|
||||
mod.charge,
|
||||
mod.baseItemID,
|
||||
mod.mutaplasmidID,
|
||||
{m.attrID: m.value for m in mod.mutators.values()})
|
||||
|
||||
return self.change_module(self.fitID, self.position, self.itemID)
|
||||
|
||||
|
||||
@@ -20,7 +20,13 @@ class GuiModuleRemoveCommand(wx.Command):
|
||||
self.sFit = Fit.getInstance()
|
||||
self.fitID = fitID
|
||||
self.modCache = [ModuleInfoCache(
|
||||
mod.modPosition, mod.item.ID, mod.state, mod.charge, mod.baseItemID, mod.mutaplasmidID) for mod in modules if not mod.isEmpty]
|
||||
mod.modPosition,
|
||||
mod.item.ID,
|
||||
mod.state,
|
||||
mod.charge,
|
||||
mod.baseItemID,
|
||||
mod.mutaplasmidID,
|
||||
{m.attrID: m.value for m in mod.mutators.values()}) for mod in modules if not mod.isEmpty]
|
||||
self.internal_history = wx.CommandProcessor()
|
||||
|
||||
def Do(self):
|
||||
|
||||
@@ -3,7 +3,7 @@ from collections import namedtuple
|
||||
from eos.const import FittingModuleState
|
||||
|
||||
|
||||
ModuleInfoCache = namedtuple('ModuleInfoCache', ['modPosition', 'itemID', 'state', 'charge', 'baseID', 'mutaplasmidID'])
|
||||
ModuleInfoCache = namedtuple('ModuleInfoCache', ['modPosition', 'itemID', 'state', 'charge', 'baseID', 'mutaplasmidID', 'mutations'])
|
||||
|
||||
|
||||
def stateLimit(item):
|
||||
|
||||
Reference in New Issue
Block a user