bec_widgets.cli.rpc.rpc_register ================================ .. py:module:: bec_widgets.cli.rpc.rpc_register Classes ------- .. autoapisummary:: bec_widgets.cli.rpc.rpc_register.RPCRegister bec_widgets.cli.rpc.rpc_register.RPCRegisterBroadcast Functions --------- .. autoapisummary:: bec_widgets.cli.rpc.rpc_register.broadcast_update Module Contents --------------- .. py:class:: RPCRegister A singleton class that keeps track of all the RPC objects registered in the system for CLI usage. .. py:method:: add_callback(callback: Callable[[dict], None]) Add a callback that will be called whenever the registry is updated. :param callback: The callback to be added. It should accept a dictionary of all the :type callback: Callable[[dict], None] :param registered RPC objects as an argument.: .. py:method:: add_rpc(rpc: bec_widgets.utils.bec_connector.BECConnector) Add an RPC object to the register. :param rpc: The RPC object to be added to the register. :type rpc: QObject .. py:method:: broadcast() Broadcast the update to all the callbacks. .. py:method:: delayed_broadcast() :classmethod: Delay the broadcast of the update to all the callbacks. .. py:method:: get_names_of_rpc_by_class_type(cls: type[bec_widgets.utils.bec_widget.BECWidget] | type[bec_widgets.utils.bec_connector.BECConnector]) -> list[str] Get all the names of the widgets. :param cls: The class of the RPC object to be retrieved. :type cls: BECWidget | BECConnector .. py:method:: get_rpc_by_id(gui_id: str) -> qtpy.QtCore.QObject | None Get an RPC object by its ID. :param gui_id: The ID of the RPC object to be retrieved. :type gui_id: str :returns: The RPC object with the given ID or None :rtype: QObject | None .. py:method:: list_all_connections() -> dict List all the registered RPC objects. :returns: A dictionary containing all the registered RPC objects. :rtype: dict .. py:method:: object_is_registered(obj: bec_widgets.utils.bec_connector.BECConnector) -> bool Check if an object is registered in the RPC register. :param obj: The object to check. :type obj: QObject :returns: True if the object is registered, False otherwise. :rtype: bool .. py:method:: remove_rpc(rpc: bec_widgets.utils.bec_connector.BECConnector) Remove an RPC object from the register. :param rpc: The RPC object to be removed from the register. :type rpc: str .. py:method:: reset_singleton() :classmethod: Reset the singleton instance. .. py:attribute:: callbacks :value: [] .. py:class:: RPCRegisterBroadcast(rpc_register: RPCRegister) Context manager for RPCRegister broadcast. .. py:method:: __enter__() Enter the context manager .. py:method:: __exit__(*exc) Exit the context manager .. py:attribute:: rpc_register .. py:function:: broadcast_update(func) Decorator to broadcast updates to the RPCRegister whenever a new RPC object is added or removed. If class attribute _skip_broadcast is set to True, the broadcast will be skipped