From fbc425476b3b690d3b3082c84398c9bceb113405 Mon Sep 17 00:00:00 2001 From: wakonig_k Date: Wed, 9 Apr 2025 17:37:27 +0200 Subject: [PATCH] feat(auto_updates): add GUI highlight management for auto updates status --- bec_widgets/cli/auto_updates.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/bec_widgets/cli/auto_updates.py b/bec_widgets/cli/auto_updates.py index 2598e8a6..98c637a2 100644 --- a/bec_widgets/cli/auto_updates.py +++ b/bec_widgets/cli/auto_updates.py @@ -53,6 +53,10 @@ class AutoUpdates: Callback for scan status messages. """ msg = ScanStatusMessage(**content, metadata=metadata) + if not self.enabled: + return + + self.enable_gui_highlights(True) match msg.status: case "open": @@ -129,6 +133,22 @@ class AutoUpdates: return sel_device return None + def enable_gui_highlights(self, enable: bool) -> None: + """ + Enable or disable GUI highlights. + + Args: + enable (bool): Whether to enable or disable the highlights. + """ + if enable: + title = self.dock_area.window().windowTitle() + if " [Auto Updates]" in title: + return + self.dock_area.window().setWindowTitle(f"{title} [Auto Updates]") + else: + title = self.dock_area.window().windowTitle() + self.dock_area.window().setWindowTitle(title.replace(" [Auto Updates]", "")) + @property def enabled(self) -> bool: """ @@ -147,9 +167,11 @@ class AutoUpdates: if value: self.connect() + self.enable_gui_highlights(True) self.on_start() else: self.disconnect() + self.enable_gui_highlights(False) self.on_stop() ########################################################################