Rework FitChanged command to avoid refreshing graph multiple times in certain cases

This commit is contained in:
DarkPhoenix
2019-07-07 14:25:27 +03:00
parent 64bc2c34c2
commit 3a09f4b45c
98 changed files with 254 additions and 248 deletions

View File

@@ -36,7 +36,7 @@ class AmmoToDmgPattern(ContextMenuSingle):
def activate(self, fullContext, mainItem, i):
fitID = self.mainFrame.getActiveFit()
Fit.getInstance().setAsPattern(fitID, mainItem)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
wx.PostEvent(self.mainFrame, GE.FitChanged(fitIDs=(fitID,)))
def getBitmap(self, context, mainItem):
return None

View File

@@ -108,7 +108,7 @@ class ChangeDamagePattern(ContextMenuUnconditional):
fitID = self.mainFrame.getActiveFit()
sFit.setDamagePattern(fitID, pattern)
setattr(self.mainFrame, "_activeDmgPattern", pattern)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
wx.PostEvent(self.mainFrame, GE.FitChanged(fitIDs=(fitID,)))
ChangeDamagePattern.register()

View File

@@ -24,8 +24,7 @@ class FactorReload(ContextMenuUnconditional):
def activate(self, fullContext, i):
fitIDs = Fit.getInstance().toggleFactorReload()
for fitID in fitIDs:
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
wx.PostEvent(self.mainFrame, GE.FitChanged(fitIDs=tuple(fitIDs)))
@property
def checked(self):

View File

@@ -32,7 +32,8 @@ class ItemGroupPrice(ContextMenuUnconditional, metaclass=ABCMeta):
def activate(self, fullContext, i):
self.settings.set(self.optionName, not self.settings.get(self.optionName))
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit()))
fitID = self.mainFrame.getActiveFit()
wx.PostEvent(self.mainFrame, GE.FitChanged(fitIDs=(fitID,)))
@property
def checked(self):

View File

@@ -116,7 +116,7 @@ class ChangeAffectingSkills(ContextMenuSingle):
self.sFit.changeChar(fitID, self.charID)
wx.PostEvent(self.mainFrame, GE.CharListUpdated())
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
wx.PostEvent(self.mainFrame, GE.FitChanged(fitIDs=(fitID,)))
ChangeAffectingSkills.register()

View File

@@ -38,7 +38,7 @@ class TargetResists(ContextMenuUnconditional):
sFit = Fit.getInstance()
fitID = self.mainFrame.getActiveFit()
sFit.setTargetResists(fitID, pattern)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
wx.PostEvent(self.mainFrame, GE.FitChanged(fitIDs=(fitID,)))
def addPattern(self, rootMenu, pattern):
id = ContextMenuUnconditional.nextID()