Minor code review fix

This commit is contained in:
Dion Moult
2021-04-22 10:53:25 +10:00
parent 8b35a3aadd
commit d3ca647cd5
3 changed files with 6 additions and 8 deletions
@@ -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,
@@ -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()]:
@@ -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"