mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 03:31:50 +02:00
WIP extended example app prototyping
This commit is contained in:
@ -446,6 +446,7 @@ class BECGuiClient(RPCBase):
|
||||
Args:
|
||||
server_registry (dict): The server registry
|
||||
"""
|
||||
logger.error("Updating dynamic namespace with server registry")
|
||||
top_level_widgets: dict[str, RPCReference] = {}
|
||||
for gui_id, state in server_registry.items():
|
||||
widget = self._add_widget(state, self)
|
||||
|
@ -140,6 +140,7 @@ class CLIServer:
|
||||
return res
|
||||
|
||||
def serialize_object(self, obj):
|
||||
# TODO here is broadcast from the server
|
||||
if isinstance(obj, BECConnector):
|
||||
# Check if RPC attribute exists and is explicitly set to False
|
||||
if hasattr(obj, "RPC") and obj.RPC is False:
|
||||
@ -149,9 +150,6 @@ class CLIServer:
|
||||
config["parent_id"] = obj.parent_id # add parent_id to config
|
||||
return {
|
||||
"gui_id": obj.gui_id,
|
||||
# "name": (
|
||||
# obj._name if hasattr(obj, "_name") else obj.__class__.__name__
|
||||
# ), # pylint: disable=protected-access
|
||||
"name": obj.objectName() if obj.objectName() else obj.__class__.__name__,
|
||||
"widget_class": obj.__class__.__name__,
|
||||
"config": config,
|
||||
@ -176,6 +174,9 @@ class CLIServer:
|
||||
"""
|
||||
|
||||
# We only need to broadcast the dock areas
|
||||
# TODO here the registry is getting update
|
||||
logger.error("Broadcasting registry update")
|
||||
# TODO HERE SHOULD BE WHOLE PARENT - Child logic handled
|
||||
data = {
|
||||
key: serialized
|
||||
for key, val in connections.items()
|
||||
|
@ -7,21 +7,45 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>824</width>
|
||||
<height>1234</height>
|
||||
<height>1320</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="Waveform" name="waveform"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="BECDockArea" name="dock_area_2"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="BECDockArea" name="dock_area"/>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
<string>Tab 1</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="Waveform" name="waveform"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Waveform" name="waveform_2"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<attribute name="title">
|
||||
<string>Tab 2</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="BECDockArea" name="dock_area"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="BECDockArea" name="dock_area_2"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -24,6 +24,7 @@ class BECMainWindow(BECWidget, QMainWindow):
|
||||
QMainWindow.__init__(self, *args, **kwargs)
|
||||
BECWidget.__init__(self, gui_id=gui_id, **kwargs)
|
||||
|
||||
self.bec_dispatcher.start_cli_server("test")
|
||||
self.app = QApplication.instance()
|
||||
|
||||
# self._upgrade_qapp() #TODO consider to make upgrade function to any QApplication to BECQApplication
|
||||
@ -49,12 +50,14 @@ class BECMainWindow(BECWidget, QMainWindow):
|
||||
self.setCentralWidget(self.ui)
|
||||
|
||||
def _init_bec_specific_ui(self):
|
||||
if getattr(self.app, "is_bec_app", False):
|
||||
self.statusBar().showMessage(f"App ID: {self.app.gui_id}")
|
||||
else:
|
||||
logger.warning(
|
||||
"Application is not a BECApplication instance. Status bar will not show App ID. Please initialize the application with BECApplication."
|
||||
)
|
||||
# if getattr(self.app, "is_bec_app", False):
|
||||
# self.statusBar().showMessage(f"App ID: {self.app.gui_id}")
|
||||
# else:
|
||||
# logger.warning(
|
||||
# "Application is not a BECApplication instance. Status bar will not show App ID. Please initialize the application with BECApplication."
|
||||
# )
|
||||
server_id = self.bec_dispatcher.cli_server.gui_id
|
||||
self.statusBar().showMessage(f"App ID: {server_id}")
|
||||
|
||||
def list_app_hierarchy(self):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user