Ensure that intent gets updated when changing quality / material

CURA-6775
This commit is contained in:
Jaime van Kessel 2019-09-19 14:26:18 +02:00
parent c76c183c6b
commit 3730ea247d
No known key found for this signature in database
GPG key ID: 3710727397403C91

View file

@ -1109,6 +1109,7 @@ class MachineManager(QObject):
self.activeQualityGroupChanged.emit() self.activeQualityGroupChanged.emit()
self.activeQualityChangesGroupChanged.emit() self.activeQualityChangesGroupChanged.emit()
self._updateIntentWithQuality()
def _setQualityGroup(self, quality_group: Optional["QualityGroup"], empty_quality_changes: bool = True) -> None: def _setQualityGroup(self, quality_group: Optional["QualityGroup"], empty_quality_changes: bool = True) -> None:
if self._global_container_stack is None: if self._global_container_stack is None:
@ -1136,6 +1137,7 @@ class MachineManager(QObject):
self.activeQualityGroupChanged.emit() self.activeQualityGroupChanged.emit()
self.activeQualityChangesGroupChanged.emit() self.activeQualityChangesGroupChanged.emit()
self._updateIntentWithQuality()
def _fixQualityChangesGroupToNotSupported(self, quality_changes_group: "QualityChangesGroup") -> None: def _fixQualityChangesGroupToNotSupported(self, quality_changes_group: "QualityChangesGroup") -> None:
metadatas = [quality_changes_group.metadata_for_global] + list(quality_changes_group.metadata_per_extruder.values()) metadatas = [quality_changes_group.metadata_for_global] + list(quality_changes_group.metadata_per_extruder.values())
@ -1277,6 +1279,21 @@ class MachineManager(QObject):
current_quality_type, quality_type) current_quality_type, quality_type)
self._setQualityGroup(candidate_quality_groups[quality_type], empty_quality_changes = True) self._setQualityGroup(candidate_quality_groups[quality_type], empty_quality_changes = True)
## Update the current intent after the quality changed
def _updateIntentWithQuality(self):
global_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack()
if global_stack is None:
return
Logger.log("d", "Updating intent due to quality change")
category = "default"
for extruder in global_stack.extruderList:
current_category = extruder.intent.getMetaDataEntry("intent_category", "default")
if current_category != "default" and current_category != category:
category = current_category
self.setIntentByCategory(category)
## Update the material profile in the current stacks when the variant is ## Update the material profile in the current stacks when the variant is
# changed. # changed.
# \param position The extruder stack to update. If provided with None, all # \param position The extruder stack to update. If provided with None, all