0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-13 19:21:50 +02:00

feat(auto_update): add GUI highlight management for auto updates status

This commit is contained in:
2025-04-10 13:20:17 +02:00
parent 55baa84eb6
commit 5f272a66a4

View File

@ -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()
########################################################################