0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-14 03:31:50 +02:00

fix: device_monitor.py crosshairs can be attached again

This commit is contained in:
wyzula-jan
2023-10-26 15:56:44 +02:00
committed by wyzula_j
parent 12469c8c1e
commit 644a97aee8

View File

@ -48,7 +48,9 @@ config_simple = {
class BECDeviceMonitor(pg.GraphicsLayoutWidget):
update_signal = pyqtSignal()
def __init__(self, config: dict = config_simple, client=None, parent=None):
def __init__(
self, config: dict = config_simple, client=None, enable_crosshair: bool = False, parent=None
):
super(BECDeviceMonitor, self).__init__(parent=None)
# Client and device manager from BEC
@ -61,6 +63,9 @@ class BECDeviceMonitor(pg.GraphicsLayoutWidget):
# Current configuration
self.config = config
# Enable crosshair
self.enable_crosshair = enable_crosshair
# Displayed Data
self.data = {}
@ -211,7 +216,17 @@ class BECDeviceMonitor(pg.GraphicsLayoutWidget):
self.curves_data[plot_name] = curve_list
# TODO hook crosshairs here
# Hook Crosshair
if self.enable_crosshair == True:
self.hook_crosshair()
def hook_crosshair(self) -> None:
"""Hook the crosshair to all plots."""
# TODO can be extendet to hook crosshair signal for mouse move/clicked
self.crosshairs = {}
for plot_name, plot in self.plots.items():
crosshair = Crosshair(plot, precision=3)
self.crosshairs[plot_name] = crosshair
def update_plot(self) -> None:
"""Update the plot data based on the stored data dictionary."""