mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 11:17:49 -06:00
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:
parent
85f2a7c385
commit
d735921d42
2 changed files with 9 additions and 7 deletions
|
@ -393,6 +393,7 @@ class CuraApplication(QtApplication):
|
|||
showDiscardOrKeepProfileChanges = pyqtSignal()
|
||||
|
||||
def discardOrKeepProfileChanges(self):
|
||||
has_user_interaction = False
|
||||
choice = Preferences.getInstance().getValue("cura/choice_on_profile_override")
|
||||
if choice == "always_discard":
|
||||
# don't show dialog and DISCARD the profile
|
||||
|
@ -403,11 +404,12 @@ class CuraApplication(QtApplication):
|
|||
else:
|
||||
# ALWAYS ask whether to keep or discard the profile
|
||||
self.showDiscardOrKeepProfileChanges.emit()
|
||||
|
||||
#sidebarSimpleDiscardOrKeepProfileChanges = pyqtSignal()
|
||||
has_user_interaction = True
|
||||
return has_user_interaction
|
||||
|
||||
@pyqtSlot(str)
|
||||
def discardOrKeepProfileChangesClosed(self, option):
|
||||
self.getMachineManager().activeQualityChanged.emit()
|
||||
if option == "discard":
|
||||
global_stack = self.getGlobalContainerStack()
|
||||
for extruder in ExtruderManager.getInstance().getMachineExtruders(global_stack.getId()):
|
||||
|
|
|
@ -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,6 +869,7 @@ class MachineManager(QObject):
|
|||
for setting_info in new_quality_settings_list:
|
||||
setting_info["stack"].sendPostponedEmits()
|
||||
|
||||
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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue