Start working on some undo / redo functionality. this is just the start, only module state changes and fit rename is implemented, and probably not very well x_x

This commit is contained in:
blitzmann
2018-07-21 00:12:28 -04:00
parent e9cb7696dd
commit 926e0a9035
7 changed files with 75 additions and 7 deletions

View File

@@ -34,6 +34,7 @@ from gui.bitmap_loader import BitmapLoader
import gui.builtinViews.emptyView
from logbook import Logger
from gui.chrome_tabs import EVT_NOTEBOOK_PAGE_CHANGED
import gui.fitCommands as cmd
from service.fit import Fit
from service.market import Market
@@ -127,6 +128,8 @@ class FittingViewDrop(wx.DropTarget):
return t
class FittingView(d.Display):
DEFAULT_COLS = ["State",
"Ammo Icon",
@@ -642,14 +645,14 @@ class FittingView(d.Display):
fitID = self.mainFrame.getActiveFit()
ctrl = event.cmdDown or event.middleIsDown
click = "ctrl" if ctrl is True else "right" if event.GetButton() == 3 else "left"
sFit.toggleModulesState(fitID, self.mods[self.GetItemData(row)], mods, click)
self.mainFrame.command.Submit(cmd.FitModuleStateChangeCommand(fitID, self.mods[self.GetItemData(row)], mods, click))
# update state tooltip
tooltip = self.activeColumns[col].getToolTip(self.mods[self.GetItemData(row)])
if tooltip:
self.SetToolTip(tooltip)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit()))
else:
event.Skip()