feat(bec_connector): ability to change object name during runtime

This commit is contained in:
2025-05-09 14:27:44 +02:00
committed by wakonig_k
parent e0dfd56a0d
commit dc151cdfe3
2 changed files with 60 additions and 0 deletions
+11
View File
@@ -205,6 +205,17 @@ class BECConnector:
f"This is not necessarily an error as the parent may be deleted before the child and includes already a cleanup. The following exception was raised:\n{content}"
)
def change_object_name(self, name: str) -> None:
"""
Change the object name of the widget. Unregister old name and register the new one.
Args:
name (str): The new object name.
"""
self.rpc_register.remove_rpc(self)
self.setObjectName(name.replace("-", "_").replace(" ", "_"))
QTimer.singleShot(0, self._update_object_name)
def _update_object_name(self) -> None:
"""
Enforce a unique object name among siblings and register the object for RPC.