diff --git a/cura/Machines/Models/IntentModel.py b/cura/Machines/Models/IntentModel.py index 62c816f3a9..f5560bc94e 100644 --- a/cura/Machines/Models/IntentModel.py +++ b/cura/Machines/Models/IntentModel.py @@ -65,14 +65,26 @@ class IntentModel(ListModel): material_nodes = self._getActiveMaterials() - layer_heights_added = [] # type: List[float] - + added_quality_type_set = set() # type: Set[str] for material_node in material_nodes: intents = self._getIntentsForMaterial(material_node, quality_groups) for intent in intents: - if intent["layer_height"] not in layer_heights_added: + if intent["quality_type"] not in added_quality_type_set: new_items.append(intent) - layer_heights_added.append(intent["layer_height"]) + added_quality_type_set.add(intent["quality_type"]) + + # Now that we added all intents that we found something for, ensure that we set add ticks (and layer_heights) + # for all groups that we don't have anything for (and set it to not available) + for quality_type, quality_group in quality_groups.items(): + # Add the intents that are of the correct category + if quality_type not in added_quality_type_set: + layer_height = fetchLayerHeight(quality_group) + new_items.append({"name": "Unavailable", + "quality_type": quality_type, + "layer_height": layer_height, + "intent_category": self._intent_category, + "available": False}) + added_quality_type_set.add(quality_type) new_items = sorted(new_items, key = lambda x: x["layer_height"]) self.setItems(new_items)