Implement cache clear reasons to avoid clearing caches when we do not need that (esp useful for dmg time cache)
This commit is contained in:
@@ -31,6 +31,7 @@ import gui.globalEvents as GE
|
||||
import gui.mainFrame
|
||||
from gui.bitmap_loader import BitmapLoader
|
||||
from gui.builtinGraphs.base import FitGraph
|
||||
from service.const import GraphCacheCleanupReason
|
||||
from service.settings import GraphSettings
|
||||
from .panel import GraphControlPanel
|
||||
|
||||
@@ -152,18 +153,18 @@ class GraphFrame(wx.Frame):
|
||||
|
||||
def OnFitChanged(self, event):
|
||||
event.Skip()
|
||||
self.getView().clearCache(fitID=event.fitID)
|
||||
self.clearCache(reason=GraphCacheCleanupReason.fitChanged, extraData=event.fitID)
|
||||
self.draw()
|
||||
|
||||
def OnGraphOptionChanged(self, event):
|
||||
event.Skip()
|
||||
self.getView().clearCache()
|
||||
self.clearCache(reason=GraphCacheCleanupReason.optionChanged)
|
||||
self.draw()
|
||||
|
||||
def OnGraphSwitched(self, event):
|
||||
view = self.getView()
|
||||
GraphSettings.getInstance().set('selectedGraph', view.internalName)
|
||||
self.clearCache()
|
||||
self.clearCache(reason=GraphCacheCleanupReason.graphSwitched)
|
||||
self.ctrlPanel.updateControls()
|
||||
self.draw()
|
||||
event.Skip()
|
||||
@@ -177,8 +178,8 @@ class GraphFrame(wx.Frame):
|
||||
def getView(self):
|
||||
return self.graphSelection.GetClientData(self.graphSelection.GetSelection())
|
||||
|
||||
def clearCache(self, fitID=None):
|
||||
self.getView().clearCache(fitID=fitID)
|
||||
def clearCache(self, reason, extraData=None):
|
||||
self.getView().clearCache(reason, extraData)
|
||||
|
||||
def draw(self):
|
||||
global mpl_version
|
||||
|
||||
@@ -25,6 +25,7 @@ import wx
|
||||
|
||||
from gui.bitmap_loader import BitmapLoader
|
||||
from gui.contextMenu import ContextMenu
|
||||
from service.const import GraphCacheCleanupReason
|
||||
from service.fit import Fit
|
||||
from .input import ConstantBox, RangeBox
|
||||
from .lists import FitList, TargetList
|
||||
@@ -118,8 +119,8 @@ class GraphControlPanel(wx.Panel):
|
||||
|
||||
self.SetSizer(mainSizer)
|
||||
|
||||
self.drawTimer = wx.Timer(self)
|
||||
self.Bind(wx.EVT_TIMER, self.OnDrawTimer, self.drawTimer)
|
||||
self.inputTimer = wx.Timer(self)
|
||||
self.Bind(wx.EVT_TIMER, self.OnInputTimer, self.inputTimer)
|
||||
self._setVectorDefaults()
|
||||
|
||||
def updateControls(self, layout=True):
|
||||
@@ -258,12 +259,12 @@ class GraphControlPanel(wx.Panel):
|
||||
|
||||
def OnFieldChanged(self, event):
|
||||
event.Skip()
|
||||
self.drawTimer.Stop()
|
||||
self.drawTimer.Start(Fit.getInstance().serviceFittingOptions['marketSearchDelay'], True)
|
||||
self.inputTimer.Stop()
|
||||
self.inputTimer.Start(Fit.getInstance().serviceFittingOptions['marketSearchDelay'], True)
|
||||
|
||||
def OnDrawTimer(self, event):
|
||||
def OnInputTimer(self, event):
|
||||
event.Skip()
|
||||
self.graphFrame.clearCache()
|
||||
self.graphFrame.clearCache(reason=GraphCacheCleanupReason.inputChanged)
|
||||
self.graphFrame.draw()
|
||||
|
||||
def getValues(self):
|
||||
|
||||
Reference in New Issue
Block a user