mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 06:58:56 +00:00
See #6570. Better variable name
This commit is contained in:
committed by
Massimo Fabbro
parent
09f6991565
commit
8b9927b77b
@@ -84,7 +84,7 @@ classes = (
|
|||||||
prop.CostItem,
|
prop.CostItem,
|
||||||
prop.CostItemQuantity,
|
prop.CostItemQuantity,
|
||||||
prop.CostItemType,
|
prop.CostItemType,
|
||||||
prop.CostItemsMapping,
|
prop.CostSchedulesMapping,
|
||||||
prop.ScheduleColumn,
|
prop.ScheduleColumn,
|
||||||
prop.BIMCostProperties,
|
prop.BIMCostProperties,
|
||||||
ui.BIM_PT_cost_schedules,
|
ui.BIM_PT_cost_schedules,
|
||||||
|
|||||||
@@ -175,12 +175,12 @@ class CostItemQuantity(PropertyGroup):
|
|||||||
total_cost_quantity: float
|
total_cost_quantity: float
|
||||||
|
|
||||||
|
|
||||||
class CostItemsMapping(PropertyGroup):
|
class CostSchedulesMapping(PropertyGroup):
|
||||||
cost_item_id: IntProperty(name="cost_item_id")
|
cost_schedule_id: IntProperty(name="cost_schedule_id")
|
||||||
csv_filepath: StringProperty(name="filepath")
|
csv_filepath: StringProperty(name="filepath")
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
cost_item_id: int
|
cost_schedule_id: int
|
||||||
csv_filepath: str
|
csv_filepath: str
|
||||||
|
|
||||||
|
|
||||||
@@ -289,7 +289,7 @@ class BIMCostProperties(PropertyGroup):
|
|||||||
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"
|
||||||
)
|
)
|
||||||
cost_schedule_files: CollectionProperty(name="Cost Schedule Files", type=CostItemsMapping)
|
cost_schedule_files: CollectionProperty(name="Cost Schedule Files", type=CostSchedulesMapping)
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
cost_schedule_predefined_types: str
|
cost_schedule_predefined_types: str
|
||||||
@@ -344,7 +344,7 @@ class BIMCostProperties(PropertyGroup):
|
|||||||
show_cost_item_operators: bool
|
show_cost_item_operators: bool
|
||||||
currency: str
|
currency: str
|
||||||
custom_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
|
@property
|
||||||
def active_cost_item(self) -> Union[CostItem, None]:
|
def active_cost_item(self) -> Union[CostItem, None]:
|
||||||
|
|||||||
@@ -76,12 +76,12 @@ class BIM_PT_cost_schedules(Panel):
|
|||||||
col = row0.column()
|
col = row0.column()
|
||||||
col.label(text="Linked CSV:")
|
col.label(text="Linked CSV:")
|
||||||
row_1 = col.row(align=True)
|
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(
|
file = next(
|
||||||
(
|
(
|
||||||
item.csv_filepath
|
item.csv_filepath
|
||||||
for item in self.props.cost_schedule_files
|
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,
|
None,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -598,9 +598,9 @@ class Cost(bonsai.core.tool.Cost):
|
|||||||
return
|
return
|
||||||
|
|
||||||
props = cls.get_cost_props()
|
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 = props.cost_schedule_files.add()
|
||||||
item.cost_item_id = cost_schedule.id()
|
item.cost_schedule_id = cost_schedule.id()
|
||||||
item.csv_filepath = file_path
|
item.csv_filepath = file_path
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
@@ -612,9 +612,9 @@ class Cost(bonsai.core.tool.Cost):
|
|||||||
|
|
||||||
props = cls.get_cost_props()
|
props = cls.get_cost_props()
|
||||||
cost_schedule_id = cost_schedule.id()
|
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):
|
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)
|
props.cost_schedule_files.remove(i)
|
||||||
print(f"Cost schedule id={cost_schedule_id} csv filepath correctly removed")
|
print(f"Cost schedule id={cost_schedule_id} csv filepath correctly removed")
|
||||||
return
|
return
|
||||||
@@ -637,7 +637,7 @@ class Cost(bonsai.core.tool.Cost):
|
|||||||
props = cls.get_cost_props()
|
props = cls.get_cost_props()
|
||||||
cost_schedule_id = props.active_cost_schedule_id
|
cost_schedule_id = props.active_cost_schedule_id
|
||||||
file_path = next(
|
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:
|
if not file_path:
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user