Finish reworking booster command invokation
This commit is contained in:
@@ -165,7 +165,11 @@ class BoosterView(d.Display):
|
||||
if col == self.getColIndex(State):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
booster = self.boosters[self.GetItemData(row)]
|
||||
self.mainFrame.command.Submit(cmd.GuiToggleBoosterStateCommand(fitID=fitID, position=self.original.index(booster)))
|
||||
if booster in self.original:
|
||||
position = self.original.index(booster)
|
||||
self.mainFrame.command.Submit(cmd.GuiToggleBoosterStateCommand(
|
||||
fitID=fitID,
|
||||
position=position))
|
||||
|
||||
def spawnMenu(self, event):
|
||||
sel = self.GetFirstSelected()
|
||||
|
||||
@@ -9,6 +9,7 @@ from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class BoosterSideEffect(ContextMenu):
|
||||
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
@@ -58,14 +59,17 @@ class BoosterSideEffect(ContextMenu):
|
||||
|
||||
def handleMode(self, event):
|
||||
effect = self.effectIds[event.Id]
|
||||
if effect is False or effect not in self.booster.sideEffects:
|
||||
booster = self.booster
|
||||
if effect is False or effect not in booster.sideEffects:
|
||||
event.Skip()
|
||||
return
|
||||
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
fit = Fit.getInstance().getFit(fitID)
|
||||
index = fit.boosters.index(self.booster)
|
||||
self.mainFrame.command.Submit(cmd.GuiToggleBoosterSideEffectStateCommand(fitID, index, effect.effectID))
|
||||
if booster in fit.boosters:
|
||||
index = fit.boosters.index(booster)
|
||||
self.mainFrame.command.Submit(cmd.GuiToggleBoosterSideEffectStateCommand(
|
||||
fitID=fitID, position=index, effectID=effect.effectID))
|
||||
|
||||
|
||||
BoosterSideEffect.register()
|
||||
|
||||
@@ -8,6 +8,7 @@ from service.fit import Fit
|
||||
|
||||
|
||||
class GuiToggleBoosterStateCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, position):
|
||||
wx.Command.__init__(self, True, 'Toggle Booster State')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
|
||||
Reference in New Issue
Block a user