From 7a164201992206df87b82eaef9e13c718705fd73 Mon Sep 17 00:00:00 2001 From: mmouchous-ledger Date: Tue, 26 Nov 2024 17:20:18 +0100 Subject: [PATCH] Move retrieval of "label" field from configuration file at Instrument level --- laserstudio/instruments/camera.py | 2 +- laserstudio/instruments/instrument.py | 4 ++++ laserstudio/instruments/laser.py | 1 - laserstudio/instruments/probe.py | 2 +- laserstudio/instruments/stage.py | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/laserstudio/instruments/camera.py b/laserstudio/instruments/camera.py index 19b5340..4f4f0c3 100644 --- a/laserstudio/instruments/camera.py +++ b/laserstudio/instruments/camera.py @@ -16,7 +16,7 @@ def __init__(self, config: dict): """ :param config: YAML configuration object """ - super().__init__() + super().__init__(config=config) # To refresh image regularly, in real-time self.refresh_interval = cast(int, config.get("refresh_interval_ms", 200)) diff --git a/laserstudio/instruments/instrument.py b/laserstudio/instruments/instrument.py index 96ceeae..6d754cc 100644 --- a/laserstudio/instruments/instrument.py +++ b/laserstudio/instruments/instrument.py @@ -4,3 +4,7 @@ class Instrument(QObject): # Signal emitted when the instrument has a parameter which changed in another way than UI interface parameter_changed = pyqtSignal(str, QVariant) + + def __init__(self, config: dict): + super().__init__() + self.label = config.get("label") diff --git a/laserstudio/instruments/laser.py b/laserstudio/instruments/laser.py index a760114..8b3bd7e 100644 --- a/laserstudio/instruments/laser.py +++ b/laserstudio/instruments/laser.py @@ -9,7 +9,6 @@ def __init__(self, config: dict): # Sweep parameters, in order to change the current_percentage # regularly, within a random value from sweep_min to sweep_max, # each sweep_freq applications - self.label = config.get("label") self.sweep_max = 100.0 self.sweep_min = 0.0 self.sweep_freq = 100 diff --git a/laserstudio/instruments/probe.py b/laserstudio/instruments/probe.py index 20bb43c..113aa38 100644 --- a/laserstudio/instruments/probe.py +++ b/laserstudio/instruments/probe.py @@ -5,7 +5,7 @@ class ProbeInstrument(Instrument): def __init__(self, config: dict): - super().__init__() + super().__init__(config=config) # Set manual position relative to the center position # of the camera, eg in the StageSight coordinates. self._fixed_pos: Optional[tuple[float, float]] = None diff --git a/laserstudio/instruments/stage.py b/laserstudio/instruments/stage.py index 22101f1..1a00801 100644 --- a/laserstudio/instruments/stage.py +++ b/laserstudio/instruments/stage.py @@ -31,7 +31,7 @@ def __init__(self, config: dict): """ :param config: YAML configuration object """ - super().__init__() + super().__init__(config=config) device_type = config.get("type") # To refresh stage position in the view, in real-time