Pset types and template types enums now show tooltips on hover

This commit is contained in:
Gorgious
2022-10-31 17:15:58 +01:00
parent a95e12c0b2
commit e8a73e008e
3 changed files with 18 additions and 10 deletions
@@ -19,7 +19,6 @@
import bpy
import ifcopenshell
import blenderbim.tool as tool
from blenderbim.bim.prop import get_ifc_entity_description
# TODO: Should this cache belong here? Dunno. Maybe.
@@ -174,4 +173,8 @@ class AddEditCustomPropertiesData:
@classmethod
def primary_measure_type(cls):
schema = tool.Ifc.schema()
return [(t, t, get_ifc_entity_description(t)) for t in sorted([d.name() for d in schema.declarations() if hasattr(d, "declared_type")])]
version = tool.Ifc.get_schema()
return [
(t, t, ifcopenshell.util.doc.get_type_doc(version, t).get("description"))
for t in sorted([d.name() for d in schema.declarations() if hasattr(d, "declared_type")])
]
@@ -21,6 +21,7 @@ import blenderbim.bim.schema
from blenderbim.bim.prop import Attribute, StrProperty
import ifcopenshell
from ifcopenshell.api.pset.data import Data
import blenderbim.tool as tool
from blenderbim.bim.module.pset.data import AddEditCustomPropertiesData
from blenderbim.bim.ifc import IfcStore
from blenderbim.bim.prop import get_property_set_description
@@ -138,6 +139,12 @@ def get_qto_names(self, context):
return []
def get_template_type(self, context):
version = tool.Ifc.get_schema()
for t in ("IfcPropertySingleValue", "IfcPropertyEnumeratedValue"):
yield (t, t, ifcopenshell.util.doc.get_entity_doc(version, t).get("description"))
def get_primary_measure_type(self, context):
if not AddEditCustomPropertiesData.is_loaded:
AddEditCustomPropertiesData.load()
@@ -214,13 +221,7 @@ class AddEditProperties(PropertyGroup):
int_value: IntProperty(name="Value")
float_value: FloatProperty(name="Value")
primary_measure_type: EnumProperty(items=get_primary_measure_type, name="Primary Measure Type")
template_type: EnumProperty(
items=[
("IfcPropertySingleValue", "IfcPropertySingleValue", "IfcPropertySingleValue"),
("IfcPropertyEnumeratedValue", "IfcPropertyEnumeratedValue", "IfcPropertyEnumeratedValue"),
],
name="Template Type",
)
template_type: EnumProperty(items=get_template_type, name="Template Type")
enum_values: CollectionProperty(name="Enum Values", type=Attribute)
def get_value_name(self):
@@ -44,7 +44,11 @@ class PsetTemplatesData:
@classmethod
def primary_measure_type(cls):
schema = tool.Ifc.schema()
return [(t, t, get_ifc_entity_description(t)) for t in sorted([d.name() for d in schema.declarations() if hasattr(d, "declared_type")])]
version = tool.Ifc.get_schema()
return [
(t, t, ifcopenshell.util.doc.get_type_doc(version, t).get("description"))
for t in sorted([d.name() for d in schema.declarations() if hasattr(d, "declared_type")])
]
@classmethod
def pset_template_files(cls):