mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 10:11:46 +00:00
Use static enum items instead of dynamic
This commit is contained in:
@@ -115,9 +115,7 @@ def get_schedule_predefined_types(self, context):
|
|||||||
return CostSchedulesData.data["predefined_types"]
|
return CostSchedulesData.data["predefined_types"]
|
||||||
|
|
||||||
|
|
||||||
# TODO: unsafe?
|
CURRENCIES_ENUM_ITEMS = (
|
||||||
def get_currencies(self, context):
|
|
||||||
return [
|
|
||||||
("USD", "USD", "Dollar"),
|
("USD", "USD", "Dollar"),
|
||||||
("EUR", "EUR", "Euro"),
|
("EUR", "EUR", "Euro"),
|
||||||
("GBP", "GBP", "Pound"),
|
("GBP", "GBP", "Pound"),
|
||||||
@@ -134,7 +132,7 @@ def get_currencies(self, context):
|
|||||||
("NOK", "NOK", "Norwegian Krone"),
|
("NOK", "NOK", "Norwegian Krone"),
|
||||||
("MAD", "MAD", "Moroccan Dirham"),
|
("MAD", "MAD", "Moroccan Dirham"),
|
||||||
("CUSTOM", "Custom currency", "Custom"),
|
("CUSTOM", "Custom currency", "Custom"),
|
||||||
]
|
)
|
||||||
|
|
||||||
|
|
||||||
class CostItem(PropertyGroup):
|
class CostItem(PropertyGroup):
|
||||||
@@ -248,7 +246,7 @@ class BIMCostProperties(PropertyGroup):
|
|||||||
)
|
)
|
||||||
change_cost_item_parent: BoolProperty(name="Change Cost Item Parent", default=False, update=update_cost_item_parent)
|
change_cost_item_parent: BoolProperty(name="Change Cost Item Parent", default=False, update=update_cost_item_parent)
|
||||||
show_cost_item_operators: BoolProperty(name="Show Cost Item Operators", default=False)
|
show_cost_item_operators: BoolProperty(name="Show Cost Item Operators", default=False)
|
||||||
currency: EnumProperty(items=get_currencies, name="Currencies")
|
currency: EnumProperty(items=CURRENCIES_ENUM_ITEMS, name="Currencies")
|
||||||
custom_currency: StringProperty(
|
custom_currency: StringProperty(
|
||||||
name="Custom Currency", default="USD", description="Custom Currency in ISO 4217 format"
|
name="Custom Currency", default="USD", description="Custom Currency in ISO 4217 format"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -79,9 +79,7 @@ def get_property_template_type(self, context):
|
|||||||
return PsetTemplatesData.data["property_template_type"]
|
return PsetTemplatesData.data["property_template_type"]
|
||||||
|
|
||||||
|
|
||||||
# TODO: unsafe?
|
TEMPLATE_TYPE_ENUM_ITEMS = (
|
||||||
def get_template_type(self, context):
|
|
||||||
return [
|
|
||||||
(
|
(
|
||||||
"PSET_TYPEDRIVENONLY",
|
"PSET_TYPEDRIVENONLY",
|
||||||
"Pset - IfcTypeObject",
|
"Pset - IfcTypeObject",
|
||||||
@@ -122,7 +120,7 @@ def get_template_type(self, context):
|
|||||||
"Not defined",
|
"Not defined",
|
||||||
"No restriction provided, the property sets defined by this IfcPropertySetTemplate can be assigned to any entity, if not otherwise restricted by the ApplicableEntity attribute.",
|
"No restriction provided, the property sets defined by this IfcPropertySetTemplate can be assigned to any entity, if not otherwise restricted by the ApplicableEntity attribute.",
|
||||||
),
|
),
|
||||||
]
|
)
|
||||||
|
|
||||||
|
|
||||||
class PsetTemplate(PropertyGroup):
|
class PsetTemplate(PropertyGroup):
|
||||||
@@ -139,7 +137,7 @@ class PsetTemplate(PropertyGroup):
|
|||||||
description=get_attribute_doc("IFC4", "IfcPropertySetTemplate", "Description"),
|
description=get_attribute_doc("IFC4", "IfcPropertySetTemplate", "Description"),
|
||||||
)
|
)
|
||||||
template_type: EnumProperty(
|
template_type: EnumProperty(
|
||||||
items=get_template_type,
|
items=TEMPLATE_TYPE_ENUM_ITEMS,
|
||||||
name="Template Type",
|
name="Template Type",
|
||||||
description=get_attribute_doc("IFC4", "IfcPropertySetTemplate", "TemplateType"),
|
description=get_attribute_doc("IFC4", "IfcPropertySetTemplate", "TemplateType"),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user