See #6570. Better variable name

This commit is contained in:
Massimo Fabbro
2025-06-08 10:21:15 +02:00
committed by Massimo Fabbro
parent 09f6991565
commit 8b9927b77b
4 changed files with 13 additions and 13 deletions
@@ -84,7 +84,7 @@ classes = (
prop.CostItem,
prop.CostItemQuantity,
prop.CostItemType,
prop.CostItemsMapping,
prop.CostSchedulesMapping,
prop.ScheduleColumn,
prop.BIMCostProperties,
ui.BIM_PT_cost_schedules,
+5 -5
View File
@@ -175,12 +175,12 @@ class CostItemQuantity(PropertyGroup):
total_cost_quantity: float
class CostItemsMapping(PropertyGroup):
cost_item_id: IntProperty(name="cost_item_id")
class CostSchedulesMapping(PropertyGroup):
cost_schedule_id: IntProperty(name="cost_schedule_id")
csv_filepath: StringProperty(name="filepath")
if TYPE_CHECKING:
cost_item_id: int
cost_schedule_id: int
csv_filepath: str
@@ -289,7 +289,7 @@ class BIMCostProperties(PropertyGroup):
custom_currency: StringProperty(
name="Custom Currency", default="USD", description="Custom Currency in ISO 4217 format"
)
cost_schedule_files: CollectionProperty(name="Cost Schedule Files", type=CostItemsMapping)
cost_schedule_files: CollectionProperty(name="Cost Schedule Files", type=CostSchedulesMapping)
if TYPE_CHECKING:
cost_schedule_predefined_types: str
@@ -344,7 +344,7 @@ class BIMCostProperties(PropertyGroup):
show_cost_item_operators: bool
currency: str
custom_currency: str
cost_schedule_files: bpy.types.bpy_prop_collection_idprop[CostItemsMapping]
cost_schedule_files: bpy.types.bpy_prop_collection_idprop[CostSchedulesMapping]
@property
def active_cost_item(self) -> Union[CostItem, None]:
+2 -2
View File
@@ -76,12 +76,12 @@ class BIM_PT_cost_schedules(Panel):
col = row0.column()
col.label(text="Linked CSV:")
row_1 = col.row(align=True)
if self.props.active_cost_schedule_id in [item.cost_item_id for item in self.props.cost_schedule_files]:
if self.props.active_cost_schedule_id in [item.cost_schedule_id for item in self.props.cost_schedule_files]:
file = next(
(
item.csv_filepath
for item in self.props.cost_schedule_files
if item.cost_item_id == self.props.active_cost_schedule_id
if item.cost_schedule_id == self.props.active_cost_schedule_id
),
None,
)
+5 -5
View File
@@ -598,9 +598,9 @@ class Cost(bonsai.core.tool.Cost):
return
props = cls.get_cost_props()
if not props.active_cost_schedule_id in [item.cost_item_id for item in props.cost_schedule_files]:
if not props.active_cost_schedule_id in [item.cost_schedule_id for item in props.cost_schedule_files]:
item = props.cost_schedule_files.add()
item.cost_item_id = cost_schedule.id()
item.cost_schedule_id = cost_schedule.id()
item.csv_filepath = file_path
else:
return
@@ -612,9 +612,9 @@ class Cost(bonsai.core.tool.Cost):
props = cls.get_cost_props()
cost_schedule_id = cost_schedule.id()
if cost_schedule_id in [item.cost_item_id for item in props.cost_schedule_files]:
if cost_schedule_id in [item.cost_schedule_id for item in props.cost_schedule_files]:
for i, item in enumerate(props.cost_schedule_files):
if item.cost_item_id == cost_schedule_id:
if item.cost_schedule_id == cost_schedule_id:
props.cost_schedule_files.remove(i)
print(f"Cost schedule id={cost_schedule_id} csv filepath correctly removed")
return
@@ -637,7 +637,7 @@ class Cost(bonsai.core.tool.Cost):
props = cls.get_cost_props()
cost_schedule_id = props.active_cost_schedule_id
file_path = next(
(item.csv_filepath for item in props.cost_schedule_files if item.cost_item_id == cost_schedule_id), None
(item.csv_filepath for item in props.cost_schedule_files if item.cost_schedule_id == cost_schedule_id), None
)
if not file_path:
return