No longer add incompatible materials to materials menus

This removes the need for the 'compatible' role but I'll keep it in for now in case we want to change the design of this later.

Contributes to issue CURA-5460.
This commit is contained in:
Ghostkeeper 2018-07-09 17:29:45 +02:00
parent c0fc0a7eba
commit f712fc0f36
No known key found for this signature in database
GPG key ID: 5252B696FB5E7C7A
3 changed files with 6 additions and 3 deletions

View file

@ -108,6 +108,8 @@ class BrandMaterialsModel(ListModel):
# Only add results for generic materials # Only add results for generic materials
if brand.lower() == "generic": if brand.lower() == "generic":
continue continue
if not metadata.get("compatible", True):
continue
if brand not in brand_group_dict: if brand not in brand_group_dict:
brand_group_dict[brand] = {} brand_group_dict[brand] = {}
@ -123,7 +125,7 @@ class BrandMaterialsModel(ListModel):
"material": metadata["material"], "material": metadata["material"],
"color_name": metadata["color_name"], "color_name": metadata["color_name"],
"container_node": container_node, "container_node": container_node,
"compatible": metadata.get("compatible", "unknown") "compatible": metadata.get("compatible", True)
} }
brand_group_dict[brand][material_type].append(item) brand_group_dict[brand][material_type].append(item)

View file

@ -44,6 +44,8 @@ class GenericMaterialsModel(BaseMaterialsModel):
# Only add results for generic materials # Only add results for generic materials
if metadata["brand"].lower() != "generic": if metadata["brand"].lower() != "generic":
continue continue
if not metadata.get("compatible", True):
continue
item = {"root_material_id": root_material_id, item = {"root_material_id": root_material_id,
"id": metadata["id"], "id": metadata["id"],
@ -52,7 +54,7 @@ class GenericMaterialsModel(BaseMaterialsModel):
"material": metadata["material"], "material": metadata["material"],
"color_name": metadata["color_name"], "color_name": metadata["color_name"],
"container_node": container_node, "container_node": container_node,
"compatible": metadata.get("compatible", "unknown") "compatible": metadata.get("compatible", True)
} }
item_list.append(item) item_list.append(item)

View file

@ -22,7 +22,6 @@ Menu
text: model.name text: model.name
checkable: true checkable: true
checked: model.root_material_id == Cura.MachineManager.currentRootMaterialId[extruderIndex] checked: model.root_material_id == Cura.MachineManager.currentRootMaterialId[extruderIndex]
enabled: model.compatible
exclusiveGroup: group exclusiveGroup: group
onTriggered: onTriggered:
{ {