From fab2c31b4f55d99ed07e9b1b5867458fc410e2c2 Mon Sep 17 00:00:00 2001 From: Kostas Karmas Date: Mon, 9 Nov 2020 16:55:43 +0100 Subject: [PATCH] Cover the last remaining case when setting the print sequence If for some reason the print sequence is set to one-at-a-time be default in the printer definition and the number of extruders of the printer is set to >=2, then the print_sequence won't show up in neither the quality changes nor the user changes, yet it will still have "one-at-a-time" as a value. In a such case, it will still need to be set to "all-at-once" in the user changes. This is a theoretical case, as it is very unlikely for a printer to have "one-at-a-time" set by default in its definition (.def.json) file and still be able to support more than one extruders. But it is a world full of possibilities out there, so you never know... CURA-7827 --- cura/Settings/MachineManager.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index a9ee9e5096..79bd784f76 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -877,19 +877,21 @@ class MachineManager(QObject): user_changes_container = self._global_container_stack.userChanges 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") + print_sequence_quality_changes = quality_changes_container.getProperty(setting_key, "value") + print_sequence_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: + # If the user changes container has a value and its the incorrect value, then reset the setting in the user + # changes (so that the circular revert-changes arrow will now show up in the interface) + if print_sequence_user_changes and print_sequence_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)) + # If the print sequence doesn't exist in either the user changes or the quality changes (yet it still has the + # wrong value in the global stack), or it exists in the quality changes and it has the wrong value, then set it + # in the user changes + elif (not print_sequence_quality_changes and not print_sequence_user_changes) \ + or (print_sequence_quality_changes and print_sequence_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)) def setActiveMachineExtruderCount(self, extruder_count: int) -> None: """Set the amount of extruders on the active machine (global stack)