From 17faf8b0cc4c8d6387f343bb54309e90ba4b9622 Mon Sep 17 00:00:00 2001 From: Bastian Leykauf Date: Tue, 24 Sep 2024 13:06:02 +0200 Subject: [PATCH] use 'double' value for comparison of enums --- linien-gui/linien_gui/ui/main_window.py | 2 +- linien-gui/linien_gui/ui/plot_widget.py | 5 ++++- linien-gui/linien_gui/ui/right_panel.py | 2 +- linien-server/linien_server/autolock/autolock.py | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/linien-gui/linien_gui/ui/main_window.py b/linien-gui/linien_gui/ui/main_window.py index 440656ba..8670f33c 100644 --- a/linien-gui/linien_gui/ui/main_window.py +++ b/linien-gui/linien_gui/ui/main_window.py @@ -166,7 +166,7 @@ def on_connection_established(self): def change_sweep_control_visibility(self, *args): autolock_running = ( - self.parameters.autolock_status.value == AutolockStatus.LOCKING + self.parameters.autolock_status.value.value == AutolockStatus.LOCKING ) optimization = self.parameters.optimization_running.value locked = self.parameters.lock.value diff --git a/linien-gui/linien_gui/ui/plot_widget.py b/linien-gui/linien_gui/ui/plot_widget.py index dc64e64c..8814dd65 100644 --- a/linien-gui/linien_gui/ui/plot_widget.py +++ b/linien-gui/linien_gui/ui/plot_widget.py @@ -308,7 +308,10 @@ def mouseReleaseEvent(self, event): if xdiff / xmax < 0.01: # it was a click pass else: # it was a selection - if self.parameters.autolock_status.value == AutolockStatus.SELECTING: + if ( + self.parameters.autolock_status.value.value + == AutolockStatus.SELECTING + ): last_combined_error_signal = self.last_plot_data[2] self.control.exposed_start_autolock( # we pickle it here because otherwise a netref is diff --git a/linien-gui/linien_gui/ui/right_panel.py b/linien-gui/linien_gui/ui/right_panel.py index 11adfe82..76e87a00 100644 --- a/linien-gui/linien_gui/ui/right_panel.py +++ b/linien-gui/linien_gui/ui/right_panel.py @@ -83,7 +83,7 @@ def optimization_status_changed(self, value: bool) -> None: def enable_or_disable_panels(self, *args) -> None: locked = self.parameters.lock.value autolock_running = ( - self.parameters.autolock_status.value == AutolockStatus.LOCKING + self.parameters.autolock_status.value.value == AutolockStatus.LOCKING ) optimization_running = self.parameters.optimization_running.value diff --git a/linien-server/linien_server/autolock/autolock.py b/linien-server/linien_server/autolock/autolock.py index 8ee3293a..c8239f52 100644 --- a/linien-server/linien_server/autolock/autolock.py +++ b/linien-server/linien_server/autolock/autolock.py @@ -122,7 +122,7 @@ def try_to_start_autolock(self, plot_data: bytes) -> None: """ if ( self.parameters.pause_acquisition.value - or self.parameters.autolock_status.value != AutolockStatus.LOCKING + or self.parameters.autolock_status.value.value != AutolockStatus.LOCKING ): return