From 2ccdd11098c230a30578b1c65c5263e6b7b11675 Mon Sep 17 00:00:00 2001 From: Kostas Karmas Date: Mon, 9 Nov 2020 16:20:13 +0100 Subject: [PATCH] Properly set the print sequence in the correct container Previously, the print sequence would be always set to all-at-once in the user container whenever the second extruder would be enabled. This was causing an interface issue, where the circular reset-setting arrow would appear next to the setting, even if the quality changes already had the correct value ("all-at-once"). This is now fixed by checking the following: - If print_sequence == "one_at_a_time" in the quality (so it is already saved in a quality profile) then set the print_sequence to "all_at_once" in the user changes so that it will be displayed as an unsaved change - If print_sequence == "one_at_a_time" in the user changes container only, meaning that it is not saved in any quality profiles, then just reset the print_sequence in the user changes, so that it will have the correct value ("all-at-once") without the reset-setting arrow appearing next to it. CURA-7827 --- cura/Settings/MachineManager.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index e363895e08..401c4152e6 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -861,15 +861,29 @@ class MachineManager(QObject): def _correctPrintSequence(self) -> None: """Resets the Print Sequence setting when there are more than one enabled extruders.""" - if self._global_container_stack is None: - return - setting_key = "print_sequence" new_value = "all_at_once" + + if self._global_container_stack is None \ + or self._global_container_stack.getProperty(setting_key, "value") == new_value \ + or self.numberExtrudersEnabled < 2: + return + user_changes_container = self._global_container_stack.userChanges - if self.numberExtrudersEnabled > 1: + quality_changes_container = self._global_container_stack.qualityChanges + print_sequence_in_quality_changes = quality_changes_container.getProperty(setting_key, "value") + print_sequence_in_user_changes = user_changes_container.getProperty(setting_key, "value") + + # If the quality changes has the wrong value, then set the correct value in the user changes + if print_sequence_in_quality_changes and print_sequence_in_quality_changes != new_value: user_changes_container.setProperty(setting_key, "value", new_value) Logger.log("d", "Setting '{}' in '{}' to '{}' because there are more than 1 enabled extruders.".format(setting_key, user_changes_container, new_value)) + # If the quality changes has no value or the correct value and the user changes container has the wrong value, + # then reset the setting in the user changes (so that the circular revert-changes arrow will now show up in the + # interface) + elif print_sequence_in_user_changes and print_sequence_in_user_changes != new_value: + user_changes_container.removeInstance(setting_key) + Logger.log("d", "Resetting '{}' in container '{}' because there are more than 1 enabled extruders.".format(setting_key, user_changes_container)) def setActiveMachineExtruderCount(self, extruder_count: int) -> None: """Set the amount of extruders on the active machine (global stack)