MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / send_webui_data

Method send_webui_data

src/bonsai/bonsai/tool/web.py:259–289  ·  view source on GitHub ↗

Sends data to the Web UI via Websocket connection. :param data: The data to send. If None, just sends data from WebData. :param data_key: The key under which to store the data in the payload. Defaults to "data". :param event: The WebSocket event to emit. Defaults to

(
        cls,
        data: Optional[Any] = None,
        data_key: str = "data",
        event: str = "data",
        namespace: str = "/blender",
        use_web_data: bool = True,
    )

Source from the content-addressed store, hash-verified

257
258 @classmethod
259 def send_webui_data(
260 cls,
261 data: Optional[Any] = None,
262 data_key: str = "data",
263 event: str = "data",
264 namespace: str = "/blender",
265 use_web_data: bool = True,
266 ) -> None:
267 """
268 Sends data to the Web UI via Websocket connection.
269
270 :param data: The data to send. If None, just sends data from WebData.
271 :param data_key: The key under which to store the data in the payload. Defaults to "data".
272 :param event: The WebSocket event to emit. Defaults to "data".
273 :param namespace: The namespace for the WebSocket event. Defaults to "/blender".
274 :param use_web_data: Whether to use data from WebData. Defaults to True.
275 """
276
277 global ws_thread
278 payload = {}
279
280 if use_web_data:
281 if not WebData.is_loaded:
282 WebData.load()
283 payload = WebData.data.copy()
284
285 if data is not None:
286 payload[data_key] = data
287
288 if ws_thread is not None and tool.Web.get_web_props().is_connected:
289 ws_thread.run_coro(cls.sio_send(payload, event, namespace))
290
291 @classmethod
292 def check_operator_queue(cls) -> None | float:

Callers 10

refresh_ui_dataFunction · 0.80
executeMethod · 0.80
send_webui_demo_messageFunction · 0.80
handle_cost_operatorMethod · 0.80
handle_gantt_operatorMethod · 0.80
send_theme_dataMethod · 0.80

Calls 4

get_web_propsMethod · 0.80
run_coroMethod · 0.80
sio_sendMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected