mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 23:02:39 +00:00
made sending data take the event and namespace names as args
This commit is contained in:
@@ -192,7 +192,7 @@ def refresh_ui_data():
|
|||||||
|
|
||||||
bpy.context.scene.DocProperties.should_draw_decorations = bpy.context.scene.DocProperties.should_draw_decorations
|
bpy.context.scene.DocProperties.should_draw_decorations = bpy.context.scene.DocProperties.should_draw_decorations
|
||||||
if bpy.context.scene.WebProperties.is_connected:
|
if bpy.context.scene.WebProperties.is_connected:
|
||||||
tool.Web.send_webui_data()
|
tool.Web.send_default_webui_data()
|
||||||
|
|
||||||
|
|
||||||
@persistent
|
@persistent
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class Web(blenderbim.core.tool.Web):
|
|||||||
ws_url = f"ws://localhost:{port}/blender"
|
ws_url = f"ws://localhost:{port}/blender"
|
||||||
ws_thread.run_coro(cls.sio_connect(ws_url))
|
ws_thread.run_coro(cls.sio_connect(ws_url))
|
||||||
cls.set_is_connected(True)
|
cls.set_is_connected(True)
|
||||||
cls.send_webui_data()
|
cls.send_default_webui_data()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def disconnect_websocket_server(cls):
|
def disconnect_websocket_server(cls):
|
||||||
@@ -114,13 +114,16 @@ class Web(blenderbim.core.tool.Web):
|
|||||||
print("Websocket server terminated successfully")
|
print("Websocket server terminated successfully")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def send_webui_data(cls):
|
def send_default_webui_data(cls, event="default_data", namespace="/blender"):
|
||||||
global ws_thread
|
|
||||||
|
|
||||||
if not WebData.is_loaded:
|
if not WebData.is_loaded:
|
||||||
WebData.load()
|
WebData.load()
|
||||||
|
cls.send_webui_data(WebData.data, event=event, namespace=namespace)
|
||||||
|
|
||||||
ws_thread.run_coro(cls.sio_send(WebData.data))
|
@classmethod
|
||||||
|
def send_webui_data(cls, data, event="data", namespace="/blender"):
|
||||||
|
global ws_thread
|
||||||
|
if ws_thread is not None and bpy.context.scene.WebProperties.is_connected:
|
||||||
|
ws_thread.run_coro(cls.sio_send(data, event, namespace))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def open_web_browser(cls, port):
|
def open_web_browser(cls, port):
|
||||||
@@ -140,8 +143,8 @@ class Web(blenderbim.core.tool.Web):
|
|||||||
await sio.disconnect()
|
await sio.disconnect()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def sio_send(cls, data):
|
async def sio_send(cls, data, event="data", namespace="/blender"):
|
||||||
await sio.emit("data", data, namespace="/blender")
|
await sio.emit(event, data, namespace=namespace)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def set_is_running(cls, is_running):
|
def set_is_running(cls, is_running):
|
||||||
|
|||||||
Reference in New Issue
Block a user