Make it obvious that we're clearning cache by fitID
This commit is contained in:
@@ -85,14 +85,14 @@ class FitGraph(metaclass=ABCMeta):
|
||||
fitCache[(ySpec, xSpec)] = plotData
|
||||
return plotData
|
||||
|
||||
def clearCache(self, key=None):
|
||||
if key is None:
|
||||
def clearCache(self, fitID=None):
|
||||
if fitID is None:
|
||||
self._plotCache.clear()
|
||||
self._calcCache.clear()
|
||||
if key in self._plotCache:
|
||||
del self._plotCache[key]
|
||||
if key in self._calcCache:
|
||||
del self._calcCache[key]
|
||||
if fitID in self._plotCache:
|
||||
del self._plotCache[fitID]
|
||||
if fitID in self._calcCache:
|
||||
del self._calcCache[fitID]
|
||||
|
||||
# Calculation stuff
|
||||
def _calcPlotPoints(self, mainInput, miscInputs, xSpec, ySpec, fit, tgt):
|
||||
|
||||
@@ -66,7 +66,7 @@ class FitWarpTimeGraph(FitGraph):
|
||||
|
||||
def __getSubwarpSpeed(self, fit):
|
||||
try:
|
||||
subwarpSpeed = self._calcCache[fit.ID]['cleanSubwarpSpeed']
|
||||
subwarpSpeed = self._calcCache[fit.ID]
|
||||
except KeyError:
|
||||
modStates = {}
|
||||
for mod in fit.modules:
|
||||
@@ -96,7 +96,7 @@ class FitWarpTimeGraph(FitGraph):
|
||||
fighter.active = False
|
||||
fit.calculateModifiedAttributes()
|
||||
subwarpSpeed = fit.ship.getModifiedItemAttr('maxVelocity')
|
||||
self._calcCache[fit.ID] = {'cleanSubwarpSpeed': subwarpSpeed}
|
||||
self._calcCache[fit.ID] = subwarpSpeed
|
||||
for projInfo, state in projFitStates.items():
|
||||
projInfo.active = state
|
||||
for mod, state in modStates.items():
|
||||
|
||||
Reference in New Issue
Block a user