Cache graph values on GUI graphs so they do not get recalculated when graph options are changed

This commit is contained in:
DarkPhoenix
2019-05-21 19:06:11 +03:00
parent a09a2a5f4b
commit 8fae275e5a
13 changed files with 42 additions and 21 deletions

View File

@@ -25,7 +25,7 @@ from abc import ABCMeta, abstractmethod
class Graph(metaclass=ABCMeta):
def __init__(self):
self.cache = {}
self._cache = {}
@abstractmethod
def getPlotPoints(self, fit, extraData, xRange, xAmount):
@@ -60,9 +60,9 @@ class Graph(metaclass=ABCMeta):
def clearCache(self, key=None):
if key is None:
self.cache.clear()
elif key in self.cache:
del self.cache[key]
self._cache.clear()
elif key in self._cache:
del self._cache[key]
class SmoothGraph(Graph, metaclass=ABCMeta):