1
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2026-03-28 19:38:27 +01:00

fix: remove patching of BECDockArea on client

This commit is contained in:
2025-03-04 15:57:23 +01:00
committed by wyzula-jan
parent a7020553f9
commit 3029433740

View File

@@ -17,6 +17,7 @@ from bec_lib.utils.import_utils import isinstance_based_on_class_name, lazy_impo
import bec_widgets.cli.client as client
from bec_widgets.cli.auto_updates import AutoUpdates
from bec_widgets.cli.client import BECDockArea
from bec_widgets.cli.rpc.rpc_base import RPCBase
if TYPE_CHECKING:
@@ -148,30 +149,6 @@ def wait_for_server(client):
yield
### ----------------------------
### NOTE
### it is far easier to extend the 'delete' method on the client side,
### to know when the client is deleted, rather than listening to server
### to get notified. However, 'generate_cli.py' cannot add extra stuff
### in the generated client module. So, here a class with the same name
### is created, and client module is patched.
class BECDockArea(client.BECDockArea):
# FIXME fix the delete method
def delete(self):
if self is BECGuiClient._top_level["bec"]:
raise RuntimeError("Cannot delete bec window")
super().delete_all()
try:
del BECGuiClient._top_level[self._gui_id]
except KeyError:
# if a dock area is not at top level
pass
client.BECDockArea = BECDockArea
### ----------------------------
class BECGuiClient(RPCBase):
_top_level = {}