From 84dde4c5c05fed5d9c4a84e1b7aed41790a9c491 Mon Sep 17 00:00:00 2001 From: Gorgious Date: Mon, 31 Oct 2022 19:34:59 +0100 Subject: [PATCH] Property set templates attributes now show a tooltip on hover --- .../bim/module/pset_template/prop.py | 42 +++++++++++++++---- src/blenderbim/blenderbim/bim/ui.py | 2 +- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/pset_template/prop.py b/src/blenderbim/blenderbim/bim/module/pset_template/prop.py index 23fef7863c..d2821ca01a 100644 --- a/src/blenderbim/blenderbim/bim/module/pset_template/prop.py +++ b/src/blenderbim/blenderbim/bim/module/pset_template/prop.py @@ -19,6 +19,7 @@ import os import bpy import ifcopenshell +from ifcopenshell.util.doc import get_attribute_doc from blenderbim.bim.module.pset_template.data import PsetTemplatesData from blenderbim.bim.prop import StrProperty, Attribute from blenderbim.bim.ifc import IfcStore @@ -111,11 +112,27 @@ def get_template_type(self, context): class PsetTemplate(PropertyGroup): - global_id: StringProperty(name="Global ID") - name: StringProperty(name="Name") - description: StringProperty(name="Description") - template_type: EnumProperty(items=get_template_type, name="Template Type") - applicable_entity: StringProperty(name="Applicable Entity") + global_id: StringProperty( + name="Global ID", + description=get_attribute_doc("IFC4", "IfcPropertySetTemplate", "GlobalId"), + ) + name: StringProperty( + name="Name", + description=get_attribute_doc("IFC4", "IfcPropertySetTemplate", "Name"), + ) + description: StringProperty( + name="Description", + description=get_attribute_doc("IFC4", "IfcPropertySetTemplate", "Description"), + ) + template_type: EnumProperty( + items=get_template_type, + name="Template Type", + description=get_attribute_doc("IFC4", "IfcPropertySetTemplate", "TemplateType"), + ) + applicable_entity: StringProperty( + name="Applicable Entity", + description=get_attribute_doc("IFC4", "IfcPropertySetTemplate", "ApplicableEntity"), + ) class EnumerationValues(PropertyGroup): @@ -126,9 +143,18 @@ class EnumerationValues(PropertyGroup): class PropTemplate(PropertyGroup): - global_id: StringProperty(name="Global ID") - name: StringProperty(name="Name") - description: StringProperty(name="Description") + global_id: StringProperty( + name="Global ID", + description=get_attribute_doc("IFC4", "IfcPropertyTemplate", "GlobalId"), + ) + name: StringProperty( + name="Name", + description=get_attribute_doc("IFC4", "IfcPropertyTemplate", "Name"), + ) + description: StringProperty( + name="Description", + description=get_attribute_doc("IFC4", "IfcPropertyTemplate", "Description"), + ) primary_measure_type: EnumProperty(items=get_primary_measure_type, name="Primary Measure Type") template_type: EnumProperty( items=[("P_SINGLEVALUE", "P_SINGLEVALUE", ""), ("P_ENUMERATEDVALUE", "P_ENUMERATEDVALUE", "")], diff --git a/src/blenderbim/blenderbim/bim/ui.py b/src/blenderbim/blenderbim/bim/ui.py index 02f70cb5a6..c40cb18b9a 100644 --- a/src/blenderbim/blenderbim/bim/ui.py +++ b/src/blenderbim/blenderbim/bim/ui.py @@ -25,6 +25,7 @@ from ifcopenshell.util.doc import ( get_entity_doc, get_property_set_doc, get_type_doc, + get_attribute_doc, ) from . import ifc import blenderbim.tool as tool @@ -406,7 +407,6 @@ def draw_custom_context_menu(self, context): layout = self.layout if isinstance(context.button_pointer, Attribute): - print(prop, prop_name, prop_value) description = getattr(context.button_pointer, "description", None) ifc_class = getattr(context.button_pointer, "ifc_class", "") if ifc_class: