Commit 179b17e7 authored by Valentin Valls's avatar Valentin Valls
Browse files

Allow to specify a set of scans

parent beeca1c4
...@@ -15,6 +15,7 @@ from typing import List ...@@ -15,6 +15,7 @@ from typing import List
from typing import Dict from typing import Dict
from typing import Tuple from typing import Tuple
import logging
from bliss.flint.model import scan_model from bliss.flint.model import scan_model
from bliss.flint.model import flint_model from bliss.flint.model import flint_model
from bliss.flint.model import plot_model from bliss.flint.model import plot_model
...@@ -22,6 +23,9 @@ from bliss.flint.model import plot_item_model ...@@ -22,6 +23,9 @@ from bliss.flint.model import plot_item_model
from bliss.flint.model import plot_state_model from bliss.flint.model import plot_state_model
_logger = logging.getLogger(__name__)
class DefaultStyleStrategy(plot_model.StyleStrategy): class DefaultStyleStrategy(plot_model.StyleStrategy):
def __init__(self, flintModel: flint_model.FlintState = None): def __init__(self, flintModel: flint_model.FlintState = None):
super(DefaultStyleStrategy, self).__init__() super(DefaultStyleStrategy, self).__init__()
...@@ -30,10 +34,16 @@ class DefaultStyleStrategy(plot_model.StyleStrategy): ...@@ -30,10 +34,16 @@ class DefaultStyleStrategy(plot_model.StyleStrategy):
Tuple[plot_model.Item, Optional[scan_model.Scan]], plot_model.Style Tuple[plot_model.Item, Optional[scan_model.Scan]], plot_model.Style
] = {} ] = {}
self.__cacheInvalidated = True self.__cacheInvalidated = True
self.__scans = []
def setFlintModel(self, flintModel: flint_model.FlintState): def setFlintModel(self, flintModel: flint_model.FlintState):
self.__flintModel = flintModel self.__flintModel = flintModel
def setScans(self, scans):
self.__scans.clear()
self.__scans.extend(scans)
self.invalidateStyles()
def __getstate__(self): def __getstate__(self):
return {} return {}
...@@ -214,11 +224,14 @@ class DefaultStyleStrategy(plot_model.StyleStrategy): ...@@ -214,11 +224,14 @@ class DefaultStyleStrategy(plot_model.StyleStrategy):
self.computeItemStyleFromImagePlot(plot) self.computeItemStyleFromImagePlot(plot)
else: else:
scans: List[Optional[scan_model.Scan]] = [] scans: List[Optional[scan_model.Scan]] = []
for item in plot.items(): if len(self.__scans) > 0:
if isinstance(item, plot_item_model.ScanItem): scans = self.__scans
scans.append(item.scan()) else:
if scans == []: for item in plot.items():
scans.append(None) if isinstance(item, plot_item_model.ScanItem):
scans.append(item.scan())
if scans == []:
scans.append(None)
self.computeItemStyleFromCurvePlot(plot, scans) self.computeItemStyleFromCurvePlot(plot, scans)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment