mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 21:42:19 +00:00
simplify setup_default_task_columns
This commit is contained in:
@@ -233,7 +233,7 @@ class BIM_PT_work_schedules(Panel):
|
|||||||
if not self.props.should_show_column_ui:
|
if not self.props.should_show_column_ui:
|
||||||
return
|
return
|
||||||
row = self.layout.row()
|
row = self.layout.row()
|
||||||
row.operator("bim.setup_default_task_columns", text="Add Default Columns", icon="ANCHOR_BOTTOM")
|
row.operator("bim.setup_default_task_columns", text="Setup Default Columns", icon="ANCHOR_BOTTOM")
|
||||||
row.alignment = "RIGHT"
|
row.alignment = "RIGHT"
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
row.prop(self.props, "column_types", text="")
|
row.prop(self.props, "column_types", text="")
|
||||||
|
|||||||
@@ -719,26 +719,12 @@ class Sequence(blenderbim.core.tool.Sequence):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_default_task_columns(cls):
|
def setup_default_task_columns(cls):
|
||||||
items = [
|
|
||||||
{
|
|
||||||
"column_type": "IfcTaskTime",
|
|
||||||
"name": "ScheduleStart",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"column_type": "IfcTaskTime",
|
|
||||||
"name": "ScheduleFinish",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"column_type": "IfcTaskTime",
|
|
||||||
"name": "ScheduleDuration",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
props = bpy.context.scene.BIMWorkScheduleProperties
|
props = bpy.context.scene.BIMWorkScheduleProperties
|
||||||
props.columns.clear()
|
props.columns.clear()
|
||||||
for item in items:
|
default_columns = ["ScheduleStart","ScheduleFinish","ScheduleDuration"]
|
||||||
|
for item in default_columns:
|
||||||
new = props.columns.add()
|
new = props.columns.add()
|
||||||
new.name = f"{item['column_type']}.{item['name']}"
|
new.name = f"IfcTaskTime.{item}"
|
||||||
new.data_type = "string"
|
new.data_type = "string"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
Reference in New Issue
Block a user