Browse Source

Fix recommended mode

CURA-6706
Lipu Fei 5 years ago
parent
commit
d99386cf2e
1 changed files with 16 additions and 4 deletions
  1. 16 4
      cura/Machines/Models/IntentModel.py

+ 16 - 4
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)