Refer _createQualityChanges through to QualityManagementModel

That's where the function was moved.
This function is still being called from various places, even though it's protected. Should change that...

Contributes to issue CURA-6600.
This commit is contained in:
Ghostkeeper 2019-09-02 17:47:31 +02:00
parent a1e6ba615c
commit 4043afd09f
No known key found for this signature in database
GPG Key ID: 86BEF881AE2CF276

View File

@ -183,33 +183,14 @@ class QualityManager(QObject):
def createQualityChanges(self, base_name: str) -> None: def createQualityChanges(self, base_name: str) -> None:
return cura.CuraApplication.CuraApplication.getInstance().getQualityManagementModel().createQualityChanges(base_name) return cura.CuraApplication.CuraApplication.getInstance().getQualityManagementModel().createQualityChanges(base_name)
# ## Create a quality changes container with the given set-up.
# Create a quality changes container with the given setup. # \param quality_type The quality type of the new container.
# # \param new_name The name of the container. This name must be unique.
def _createQualityChanges(self, quality_type: str, new_name: str, machine: "GlobalStack", # \param machine The global stack to create the profile for.
extruder_stack: Optional["ExtruderStack"]) -> "InstanceContainer": # \param extruder_stack The extruder stack to create the profile for. If
base_id = machine.definition.getId() if extruder_stack is None else extruder_stack.getId() # not provided, only a global container will be created.
new_id = base_id + "_" + new_name def _createQualityChanges(self, quality_type: str, new_name: str, machine: "GlobalStack", extruder_stack: Optional["ExtruderStack"]) -> "InstanceContainer":
new_id = new_id.lower().replace(" ", "_") return cura.CuraApplication.CuraApplication.getInstance().getQualityManagementModel()._createQualityChanges(quality_type, new_name, machine, extruder_stack)
new_id = self._container_registry.uniqueName(new_id)
# Create a new quality_changes container for the quality.
quality_changes = InstanceContainer(new_id)
quality_changes.setName(new_name)
quality_changes.setMetaDataEntry("type", "quality_changes")
quality_changes.setMetaDataEntry("quality_type", quality_type)
# If we are creating a container for an extruder, ensure we add that to the container
if extruder_stack is not None:
quality_changes.setMetaDataEntry("position", extruder_stack.getMetaDataEntry("position"))
# If the machine specifies qualities should be filtered, ensure we match the current criteria.
machine_definition_id = getMachineDefinitionIDForQualitySearch(machine.definition)
quality_changes.setDefinition(machine_definition_id)
quality_changes.setMetaDataEntry("setting_version", cura.CuraApplication.CuraApplication.getInstance().SettingVersion)
return quality_changes
# #
# Gets the machine definition ID that can be used to search for Quality containers that are suitable for the given # Gets the machine definition ID that can be used to search for Quality containers that are suitable for the given