added scale_factor for CAQLabel

This commit is contained in:
2024-12-13 15:33:26 +01:00
parent c0dd0c6038
commit 13fa5c0f2e

View File

@@ -163,13 +163,17 @@ class CAQLabel(QLabel, PVGateway):
def __init__(self, parent=None, pv_name: str = "", monitor_callback=None,
pv_within_daq_group: bool = False, color_mode=None,
show_units: bool = False, prefix: str = "", suffix: str = "",
notify_freq_hz: int = 0, precision: int = 0):
notify_freq_hz: int = 0, precision: int = 0,
scale_factor: float = 1):
super().__init__(parent, pv_name, monitor_callback, pv_within_daq_group,
color_mode, show_units, prefix, suffix,
connect_callback=self.py_connect_callback,
notify_freq_hz=notify_freq_hz, precision=precision)
self.scale_factor = scale_factor
self.is_initialize_complete()
self.configure_widget()
@@ -185,12 +189,16 @@ class CAQLabel(QLabel, PVGateway):
@Slot(object, str, int)
def receive_daq_update(self, daq_pvd, daq_mode, daq_state):
if self.scale_factor != 1:
daq_pvd.value[0] = daq_pvd.value[0] * self.scale_factor
PVGateway.receive_daq_update(self, daq_pvd, daq_mode, daq_state)
@Slot(str, int, int)
@Slot(int, int, int)
@Slot(float, int, int)
def receive_monitor_update(self, value, status, alarm_severity):
if self.scale_factor != 1:
value = value * self.scale_factor
PVGateway.receive_monitor_update(self, value, status, alarm_severity)
@Slot(int, str, int)