0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-14 11:41:49 +02:00

refactor: BECGuiClientMixin -> BECGuiClient

- Mixin class was only used with BECDockArea, now it is a class by itself
which represents the client object connected to the GUI server ; ".main"
is the dock area of the main window
- Enhanced "wait_for_server"
- ".selected_device" is stored in Redis, to allow server-side to know
about the auto update configuration instead of keeping it on client
This commit is contained in:
2024-12-16 11:53:32 +01:00
committed by wakonig_k
parent bdb25206d9
commit 809e654087
9 changed files with 262 additions and 172 deletions

View File

@ -4,7 +4,7 @@ from unittest import mock
import pytest
from bec_widgets.cli.client import BECFigure
from bec_widgets.cli.client_utils import BECGuiClientMixin, _start_plot_process
from bec_widgets.cli.client_utils import BECGuiClient, _start_plot_process
from bec_widgets.tests.utils import FakeDevice
@ -63,7 +63,7 @@ def test_client_utils_passes_client_config_to_server(bec_dispatcher):
@contextmanager
def bec_client_mixin():
mixin = BECGuiClientMixin()
mixin = BECGuiClient()
mixin._client = bec_dispatcher.client
mixin._gui_id = "gui_id"
mixin.gui_is_alive = mock.MagicMock()
@ -82,6 +82,6 @@ def test_client_utils_passes_client_config_to_server(bec_dispatcher):
wait=False
) # the started event will not be set, wait=True would block forever
mock_start_plot.assert_called_once_with(
"gui_id", BECGuiClientMixin, mixin._client._service_config.config, logger=mock.ANY
"gui_id", BECGuiClient, mixin._client._service_config.config, logger=mock.ANY
)
mixin._start_update_script.assert_called_once()

View File

@ -70,7 +70,7 @@ def test_client_generator_with_black_formatting():
import enum
from typing import Literal, Optional, overload
from bec_widgets.cli.client_utils import BECGuiClientMixin, RPCBase, rpc_call
from bec_widgets.cli.client_utils import RPCBase, rpc_call
# pylint: skip-file