mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 06:58:56 +00:00
make webui default for work schedules and simplfy condition
This commit is contained in:
@@ -254,7 +254,7 @@ class ExportIfcCsv(bpy.types.Operator):
|
|||||||
schedule_creator = scheduler.Scheduler()
|
schedule_creator = scheduler.Scheduler()
|
||||||
schedule_creator.schedule(self.filepath, tool.Drawing.get_path_with_ext(self.filepath, "svg"))
|
schedule_creator.schedule(self.filepath, tool.Drawing.get_path_with_ext(self.filepath, "svg"))
|
||||||
if props.format == "web":
|
if props.format == "web":
|
||||||
if not context.scene.WebProperties.is_running and not context.scene.WebProperties.is_connected:
|
if not context.scene.WebProperties.is_connected:
|
||||||
bpy.ops.bim.connect_websocket_server()
|
bpy.ops.bim.connect_websocket_server()
|
||||||
tool.Web.send_webui_data(data=ifc_csv.dataframe.to_csv(index=False), data_key="csv_data", event="csv_data")
|
tool.Web.send_webui_data(data=ifc_csv.dataframe.to_csv(index=False), data_key="csv_data", event="csv_data")
|
||||||
|
|
||||||
|
|||||||
@@ -1541,20 +1541,10 @@ class Sequence(bonsai.core.tool.Sequence):
|
|||||||
def generate_gantt_browser_chart(
|
def generate_gantt_browser_chart(
|
||||||
cls, task_json: list[dict[str, Any]], work_schedule: ifcopenshell.entity_instance
|
cls, task_json: list[dict[str, Any]], work_schedule: ifcopenshell.entity_instance
|
||||||
) -> None:
|
) -> None:
|
||||||
if bpy.context.scene.WebProperties.is_connected:
|
if not bpy.context.scene.WebProperties.is_connected:
|
||||||
gantt_data = {"tasks": task_json, "work_schedule": work_schedule.get_info(recursive=True)}
|
bpy.ops.bim.connect_websocket_server()
|
||||||
tool.Web.send_webui_data(data=gantt_data, data_key="gantt_data", event="gantt_data")
|
gantt_data = {"tasks": task_json, "work_schedule": work_schedule.get_info(recursive=True)}
|
||||||
return
|
tool.Web.send_webui_data(data=gantt_data, data_key="gantt_data", event="gantt_data")
|
||||||
|
|
||||||
with open(os.path.join(bpy.context.scene.BIMProperties.data_dir, "gantt", "index.html"), "w") as f:
|
|
||||||
with open(os.path.join(bpy.context.scene.BIMProperties.data_dir, "gantt", "index.mustache"), "r") as t:
|
|
||||||
task_b64 = base64.b64encode(bytes(json.dumps(task_json), "utf-8")).decode("utf-8")
|
|
||||||
f.write(
|
|
||||||
pystache.render(
|
|
||||||
t.read(), {"json_data": task_b64, "data": json.dumps(work_schedule.get_info(recursive=True))}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
webbrowser.open("file://" + os.path.join(bpy.context.scene.BIMProperties.data_dir, "gantt", "index.html"))
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def is_filter_by_active_schedule(cls) -> bool:
|
def is_filter_by_active_schedule(cls) -> bool:
|
||||||
|
|||||||
Reference in New Issue
Block a user