From d3ca647cd5cc47bc1dfffcff8250f1ca73234d28 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Thu, 22 Apr 2021 10:53:25 +1000 Subject: [PATCH] Minor code review fix --- src/blenderbim/blenderbim/bim/module/cost/__init__.py | 2 ++ src/blenderbim/blenderbim/bim/module/cost/operator.py | 6 +----- src/blenderbim/blenderbim/bim/module/cost/ui.py | 6 +++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/cost/__init__.py b/src/blenderbim/blenderbim/bim/module/cost/__init__.py index 8d420e367d..f5fb62433b 100644 --- a/src/blenderbim/blenderbim/bim/module/cost/__init__.py +++ b/src/blenderbim/blenderbim/bim/module/cost/__init__.py @@ -5,9 +5,11 @@ classes = ( operator.AddCostSchedule, operator.RemoveCostSchedule, operator.EditCostSchedule, + operator.EditCostItem, operator.EnableEditingCostSchedule, operator.EnableEditingCostItems, operator.EnableEditingCostItem, + operator.DisableEditingCostItem, operator.DisableEditingCostSchedule, operator.AddCostItem, operator.AddSummaryCostItem, diff --git a/src/blenderbim/blenderbim/bim/module/cost/operator.py b/src/blenderbim/blenderbim/bim/module/cost/operator.py index 95e1b89008..4a4b9597e3 100644 --- a/src/blenderbim/blenderbim/bim/module/cost/operator.py +++ b/src/blenderbim/blenderbim/bim/module/cost/operator.py @@ -228,7 +228,7 @@ class EnableEditingCostItem(bpy.types.Operator): for attribute in IfcStore.get_schema().declaration_by_name("IfcCostItem").all_attributes(): data_type = ifcopenshell.util.attribute.get_primitive_type(attribute) - if data_type == "entity": + if data_type == "entity" or isinstance(data_type, tuple): continue new = props.cost_item_attributes.add() new.name = attribute.name() @@ -237,10 +237,6 @@ class EnableEditingCostItem(bpy.types.Operator): new.data_type = data_type if data_type == "string": new.string_value = "" if new.is_null else data[attribute.name()] - elif data_type == "boolean": - new.bool_value = False if new.is_null else data[attribute.name()] - elif data_type == "integer": - new.int_value = 0 if new.is_null else data[attribute.name()] elif data_type == "enum": new.enum_items = json.dumps(ifcopenshell.util.attribute.get_enum_items(attribute)) if data[attribute.name()]: diff --git a/src/blenderbim/blenderbim/bim/module/cost/ui.py b/src/blenderbim/blenderbim/bim/module/cost/ui.py index 22a85127b1..8523ba70ed 100644 --- a/src/blenderbim/blenderbim/bim/module/cost/ui.py +++ b/src/blenderbim/blenderbim/bim/module/cost/ui.py @@ -62,9 +62,6 @@ class BIM_PT_cost_schedules(Panel): if attribute.is_optional: row.prop(attribute, "is_null", icon="RADIOBUT_OFF" if attribute.is_null else "RADIOBUT_ON", text="") - # row = self.layout.row(align=True) - # row.label(text="X Summary Cost Items") - def draw_editable_cost_item_ui(self, cost_schedule_id): self.layout.template_list( "BIM_UL_cost_items", @@ -125,6 +122,9 @@ class BIM_UL_cost_items(UIList): if props.active_cost_item_id == item.ifc_definition_id: row.operator("bim.edit_cost_item", text="", icon="CHECKMARK") row.operator("bim.disable_editing_cost_item", text="", icon="CANCEL") + elif props.active_cost_item_id: + row.operator("bim.add_cost_item", text="", icon="ADD").cost_item = item.ifc_definition_id + row.operator("bim.remove_cost_item", text="", icon="X").cost_item = item.ifc_definition_id else: row.operator( "bim.enable_editing_cost_item", text="", icon="GREASEPENCIL"