Rework FitChanged command to avoid refreshing graph multiple times in certain cases
This commit is contained in:
@@ -101,16 +101,16 @@ class BoosterView(d.Display):
|
||||
def fitChanged(self, event):
|
||||
event.Skip()
|
||||
activeFitID = self.mainFrame.getActiveFit()
|
||||
if activeFitID is not None and event.fitID is not None and event.fitID != activeFitID:
|
||||
if activeFitID is not None and activeFitID not in event.fitIDs:
|
||||
return
|
||||
|
||||
sFit = Fit.getInstance()
|
||||
fit = sFit.getFit(event.fitID)
|
||||
fit = sFit.getFit(activeFitID)
|
||||
|
||||
self.Parent.Parent.DisablePage(self, not fit or fit.isStructure)
|
||||
|
||||
# Clear list and get out if current fitId is None
|
||||
if event.fitID is None and self.lastFitId is not None:
|
||||
if activeFitID is None and self.lastFitId is not None:
|
||||
self.DeleteAllItems()
|
||||
self.lastFitId = None
|
||||
return
|
||||
@@ -120,8 +120,8 @@ class BoosterView(d.Display):
|
||||
if self.boosters is not None:
|
||||
self.boosters.sort(key=lambda booster: booster.slot or 0)
|
||||
|
||||
if event.fitID != self.lastFitId:
|
||||
self.lastFitId = event.fitID
|
||||
if activeFitID != self.lastFitId:
|
||||
self.lastFitId = activeFitID
|
||||
|
||||
item = self.GetNextItem(-1, wx.LIST_NEXT_ALL, wx.LIST_STATE_DONTCARE)
|
||||
|
||||
|
||||
@@ -137,16 +137,16 @@ class CargoView(d.Display):
|
||||
def fitChanged(self, event):
|
||||
event.Skip()
|
||||
activeFitID = self.mainFrame.getActiveFit()
|
||||
if activeFitID is not None and event.fitID is not None and event.fitID != activeFitID:
|
||||
if activeFitID is not None and activeFitID not in event.fitIDs:
|
||||
return
|
||||
|
||||
sFit = Fit.getInstance()
|
||||
fit = sFit.getFit(event.fitID)
|
||||
fit = sFit.getFit(activeFitID)
|
||||
|
||||
# self.Parent.Parent.DisablePage(self, not fit or fit.isStructure)
|
||||
|
||||
# Clear list and get out if current fitId is None
|
||||
if event.fitID is None and self.lastFitId is not None:
|
||||
if activeFitID is None and self.lastFitId is not None:
|
||||
self.DeleteAllItems()
|
||||
self.lastFitId = None
|
||||
return
|
||||
@@ -156,8 +156,8 @@ class CargoView(d.Display):
|
||||
if self.cargo is not None:
|
||||
self.cargo.sort(key=lambda c: (c.item.group.category.name, c.item.group.name, c.item.name))
|
||||
|
||||
if event.fitID != self.lastFitId:
|
||||
self.lastFitId = event.fitID
|
||||
if activeFitID != self.lastFitId:
|
||||
self.lastFitId = activeFitID
|
||||
|
||||
item = self.GetNextItem(-1, wx.LIST_NEXT_ALL, wx.LIST_STATE_DONTCARE)
|
||||
|
||||
|
||||
@@ -126,24 +126,24 @@ class CommandView(d.Display):
|
||||
def fitChanged(self, event):
|
||||
event.Skip()
|
||||
activeFitID = self.mainFrame.getActiveFit()
|
||||
if activeFitID is not None and event.fitID is not None and event.fitID != activeFitID:
|
||||
if activeFitID is not None and activeFitID not in event.fitIDs:
|
||||
return
|
||||
|
||||
sFit = Fit.getInstance()
|
||||
fit = sFit.getFit(event.fitID)
|
||||
fit = sFit.getFit(activeFitID)
|
||||
|
||||
AddCommandFit.populateFits(event)
|
||||
|
||||
self.Parent.Parent.DisablePage(self, not fit or fit.isStructure)
|
||||
|
||||
# Clear list and get out if current fitId is None
|
||||
if event.fitID is None and self.lastFitId is not None:
|
||||
if activeFitID is None and self.lastFitId is not None:
|
||||
self.DeleteAllItems()
|
||||
self.lastFitId = None
|
||||
return
|
||||
|
||||
if event.fitID != self.lastFitId:
|
||||
self.lastFitId = event.fitID
|
||||
if activeFitID != self.lastFitId:
|
||||
self.lastFitId = activeFitID
|
||||
|
||||
item = self.GetNextItem(-1, wx.LIST_NEXT_ALL, wx.LIST_STATE_DONTCARE)
|
||||
|
||||
|
||||
@@ -201,16 +201,16 @@ class DroneView(Display):
|
||||
def fitChanged(self, event):
|
||||
event.Skip()
|
||||
activeFitID = self.mainFrame.getActiveFit()
|
||||
if activeFitID is not None and event.fitID is not None and event.fitID != activeFitID:
|
||||
if activeFitID is not None and activeFitID not in event.fitIDs:
|
||||
return
|
||||
|
||||
sFit = Fit.getInstance()
|
||||
fit = sFit.getFit(event.fitID)
|
||||
fit = sFit.getFit(activeFitID)
|
||||
|
||||
self.Parent.Parent.DisablePage(self, not fit or fit.isStructure)
|
||||
|
||||
# Clear list and get out if current fitId is None
|
||||
if event.fitID is None and self.lastFitId is not None:
|
||||
if activeFitID is None and self.lastFitId is not None:
|
||||
self.DeleteAllItems()
|
||||
self.lastFitId = None
|
||||
return
|
||||
@@ -221,8 +221,8 @@ class DroneView(Display):
|
||||
if self.drones is not None:
|
||||
self.drones.sort(key=self.droneKey)
|
||||
|
||||
if event.fitID != self.lastFitId:
|
||||
self.lastFitId = event.fitID
|
||||
if activeFitID != self.lastFitId:
|
||||
self.lastFitId = activeFitID
|
||||
|
||||
item = self.GetNextItem(-1, wx.LIST_NEXT_ALL, wx.LIST_STATE_DONTCARE)
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ class FighterView(wx.Panel):
|
||||
def fitChanged(self, event):
|
||||
event.Skip()
|
||||
activeFitID = self.mainFrame.getActiveFit()
|
||||
if activeFitID is not None and event.fitID is not None and event.fitID != activeFitID:
|
||||
if activeFitID is not None and activeFitID not in event.fitIDs:
|
||||
return
|
||||
|
||||
sFit = Fit.getInstance()
|
||||
@@ -246,16 +246,16 @@ class FighterDisplay(d.Display):
|
||||
def fitChanged(self, event):
|
||||
event.Skip()
|
||||
activeFitID = self.mainFrame.getActiveFit()
|
||||
if activeFitID is not None and event.fitID is not None and event.fitID != activeFitID:
|
||||
if activeFitID is not None and activeFitID not in event.fitIDs:
|
||||
return
|
||||
|
||||
sFit = Fit.getInstance()
|
||||
fit = sFit.getFit(event.fitID)
|
||||
fit = sFit.getFit(activeFitID)
|
||||
|
||||
self.Parent.Parent.Parent.DisablePage(self.Parent, not fit)
|
||||
|
||||
# Clear list and get out if current fitId is None
|
||||
if event.fitID is None and self.lastFitId is not None:
|
||||
if activeFitID is None and self.lastFitId is not None:
|
||||
self.DeleteAllItems()
|
||||
self.lastFitId = None
|
||||
return
|
||||
@@ -266,8 +266,8 @@ class FighterDisplay(d.Display):
|
||||
if self.fighters is not None:
|
||||
self.fighters.sort(key=self.fighterKey)
|
||||
|
||||
if event.fitID != self.lastFitId:
|
||||
self.lastFitId = event.fitID
|
||||
if activeFitID != self.lastFitId:
|
||||
self.lastFitId = activeFitID
|
||||
|
||||
item = self.GetNextItem(-1, wx.LIST_NEXT_ALL, wx.LIST_STATE_DONTCARE)
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ class ImplantView(wx.Panel):
|
||||
def fitChanged(self, event):
|
||||
event.Skip()
|
||||
activeFitID = self.mainFrame.getActiveFit()
|
||||
if activeFitID is not None and event.fitID is not None and event.fitID != activeFitID:
|
||||
if activeFitID is not None and activeFitID not in event.fitIDs:
|
||||
return
|
||||
|
||||
sFit = Fit.getInstance()
|
||||
@@ -156,16 +156,16 @@ class ImplantDisplay(d.Display):
|
||||
def fitChanged(self, event):
|
||||
event.Skip()
|
||||
activeFitID = self.mainFrame.getActiveFit()
|
||||
if activeFitID is not None and event.fitID is not None and event.fitID != activeFitID:
|
||||
if activeFitID is not None and activeFitID not in event.fitIDs:
|
||||
return
|
||||
|
||||
sFit = Fit.getInstance()
|
||||
fit = sFit.getFit(event.fitID)
|
||||
fit = sFit.getFit(activeFitID)
|
||||
|
||||
self.Parent.Parent.Parent.DisablePage(self.Parent, not fit or fit.isStructure)
|
||||
|
||||
# Clear list and get out if current fitId is None
|
||||
if event.fitID is None and self.lastFitId is not None:
|
||||
if activeFitID is None and self.lastFitId is not None:
|
||||
self.DeleteAllItems()
|
||||
self.lastFitId = None
|
||||
return
|
||||
@@ -175,8 +175,8 @@ class ImplantDisplay(d.Display):
|
||||
if self.implants is not None:
|
||||
self.implants.sort(key=lambda implant: implant.slot or 0)
|
||||
|
||||
if event.fitID != self.lastFitId:
|
||||
self.lastFitId = event.fitID
|
||||
if activeFitID != self.lastFitId:
|
||||
self.lastFitId = activeFitID
|
||||
|
||||
item = self.GetNextItem(-1, wx.LIST_NEXT_ALL, wx.LIST_STATE_DONTCARE)
|
||||
|
||||
|
||||
@@ -32,11 +32,11 @@ class NotesView(wx.Panel):
|
||||
def fitChanged(self, event):
|
||||
event.Skip()
|
||||
activeFitID = self.mainFrame.getActiveFit()
|
||||
if activeFitID is not None and event.fitID is not None and event.fitID != activeFitID:
|
||||
if activeFitID is not None and activeFitID not in event.fitIDs:
|
||||
return
|
||||
|
||||
sFit = Fit.getInstance()
|
||||
fit = sFit.getFit(event.fitID)
|
||||
fit = sFit.getFit(activeFitID)
|
||||
|
||||
self.saveTimer.Stop() # cancel any pending timers
|
||||
|
||||
@@ -46,11 +46,11 @@ class NotesView(wx.Panel):
|
||||
if self.lastFitId is not None:
|
||||
sFit.editNotes(self.lastFitId, self.editNotes.GetValue())
|
||||
|
||||
if event.fitID is None and self.lastFitId is not None:
|
||||
if activeFitID is None and self.lastFitId is not None:
|
||||
self.lastFitId = None
|
||||
return
|
||||
elif event.fitID != self.lastFitId:
|
||||
self.lastFitId = event.fitID
|
||||
elif activeFitID != self.lastFitId:
|
||||
self.lastFitId = activeFitID
|
||||
self.editNotes.SetValue(fit.notes or "")
|
||||
|
||||
def onText(self, event):
|
||||
|
||||
@@ -170,25 +170,25 @@ class ProjectedView(d.Display):
|
||||
def fitChanged(self, event):
|
||||
event.Skip()
|
||||
activeFitID = self.mainFrame.getActiveFit()
|
||||
if activeFitID is not None and event.fitID is not None and event.fitID != activeFitID:
|
||||
if activeFitID is not None and activeFitID not in event.fitIDs:
|
||||
return
|
||||
|
||||
sFit = Fit.getInstance()
|
||||
fit = sFit.getFit(event.fitID)
|
||||
fit = sFit.getFit(activeFitID)
|
||||
# pyfalog.debug('ProjectedView::fitChanged: {}', repr(fit))
|
||||
|
||||
self.Parent.Parent.DisablePage(self, not fit or fit.isStructure)
|
||||
|
||||
# Clear list and get out if current fitId is None
|
||||
if event.fitID is None and self.lastFitId is not None:
|
||||
if activeFitID is None and self.lastFitId is not None:
|
||||
self.DeleteAllItems()
|
||||
self.lastFitId = None
|
||||
return
|
||||
|
||||
|
||||
|
||||
if event.fitID != self.lastFitId:
|
||||
self.lastFitId = event.fitID
|
||||
if activeFitID != self.lastFitId:
|
||||
self.lastFitId = activeFitID
|
||||
|
||||
item = self.GetNextItem(-1, wx.LIST_NEXT_ALL, wx.LIST_STATE_DONTCARE)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user