mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 07:16:53 +00:00
clean up from developer's feedback + black formatting
This commit is contained in:
@@ -25,7 +25,6 @@ import bonsai.tool as tool
|
|||||||
from bpy_extras.io_utils import ImportHelper, ExportHelper
|
from bpy_extras.io_utils import ImportHelper, ExportHelper
|
||||||
import bonsai.tool as tool
|
import bonsai.tool as tool
|
||||||
import bonsai.core.cost as core
|
import bonsai.core.cost as core
|
||||||
from bonsai.bim.module.cost.data import CostSchedulesData
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from typing import get_args, TYPE_CHECKING, Literal
|
from typing import get_args, TYPE_CHECKING, Literal
|
||||||
@@ -103,7 +102,6 @@ class EnableEditingCostItems(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
core.enable_editing_cost_items(tool.Cost, cost_schedule=tool.Ifc.get().by_id(self.cost_schedule))
|
core.enable_editing_cost_items(tool.Cost, cost_schedule=tool.Ifc.get().by_id(self.cost_schedule))
|
||||||
CostSchedulesData.is_loaded = False
|
|
||||||
|
|
||||||
|
|
||||||
class DisableEditingCostSchedule(bpy.types.Operator, tool.Ifc.Operator):
|
class DisableEditingCostSchedule(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
@@ -582,8 +580,6 @@ class ImportCostScheduleCsv(bpy.types.Operator, ImportHelper, tool.Ifc.Operator)
|
|||||||
cost_schedule = core.import_cost_schedule_csv(tool.Cost, str(resolved_path), self.is_schedule_of_rates)
|
cost_schedule = core.import_cost_schedule_csv(tool.Cost, str(resolved_path), self.is_schedule_of_rates)
|
||||||
if cost_schedule:
|
if cost_schedule:
|
||||||
core.add_csv_filepath(tool.Cost, store_path, self.is_schedule_of_rates, cost_schedule)
|
core.add_csv_filepath(tool.Cost, store_path, self.is_schedule_of_rates, cost_schedule)
|
||||||
CostSchedulesData.is_loaded = False
|
|
||||||
|
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
return {"CANCELLED"}
|
return {"CANCELLED"}
|
||||||
|
|
||||||
@@ -593,6 +589,7 @@ class ImportCostScheduleCsv(bpy.types.Operator, ImportHelper, tool.Ifc.Operator)
|
|||||||
row = self.layout.row()
|
row = self.layout.row()
|
||||||
row.prop(self, "use_relative_path")
|
row.prop(self, "use_relative_path")
|
||||||
|
|
||||||
|
|
||||||
class RefreshCostScheduleCsv(bpy.types.Operator, tool.Ifc.Operator):
|
class RefreshCostScheduleCsv(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
bl_idname = "bim.refresh_cost_schedule_csv"
|
bl_idname = "bim.refresh_cost_schedule_csv"
|
||||||
bl_label = "Refresh Cost Schedule CSV"
|
bl_label = "Refresh Cost Schedule CSV"
|
||||||
@@ -615,8 +612,6 @@ class RefreshCostScheduleCsv(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
core.refresh_cost_schedule_csv(tool.Cost)
|
core.refresh_cost_schedule_csv(tool.Cost)
|
||||||
CostSchedulesData.is_loaded = False
|
|
||||||
|
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -174,6 +174,7 @@ class CostItemQuantity(PropertyGroup):
|
|||||||
unit_symbol: str
|
unit_symbol: str
|
||||||
total_cost_quantity: float
|
total_cost_quantity: float
|
||||||
|
|
||||||
|
|
||||||
class CostItemType(PropertyGroup):
|
class CostItemType(PropertyGroup):
|
||||||
name: StringProperty(name="Name")
|
name: StringProperty(name="Name")
|
||||||
ifc_definition_id: IntProperty(name="IFC Definition ID")
|
ifc_definition_id: IntProperty(name="IFC Definition ID")
|
||||||
|
|||||||
@@ -18,8 +18,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
from typing import TYPE_CHECKING, Optional, Union, Literal
|
from typing import TYPE_CHECKING, Optional, Union, Literal
|
||||||
import os
|
|
||||||
from bonsai.bim.module.cost.data import CostSchedulesData
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
import bpy
|
import bpy
|
||||||
@@ -345,7 +343,6 @@ def import_cost_schedule_csv(
|
|||||||
cost: type[tool.Cost], resolved_path: str, is_schedule_of_rates: bool
|
cost: type[tool.Cost], resolved_path: str, is_schedule_of_rates: bool
|
||||||
) -> ifcopenshell.entity_instance:
|
) -> ifcopenshell.entity_instance:
|
||||||
|
|
||||||
|
|
||||||
cost_schedule = cost.import_cost_schedule_csv(resolved_path, is_schedule_of_rates)
|
cost_schedule = cost.import_cost_schedule_csv(resolved_path, is_schedule_of_rates)
|
||||||
return cost_schedule
|
return cost_schedule
|
||||||
|
|
||||||
@@ -359,16 +356,10 @@ def remove_csv_filepath(cost: type[tool.Cost], cost_schedule) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def refresh_cost_schedule_csv(cost: type[tool.Cost]) -> Optional[str]:
|
def refresh_cost_schedule_csv(cost: type[tool.Cost]) -> Optional[str]:
|
||||||
|
|
||||||
|
|
||||||
cost.delete_all_cost_items()
|
cost.delete_all_cost_items()
|
||||||
cost.refresh_cost_schedule_csv()
|
cost.refresh_cost_schedule_csv()
|
||||||
cost.load_cost_schedule_tree()
|
cost.load_cost_schedule_tree()
|
||||||
|
|
||||||
CostSchedulesData.is_loaded = False
|
|
||||||
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
def add_cost_column(cost: type[tool.Cost], name: str) -> None:
|
def add_cost_column(cost: type[tool.Cost], name: str) -> None:
|
||||||
cost.add_cost_column(name)
|
cost.add_cost_column(name)
|
||||||
@@ -470,9 +461,3 @@ def add_currency(ifc: type[tool.Ifc], cost: type[tool.Cost]) -> ifcopenshell.ent
|
|||||||
|
|
||||||
def generate_cost_schedule_browser(cost: type[tool.Cost], cost_schedule: ifcopenshell.entity_instance) -> None:
|
def generate_cost_schedule_browser(cost: type[tool.Cost], cost_schedule: ifcopenshell.entity_instance) -> None:
|
||||||
return cost.generate_cost_schedule_browser(cost_schedule)
|
return cost.generate_cost_schedule_browser(cost_schedule)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1097,6 +1097,3 @@ class Cost(bonsai.core.tool.Cost):
|
|||||||
if results["quantity_type"] == "IfcQuantityCount":
|
if results["quantity_type"] == "IfcQuantityCount":
|
||||||
results["unit_symbol"] = "U"
|
results["unit_symbol"] = "U"
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user