mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 14:44:13 -06:00
Add flag to ignore discard or keep dialog when changing print setup
This commit is contained in:
parent
eaa27114c6
commit
0e1cd99578
1 changed files with 6 additions and 6 deletions
|
@ -739,7 +739,7 @@ class MachineManager(QObject):
|
|||
## Set the active material by switching out a container
|
||||
# Depending on from/to material+current variant, a quality profile is chosen and set.
|
||||
@pyqtSlot(str)
|
||||
def setActiveMaterial(self, material_id: str):
|
||||
def setActiveMaterial(self, material_id: str, always_discard_changes = False):
|
||||
with postponeSignals(*self._getContainerChangedSignals(), compress = CompressTechnique.CompressPerParameterValue):
|
||||
containers = ContainerRegistry.getInstance().findInstanceContainers(id = material_id)
|
||||
if not containers or not self._active_container_stack:
|
||||
|
@ -821,10 +821,10 @@ class MachineManager(QObject):
|
|||
if not old_quality_changes:
|
||||
new_quality_id = candidate_quality.getId()
|
||||
|
||||
self.setActiveQuality(new_quality_id)
|
||||
self.setActiveQuality(new_quality_id, always_discard_changes = always_discard_changes)
|
||||
|
||||
@pyqtSlot(str)
|
||||
def setActiveVariant(self, variant_id: str):
|
||||
def setActiveVariant(self, variant_id: str, always_discard_changes = False):
|
||||
with postponeSignals(*self._getContainerChangedSignals(), compress = CompressTechnique.CompressPerParameterValue):
|
||||
containers = ContainerRegistry.getInstance().findInstanceContainers(id = variant_id)
|
||||
if not containers or not self._active_container_stack:
|
||||
|
@ -840,14 +840,14 @@ class MachineManager(QObject):
|
|||
if old_material:
|
||||
preferred_material_name = old_material.getName()
|
||||
preferred_material_id = self._updateMaterialContainer(self._global_container_stack.definition, self._global_container_stack, containers[0], preferred_material_name).id
|
||||
self.setActiveMaterial(preferred_material_id)
|
||||
self.setActiveMaterial(preferred_material_id, always_discard_changes = always_discard_changes)
|
||||
else:
|
||||
Logger.log("w", "While trying to set the active variant, no variant was found to replace.")
|
||||
|
||||
## set the active quality
|
||||
# \param quality_id The quality_id of either a quality or a quality_changes
|
||||
@pyqtSlot(str)
|
||||
def setActiveQuality(self, quality_id: str):
|
||||
def setActiveQuality(self, quality_id: str, always_discard_changes = False):
|
||||
with postponeSignals(*self._getContainerChangedSignals(), compress = CompressTechnique.CompressPerParameterValue):
|
||||
self.blurSettings.emit()
|
||||
|
||||
|
@ -909,7 +909,7 @@ class MachineManager(QObject):
|
|||
# the dialog will be the those before the switching.
|
||||
self._executeDelayedActiveContainerStackChanges()
|
||||
|
||||
if self.hasUserSettings and Preferences.getInstance().getValue("cura/active_mode") == 1:
|
||||
if self.hasUserSettings and Preferences.getInstance().getValue("cura/active_mode") == 1 and not always_discard_changes:
|
||||
Application.getInstance().discardOrKeepProfileChanges()
|
||||
|
||||
## Used to update material and variant in the active container stack with a delay.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue