Move gui commands to their own package to avoid confusion in commands package
This commit is contained in:
0
gui/fitCommands/gui/projectedModule/__init__.py
Normal file
0
gui/fitCommands/gui/projectedModule/__init__.py
Normal file
30
gui/fitCommands/gui/projectedModule/add.py
Normal file
30
gui/fitCommands/gui/projectedModule/add.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from gui.fitCommands.calc.module.projectedAdd import CalcAddProjectedModuleCommand
|
||||
from gui.fitCommands.helpers import InternalCommandHistory, ModuleInfo
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiAddProjectedModuleCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, itemID):
|
||||
wx.Command.__init__(self, True, 'Add Projected Module')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.itemID = itemID
|
||||
|
||||
def Do(self):
|
||||
cmd = CalcAddProjectedModuleCommand(fitID=self.fitID, modInfo=ModuleInfo(itemID=self.itemID))
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
success = self.internalHistory.undoAll()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return success
|
||||
31
gui/fitCommands/gui/projectedModule/changeCharges.py
Normal file
31
gui/fitCommands/gui/projectedModule/changeCharges.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from gui.fitCommands.calc.module.changeCharges import CalcChangeModuleChargesCommand
|
||||
from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiChangeProjectedModuleChargesCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, modules, chargeItemID):
|
||||
wx.Command.__init__(self, True, 'Change Projected Module Charges')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.positions = [mod.modPosition for mod in modules]
|
||||
self.chargeItemID = chargeItemID
|
||||
|
||||
def Do(self):
|
||||
cmd = CalcChangeModuleChargesCommand(fitID=self.fitID, projected=True, chargeMap={p: self.chargeItemID for p in self.positions})
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
success = self.internalHistory.undoAll()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return success
|
||||
37
gui/fitCommands/gui/projectedModule/changeSpool.py
Normal file
37
gui/fitCommands/gui/projectedModule/changeSpool.py
Normal file
@@ -0,0 +1,37 @@
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from gui.fitCommands.calc.module.changeSpool import CalcChangeModuleSpoolCommand
|
||||
from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiChangeProjectedModuleSpoolCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, position, spoolType, spoolAmount):
|
||||
wx.Command.__init__(self, True, 'Change Projected Module Spool')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.position = position
|
||||
self.spoolType = spoolType
|
||||
self.spoolAmount = spoolAmount
|
||||
|
||||
def Do(self):
|
||||
cmd = CalcChangeModuleSpoolCommand(
|
||||
fitID=self.fitID,
|
||||
projected=True,
|
||||
position=self.position,
|
||||
spoolType=self.spoolType,
|
||||
spoolAmount=self.spoolAmount)
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
success = self.internalHistory.undoAll()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return success
|
||||
31
gui/fitCommands/gui/projectedModule/changeState.py
Normal file
31
gui/fitCommands/gui/projectedModule/changeState.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from gui.fitCommands.calc.module.projectedChangeState import CalcChangeProjectedModuleStateCommand
|
||||
from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiChangeProjectedModuleStateCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, position, click):
|
||||
wx.Command.__init__(self, True, 'Change Projected Module State')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.position = position
|
||||
self.click = click
|
||||
|
||||
def Do(self):
|
||||
cmd = CalcChangeProjectedModuleStateCommand(fitID=self.fitID, position=self.position, click=self.click)
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
success = self.internalHistory.undoAll()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return success
|
||||
30
gui/fitCommands/gui/projectedModule/remove.py
Normal file
30
gui/fitCommands/gui/projectedModule/remove.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from gui.fitCommands.calc.module.projectedRemove import CalcRemoveProjectedModuleCommand
|
||||
from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiRemoveProjectedModuleCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, position):
|
||||
wx.Command.__init__(self, True, 'Remove Projected Module')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.position = position
|
||||
|
||||
def Do(self):
|
||||
cmd = CalcRemoveProjectedModuleCommand(fitID=self.fitID, position=self.position)
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
success = self.internalHistory.undoAll()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return success
|
||||
Reference in New Issue
Block a user