diff --git a/src/bonsai/bonsai/bim/module/cost/prop.py b/src/bonsai/bonsai/bim/module/cost/prop.py index 2b5a09f895..092f429121 100644 --- a/src/bonsai/bonsai/bim/module/cost/prop.py +++ b/src/bonsai/bonsai/bim/module/cost/prop.py @@ -115,26 +115,24 @@ def get_schedule_predefined_types(self, context): return CostSchedulesData.data["predefined_types"] -# TODO: unsafe? -def get_currencies(self, context): - return [ - ("USD", "USD", "Dollar"), - ("EUR", "EUR", "Euro"), - ("GBP", "GBP", "Pound"), - ("AUD", "AUD", "Australian Dollar"), - ("CAD", "CAD", "Canadian Dollar"), - ("CHF", "CHF", "Swiss Franc"), - ("CNY", "CNY", "Chinese Yuan"), - ("HKD", "HKD", "Hong Kong Dollar"), - ("JPY", "JPY", "Japanese Yen"), - ("NZD", "NZD", "New Zealand Dollar"), - ("SEK", "SEK", "Swedish Krona"), - ("KRW", "KRW", "South Korean Won"), - ("SGD", "SGD", "Singapore Dollar"), - ("NOK", "NOK", "Norwegian Krone"), - ("MAD", "MAD", "Moroccan Dirham"), - ("CUSTOM", "Custom currency", "Custom"), - ] +CURRENCIES_ENUM_ITEMS = ( + ("USD", "USD", "Dollar"), + ("EUR", "EUR", "Euro"), + ("GBP", "GBP", "Pound"), + ("AUD", "AUD", "Australian Dollar"), + ("CAD", "CAD", "Canadian Dollar"), + ("CHF", "CHF", "Swiss Franc"), + ("CNY", "CNY", "Chinese Yuan"), + ("HKD", "HKD", "Hong Kong Dollar"), + ("JPY", "JPY", "Japanese Yen"), + ("NZD", "NZD", "New Zealand Dollar"), + ("SEK", "SEK", "Swedish Krona"), + ("KRW", "KRW", "South Korean Won"), + ("SGD", "SGD", "Singapore Dollar"), + ("NOK", "NOK", "Norwegian Krone"), + ("MAD", "MAD", "Moroccan Dirham"), + ("CUSTOM", "Custom currency", "Custom"), +) 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) 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( name="Custom Currency", default="USD", description="Custom Currency in ISO 4217 format" ) diff --git a/src/bonsai/bonsai/bim/module/pset_template/prop.py b/src/bonsai/bonsai/bim/module/pset_template/prop.py index 766f8dee73..9217511e7c 100644 --- a/src/bonsai/bonsai/bim/module/pset_template/prop.py +++ b/src/bonsai/bonsai/bim/module/pset_template/prop.py @@ -79,50 +79,48 @@ def get_property_template_type(self, context): return PsetTemplatesData.data["property_template_type"] -# TODO: unsafe? -def get_template_type(self, context): - return [ - ( - "PSET_TYPEDRIVENONLY", - "Pset - IfcTypeObject", - "The property sets defined by this IfcPropertySetTemplate can only be assigned to subtypes of IfcTypeObject.", - ), - ( - "PSET_TYPEDRIVENOVERRIDE", - "Pset - IfcTypeObject - Override", - "The property sets defined by this IfcPropertySetTemplate can only be assigned to subtypes of IfcTypeObject.", - ), - ( - "PSET_OCCURRENCEDRIVEN", - "Pset - IfcObject", - "The property sets defined by this IfcPropertySetTemplate can only be assigned to subtypes of IfcObject.", - ), - ( - "PSET_PERFORMANCEDRIVEN", - "Pset - IfcPerformanceHistory", - "The property sets defined by this IfcPropertySetTemplate can only be assigned to IfcPerformanceHistory.", - ), - ( - "QTO_TYPEDRIVENONLY", - "Qto - IfcTypeObject", - "The element quantity defined by this IfcPropertySetTemplate can only be assigned to subtypes of IfcTypeObject.", - ), - ( - "QTO_TYPEDRIVENOVERRIDE", - "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", - "The element quantity defined by this IfcPropertySetTemplate can only be assigned to subtypes of IfcObject.", - ), - ( - "NOTDEFINED", - "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.", - ), - ] +TEMPLATE_TYPE_ENUM_ITEMS = ( + ( + "PSET_TYPEDRIVENONLY", + "Pset - IfcTypeObject", + "The property sets defined by this IfcPropertySetTemplate can only be assigned to subtypes of IfcTypeObject.", + ), + ( + "PSET_TYPEDRIVENOVERRIDE", + "Pset - IfcTypeObject - Override", + "The property sets defined by this IfcPropertySetTemplate can only be assigned to subtypes of IfcTypeObject.", + ), + ( + "PSET_OCCURRENCEDRIVEN", + "Pset - IfcObject", + "The property sets defined by this IfcPropertySetTemplate can only be assigned to subtypes of IfcObject.", + ), + ( + "PSET_PERFORMANCEDRIVEN", + "Pset - IfcPerformanceHistory", + "The property sets defined by this IfcPropertySetTemplate can only be assigned to IfcPerformanceHistory.", + ), + ( + "QTO_TYPEDRIVENONLY", + "Qto - IfcTypeObject", + "The element quantity defined by this IfcPropertySetTemplate can only be assigned to subtypes of IfcTypeObject.", + ), + ( + "QTO_TYPEDRIVENOVERRIDE", + "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", + "The element quantity defined by this IfcPropertySetTemplate can only be assigned to subtypes of IfcObject.", + ), + ( + "NOTDEFINED", + "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): @@ -139,7 +137,7 @@ class PsetTemplate(PropertyGroup): description=get_attribute_doc("IFC4", "IfcPropertySetTemplate", "Description"), ) template_type: EnumProperty( - items=get_template_type, + items=TEMPLATE_TYPE_ENUM_ITEMS, name="Template Type", description=get_attribute_doc("IFC4", "IfcPropertySetTemplate", "TemplateType"), )