clean up updating selected task ICOM and UI re-ordering for work schedule subpanels

This commit is contained in:
Sigma Dimensions (Yass)
2023-08-21 13:28:08 +01:00
parent 954722f40b
commit dde12b36f8
9 changed files with 35 additions and 62 deletions
@@ -51,9 +51,9 @@ class BIM_PT_cost_schedules(Panel):
for schedule in CostSchedulesData.data["schedules"]:
self.draw_cost_schedule_ui(schedule)
row2 = self.layout.row()
row2.alignment = "RIGHT"
row2.operator("bim.export_cost_schedules", text="Export all", icon="EXPORT")
row2 = self.layout.row()
row2.alignment = "RIGHT"
row2.operator("bim.export_cost_schedules", text="Export all", icon="EXPORT")
def draw_cost_schedule_ui(self, cost_schedule):
row = self.layout.row(align=True)
@@ -370,6 +370,7 @@ class BIM_PT_task_qtos(Panel):
bl_region_type = "WINDOW"
bl_context = "scene"
bl_parent_id = "BIM_PT_work_schedules"
bl_order = 2
@classmethod
def poll(cls, context):
@@ -510,6 +511,7 @@ class BIM_PT_work_schedule_psets(Panel):
bl_region_type = "WINDOW"
bl_context = "scene"
bl_parent_id = "BIM_PT_work_schedules"
bl_order = 3
@classmethod
def poll(cls, context):
@@ -91,10 +91,7 @@ classes = (
operator.LoadAnimationColorScheme,
operator.LoadDefaultAnimationColors,
operator.LoadProductTasks,
operator.LoadTaskInputs,
operator.LoadTaskOutputs,
operator.LoadTaskProperties,
operator.LoadTaskResources,
operator.RecalculateSchedule,
operator.RemoveTask,
operator.RemoveTaskCalendar,
@@ -1202,36 +1202,6 @@ class SetTaskSortColumn(bpy.types.Operator):
return {"FINISHED"}
class LoadTaskResources(bpy.types.Operator):
bl_idname = "bim.load_task_resources"
bl_label = "Load Task Resources"
bl_options = {"REGISTER", "UNDO"}
def execute(self, context):
core.load_task_resources(tool.Sequence)
return {"FINISHED"}
class LoadTaskInputs(bpy.types.Operator):
bl_idname = "bim.load_task_inputs"
bl_label = "Load Task Inputs"
bl_options = {"REGISTER", "UNDO"}
def execute(self, context):
core.load_task_inputs(tool.Sequence)
return {"FINISHED"}
class LoadTaskOutputs(bpy.types.Operator):
bl_idname = "bim.load_task_outputs"
bl_label = "Load Task Outputs"
bl_options = {"REGISTER", "UNDO"}
def execute(self, context):
core.load_task_outputs(tool.Sequence)
return {"FINISHED"}
class CalculateTaskDuration(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.calculate_task_duration"
bl_label = "Calculate Task Duration"
@@ -88,11 +88,9 @@ def getWorkCalendars(self, context):
def update_active_task_index(self, context):
bpy.ops.bim.load_task_inputs()
bpy.ops.bim.load_task_resources()
bpy.ops.bim.load_task_outputs()
task = tool.Sequence.get_highlighted_task()
self.highlighted_task_id = task.id() if task else 0
tool.Sequence.update_task_ICOM(task)
blenderbim.bim.module.pset.data.refresh()
if self.editing_task_type == "SEQUENCE":
tool.Sequence.load_task_properties()
@@ -106,15 +104,21 @@ def update_highlighted_task_id(self):
def update_active_task_outputs(self, context):
bpy.ops.bim.load_task_outputs()
task = tool.Sequence.get_highlighted_task()
outputs = tool.Sequence.get_task_outputs(task)
tool.Sequence.load_task_outputs(outputs)
def update_active_task_resources(self, context):
bpy.ops.bim.load_task_resources()
task = tool.Sequence.get_highlighted_task()
resources = tool.Sequence.get_task_resources(task)
tool.Sequence.load_task_resources(resources)
def update_active_task_inputs(self, context):
bpy.ops.bim.load_task_inputs()
task = tool.Sequence.get_highlighted_task()
inputs = tool.Sequence.get_task_inputs(task)
tool.Sequence.load_task_inputs(inputs)
def updateTaskName(self, context):
@@ -54,7 +54,7 @@ class BIM_PT_work_plans(Panel):
row.label(text=f"{WorkPlansData.data['total_work_plans']} Work Plans Found", icon="TEXT")
else:
row.label(text="No Work Plans found.", icon="TEXT")
row.operator("bim.add_work_plan", icon="", text="")
row.operator("bim.add_work_plan", icon="ADD", text="")
for work_plan in WorkPlansData.data["work_plans"]:
self.draw_work_plan_ui(work_plan)
@@ -186,10 +186,14 @@ class BIM_PT_work_schedules(Panel):
row2 = col.row(align=True)
row.operator("bim.disable_editing_work_schedule", text="Cancel", icon="CANCEL")
if not self.props.active_work_schedule_id:
row.label(
grid = self.layout.grid_flow(columns=2, even_columns=True)
col1 = grid.column()
col1.label(
text="{}[{}]".format(work_schedule["Name"], work_schedule["PredefinedType"]) or "Unnamed",
icon="LINENUMBERS_ON",
)
col2 = grid.column()
row = col2.row(align=True)
row.operator(
"bim.enable_editing_work_schedule_tasks", text="Tasks", icon="ACTION"
).work_schedule = work_schedule_id
@@ -434,6 +438,7 @@ class BIM_PT_animation_tools(Panel):
bl_region_type = "WINDOW"
bl_context = "scene"
bl_parent_id = "BIM_PT_work_schedules"
bl_order = 4
@classmethod
def poll(cls, context):
@@ -599,6 +604,7 @@ class BIM_PT_task_icom(Panel):
bl_region_type = "WINDOW"
bl_context = "scene"
bl_parent_id = "BIM_PT_work_schedules"
bl_order = 1
@classmethod
def poll(cls, context):
@@ -269,24 +269,6 @@ def unassign_resource(ifc, sequence, task=None, resource=None):
sequence.load_resources()
def load_task_outputs(sequence):
task = sequence.get_highlighted_task()
outputs = sequence.get_task_outputs(task)
sequence.load_task_outputs(outputs)
def load_task_inputs(sequence):
task = sequence.get_highlighted_task()
inputs = sequence.get_task_inputs(task)
sequence.load_task_inputs(inputs)
def load_task_resources(sequence):
task = sequence.get_highlighted_task()
resources = sequence.get_task_resources(task)
sequence.load_task_resources(resources)
def remove_work_calendar(ifc, work_calendar=None):
ifc.run("sequence.remove_work_calendar", work_calendar=work_calendar)
+1
View File
@@ -757,6 +757,7 @@ class Sequence:
def set_task_sort_column(cls, column): pass
def setup_default_task_columns(cls): pass
def show_snapshot(cls, product_states): pass
def update_task_ICOM(cls, task): pass
def update_visualisation_date(cls, start_date, finish_date): pass
@@ -1657,3 +1657,14 @@ class Sequence(blenderbim.core.tool.Sequence):
new = props.task_output_colors.add()
new.name = str(value)
new.color = colour[0:3]
@classmethod
def update_task_ICOM(cls, task):
if not task:
return
inputs = cls.get_task_inputs(task)
outputs = cls.get_task_outputs(task)
resources = cls.get_task_resources(task)
cls.load_task_inputs(inputs)
cls.load_task_outputs(outputs)
cls.load_task_resources(resources)