mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-12 09:17:50 -06:00
Merge branch '2.3'
This commit is contained in:
commit
8b75dd5f97
5 changed files with 37 additions and 12 deletions
|
@ -131,7 +131,8 @@ class QualityManager:
|
||||||
#
|
#
|
||||||
# \param global_container_stack \type{ContainerStack} the global machine definition
|
# \param global_container_stack \type{ContainerStack} the global machine definition
|
||||||
# \param extruder_stacks \type{List[ContainerStack]} the list of extruder stacks
|
# \param extruder_stacks \type{List[ContainerStack]} the list of extruder stacks
|
||||||
# \return \type{List[InstanceContainer]} the list of the matching qualities
|
# \return \type{List[InstanceContainer]} the list of the matching qualities. The quality profiles
|
||||||
|
# return come from the first extruder in the given list of extruders.
|
||||||
def findAllUsableQualitiesForMachineAndExtruders(self, global_container_stack, extruder_stacks):
|
def findAllUsableQualitiesForMachineAndExtruders(self, global_container_stack, extruder_stacks):
|
||||||
global_machine_definition = global_container_stack.getBottom()
|
global_machine_definition = global_container_stack.getBottom()
|
||||||
|
|
||||||
|
|
|
@ -148,6 +148,16 @@ class MachineManager(QObject):
|
||||||
|
|
||||||
if matching_extruder and matching_extruder.findContainer({"type": "material"}).getMetaDataEntry("GUID") != material_id:
|
if matching_extruder and matching_extruder.findContainer({"type": "material"}).getMetaDataEntry("GUID") != material_id:
|
||||||
# Save the material that needs to be changed. Multiple changes will be handled by the callback.
|
# Save the material that needs to be changed. Multiple changes will be handled by the callback.
|
||||||
|
if matching_extruder:
|
||||||
|
variant_container = matching_extruder.findContainer({"type": "variant"})
|
||||||
|
if self._global_container_stack.getBottom().getMetaDataEntry("has_variants") and variant_container:
|
||||||
|
variant_id = self.getQualityVariantId(self._global_container_stack.getBottom(), variant_container)
|
||||||
|
for container in containers:
|
||||||
|
if container.getMetaDataEntry("variant") == variant_id:
|
||||||
|
self._auto_materials_changed[str(index)] = container.getId()
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
# Just use the first result we found.
|
||||||
self._auto_materials_changed[str(index)] = containers[0].getId()
|
self._auto_materials_changed[str(index)] = containers[0].getId()
|
||||||
self._printer_output_devices[0].materialHotendChangedMessage(self._materialHotendChangedCallback)
|
self._printer_output_devices[0].materialHotendChangedMessage(self._materialHotendChangedCallback)
|
||||||
else:
|
else:
|
||||||
|
@ -498,8 +508,8 @@ class MachineManager(QObject):
|
||||||
|
|
||||||
@pyqtProperty(str, notify = activeQualityChanged)
|
@pyqtProperty(str, notify = activeQualityChanged)
|
||||||
def activeQualityType(self):
|
def activeQualityType(self):
|
||||||
if self._global_container_stack:
|
if self._active_container_stack:
|
||||||
quality = self._global_container_stack.findContainer(type = "quality")
|
quality = self._active_container_stack.findContainer(type = "quality")
|
||||||
if quality:
|
if quality:
|
||||||
return quality.getMetaDataEntry("quality_type")
|
return quality.getMetaDataEntry("quality_type")
|
||||||
return ""
|
return ""
|
||||||
|
@ -529,8 +539,8 @@ class MachineManager(QObject):
|
||||||
|
|
||||||
@pyqtProperty(str, notify = activeQualityChanged)
|
@pyqtProperty(str, notify = activeQualityChanged)
|
||||||
def activeQualityChangesId(self):
|
def activeQualityChangesId(self):
|
||||||
if self._global_container_stack:
|
if self._active_container_stack:
|
||||||
changes = self._global_container_stack.findContainer(type = "quality_changes")
|
changes = self._active_container_stack.findContainer(type = "quality_changes")
|
||||||
if changes:
|
if changes:
|
||||||
return changes.getId()
|
return changes.getId()
|
||||||
return ""
|
return ""
|
||||||
|
|
|
@ -28,5 +28,14 @@ class ProfilesModel(InstanceContainersModel):
|
||||||
if global_container_stack is None:
|
if global_container_stack is None:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
# Get the list of extruders and place the selected extruder at the front of the list.
|
||||||
|
extruder_manager = ExtruderManager.getInstance()
|
||||||
|
active_extruder = extruder_manager.getActiveExtruderStack()
|
||||||
|
extruder_stacks = extruder_manager.getActiveExtruderStacks()
|
||||||
|
extruder_stacks.remove(active_extruder)
|
||||||
|
extruder_stacks = [active_extruder] + extruder_stacks
|
||||||
|
|
||||||
|
# Fetch the list of useable qualities across all extruders.
|
||||||
|
# The actual list of quality profiles come from the first extruder in the extruder list.
|
||||||
return QualityManager.getInstance().findAllUsableQualitiesForMachineAndExtruders(global_container_stack,
|
return QualityManager.getInstance().findAllUsableQualitiesForMachineAndExtruders(global_container_stack,
|
||||||
ExtruderManager.getInstance().getActiveExtruderStacks())
|
extruder_stacks)
|
||||||
|
|
|
@ -25,9 +25,17 @@ class QualityAndUserProfilesModel(ProfilesModel):
|
||||||
machine_definition = quality_manager.getParentMachineDefinition(global_container_stack.getBottom())
|
machine_definition = quality_manager.getParentMachineDefinition(global_container_stack.getBottom())
|
||||||
quality_changes_list = quality_manager.findAllQualityChangesForMachine(machine_definition)
|
quality_changes_list = quality_manager.findAllQualityChangesForMachine(machine_definition)
|
||||||
|
|
||||||
# Fetch the list of qualities
|
# Get the list of extruders and place the selected extruder at the front of the list.
|
||||||
|
extruder_manager = ExtruderManager.getInstance()
|
||||||
|
active_extruder = extruder_manager.getActiveExtruderStack()
|
||||||
|
extruder_stacks = extruder_manager.getActiveExtruderStacks()
|
||||||
|
extruder_stacks.remove(active_extruder)
|
||||||
|
extruder_stacks = [active_extruder] + extruder_stacks
|
||||||
|
|
||||||
|
# Fetch the list of useable qualities across all extruders.
|
||||||
|
# The actual list of quality profiles come from the first extruder in the extruder list.
|
||||||
quality_list = QualityManager.getInstance().findAllUsableQualitiesForMachineAndExtruders(global_container_stack,
|
quality_list = QualityManager.getInstance().findAllUsableQualitiesForMachineAndExtruders(global_container_stack,
|
||||||
ExtruderManager.getInstance().getActiveExtruderStacks())
|
extruder_stacks)
|
||||||
|
|
||||||
# Filter the quality_change by the list of available quality_types
|
# Filter the quality_change by the list of available quality_types
|
||||||
quality_type_set = set([x.getMetaDataEntry("quality_type") for x in quality_list])
|
quality_type_set = set([x.getMetaDataEntry("quality_type") for x in quality_list])
|
||||||
|
|
|
@ -110,9 +110,6 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel):
|
||||||
"definition": quality_changes_container.getDefinition().getId()
|
"definition": quality_changes_container.getDefinition().getId()
|
||||||
}
|
}
|
||||||
|
|
||||||
if self._material_id and self._material_id != "empty_material":
|
|
||||||
criteria["material"] = self._material_id
|
|
||||||
|
|
||||||
quality_container = self._container_registry.findInstanceContainers(**criteria)
|
quality_container = self._container_registry.findInstanceContainers(**criteria)
|
||||||
if not quality_container:
|
if not quality_container:
|
||||||
UM.Logger.log("w", "Could not find a quality container matching quality changes %s", quality_changes_container.getId())
|
UM.Logger.log("w", "Could not find a quality container matching quality changes %s", quality_changes_container.getId())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue