1
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2026-03-04 16:02:51 +01:00

refactor(bec-status-box): add get_server_state user_access method to BECStatusBox

This commit is contained in:
2025-05-01 19:48:34 +02:00
parent 37f002427a
commit 1619446ec9
2 changed files with 7 additions and 2 deletions

View File

@@ -491,9 +491,9 @@ class BECStatusBox(RPCBase):
"""An autonomous widget to display the status of BEC services."""
@rpc_call
def remove(self):
def get_server_state(self) -> "str":
"""
Cleanup the BECConnector
Get the state ("RUNNING", "BUSY", "IDLE", "ERROR") of the BEC server
"""

View File

@@ -76,6 +76,7 @@ class BECStatusBox(BECWidget, CompactPopupWidget):
PLUGIN = True
CORE_SERVICES = ["DeviceServer", "ScanServer", "SciHub", "ScanBundler", "FileWriterManager"]
USER_ACCESS = ["get_server_state"]
service_update = Signal(BECServiceInfoContainer)
bec_core_state = Signal(str)
@@ -134,6 +135,10 @@ class BECStatusBox(BECWidget, CompactPopupWidget):
"QTreeWidget::item:selected {}"
)
def get_server_state(self) -> str:
"""Get the state ("RUNNING", "BUSY", "IDLE", "ERROR") of the BEC server"""
return self.status_container[self.box_name]["info"].status
def _create_status_widget(
self, service_name: str, status=BECStatus, info: dict = None, metrics: dict = None
) -> StatusItem: