mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 03:31:50 +02:00
refactor(rpc_server): cli_server renamed to rpc_server
This commit is contained in:
@ -19,7 +19,7 @@ logger = bec_logger.logger
|
|||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from bec_lib.endpoints import EndpointInfo
|
from bec_lib.endpoints import EndpointInfo
|
||||||
|
|
||||||
from bec_widgets.utils.cli_server import CLIServer
|
from bec_widgets.utils.rpc_server import RPCServer
|
||||||
|
|
||||||
|
|
||||||
class QtThreadSafeCallback(QObject):
|
class QtThreadSafeCallback(QObject):
|
||||||
@ -78,9 +78,8 @@ class BECDispatcher:
|
|||||||
_instance = None
|
_instance = None
|
||||||
_initialized = False
|
_initialized = False
|
||||||
client: BECClient
|
client: BECClient
|
||||||
cli_server: CLIServer | None = None
|
cli_server: RPCServer | None = None
|
||||||
|
|
||||||
# TODO add custom gui id for server
|
|
||||||
def __new__(
|
def __new__(
|
||||||
cls,
|
cls,
|
||||||
client=None,
|
client=None,
|
||||||
@ -208,7 +207,7 @@ class BECDispatcher:
|
|||||||
gui_id(str, optional): The GUI ID. Defaults to None. If None, a unique identifier will be generated.
|
gui_id(str, optional): The GUI ID. Defaults to None. If None, a unique identifier will be generated.
|
||||||
"""
|
"""
|
||||||
# pylint: disable=import-outside-toplevel
|
# pylint: disable=import-outside-toplevel
|
||||||
from bec_widgets.utils.cli_server import CLIServer
|
from bec_widgets.utils.rpc_server import RPCServer
|
||||||
|
|
||||||
if gui_id is None:
|
if gui_id is None:
|
||||||
gui_id = self.generate_unique_identifier()
|
gui_id = self.generate_unique_identifier()
|
||||||
@ -216,7 +215,7 @@ class BECDispatcher:
|
|||||||
if not self.client.started:
|
if not self.client.started:
|
||||||
logger.error("Cannot start CLI server without a running client")
|
logger.error("Cannot start CLI server without a running client")
|
||||||
return
|
return
|
||||||
self.cli_server = CLIServer(gui_id, dispatcher=self, client=self.client)
|
self.cli_server = RPCServer(gui_id, dispatcher=self, client=self.client)
|
||||||
logger.success(f"Started CLI server with gui_id: {gui_id}")
|
logger.success(f"Started CLI server with gui_id: {gui_id}")
|
||||||
|
|
||||||
def stop_cli_server(self):
|
def stop_cli_server(self):
|
||||||
|
@ -51,7 +51,7 @@ def rpc_exception_hook(err_func):
|
|||||||
popup.custom_exception_hook = old_exception_hook
|
popup.custom_exception_hook = old_exception_hook
|
||||||
|
|
||||||
|
|
||||||
class CLIServer:
|
class RPCServer:
|
||||||
|
|
||||||
client: BECClient
|
client: BECClient
|
||||||
|
|
Reference in New Issue
Block a user