diff --git a/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py b/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py index 63757ee0ec219310a3679a49bc6eea2e691f2a41..aa830071b4a18e8f16ddbda2bcdd80448c450411 100755 --- a/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py +++ b/sohstationviewer/view/plotting/plotting_widget/plotting_widget.py @@ -223,6 +223,12 @@ class PlottingWidget(QtWidgets.QScrollArea): ruler_text: the current text shown above the ruler """ self.ruler_text: Optional[matplotlib.text.Text] = None + """ + button_press_picked_a_point: whether a button press event triggered a + pick event. Used to fix a bug where picking a point on the SOH plot of + an RT130 data set does not bring the SOH messages dialog to the front. + """ + self.is_button_press_event_triggered_pick_event: bool = False self.set_colors('B') @@ -296,6 +302,7 @@ class PlottingWidget(QtWidgets.QScrollArea): + If the chan_data has key 'logIdx', raise the Search Messages dialog, focus SOH tab, roll to the corresponding line. """ + self.is_button_press_event_triggered_pick_event = True artist = event.artist ax = artist.axes @@ -380,9 +387,18 @@ class PlottingWidget(QtWidgets.QScrollArea): w.on_ctrl_cmd_click(xdata) w.draw() - self.parent.show() - self.parent.activateWindow() - self.parent.raise_() + if (not self.is_button_press_event_triggered_pick_event or + modifiers == QtCore.Qt.ShiftModifier): + # Bring the main window to the front only if no point was picked. + # In logpeek and qpeek, zooming is always done, event if a point is + # picked, so we replicate that here. + self.parent.show() + self.parent.activateWindow() + self.parent.raise_() + else: + # Reset the flag checking if this button press event triggered a + # pick event. + self.is_button_press_event_triggered_pick_event = False def on_ctrl_cmd_click(self, xdata): """