Take into account the keep/discard interaction when emitting signals

CURA-4248

When user switches to a different profile, the keep/discard dialog can
show up. Don't emit signals immediately if this interaction takes place
because it will trigger an unnecessary slice.
This commit is contained in:
Lipu Fei 2017-10-19 08:32:26 +02:00
parent 85f2a7c385
commit d735921d42
2 changed files with 9 additions and 7 deletions

View file

@ -858,8 +858,10 @@ class MachineManager(QObject):
for stack in name_changed_connect_stacks:
stack.nameChanged.connect(self._onQualityNameChanged)
has_user_interaction = False
if self.hasUserSettings and Preferences.getInstance().getValue("cura/active_mode") == 1:
self._askUserToKeepOrClearCurrentSettings()
# Show the keep/discard user settings dialog
has_user_interaction = Application.getInstance().discardOrKeepProfileChanges()
else:
# If the user doesn't have any of adjusted settings then slicing will be triggered by emit()
# Send emits that are postponed in replaceContainer.
@ -867,7 +869,8 @@ class MachineManager(QObject):
for setting_info in new_quality_settings_list:
setting_info["stack"].sendPostponedEmits()
self.activeQualityChanged.emit()
if not has_user_interaction:
self.activeQualityChanged.emit()
## Determine the quality and quality changes settings for the current machine for a quality name.
#
@ -986,9 +989,6 @@ class MachineManager(QObject):
stack.qualityChanges.nameChanged.connect(self._onQualityNameChanged)
self._onQualityNameChanged()
def _askUserToKeepOrClearCurrentSettings(self):
Application.getInstance().discardOrKeepProfileChanges()
@pyqtProperty(str, notify = activeVariantChanged)
def activeVariantName(self) -> str:
if self._active_container_stack: