mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-29 11:46:33 +00:00
Fix UI errors if there are no pset template files
This commit is contained in:
@@ -87,7 +87,9 @@ class PsetTemplatesData:
|
|||||||
return sorted(results, key=lambda x: x[1])
|
return sorted(results, key=lambda x: x[1])
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def pset_templates(cls):
|
def pset_templates(cls) -> list[tuple[str, str, str]]:
|
||||||
|
if not cls.data["pset_template_files"]:
|
||||||
|
return []
|
||||||
if not IfcStore.pset_template_file:
|
if not IfcStore.pset_template_file:
|
||||||
IfcStore.pset_template_path = bpy.context.scene.BIMPsetTemplateProperties.pset_template_files
|
IfcStore.pset_template_path = bpy.context.scene.BIMPsetTemplateProperties.pset_template_files
|
||||||
IfcStore.pset_template_file = ifcopenshell.open(IfcStore.pset_template_path)
|
IfcStore.pset_template_file = ifcopenshell.open(IfcStore.pset_template_path)
|
||||||
|
|||||||
@@ -38,7 +38,10 @@ class BIM_PT_pset_template(Panel):
|
|||||||
self.props = context.scene.BIMPsetTemplateProperties
|
self.props = context.scene.BIMPsetTemplateProperties
|
||||||
|
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
prop_with_search(row, self.props, "pset_template_files", text="", icon="FILE")
|
if PsetTemplatesData.data["pset_template_files"]:
|
||||||
|
prop_with_search(row, self.props, "pset_template_files", text="", icon="FILE")
|
||||||
|
else:
|
||||||
|
row.label(text="No Pset Template Files", icon="FILE")
|
||||||
row.operator("bim.add_pset_template_file", icon="ADD", text="")
|
row.operator("bim.add_pset_template_file", icon="ADD", text="")
|
||||||
row.operator("bim.remove_pset_template_file", icon="X", text="")
|
row.operator("bim.remove_pset_template_file", icon="X", text="")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user