Overhaul module-related commands
This commit is contained in:
@@ -3,16 +3,14 @@ from logbook import Logger
|
||||
|
||||
import eos.db
|
||||
from service.fit import Fit
|
||||
from gui.fitCommands.helpers import ModuleInfoCache
|
||||
from gui.fitCommands.helpers import ModuleInfo
|
||||
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
class FitRemoveProjectedModuleCommand(wx.Command):
|
||||
""""
|
||||
from sFit.project
|
||||
"""
|
||||
|
||||
def __init__(self, fitID, position):
|
||||
wx.Command.__init__(self, True)
|
||||
self.fitID = fitID
|
||||
@@ -23,17 +21,8 @@ class FitRemoveProjectedModuleCommand(wx.Command):
|
||||
pyfalog.debug("Removing ({}) onto: {}".format(self.fitID, self.position))
|
||||
fit = Fit.getInstance().getFit(self.fitID)
|
||||
mod = fit.projectedModules[self.position]
|
||||
self.savedModInfo = ModuleInfoCache(
|
||||
modPosition=self.position,
|
||||
itemID=mod.itemID,
|
||||
state=mod.state,
|
||||
chargeID=mod.chargeID,
|
||||
baseID=None,
|
||||
mutaplasmidID=None,
|
||||
mutations={})
|
||||
|
||||
self.savedModInfo = ModuleInfo.fromModule(mod)
|
||||
del fit.projectedModules[self.position]
|
||||
|
||||
eos.db.commit()
|
||||
return True
|
||||
|
||||
@@ -41,12 +30,6 @@ class FitRemoveProjectedModuleCommand(wx.Command):
|
||||
from gui.fitCommands.calc.fitAddProjectedModule import FitAddProjectedModuleCommand
|
||||
cmd = FitAddProjectedModuleCommand(
|
||||
fitID=self.fitID,
|
||||
newItemID=self.savedModInfo.itemID,
|
||||
newBaseItemID=self.savedModInfo.baseID,
|
||||
newMutaplasmidID=self.savedModInfo.mutaplasmidID,
|
||||
newMutations=self.savedModInfo.mutations,
|
||||
newState=self.savedModInfo.state,
|
||||
newChargeID=self.savedModInfo.chargeID,
|
||||
newPosition=self.savedModInfo.modPosition)
|
||||
cmd.Do()
|
||||
return True
|
||||
newModInfo=self.savedModInfo,
|
||||
newPosition=self.position)
|
||||
return cmd.Do()
|
||||
|
||||
Reference in New Issue
Block a user