@@ -41,11 +41,12 @@ def __init__(self, parent=None, args=None, macros=None, ui_filename=__file__.rep
41
41
self .ui .month_scale_btn : 2628300 ,
42
42
self .ui .cursor_scale_btn : - 1 ,
43
43
}
44
- self .ui .timespan_btns .buttonClicked .connect (self .set_plot_timerange )
44
+ self .ui .timespan_btns .buttonToggled .connect (self .set_plot_timerange )
45
45
46
- # Click "Cursor" button on plot-mouse interaction
47
- plot_viewbox = self .ui .main_plot .plotItem .vb
48
- plot_viewbox .sigRangeChangedManually .connect (self .ui .cursor_scale_btn .click )
46
+ # Toggle "Cursor" button on plot-mouse interaction
47
+ multi_axis_plot = self .ui .main_plot .plotItem
48
+ multi_axis_plot .vb .menu = None
49
+ multi_axis_plot .sigXRangeChangedManually .connect (self .ui .cursor_scale_btn .toggle )
49
50
50
51
# Parse macros & arguments, then include them in startup
51
52
input_file , startup_pvs = self .parse_macros_and_args (macros , args )
@@ -180,8 +181,8 @@ def resetPlot(self) -> None:
180
181
self .axis_table_model .set_model_axes ()
181
182
self .curves_model .set_model_curves ()
182
183
183
- @Slot (QAbstractButton )
184
- def set_plot_timerange (self , button : QAbstractButton ) -> None :
184
+ @Slot (QAbstractButton , bool )
185
+ def set_plot_timerange (self , button : QAbstractButton , toggled : bool ) -> None :
185
186
"""Slot to be called when a timespan setting button is pressed.
186
187
This will enable autoscrolling along the x-axis and disable mouse
187
188
controls. If the "Cursor" button is pressed, then autoscrolling is
@@ -192,7 +193,12 @@ def set_plot_timerange(self, button: QAbstractButton) -> None:
192
193
button : QAbstractButton
193
194
The timespan setting button pressed. Determines which timespan
194
195
to set.
196
+ toggled : bool
197
+ Whether or not the associated button is toggled or not.
195
198
"""
199
+ if not toggled :
200
+ return
201
+
196
202
logger .debug ("Setting plot timerange" )
197
203
if button not in self .button_spans :
198
204
logger .error (f"{ button } is not a valid timespan button" )
0 commit comments