Make intents work on quality management page

CURA-6706
This commit is contained in:
Lipu Fei 2019-10-04 13:36:03 +02:00
parent 1981a7c65b
commit c42feae11c
6 changed files with 114 additions and 40 deletions

View file

@ -74,21 +74,7 @@ class IntentModel(ListModel):
new_items.append(intent)
layer_heights_added.append(intent["layer_height"])
# 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_tuple, quality_group in quality_groups.items():
# Add the intents that are of the correct category
if quality_tuple[0] != self._intent_category:
layer_height = fetchLayerHeight(quality_group)
if layer_height not in layer_heights_added:
new_items.append({"name": "Unavailable",
"quality_type": "",
"layer_height": layer_height,
"intent_category": self._intent_category,
"available": False})
layer_heights_added.append(layer_height)
new_items = sorted(new_items, key=lambda x: x["layer_height"])
new_items = sorted(new_items, key = lambda x: x["layer_height"])
self.setItems(new_items)
## Get the active materials for all extruders. No duplicates will be returned
@ -122,11 +108,11 @@ class IntentModel(ListModel):
if intent_node.intent_category != self._intent_category:
continue
extruder_intents.append({"name": quality_group.name,
"quality_type": quality_group.quality_type,
"layer_height": layer_height,
"available": quality_group.is_available,
"intent_category": self._intent_category
})
"quality_type": quality_group.quality_type,
"layer_height": layer_height,
"available": quality_group.is_available,
"intent_category": self._intent_category
})
return extruder_intents
def __repr__(self):