From 599756bc4c7251dd3f06bbe40150ee1a766df4d4 Mon Sep 17 00:00:00 2001 From: "benjamin.jakimow@geo.hu-berlin.de" <q8DTkxUg-BB> Date: Mon, 19 Feb 2018 16:08:16 +0100 Subject: [PATCH] plotstyling.py added PlotStyle.sigUpdated() --- timeseriesviewer/plotstyling.py | 44 ++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/timeseriesviewer/plotstyling.py b/timeseriesviewer/plotstyling.py index 5adff111..b7385f48 100644 --- a/timeseriesviewer/plotstyling.py +++ b/timeseriesviewer/plotstyling.py @@ -56,39 +56,47 @@ PENSTYLES = [(Qt.SolidLine, '___'), class PlotStyle(QObject): + sigUpdated = pyqtSignal() def __init__(self, **kwds): plotStyle = kwds.get('plotStyle') if plotStyle: kwds.pop('plotStyle') super(PlotStyle,self).__init__(**kwds) + self.markerSymbol = MARKERSYMBOLS[0][0] + self.markerSize = 10 + self.markerBrush = QBrush() + self.markerBrush.setColor(Qt.green) + self.markerBrush.setStyle(Qt.SolidPattern) + self.backgroundColor = Qt.black - if plotStyle: - self.copyFrom(plotStyle) - else: - self.markerSymbol = MARKERSYMBOLS[0][0] - self.markerSize = 10 - self.markerBrush = QBrush() - self.markerBrush.setColor(Qt.green) - self.markerBrush.setStyle(Qt.SolidPattern) + self.markerPen = QPen() + self.markerPen.setStyle(Qt.SolidLine) + self.markerPen.setColor(Qt.white) - self.backgroundColor = Qt.black + self.linePen = QPen() + self.linePen.setStyle(Qt.NoPen) + self.linePen.setColor(QColor(74, 75, 75)) - self.markerPen = QPen() - self.markerPen.setStyle(Qt.SolidLine) - self.markerPen.setColor(Qt.white) + self.mIsVisible = True - self.linePen = QPen() - self.linePen.setStyle(Qt.NoPen) - self.linePen.setColor(QColor(74,75,75)) - - self.mIsVisible = True + if plotStyle: + self.copyFrom(plotStyle) def setVisibility(self, b): assert isinstance(b, bool) + old = self.mIsVisible self.mIsVisible = b + if b != old: + self.update() + + + def update(self): + self.sigUpdated.emit() + + def isVisible(self): return self.mIsVisible @@ -101,6 +109,8 @@ class PlotStyle(QObject): self.markerSize = plotStyle.markerSize self.backgroundColor = QColor(plotStyle.backgroundColor) self.linePen = QPen(plotStyle.linePen) + self.setVisibility(plotStyle.isVisible()) + self.update() s = "" def createIcon(self, size=None): -- GitLab