Added new intent selection buttons and resolution drop down to replace the matrix.

We are now selecting intents first and then quality, however the container hierarchy quality -> intents. This is the reason for the new functions inside machine manager.

CURA-8849
This commit is contained in:
j.delarago 2022-06-14 11:41:38 +02:00
parent 6f88adab8e
commit a87695cd8d
9 changed files with 454 additions and 178 deletions

View file

@ -1778,3 +1778,31 @@ class MachineManager(QObject):
abbr_machine += stripped_word
return abbr_machine
@pyqtSlot(str, str, result = bool)
def intentCategoryHasQuality(self, intent_category: str, quality_type: str) -> bool:
""" Checks if there are any quality groups for active extruders that have an intent category """
quality_groups = ContainerTree.getInstance().getCurrentQualityGroups()
if quality_type in quality_groups:
quality_group = quality_groups[quality_type]
for node in quality_group.nodes_for_extruders.values():
if any(intent.intent_category == intent_category for intent in node.intents.values()):
return True
return False
@pyqtSlot(str, result = str)
def getDefaultQualityTypeForIntent(self, intent_category) -> str:
""" If there is an intent category for the default machine quality return it, otherwise return the first quality for this intent category """
machine = ContainerTree.getInstance().machines.get(self._global_container_stack.definition.getId())
if self.intentCategoryHasQuality(intent_category, machine.preferred_quality_type):
return machine.preferred_quality_type
for quality_type, quality_group in ContainerTree.getInstance().getCurrentQualityGroups().items():
for node in quality_group.nodes_for_extruders.values():
if any(intent.intent_category == intent_category for intent in node.intents.values()):
return quality_type
return ""