Improved UI for psets and qtos with collapsible panels and improved readibility

This commit is contained in:
Dion Moult
2020-11-29 23:24:56 +11:00
parent e3f61510ad
commit 98f45817a6
2 changed files with 59 additions and 19 deletions
@@ -1646,6 +1646,8 @@ class IfcParameter(PropertyGroup):
class PsetQto(PropertyGroup):
name: StringProperty(name="Name")
properties: CollectionProperty(name="Properties", type=Attribute)
is_expanded: BoolProperty(name="Is Expanded")
is_editable: BoolProperty(name="Is Editable")
class GlobalId(PropertyGroup):
+57 -19
View File
@@ -195,7 +195,12 @@ class BIM_PT_object_material(Panel):
row.prop(material, "category")
elif props.material_type == "IfcMaterialProfileSet":
row.template_list(
"MATERIAL_UL_matslots", "", set_props, "material_profiles", set_props, "active_material_profile_index",
"MATERIAL_UL_matslots",
"",
set_props,
"material_profiles",
set_props,
"active_material_profile_index",
)
col = row.column(align=True)
col.operator("bim.add_material_profile", icon="ADD", text="")
@@ -253,22 +258,43 @@ class BIM_PT_object_psets(Panel):
def draw_psets_ui(self, props, enabled=True):
for index, pset in enumerate(props.psets):
row = self.layout.row(align=True)
row.enabled = enabled
row.prop(pset, "name", text="")
box = self.layout.box()
row = box.row(align=True)
row.prop(
pset,
"is_expanded",
icon="TRIA_DOWN" if pset.is_expanded else "TRIA_RIGHT",
icon_only=True,
emboss=False,
)
row2 = row.row(align=True)
row2.enabled = enabled
row2.prop(pset, "name", text="", icon="COPY_ID", emboss=pset.is_editable)
if enabled:
row.prop(pset, "is_editable", icon="CHECKMARK" if pset.is_editable else "GREASEPENCIL", icon_only=True)
row.operator("bim.remove_pset", icon="X", text="").pset_index = index
for prop in pset.properties:
row = self.layout.row(align=True)
row.enabled = enabled
row.prop(prop, "name", text="")
row.prop(prop, "string_value", text="")
if not enabled:
continue
op = row.operator("bim.copy_property_to_selection", icon="COPYDOWN", text="")
op.pset_name = pset.name
op.prop_name = prop.name
op.prop_value = prop.string_value
if not pset.is_expanded:
continue
if pset.is_editable:
for prop in pset.properties:
row = box.row(align=True)
row.enabled = enabled
row.prop(prop, "name", text="")
row.prop(prop, "string_value", text="")
if not enabled:
continue
op = row.operator("bim.copy_property_to_selection", icon="COPYDOWN", text="")
op.pset_name = pset.name
op.prop_name = prop.name
op.prop_value = prop.string_value
else:
col = box.column(align=True)
for prop in pset.properties:
if not prop.string_value:
continue
col.enabled = enabled
col.prop(prop, "string_value", text=prop.name)
class BIM_PT_object_qto(Panel):
@@ -292,11 +318,18 @@ class BIM_PT_object_qto(Panel):
row.operator("bim.add_qto")
for index, qto in enumerate(props.qtos):
row = layout.row(align=True)
row.prop(qto, "name", text="")
box = self.layout.box()
row = box.row(align=True)
row.prop(
qto, "is_expanded", icon="TRIA_DOWN" if qto.is_expanded else "TRIA_RIGHT", icon_only=True, emboss=False
)
row.prop(qto, "name", text="", icon="COPY_ID")
row.operator("bim.remove_qto", icon="X", text="").index = index
if not qto.is_expanded:
continue
for index2, prop in enumerate(qto.properties):
row = layout.row(align=True)
row = box.row(align=True)
row.prop(prop, "name", text="")
row.prop(prop, "string_value", text="")
if (
@@ -836,7 +869,12 @@ class BIM_PT_presentation_layer_data(Panel):
return
layout.template_list(
"BIM_UL_generic", "", scene_props, "presentation_layers", scene_props, "active_presentation_layer_index",
"BIM_UL_generic",
"",
scene_props,
"presentation_layers",
scene_props,
"active_presentation_layer_index",
)
if scene_props.active_presentation_layer_index < len(scene_props.presentation_layers):
op = layout.row().operator("bim.assign_presentation_layer")