Disable editing operators : Change icon

This commit is contained in:
Gorgious
2021-08-20 10:13:00 +02:00
parent 5c62cb244a
commit 447c07460a
11 changed files with 22 additions and 23 deletions
@@ -57,7 +57,7 @@ class BIM_PT_aggregate(Panel):
row.prop(props, "relating_object", text="")
if props.relating_object:
row.operator("bim.assign_object", icon="CHECKMARK", text="").relating_object = props.relating_object.name
row.operator("bim.disable_editing_aggregate", icon="X", text="")
row.operator("bim.disable_editing_aggregate", icon="CANCEL", text="")
else:
row = self.layout.row(align=True)
name = "{}/{}".format(
@@ -147,7 +147,7 @@ class BIM_PT_classification_references(Panel):
row = self.layout.row(align=True)
row.prop(self.props.reference_attributes.get("Name"), "string_value", text="", icon="ASSET_MANAGER")
row.operator("bim.edit_classification_reference", text="", icon="CHECKMARK")
row.operator("bim.disable_editing_classification_reference", text="", icon="X")
row.operator("bim.disable_editing_classification_reference", text="", icon="CANCEL")
for attribute in self.props.reference_attributes:
if attribute.name == "Name":
@@ -115,7 +115,7 @@ class BIM_PT_object_constraints(Panel):
row = self.layout.row(align=True)
icon = "LIGHT" if self.props.is_adding == "IfcObjective" else "FILE_HIDDEN"
row.label(text="Adding {}".format(self.props.is_adding), icon=icon)
row.operator("bim.disable_assigning_constraint", text="", icon="X")
row.operator("bim.disable_assigning_constraint", text="", icon="CANCEL")
self.layout.template_list(
"BIM_UL_object_constraints",
"",
@@ -138,7 +138,7 @@ class BIM_UL_constraints(UIList):
if context.scene.BIMConstraintProperties.active_constraint_id == item.ifc_definition_id:
if context.scene.BIMConstraintProperties.is_editing == "IfcObjective":
row.operator("bim.edit_objective", text="", icon="CHECKMARK")
row.operator("bim.disable_editing_constraint", text="", icon="X")
row.operator("bim.disable_editing_constraint", text="", icon="CANCEL")
elif context.scene.BIMConstraintProperties.active_constraint_id:
row.operator("bim.remove_constraint", text="", icon="X").constraint = item.ifc_definition_id
else:
@@ -46,7 +46,7 @@ class BIM_PT_documents(Panel):
row.label(text="{} Documents Found".format(len(Data.information)), icon="FILE")
if self.props.is_editing == "information":
row.operator("bim.add_information", text="", icon="ADD")
row.operator("bim.disable_document_editing_ui", text="", icon="X")
row.operator("bim.disable_document_editing_ui", text="", icon="CANCEL")
else:
row.operator("bim.load_information", text="", icon="IMPORT")
@@ -55,7 +55,7 @@ class BIM_PT_documents(Panel):
row.label(text="{} References Found".format(len(Data.references)), icon="FILE_HIDDEN")
if self.props.is_editing == "reference":
row.operator("bim.add_document_reference", text="", icon="ADD")
row.operator("bim.disable_document_editing_ui", text="", icon="X")
row.operator("bim.disable_document_editing_ui", text="", icon="CANCEL")
else:
row.operator("bim.load_document_references", text="", icon="IMPORT")
@@ -129,7 +129,7 @@ class BIM_PT_object_documents(Panel):
row = self.layout.row(align=True)
icon = "FILE" if self.props.is_adding == "IfcDocumentInformation" else "FILE_HIDDEN"
row.label(text="Adding {}".format(self.props.is_adding), icon=icon)
row.operator("bim.disable_assigning_document", text="", icon="X")
row.operator("bim.disable_assigning_document", text="", icon="CANCEL")
self.layout.template_list(
"BIM_UL_object_documents",
"",
@@ -155,7 +155,7 @@ class BIM_UL_documents(UIList):
row.operator("bim.edit_information", text="", icon="CHECKMARK")
elif context.scene.BIMDocumentProperties.is_editing == "reference":
row.operator("bim.edit_document_reference", text="", icon="CHECKMARK")
row.operator("bim.disable_editing_document", text="", icon="X")
row.operator("bim.disable_editing_document", text="", icon="CANCEL")
elif context.scene.BIMDocumentProperties.active_document_id:
row.operator("bim.remove_document", text="", icon="X").document = item.ifc_definition_id
else:
@@ -52,7 +52,7 @@ class BIM_PT_gis(Panel):
row = self.layout.row(align=True)
row.label(text="Projected CRS", icon="WORLD")
row.operator("bim.edit_georeferencing", icon="CHECKMARK", text="")
row.operator("bim.disable_editing_georeferencing", icon="X", text="")
row.operator("bim.disable_editing_georeferencing", icon="CANCEL", text="")
draw_attributes(props.projected_crs, self.layout)
@@ -44,7 +44,7 @@ class BIM_PT_layers(Panel):
row.label(text="{} Layers Found".format(len(Data.layers.keys())))
if self.props.is_editing:
row.operator("bim.add_presentation_layer", text="", icon="ADD")
row.operator("bim.disable_layer_editing_ui", text="", icon="X")
row.operator("bim.disable_layer_editing_ui", text="", icon="CANCEL")
else:
row.operator("bim.load_layers", text="", icon="GREASEPENCIL")
@@ -92,7 +92,7 @@ class BIM_UL_layers(UIList):
if context.scene.BIMLayerProperties.active_layer_id == item.ifc_definition_id:
row.operator("bim.edit_presentation_layer", text="", icon="CHECKMARK")
row.operator("bim.disable_editing_layer", text="", icon="X")
row.operator("bim.disable_editing_layer", text="", icon="CANCEL")
elif context.scene.BIMLayerProperties.active_layer_id:
row.operator("bim.remove_presentation_layer", text="", icon="X").layer = item.ifc_definition_id
else:
@@ -64,7 +64,7 @@ def draw_roles_ui(box, assigned_object_id, roles, context):
box2 = box.box()
row = draw_prop_on_new_row(box2, blender_role, "name", align=True, icon="MOD_CLOTH", text="")
row.operator("bim.edit_role", icon="CHECKMARK", text="")
row.operator("bim.disable_editing_role", icon="X", text="")
row.operator("bim.disable_editing_role", icon="CANCEL", text="")
if blender_role.name == "USERDEFINED":
draw_prop_on_new_row(box2, blender_role, "user_defined_role")
draw_prop_on_new_row(box2, blender_role, "description")
@@ -92,7 +92,7 @@ def draw_addresses_ui(box, assigned_object_id, addresses, file, context):
box2 = box.box()
row = draw_prop_on_new_row(box2, blender_address, "purpose", align=True, icon="MOD_CLOTH", text="")
row.operator("bim.edit_address", icon="CHECKMARK", text="")
row.operator("bim.disable_editing_address", icon="X", text="")
row.operator("bim.disable_editing_address", icon="CANCEL", text="")
if blender_address.purpose == "USERDEFINED":
draw_prop_on_new_row(box2, blender_address, "user_defined_purpose")
draw_prop_on_new_row(box2, blender_address, "description")
@@ -150,7 +150,7 @@ class BIM_PT_people(Panel):
box = self.layout.box()
row = draw_prop_on_new_row(box, blender_person, "name", align=True, icon="USER", text="")
row.operator("bim.edit_person", icon="CHECKMARK", text="")
row.operator("bim.disable_editing_person", icon="X", text="")
row.operator("bim.disable_editing_person", icon="CANCEL", text="")
draw_prop_on_new_row(box, blender_person, "family_name")
draw_prop_on_new_row(box, blender_person, "given_name")
draw_string_collection(box, blender_person, "middle_names")
@@ -204,7 +204,7 @@ class BIM_PT_organisations(Panel):
row = box.row(align=True)
row.prop(blender_organisation, "name", icon="USER", text="")
row.operator("bim.edit_organisation", icon="CHECKMARK", text="")
row.operator("bim.disable_editing_organisation", icon="X", text="")
row.operator("bim.disable_editing_organisation", icon="CANCEL", text="")
draw_prop_on_new_row(box, blender_organisation, "identification")
draw_prop_on_new_row(box, blender_organisation, "description")
@@ -48,7 +48,7 @@ class BIM_PT_pset_template(Panel):
if props.active_pset_template_id:
row.operator("bim.edit_pset_template", text="", icon="CHECKMARK")
row.operator("bim.disable_editing_pset_template", text="", icon="X")
row.operator("bim.disable_editing_pset_template", text="", icon="CANCEL")
else:
row.operator("bim.add_pset_template", text="", icon="ADD")
row.operator("bim.enable_editing_pset_template", text="", icon="GREASEPENCIL")
@@ -97,7 +97,7 @@ class BIM_PT_pset_template(Panel):
if props.active_prop_template_id and props.active_prop_template_id == prop_template_id:
op = row.operator("bim.edit_prop_template", icon="CHECKMARK", text="")
row.operator("bim.disable_editing_prop_template", icon="X", text="")
row.operator("bim.disable_editing_prop_template", icon="CANCEL", text="")
elif props.active_prop_template_id and props.active_prop_template_id != prop_template_id:
row.operator("bim.remove_prop_template", icon="X", text="").prop_template = prop_template_id
else:
@@ -282,12 +282,12 @@ class BIM_PT_work_schedules(Panel):
if self.props.active_sequence_id == sequence["id"]:
if self.props.editing_sequence_type == "ATTRIBUTES":
row.operator("bim.edit_sequence_attributes", text="", icon="CHECKMARK")
row.operator("bim.disable_editing_sequence", text="", icon="X")
row.operator("bim.disable_editing_sequence", text="", icon="CANCEL")
self.draw_editable_sequence_attributes_ui()
elif self.props.editing_sequence_type == "TIME_LAG":
op = row.operator("bim.edit_sequence_time_lag", text="", icon="CHECKMARK")
op.lag_time = sequence["TimeLag"]
row.operator("bim.disable_editing_sequence", text="", icon="X")
row.operator("bim.disable_editing_sequence", text="", icon="CANCEL")
self.draw_editable_sequence_time_lag_ui()
else:
if sequence["TimeLag"]:
@@ -40,7 +40,7 @@ def draw_boundary_condition_ui(layout, boundary_condition_id, connection_id, pro
if props.active_boundary_condition and props.active_boundary_condition == boundary_condition_id:
row.label(text=data["type"], icon="CON_TRACKTO")
row.operator("bim.edit_structural_boundary_condition", text="", icon="CHECKMARK").connection = connection_id
row.operator("bim.disable_editing_structural_boundary_condition", text="", icon="X")
row.operator("bim.disable_editing_structural_boundary_condition", text="", icon="CANCEL")
elif props.active_boundary_condition and props.active_boundary_condition != boundary_condition_id:
row.label(text=data["type"], icon="CON_TRACKTO")
row.operator("bim.remove_structural_boundary_condition", text="", icon="X").connection = connection_id
@@ -338,7 +338,7 @@ class BIM_UL_structural_analysis_models(UIList):
if context.scene.BIMStructuralProperties.active_structural_analysis_model_id == item.ifc_definition_id:
row.operator("bim.edit_structural_analysis_model", text="", icon="CHECKMARK")
row.operator("bim.disable_editing_structural_analysis_model", text="", icon="X")
row.operator("bim.disable_editing_structural_analysis_model", text="", icon="CANCEL")
elif context.scene.BIMStructuralProperties.active_structural_analysis_model_id:
op = row.operator("bim.remove_structural_analysis_model", text="", icon="X")
op.structural_analysis_model = item.ifc_definition_id
@@ -72,8 +72,7 @@ class BIM_PT_type(Panel):
row.prop(props, "relating_type", text="")
row.operator("bim.assign_type", icon="CHECKMARK", text="")
else:
row.prop(props, "blank_relating_type", text="")
row.operator("bim.disable_editing_type", icon="X", text="")
row.operator("bim.disable_editing_type", icon="CANCEL", text="")
else:
row = self.layout.row(align=True)
name = "{}/{}".format(