fix loading cost schedule webui from blender operator

This commit is contained in:
myoualid
2024-09-08 15:25:56 +01:00
parent 2f026218ff
commit 83be26e196
3 changed files with 6 additions and 4 deletions
@@ -70,6 +70,8 @@ class WebNamespace(socketio.AsyncNamespace):
await self.emit("gantt_data", {"blenderId": blenderId, "data": messages["gantt_data"]}, room=sid)
if "demo_data" in messages:
await self.emit("demo_data", {"blenderId": blenderId, "data": messages["demo_data"]}, room=sid)
if 'cost_items' in messages:
await self.emit("cost_items", {"blenderId": blenderId, "data": messages["cost_items"]}, room=sid)
async def process_svg(self, file_path):
def encode_image(filepath):
+1 -2
View File
@@ -401,5 +401,4 @@ def add_currency(ifc: tool.Ifc, cost: tool.Cost) -> ifcopenshell.entity_instance
def generate_cost_schedule_browser(cost: tool.Cost, cost_schedule: ifcopenshell.entity_instance) -> bpy.types.Panel:
cost_schedule_data = cost.create_cost_schedule_json(cost_schedule)
return cost.generate_cost_schedule_browser(cost_schedule_data)
return cost.generate_cost_schedule_browser(cost_schedule)
+3 -2
View File
@@ -854,7 +854,8 @@ class Cost(bonsai.core.tool.Cost):
return {"id": unit.id(), "name": unit.Currency}
@classmethod
def generate_cost_schedule_browser(cls, cost_schedule_data: list[dict[str, Any]]) -> None:
def generate_cost_schedule_browser(cls, cost_chedule) -> None:
if not bpy.context.scene.WebProperties.is_connected:
bpy.ops.bim.connect_websocket_server(page="costing")
tool.Web.send_webui_data(data=cost_schedule_data, data_key="cost_items", event="cost_items")
cost_schedule_data = cls.create_cost_schedule_json(cost_chedule)
tool.Web.send_webui_data(data={"cost_items": cost_schedule_data, "cost_schedule_id": cost_chedule.id()}, data_key="cost_items", event="cost_items")