mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 11:41:49 +02:00
fix: device_monitor.py crosshairs can be attached again
This commit is contained in:
@ -48,7 +48,9 @@ config_simple = {
|
|||||||
class BECDeviceMonitor(pg.GraphicsLayoutWidget):
|
class BECDeviceMonitor(pg.GraphicsLayoutWidget):
|
||||||
update_signal = pyqtSignal()
|
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)
|
super(BECDeviceMonitor, self).__init__(parent=None)
|
||||||
|
|
||||||
# Client and device manager from BEC
|
# Client and device manager from BEC
|
||||||
@ -61,6 +63,9 @@ class BECDeviceMonitor(pg.GraphicsLayoutWidget):
|
|||||||
# Current configuration
|
# Current configuration
|
||||||
self.config = config
|
self.config = config
|
||||||
|
|
||||||
|
# Enable crosshair
|
||||||
|
self.enable_crosshair = enable_crosshair
|
||||||
|
|
||||||
# Displayed Data
|
# Displayed Data
|
||||||
self.data = {}
|
self.data = {}
|
||||||
|
|
||||||
@ -211,7 +216,17 @@ class BECDeviceMonitor(pg.GraphicsLayoutWidget):
|
|||||||
|
|
||||||
self.curves_data[plot_name] = curve_list
|
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:
|
def update_plot(self) -> None:
|
||||||
"""Update the plot data based on the stored data dictionary."""
|
"""Update the plot data based on the stored data dictionary."""
|
||||||
|
Reference in New Issue
Block a user