Rework graph interfaces again

This commit is contained in:
DarkPhoenix
2019-05-17 17:48:20 +03:00
parent 512f48ebdd
commit fb5eb220fd
12 changed files with 89 additions and 183 deletions

View File

@@ -44,7 +44,7 @@ class Graph(metaclass=ABCMeta):
@property
def extraInputs(self):
return ()
return {}
@property
@abstractmethod
@@ -55,6 +55,11 @@ class Graph(metaclass=ABCMeta):
def redrawOnEffectiveChange(self):
return False
def getPlotPoints(self, fit, extraData, xRange, xAmount, yType):
xRange = self.parseRange(xRange)
graph = getattr(self, self.yDefs[yType].eosGraph, None)
return graph.getPlotPoints(fit, extraData, xRange, xAmount)
def parseRange(self, string):
m = re.match('\s*(?P<first>\d+(\.\d+)?)\s*(-\s*(?P<second>\d+(\.\d+)?))?', string)
if m is None:
@@ -67,8 +72,8 @@ class Graph(metaclass=ABCMeta):
return (float(first), float(second))
XDef = namedtuple('XDef', ('handle', 'inputDefault', 'inputLabel', 'inputIconID', 'axisLabel'))
YDef = namedtuple('YDef', ('handle', 'switchLabel', 'axisLabel'))
XDef = namedtuple('XDef', ('inputDefault', 'inputLabel', 'inputIconID', 'axisLabel'))
YDef = namedtuple('YDef', ('switchLabel', 'axisLabel', 'eosGraph'))
ExtraInput = namedtuple('ExtraInput', ('handle', 'inputDefault', 'inputLabel', 'inputIconID'))