mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-13 11:11:49 +02:00
feat(auto_updates): add GUI highlight management for auto updates status
This commit is contained in:
@ -53,6 +53,10 @@ class AutoUpdates:
|
|||||||
Callback for scan status messages.
|
Callback for scan status messages.
|
||||||
"""
|
"""
|
||||||
msg = ScanStatusMessage(**content, metadata=metadata)
|
msg = ScanStatusMessage(**content, metadata=metadata)
|
||||||
|
if not self.enabled:
|
||||||
|
return
|
||||||
|
|
||||||
|
self.enable_gui_highlights(True)
|
||||||
|
|
||||||
match msg.status:
|
match msg.status:
|
||||||
case "open":
|
case "open":
|
||||||
@ -129,6 +133,22 @@ class AutoUpdates:
|
|||||||
return sel_device
|
return sel_device
|
||||||
return None
|
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
|
@property
|
||||||
def enabled(self) -> bool:
|
def enabled(self) -> bool:
|
||||||
"""
|
"""
|
||||||
@ -147,9 +167,11 @@ class AutoUpdates:
|
|||||||
|
|
||||||
if value:
|
if value:
|
||||||
self.connect()
|
self.connect()
|
||||||
|
self.enable_gui_highlights(True)
|
||||||
self.on_start()
|
self.on_start()
|
||||||
else:
|
else:
|
||||||
self.disconnect()
|
self.disconnect()
|
||||||
|
self.enable_gui_highlights(False)
|
||||||
self.on_stop()
|
self.on_stop()
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
|
Reference in New Issue
Block a user