Skip to content
This repository was archived by the owner on Nov 24, 2024. It is now read-only.

Commit d3ca647

Browse files
committed
Minor code review fix
1 parent 8b35a3a commit d3ca647

3 files changed

Lines changed: 6 additions & 8 deletions

File tree

src/blenderbim/blenderbim/bim/module/cost/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
operator.AddCostSchedule,
66
operator.RemoveCostSchedule,
77
operator.EditCostSchedule,
8+
operator.EditCostItem,
89
operator.EnableEditingCostSchedule,
910
operator.EnableEditingCostItems,
1011
operator.EnableEditingCostItem,
12+
operator.DisableEditingCostItem,
1113
operator.DisableEditingCostSchedule,
1214
operator.AddCostItem,
1315
operator.AddSummaryCostItem,

src/blenderbim/blenderbim/bim/module/cost/operator.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def execute(self, context):
228228

229229
for attribute in IfcStore.get_schema().declaration_by_name("IfcCostItem").all_attributes():
230230
data_type = ifcopenshell.util.attribute.get_primitive_type(attribute)
231-
if data_type == "entity":
231+
if data_type == "entity" or isinstance(data_type, tuple):
232232
continue
233233
new = props.cost_item_attributes.add()
234234
new.name = attribute.name()
@@ -237,10 +237,6 @@ def execute(self, context):
237237
new.data_type = data_type
238238
if data_type == "string":
239239
new.string_value = "" if new.is_null else data[attribute.name()]
240-
elif data_type == "boolean":
241-
new.bool_value = False if new.is_null else data[attribute.name()]
242-
elif data_type == "integer":
243-
new.int_value = 0 if new.is_null else data[attribute.name()]
244240
elif data_type == "enum":
245241
new.enum_items = json.dumps(ifcopenshell.util.attribute.get_enum_items(attribute))
246242
if data[attribute.name()]:

src/blenderbim/blenderbim/bim/module/cost/ui.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ def draw_editable_cost_schedule_ui(self):
6262
if attribute.is_optional:
6363
row.prop(attribute, "is_null", icon="RADIOBUT_OFF" if attribute.is_null else "RADIOBUT_ON", text="")
6464

65-
# row = self.layout.row(align=True)
66-
# row.label(text="X Summary Cost Items")
67-
6865
def draw_editable_cost_item_ui(self, cost_schedule_id):
6966
self.layout.template_list(
7067
"BIM_UL_cost_items",
@@ -125,6 +122,9 @@ def draw_item(self, context, layout, data, item, icon, active_data, active_propn
125122
if props.active_cost_item_id == item.ifc_definition_id:
126123
row.operator("bim.edit_cost_item", text="", icon="CHECKMARK")
127124
row.operator("bim.disable_editing_cost_item", text="", icon="CANCEL")
125+
elif props.active_cost_item_id:
126+
row.operator("bim.add_cost_item", text="", icon="ADD").cost_item = item.ifc_definition_id
127+
row.operator("bim.remove_cost_item", text="", icon="X").cost_item = item.ifc_definition_id
128128
else:
129129
row.operator(
130130
"bim.enable_editing_cost_item", text="", icon="GREASEPENCIL"

0 commit comments

Comments
 (0)