From 327899ca62db3bc352dd4cc4d7c635cbd6e4bc50 Mon Sep 17 00:00:00 2001 From: Massimo Fabbro Date: Sun, 25 May 2025 07:59:50 +0200 Subject: [PATCH] See #6570. Small fix for previuos commit --- src/bonsai/bonsai/bim/module/cost/data.py | 4 ++-- src/bonsai/bonsai/bim/module/cost/prop.py | 9 +-------- src/bonsai/bonsai/bim/module/cost/ui.py | 3 +-- src/bonsai/bonsai/tool/cost.py | 3 ++- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/cost/data.py b/src/bonsai/bonsai/bim/module/cost/data.py index cc1d96fdc0..0826821c37 100644 --- a/src/bonsai/bonsai/bim/module/cost/data.py +++ b/src/bonsai/bonsai/bim/module/cost/data.py @@ -155,8 +155,8 @@ class CostSchedulesData: else: data["TotalCost"] = data["TotalAppliedValue"] * cost_quantity if is_sum: - #pass If it is None it doesn't allow me to assign a cost rate composed by sum - data["TotalAppliedValue"] = None + pass #If it is None it doesn't allow me to assign a cost rate composed by sum + #data["TotalAppliedValue"] = None @classmethod def _load_assigned_cost_rate(cls, cost_item: ifcopenshell.entity_instance, data: CostItem) -> None: diff --git a/src/bonsai/bonsai/bim/module/cost/prop.py b/src/bonsai/bonsai/bim/module/cost/prop.py index 49645be8a7..39011c791c 100644 --- a/src/bonsai/bonsai/bim/module/cost/prop.py +++ b/src/bonsai/bonsai/bim/module/cost/prop.py @@ -39,11 +39,7 @@ from typing import TYPE_CHECKING, Literal def get_schedule_of_rates(self, context): if not CostItemRatesData.is_loaded: CostItemRatesData.load() - return CostItemRatesData.data["schedule_of_rates"] - -def get_cost_schedules(self, context): - if not CostItemRatesData.is_loaded: - CostItemRatesData.load() + #return CostItemRatesData.data["schedule_of_rates"] return CostItemRatesData.data["cost_schedules"] @@ -268,9 +264,6 @@ class BIMCostProperties(PropertyGroup): schedule_of_rates: EnumProperty( items=get_schedule_of_rates, name="Schedule Of Rates", update=update_schedule_of_rates ) - cost_schedules: EnumProperty( - items=get_cost_schedules, name="Cost Schedules", update=update_schedule_of_rates - ) cost_item_rates: CollectionProperty(name="Cost Item Rates", type=CostItem) active_cost_item_rate_index: IntProperty(name="Active Cost Rate Index") contracted_cost_item_rates: StringProperty(name="Contracted Cost Item Rates", default="[]") diff --git a/src/bonsai/bonsai/bim/module/cost/ui.py b/src/bonsai/bonsai/bim/module/cost/ui.py index 420d5a3e51..68bc93c1c7 100644 --- a/src/bonsai/bonsai/bim/module/cost/ui.py +++ b/src/bonsai/bonsai/bim/module/cost/ui.py @@ -617,8 +617,7 @@ class BIM_PT_cost_item_rates(Panel): def draw(self, context): self.props = tool.Cost.get_cost_props() row = self.layout.row(align=True) - #row.prop(self.props, "schedule_of_rates", text="") - row.prop(self.props, "cost_schedules", text="") + row.prop(self.props, "schedule_of_rates", text="") if self.props.active_cost_item_rate_index < len(self.props.cost_item_rates): cost_item = self.props.cost_items[self.props.active_cost_item_index] cost_item_rate = self.props.cost_item_rates[self.props.active_cost_item_rate_index] diff --git a/src/bonsai/bonsai/tool/cost.py b/src/bonsai/bonsai/tool/cost.py index 0bac42a09d..5de96d3d4e 100644 --- a/src/bonsai/bonsai/tool/cost.py +++ b/src/bonsai/bonsai/tool/cost.py @@ -441,7 +441,8 @@ class Cost(bonsai.core.tool.Cost): props = cls.get_cost_props() props.cost_value_attributes.clear() - is_rates = cls.is_active_schedule_of_rates() + #is_rates = cls.is_active_schedule_of_rates() + is_rates = True #so it is possible to assign a cost item rate that it not only from a Schedule of Rate callback = lambda name, prop, data: import_attributes( name, prop, data, cost_value, is_rates, props.cost_value_attributes )