@@ -38,6 +38,11 @@ class ContourSpacingTooLarge(UserWarning):
3838
3939class PipelinePlot (QtWidgets .QWidget ):
4040 """Implements the plotting pipeline using pyqtgraph"""
41+ # widgets emit these whenever they changed the pipeline
42+ pp_mod_send = QtCore .pyqtSignal (dict )
43+ # widgets receive these so they can reflect the pipeline changes
44+ pp_mod_recv = QtCore .pyqtSignal (dict )
45+
4146 instances = {}
4247
4348 def __init__ (self , parent , pipeline , plot_id , * args , ** kwargs ):
@@ -58,6 +63,20 @@ def __init__(self, parent, pipeline, plot_id, *args, **kwargs):
5863 self .update_content ()
5964 PipelinePlot .instances [plot_id ] = self
6065
66+ self .pp_mod_recv .connect (self .on_pp_mod_recv )
67+
68+ @QtCore .pyqtSlot (dict )
69+ def on_pp_mod_recv (self , data ):
70+ pip_data = data .get ("pipeline" , {})
71+ if pip_data .get ("plot_changed" ) == self .identifier :
72+ plot = self .pipeline .get_plot (self .identifier )
73+ plot_state = plot .__getstate__ ()
74+ self .update_content ()
75+ if plot .__getstate__ () != plot_state :
76+ # Updated the range controls
77+ self .pp_mod_send .emit (
78+ {"pipeline" : {"plot_range_corrected" : self .identifier }})
79+
6180 @QtCore .pyqtSlot ()
6281 def update_content (self ):
6382 """Update the current plot"""
@@ -135,6 +154,8 @@ def update_content_plot(self, plot_state, slot_states, dslist):
135154 gen ["range y" ] = self .pipeline .get_min_max (feat = gen ["axis y" ],
136155 plot_id = self .identifier ,
137156 margin = 0.05 )
157+ plot = self .pipeline .get_plot (self .identifier )
158+ plot .__setstate__ (plot_state )
138159
139160 # title
140161 self .setWindowTitle (lay ["name" ])
0 commit comments