mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-14 02:07:51 -06:00
CURA-4606 cleanup and optimization for replaceContainer
This commit is contained in:
parent
bf2317a74d
commit
8aab8f4394
6 changed files with 8 additions and 23 deletions
|
@ -239,7 +239,8 @@ class QualityManager(QObject):
|
||||||
|
|
||||||
machine_node = self._machine_quality_type_to_quality_changes_dict.get(machine_definition_id)
|
machine_node = self._machine_quality_type_to_quality_changes_dict.get(machine_definition_id)
|
||||||
if not machine_node:
|
if not machine_node:
|
||||||
raise RuntimeError("Cannot find node for machine def [%s] in QualityChanges lookup table" % machine_definition_id)
|
Logger.log("e", "Cannot find node for machine def [%s] in QualityChanges lookup table", machine_definition_id)
|
||||||
|
return {}
|
||||||
|
|
||||||
# Update availability for each QualityChangesGroup:
|
# Update availability for each QualityChangesGroup:
|
||||||
# A custom profile is always available as long as the quality_type it's based on is available
|
# A custom profile is always available as long as the quality_type it's based on is available
|
||||||
|
|
|
@ -348,6 +348,10 @@ class CuraContainerStack(ContainerStack):
|
||||||
elif container != self._empty_instance_container and container.getMetaDataEntry("type") != expected_type:
|
elif container != self._empty_instance_container and container.getMetaDataEntry("type") != expected_type:
|
||||||
raise Exceptions.InvalidContainerError("Cannot replace container at index {index} with a container that is not of {type} type, but {actual_type} type.".format(index = index, type = expected_type, actual_type = container.getMetaDataEntry("type")))
|
raise Exceptions.InvalidContainerError("Cannot replace container at index {index} with a container that is not of {type} type, but {actual_type} type.".format(index = index, type = expected_type, actual_type = container.getMetaDataEntry("type")))
|
||||||
|
|
||||||
|
current_container = self._containers[index]
|
||||||
|
if current_container.getId() == container.getId():
|
||||||
|
return
|
||||||
|
|
||||||
super().replaceContainer(index, container, postpone_emit)
|
super().replaceContainer(index, container, postpone_emit)
|
||||||
|
|
||||||
## Overridden from ContainerStack
|
## Overridden from ContainerStack
|
||||||
|
|
|
@ -1642,6 +1642,7 @@ class MachineManager(QObject):
|
||||||
self.blurSettings.emit()
|
self.blurSettings.emit()
|
||||||
with postponeSignals(*self._getContainerChangedSignals(), compress = CompressTechnique.CompressPerParameterValue):
|
with postponeSignals(*self._getContainerChangedSignals(), compress = CompressTechnique.CompressPerParameterValue):
|
||||||
self._setQualityGroup(quality_group)
|
self._setQualityGroup(quality_group)
|
||||||
|
Logger.log("d", "Quality set!")
|
||||||
|
|
||||||
@pyqtProperty("QVariant", fset = setQualityGroup, notify = activeQualityGroupChanged)
|
@pyqtProperty("QVariant", fset = setQualityGroup, notify = activeQualityGroupChanged)
|
||||||
def activeQualityGroup(self):
|
def activeQualityGroup(self):
|
||||||
|
|
|
@ -13,12 +13,6 @@ Menu
|
||||||
title: "Material"
|
title: "Material"
|
||||||
|
|
||||||
property int extruderIndex: 0
|
property int extruderIndex: 0
|
||||||
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
|
||||||
|
|
||||||
MenuSeparator
|
|
||||||
{
|
|
||||||
visible: automaticMaterial.visible
|
|
||||||
}
|
|
||||||
|
|
||||||
Instantiator
|
Instantiator
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,21 +13,6 @@ Menu
|
||||||
title: "Nozzle"
|
title: "Nozzle"
|
||||||
|
|
||||||
property int extruderIndex: 0
|
property int extruderIndex: 0
|
||||||
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
|
||||||
property bool isClusterPrinter:
|
|
||||||
{
|
|
||||||
if (Cura.MachineManager.printerOutputDevices.length == 0)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
var clusterSize = Cura.MachineManager.printerOutputDevices[0].clusterSize;
|
|
||||||
// This is not a cluster printer or the cluster it is just one printer
|
|
||||||
if (clusterSize == undefined || clusterSize == 1)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Cura.NozzleModel
|
Cura.NozzleModel
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,7 +19,7 @@ Menu
|
||||||
{
|
{
|
||||||
text: (model.layer_height != "") ? model.name + " - " + model.layer_height : model.name
|
text: (model.layer_height != "") ? model.name + " - " + model.layer_height : model.name
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: Cura.MachineManager.activeQualityGroup.getName() == model.name
|
checked: Cura.MachineManager.activeQualityGroup && (Cura.MachineManager.activeQualityGroup.getName() == model.name)
|
||||||
exclusiveGroup: group
|
exclusiveGroup: group
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
Cura.MachineManager.setQualityGroup(model.quality_group)
|
Cura.MachineManager.setQualityGroup(model.quality_group)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue