mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 15:08:51 +00:00
Use static enum items instead of dynamic
This commit is contained in:
@@ -115,26 +115,24 @@ 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):
|
("USD", "USD", "Dollar"),
|
||||||
return [
|
("EUR", "EUR", "Euro"),
|
||||||
("USD", "USD", "Dollar"),
|
("GBP", "GBP", "Pound"),
|
||||||
("EUR", "EUR", "Euro"),
|
("AUD", "AUD", "Australian Dollar"),
|
||||||
("GBP", "GBP", "Pound"),
|
("CAD", "CAD", "Canadian Dollar"),
|
||||||
("AUD", "AUD", "Australian Dollar"),
|
("CHF", "CHF", "Swiss Franc"),
|
||||||
("CAD", "CAD", "Canadian Dollar"),
|
("CNY", "CNY", "Chinese Yuan"),
|
||||||
("CHF", "CHF", "Swiss Franc"),
|
("HKD", "HKD", "Hong Kong Dollar"),
|
||||||
("CNY", "CNY", "Chinese Yuan"),
|
("JPY", "JPY", "Japanese Yen"),
|
||||||
("HKD", "HKD", "Hong Kong Dollar"),
|
("NZD", "NZD", "New Zealand Dollar"),
|
||||||
("JPY", "JPY", "Japanese Yen"),
|
("SEK", "SEK", "Swedish Krona"),
|
||||||
("NZD", "NZD", "New Zealand Dollar"),
|
("KRW", "KRW", "South Korean Won"),
|
||||||
("SEK", "SEK", "Swedish Krona"),
|
("SGD", "SGD", "Singapore Dollar"),
|
||||||
("KRW", "KRW", "South Korean Won"),
|
("NOK", "NOK", "Norwegian Krone"),
|
||||||
("SGD", "SGD", "Singapore Dollar"),
|
("MAD", "MAD", "Moroccan Dirham"),
|
||||||
("NOK", "NOK", "Norwegian Krone"),
|
("CUSTOM", "Custom currency", "Custom"),
|
||||||
("MAD", "MAD", "Moroccan Dirham"),
|
)
|
||||||
("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,50 +79,48 @@ 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 - IfcTypeObject",
|
||||||
"PSET_TYPEDRIVENONLY",
|
"The property sets defined by this IfcPropertySetTemplate can only be assigned to subtypes of IfcTypeObject.",
|
||||||
"Pset - IfcTypeObject",
|
),
|
||||||
"The property sets defined by this IfcPropertySetTemplate can only be assigned to subtypes of IfcTypeObject.",
|
(
|
||||||
),
|
"PSET_TYPEDRIVENOVERRIDE",
|
||||||
(
|
"Pset - IfcTypeObject - Override",
|
||||||
"PSET_TYPEDRIVENOVERRIDE",
|
"The property sets defined by this IfcPropertySetTemplate can only be assigned to subtypes of IfcTypeObject.",
|
||||||
"Pset - IfcTypeObject - Override",
|
),
|
||||||
"The property sets defined by this IfcPropertySetTemplate can only be assigned to subtypes of IfcTypeObject.",
|
(
|
||||||
),
|
"PSET_OCCURRENCEDRIVEN",
|
||||||
(
|
"Pset - IfcObject",
|
||||||
"PSET_OCCURRENCEDRIVEN",
|
"The property sets defined by this IfcPropertySetTemplate can only be assigned to subtypes of IfcObject.",
|
||||||
"Pset - IfcObject",
|
),
|
||||||
"The property sets defined by this IfcPropertySetTemplate can only be assigned to subtypes of IfcObject.",
|
(
|
||||||
),
|
"PSET_PERFORMANCEDRIVEN",
|
||||||
(
|
"Pset - IfcPerformanceHistory",
|
||||||
"PSET_PERFORMANCEDRIVEN",
|
"The property sets defined by this IfcPropertySetTemplate can only be assigned to IfcPerformanceHistory.",
|
||||||
"Pset - IfcPerformanceHistory",
|
),
|
||||||
"The property sets defined by this IfcPropertySetTemplate can only be assigned to IfcPerformanceHistory.",
|
(
|
||||||
),
|
"QTO_TYPEDRIVENONLY",
|
||||||
(
|
"Qto - IfcTypeObject",
|
||||||
"QTO_TYPEDRIVENONLY",
|
"The element quantity defined by this IfcPropertySetTemplate can only be assigned to subtypes of IfcTypeObject.",
|
||||||
"Qto - IfcTypeObject",
|
),
|
||||||
"The element quantity defined by this IfcPropertySetTemplate can only be assigned to subtypes of IfcTypeObject.",
|
(
|
||||||
),
|
"QTO_TYPEDRIVENOVERRIDE",
|
||||||
(
|
"Qto - IfcTypeObject - Override",
|
||||||
"QTO_TYPEDRIVENOVERRIDE",
|
"The element quantity defined by this IfcPropertySetTemplate can be assigned to subtypes of IfcTypeObject and can be overridden by an element quantity with same name at subtypes of IfcObject.",
|
||||||
"Qto - IfcTypeObject - Override",
|
),
|
||||||
"The element quantity defined by this IfcPropertySetTemplate can be assigned to subtypes of IfcTypeObject and can be overridden by an element quantity with same name at subtypes of IfcObject.",
|
(
|
||||||
),
|
"QTO_OCCURRENCEDRIVEN",
|
||||||
(
|
"Qto - IfcObject",
|
||||||
"QTO_OCCURRENCEDRIVEN",
|
"The element quantity defined by this IfcPropertySetTemplate can only be assigned to subtypes of IfcObject.",
|
||||||
"Qto - IfcObject",
|
),
|
||||||
"The element quantity defined by this IfcPropertySetTemplate can only be assigned to subtypes of IfcObject.",
|
(
|
||||||
),
|
"NOTDEFINED",
|
||||||
(
|
"Not defined",
|
||||||
"NOTDEFINED",
|
"No restriction provided, the property sets defined by this IfcPropertySetTemplate can be assigned to any entity, if not otherwise restricted by the ApplicableEntity attribute.",
|
||||||
"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.",
|
)
|
||||||
),
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
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