diff --git a/timeseriesviewer/plotstyling.py b/timeseriesviewer/plotstyling.py index 5adff11188be5ffb702e2622c8233cd37b2d3236..b7385f4815a3be1f2af1a2e2ab8b6318f5caad86 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):