From 1921444e152e06c4decc790452f3c496cf8ee961 Mon Sep 17 00:00:00 2001 From: wakonig_k Date: Sat, 12 Apr 2025 19:26:29 +0200 Subject: [PATCH] fix(bec_connector): add assertion to ensure BECConnector is used with a QObject; closes #475 --- bec_widgets/utils/bec_connector.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bec_widgets/utils/bec_connector.py b/bec_widgets/utils/bec_connector.py index d1629cce..fa2934fb 100644 --- a/bec_widgets/utils/bec_connector.py +++ b/bec_widgets/utils/bec_connector.py @@ -93,8 +93,12 @@ class BECConnector: # Ensure the parent is always the first argument for QObject parent = kwargs.pop("parent", None) # This initializes the QObject or any qt related class BECConnector has to be used from this line down with QObject, otherwise hierarchy logic will not work - # TODO do a proper check if the class is a QObject -> issue #475 super().__init__(parent=parent, **kwargs) + + assert isinstance( + self, QObject + ), "BECConnector must be used with a QObject or any qt related class." + # BEC related connections self.bec_dispatcher = BECDispatcher(client=client) self.client = self.bec_dispatcher.client if client is None else client