diff options
author | Ghostkeeper <rubend@tutanota.com> | 2017-06-14 16:30:55 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2017-06-14 16:30:55 +0300 |
commit | ebd2f0b41577787e3a7964f61933857e1a8b44d8 (patch) | |
tree | 0fd37524c9fd3baabc8abd87bb8a4a2d718aff30 /cura/QualityManager.py | |
parent | f4e620c458d1553ca8302e80c3d0e7f80687a54e (diff) |
Fix switching to quality changes profiles
It would put the global quality changes profile in each of the extruders, thus not giving any per-extruder settings.
Contributes to issue CURA-3935.
Diffstat (limited to 'cura/QualityManager.py')
-rw-r--r-- | cura/QualityManager.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/cura/QualityManager.py b/cura/QualityManager.py index c76a515c5b..d75d821b46 100644 --- a/cura/QualityManager.py +++ b/cura/QualityManager.py @@ -54,9 +54,16 @@ class QualityManager: # specified then the currently selected machine definition is used..
# \return the matching quality changes containers \type{List[InstanceContainer]}
def findQualityChangesByName(self, quality_changes_name: str, machine_definition: Optional["DefinitionContainerInterface"] = None):
+ if not machine_definition:
+ global_stack = Application.getGlobalContainerStack()
+ if not global_stack:
+ return [] #No stack, so no current definition could be found, so there are no quality changes either.
+ machine_definition = global_stack.definition
+
result = self.findAllQualityChangesForMachine(machine_definition)
+ for extruder in self.findAllExtruderDefinitionsForMachine(machine_definition):
+ result.extend(self.findAllQualityChangesForExtruder(extruder))
result = [quality_change for quality_change in result if quality_change.getName() == quality_changes_name]
-
return result
## Fetch the list of available quality types for this combination of machine definition and materials.
@@ -137,6 +144,18 @@ class QualityManager: quality_changes_list = ContainerRegistry.getInstance().findInstanceContainers(**filter_dict)
return quality_changes_list
+ def findAllExtruderDefinitionsForMachine(self, machine_definition: "DefinitionContainerInterface") -> List["DefinitionContainerInterface"]:
+ filter_dict = { "machine": machine_definition.getId() }
+ return ContainerRegistry.getInstance().findDefinitionContainers(**filter_dict)
+
+ ## Find all quality changes for a given extruder.
+ #
+ # \param extruder_definition The extruder to find the quality changes for.
+ # \return The list of quality changes for the given extruder.
+ def findAllQualityChangesForExtruder(self, extruder_definition: "DefinitionContainerInterface") -> List[InstanceContainer]:
+ filter_dict = {"type": "quality_changes", "extruder": extruder_definition.getId()}
+ return ContainerRegistry.getInstance().findInstanceContainers(**filter_dict)
+
## Find all usable qualities for a machine and extruders.
#
# Finds all of the qualities for this combination of machine and extruders.
|