From 475ca9f2d81bcc2bb0c7b104c0712b13d6616c08 Mon Sep 17 00:00:00 2001 From: wakonig_k Date: Sat, 13 Sep 2025 10:50:05 +0200 Subject: [PATCH] fix(connector): only flush pending events --- bec_widgets/utils/bec_connector.py | 2 +- bec_widgets/utils/rpc_server.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bec_widgets/utils/bec_connector.py b/bec_widgets/utils/bec_connector.py index c04b3fd3..48a29fd1 100644 --- a/bec_widgets/utils/bec_connector.py +++ b/bec_widgets/utils/bec_connector.py @@ -213,7 +213,7 @@ class BECConnector: - If there's a nearest BECConnector parent, only compare with children of that parent. - If parent is None (i.e., top-level object), compare with all other top-level BECConnectors. """ - QApplication.processEvents() + QApplication.sendPostedEvents() parent_bec = WidgetHierarchy._get_becwidget_ancestor(self) if parent_bec: diff --git a/bec_widgets/utils/rpc_server.py b/bec_widgets/utils/rpc_server.py index 428e2414..6991768c 100644 --- a/bec_widgets/utils/rpc_server.py +++ b/bec_widgets/utils/rpc_server.py @@ -1,6 +1,7 @@ from __future__ import annotations import functools +import time import traceback import types from contextlib import contextmanager @@ -229,6 +230,8 @@ class RPCServer: if wait: while not self.rpc_register.object_is_registered(connector): QApplication.processEvents() + logger.info(f"Waiting for {connector} to be registered...") + time.sleep(0.1) widget_class = getattr(connector, "rpc_widget_class", None) if not widget_class: