mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Use the new quality_type when setting the active quality
Contributes to CURA-2006
This commit is contained in:
parent
b894e3888c
commit
e2a4aeb8ff
1 changed files with 17 additions and 10 deletions
|
|
@ -199,14 +199,6 @@ class MachineManager(QObject):
|
||||||
if old_index is not None:
|
if old_index is not None:
|
||||||
extruder_manager.setActiveExtruderIndex(old_index)
|
extruder_manager.setActiveExtruderIndex(old_index)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _onGlobalContainerChanged(self):
|
def _onGlobalContainerChanged(self):
|
||||||
if self._global_container_stack:
|
if self._global_container_stack:
|
||||||
self._global_container_stack.nameChanged.disconnect(self._onMachineNameChanged)
|
self._global_container_stack.nameChanged.disconnect(self._onMachineNameChanged)
|
||||||
|
|
@ -577,14 +569,29 @@ class MachineManager(QObject):
|
||||||
Logger.log("e", "Tried to set quality to a container that is not of the right type")
|
Logger.log("e", "Tried to set quality to a container that is not of the right type")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
quality_type = quality_container.getMetaDataEntry("quality_type")
|
||||||
|
if not quality_type:
|
||||||
|
quality_type = quality_changes_container.getName()
|
||||||
|
|
||||||
stacks = [ s for s in ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId()) ]
|
stacks = [ s for s in ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId()) ]
|
||||||
stacks.insert(0, self._global_container_stack)
|
stacks.insert(0, self._global_container_stack)
|
||||||
|
|
||||||
for stack in stacks:
|
for stack in stacks:
|
||||||
extruder_id = stack.getId() if stack != self._global_container_stack else None
|
extruder_id = stack.getId() if stack != self._global_container_stack else None
|
||||||
stack_quality = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(name = quality_container.getName(), extruder = extruder_id)
|
|
||||||
|
criteria = { "quality_type": quality_type, "extruder": extruder_id }
|
||||||
|
|
||||||
|
if self._global_container_stack.getMetaDataEntry("has_machine_quality"):
|
||||||
|
material = stack.findContainer(type = "material")
|
||||||
|
criteria["material"] = material.getId()
|
||||||
|
|
||||||
|
stack_quality = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**criteria)
|
||||||
|
if not stack_quality:
|
||||||
|
criteria.pop("extruder")
|
||||||
|
stack_quality = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**criteria)
|
||||||
if not stack_quality:
|
if not stack_quality:
|
||||||
stack_quality = quality_container
|
stack_quality = quality_container
|
||||||
|
stack_quality = stack_quality[0]
|
||||||
else:
|
else:
|
||||||
stack_quality = stack_quality[0]
|
stack_quality = stack_quality[0]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue