Rework FitChanged command to avoid refreshing graph multiple times in certain cases
This commit is contained in:
@@ -27,9 +27,9 @@ class GuiAddLocalModuleCommand(wx.Command):
|
||||
eos.db.commit()
|
||||
wx.PostEvent(
|
||||
gui.mainFrame.MainFrame.getInstance(),
|
||||
GE.FitChanged(fitID=self.fitID, action='modadd', typeID=self.itemID)
|
||||
GE.FitChanged(fitIDs=(self.fitID,), action='modadd', typeID=self.itemID)
|
||||
if success else
|
||||
GE.FitChanged(fitID=self.fitID))
|
||||
GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
return success
|
||||
|
||||
def Undo(self):
|
||||
@@ -43,7 +43,7 @@ class GuiAddLocalModuleCommand(wx.Command):
|
||||
eos.db.commit()
|
||||
wx.PostEvent(
|
||||
gui.mainFrame.MainFrame.getInstance(),
|
||||
GE.FitChanged(fitID=self.fitID, action='moddel', typeID=self.itemID)
|
||||
GE.FitChanged(fitIDs=(self.fitID,), action='moddel', typeID=self.itemID)
|
||||
if success else
|
||||
GE.FitChanged(fitID=self.fitID))
|
||||
GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
return success
|
||||
|
||||
@@ -25,7 +25,7 @@ class GuiChangeLocalModuleChargesCommand(wx.Command):
|
||||
sFit.recalc(self.fitID)
|
||||
sFit.fill(self.fitID)
|
||||
eos.db.commit()
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
return success
|
||||
|
||||
def Undo(self):
|
||||
@@ -35,5 +35,5 @@ class GuiChangeLocalModuleChargesCommand(wx.Command):
|
||||
sFit.recalc(self.fitID)
|
||||
sFit.fill(self.fitID)
|
||||
eos.db.commit()
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
return success
|
||||
|
||||
@@ -48,11 +48,11 @@ class GuiChangeLocalModuleMetasCommand(wx.Command):
|
||||
eos.db.commit()
|
||||
events = []
|
||||
if success and self.replacedItemIDs:
|
||||
events.append(GE.FitChanged(fitID=self.fitID, action='moddel', typeID=self.replacedItemIDs))
|
||||
events.append(GE.FitChanged(fitIDs=(self.fitID,), action='moddel', typeID=self.replacedItemIDs))
|
||||
if success:
|
||||
events.append(GE.FitChanged(fitID=self.fitID, action='modadd', typeID=self.newItemID))
|
||||
events.append(GE.FitChanged(fitIDs=(self.fitID,), action='modadd', typeID=self.newItemID))
|
||||
if not events:
|
||||
events.append(GE.FitChanged(fitID=self.fitID))
|
||||
events.append(GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
for event in events:
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), event)
|
||||
return success
|
||||
@@ -68,11 +68,11 @@ class GuiChangeLocalModuleMetasCommand(wx.Command):
|
||||
eos.db.commit()
|
||||
events = []
|
||||
if success:
|
||||
events.append(GE.FitChanged(fitID=self.fitID, action='moddel', typeID=self.newItemID))
|
||||
events.append(GE.FitChanged(fitIDs=(self.fitID,), action='moddel', typeID=self.newItemID))
|
||||
if success and self.replacedItemIDs:
|
||||
events.append(GE.FitChanged(fitID=self.fitID, action='modadd', typeID=self.replacedItemIDs))
|
||||
events.append(GE.FitChanged(fitIDs=(self.fitID,), action='modadd', typeID=self.replacedItemIDs))
|
||||
if not events:
|
||||
events.append(GE.FitChanged(fitID=self.fitID))
|
||||
events.append(GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
for event in events:
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), event)
|
||||
return success
|
||||
|
||||
@@ -30,7 +30,7 @@ class GuiChangeLocalModuleMutationCommand(wx.Command):
|
||||
sFit.recalc(self.fitID)
|
||||
sFit.fill(self.fitID)
|
||||
eos.db.commit()
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
return success
|
||||
|
||||
def Undo(self):
|
||||
@@ -40,5 +40,5 @@ class GuiChangeLocalModuleMutationCommand(wx.Command):
|
||||
sFit.recalc(self.fitID)
|
||||
sFit.fill(self.fitID)
|
||||
eos.db.commit()
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
return success
|
||||
|
||||
@@ -31,7 +31,7 @@ class GuiChangeLocalModuleSpoolCommand(wx.Command):
|
||||
sFit.recalc(self.fitID)
|
||||
sFit.fill(self.fitID)
|
||||
eos.db.commit()
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
return success
|
||||
|
||||
def Undo(self):
|
||||
@@ -41,5 +41,5 @@ class GuiChangeLocalModuleSpoolCommand(wx.Command):
|
||||
sFit.recalc(self.fitID)
|
||||
sFit.fill(self.fitID)
|
||||
eos.db.commit()
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
return success
|
||||
|
||||
@@ -31,7 +31,7 @@ class GuiChangeLocalModuleStatesCommand(wx.Command):
|
||||
sFit.recalc(self.fitID)
|
||||
self.savedRemovedDummies = sFit.fill(self.fitID)
|
||||
eos.db.commit()
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
return success
|
||||
|
||||
def Undo(self):
|
||||
@@ -43,5 +43,5 @@ class GuiChangeLocalModuleStatesCommand(wx.Command):
|
||||
sFit.recalc(self.fitID)
|
||||
sFit.fill(self.fitID)
|
||||
eos.db.commit()
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
return success
|
||||
|
||||
@@ -32,9 +32,9 @@ class GuiCloneLocalModuleCommand(wx.Command):
|
||||
eos.db.commit()
|
||||
self.savedItemID = fit.modules[self.srcPosition].itemID
|
||||
if success and self.savedItemID is not None:
|
||||
event = GE.FitChanged(fitID=self.fitID, action='modadd', typeID=self.savedItemID)
|
||||
event = GE.FitChanged(fitIDs=(self.fitID,), action='modadd', typeID=self.savedItemID)
|
||||
else:
|
||||
event = GE.FitChanged(fitID=self.fitID)
|
||||
event = GE.FitChanged(fitIDs=(self.fitID,))
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), event)
|
||||
return success
|
||||
|
||||
@@ -48,8 +48,8 @@ class GuiCloneLocalModuleCommand(wx.Command):
|
||||
sFit.fill(self.fitID)
|
||||
eos.db.commit()
|
||||
if success and self.savedItemID is not None:
|
||||
event = GE.FitChanged(fitID=self.fitID, action='moddel', typeID=self.savedItemID)
|
||||
event = GE.FitChanged(fitIDs=(self.fitID,), action='moddel', typeID=self.savedItemID)
|
||||
else:
|
||||
event = GE.FitChanged(fitID=self.fitID)
|
||||
event = GE.FitChanged(fitIDs=(self.fitID,))
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), event)
|
||||
return success
|
||||
|
||||
@@ -33,9 +33,9 @@ class GuiFillWithNewLocalModulesCommand(wx.Command):
|
||||
success = added_modules > 0
|
||||
wx.PostEvent(
|
||||
gui.mainFrame.MainFrame.getInstance(),
|
||||
GE.FitChanged(fitID=self.fitID, action='modadd', typeID=self.itemID)
|
||||
GE.FitChanged(fitIDs=(self.fitID,), action='modadd', typeID=self.itemID)
|
||||
if success else
|
||||
GE.FitChanged(fitID=self.fitID))
|
||||
GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
return success
|
||||
|
||||
def Undo(self):
|
||||
@@ -49,7 +49,7 @@ class GuiFillWithNewLocalModulesCommand(wx.Command):
|
||||
eos.db.commit()
|
||||
wx.PostEvent(
|
||||
gui.mainFrame.MainFrame.getInstance(),
|
||||
GE.FitChanged(fitID=self.fitID, action='moddel', typeID=self.itemID)
|
||||
GE.FitChanged(fitIDs=(self.fitID,), action='moddel', typeID=self.itemID)
|
||||
if success else
|
||||
GE.FitChanged(fitID=self.fitID))
|
||||
GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
return success
|
||||
|
||||
@@ -37,9 +37,9 @@ class GuiFillWithClonedLocalModulesCommand(wx.Command):
|
||||
success = added_modules > 0
|
||||
wx.PostEvent(
|
||||
gui.mainFrame.MainFrame.getInstance(),
|
||||
GE.FitChanged(fitID=self.fitID, action='modadd', typeID=self.savedItemID)
|
||||
GE.FitChanged(fitIDs=(self.fitID,), action='modadd', typeID=self.savedItemID)
|
||||
if success else
|
||||
GE.FitChanged(fitID=self.fitID))
|
||||
GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
return success
|
||||
|
||||
def Undo(self):
|
||||
@@ -53,7 +53,7 @@ class GuiFillWithClonedLocalModulesCommand(wx.Command):
|
||||
eos.db.commit()
|
||||
wx.PostEvent(
|
||||
gui.mainFrame.MainFrame.getInstance(),
|
||||
GE.FitChanged(fitID=self.fitID, action='moddel', typeID=self.savedItemID)
|
||||
GE.FitChanged(fitIDs=(self.fitID,), action='moddel', typeID=self.savedItemID)
|
||||
if success else
|
||||
GE.FitChanged(fitID=self.fitID))
|
||||
GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
return success
|
||||
|
||||
@@ -43,7 +43,7 @@ class GuiConvertMutatedLocalModuleCommand(wx.Command):
|
||||
sFit.recalc(self.fitID)
|
||||
sFit.fill(self.fitID)
|
||||
eos.db.commit()
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
return success
|
||||
|
||||
def Undo(self):
|
||||
@@ -53,5 +53,5 @@ class GuiConvertMutatedLocalModuleCommand(wx.Command):
|
||||
sFit.recalc(self.fitID)
|
||||
sFit.fill(self.fitID)
|
||||
eos.db.commit()
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
return success
|
||||
|
||||
@@ -31,7 +31,7 @@ class GuiImportLocalMutatedModuleCommand(wx.Command):
|
||||
eos.db.commit()
|
||||
wx.PostEvent(
|
||||
gui.mainFrame.MainFrame.getInstance(),
|
||||
GE.FitChanged(fitID=self.fitID, action='modadd', typeID=self.newModInfo.itemID))
|
||||
GE.FitChanged(fitIDs=(self.fitID,), action='modadd', typeID=self.newModInfo.itemID))
|
||||
return success
|
||||
|
||||
def Undo(self):
|
||||
@@ -45,5 +45,5 @@ class GuiImportLocalMutatedModuleCommand(wx.Command):
|
||||
eos.db.commit()
|
||||
wx.PostEvent(
|
||||
gui.mainFrame.MainFrame.getInstance(),
|
||||
GE.FitChanged(fitID=self.fitID, action='moddel', typeID=self.newModInfo.itemID))
|
||||
GE.FitChanged(fitIDs=(self.fitID,), action='moddel', typeID=self.newModInfo.itemID))
|
||||
return success
|
||||
|
||||
@@ -38,7 +38,7 @@ class GuiRevertMutatedLocalModuleCommand(wx.Command):
|
||||
sFit.recalc(self.fitID)
|
||||
sFit.fill(self.fitID)
|
||||
eos.db.commit()
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
return success
|
||||
|
||||
def Undo(self):
|
||||
@@ -48,5 +48,5 @@ class GuiRevertMutatedLocalModuleCommand(wx.Command):
|
||||
sFit.recalc(self.fitID)
|
||||
sFit.fill(self.fitID)
|
||||
eos.db.commit()
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
return success
|
||||
|
||||
@@ -30,9 +30,9 @@ class GuiRemoveLocalModuleCommand(wx.Command):
|
||||
eos.db.commit()
|
||||
wx.PostEvent(
|
||||
gui.mainFrame.MainFrame.getInstance(),
|
||||
GE.FitChanged(fitID=self.fitID, action='moddel', typeID=self.savedTypeIDs)
|
||||
GE.FitChanged(fitIDs=(self.fitID,), action='moddel', typeID=self.savedTypeIDs)
|
||||
if success and self.savedTypeIDs else
|
||||
GE.FitChanged(fitID=self.fitID))
|
||||
GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
return success
|
||||
|
||||
def Undo(self):
|
||||
@@ -46,7 +46,7 @@ class GuiRemoveLocalModuleCommand(wx.Command):
|
||||
eos.db.commit()
|
||||
wx.PostEvent(
|
||||
gui.mainFrame.MainFrame.getInstance(),
|
||||
GE.FitChanged(fitID=self.fitID, action='modadd', typeID=self.savedTypeIDs)
|
||||
GE.FitChanged(fitIDs=(self.fitID,), action='modadd', typeID=self.savedTypeIDs)
|
||||
if success and self.savedTypeIDs else
|
||||
GE.FitChanged(fitID=self.fitID))
|
||||
GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
return success
|
||||
|
||||
@@ -34,9 +34,9 @@ class GuiReplaceLocalModuleCommand(wx.Command):
|
||||
eos.db.commit()
|
||||
wx.PostEvent(
|
||||
gui.mainFrame.MainFrame.getInstance(),
|
||||
GE.FitChanged(fitID=self.fitID, action='modadd', typeID=self.itemID)
|
||||
GE.FitChanged(fitIDs=(self.fitID,), action='modadd', typeID=self.itemID)
|
||||
if success else
|
||||
GE.FitChanged(fitID=self.fitID))
|
||||
GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
return success
|
||||
|
||||
def Undo(self):
|
||||
@@ -50,7 +50,7 @@ class GuiReplaceLocalModuleCommand(wx.Command):
|
||||
eos.db.commit()
|
||||
wx.PostEvent(
|
||||
gui.mainFrame.MainFrame.getInstance(),
|
||||
GE.FitChanged(fitID=self.fitID, action='moddel', typeID=self.itemID)
|
||||
GE.FitChanged(fitIDs=(self.fitID,), action='moddel', typeID=self.itemID)
|
||||
if success else
|
||||
GE.FitChanged(fitID=self.fitID))
|
||||
GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
return success
|
||||
|
||||
@@ -22,11 +22,11 @@ class GuiSwapLocalModulesCommand(wx.Command):
|
||||
cmd = CalcSwapLocalModuleCommand(fitID=self.fitID, position1=self.position1, position2=self.position2)
|
||||
success = self.internalHistory.submit(cmd)
|
||||
eos.db.commit()
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
return success
|
||||
|
||||
def Undo(self):
|
||||
success = self.internalHistory.undoAll()
|
||||
eos.db.commit()
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitIDs=(self.fitID,)))
|
||||
return success
|
||||
|
||||
Reference in New Issue
Block a user