Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelle Spijker <j.spijker@ultimaker.com>2020-11-09 21:48:26 +0300
committerGitHub <noreply@github.com>2020-11-09 21:48:26 +0300
commit05d98091b0cc39227b87123ff3777dc232b3810d (patch)
treeb00946d621e3eb6dc140420bb52f5da936635e7d
parentf3a8282a760e7454ee5ca644513550fdc4a6df5a (diff)
parent4b35bd1724cd0c0c8da5b85f6627a9678918bd0d (diff)
Merge pull request #8698 from Ultimaker/CURA-7827_Properly_set_print_sequence_when_number_of_enabled_extruder_changes
CURA-7827: Correct print sequence when there are more than one enabled extruders
-rw-r--r--cura/Settings/ContainerManager.py3
-rwxr-xr-xcura/Settings/MachineManager.py41
-rw-r--r--tests/TestMachineManager.py5
3 files changed, 42 insertions, 7 deletions
diff --git a/cura/Settings/ContainerManager.py b/cura/Settings/ContainerManager.py
index 80a0d64474..08fdf707cf 100644
--- a/cura/Settings/ContainerManager.py
+++ b/cura/Settings/ContainerManager.py
@@ -345,6 +345,9 @@ class ContainerManager(QObject):
# user changes are possibly added to make the current setup match the current enabled extruders
machine_manager.correctExtruderSettings()
+ # The Print Sequence should be changed to match the current setup
+ machine_manager.correctPrintSequence()
+
for container in send_emits_containers:
container.sendPostponedEmits()
diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py
index 58fd8171b5..1a2ab72a33 100755
--- a/cura/Settings/MachineManager.py
+++ b/cura/Settings/MachineManager.py
@@ -128,6 +128,7 @@ class MachineManager(QObject):
self.activeQualityChangesGroupChanged.connect(self.activeQualityDisplayNameChanged)
self.activeStackValueChanged.connect(self._reCalculateNumUserSettings)
+ self.numberExtrudersEnabledChanged.connect(self.correctPrintSequence)
activeQualityDisplayNameChanged = pyqtSignal()
@@ -826,11 +827,6 @@ class MachineManager(QObject):
result = [] # type: List[str]
for setting_instance in container.findInstances():
setting_key = setting_instance.definition.key
- if setting_key == "print_sequence":
- old_value = container.getProperty(setting_key, "value")
- Logger.log("d", "Reset setting [%s] in [%s] because its old value [%s] is no longer valid", setting_key, container, old_value)
- result.append(setting_key)
- continue
if not self._global_container_stack.getProperty(setting_key, "type") in ("extruder", "optional_extruder"):
continue
@@ -862,6 +858,41 @@ class MachineManager(QObject):
title = catalog.i18nc("@info:title", "Settings updated"))
caution_message.show()
+ def correctPrintSequence(self) -> None:
+ """
+ Sets the Print Sequence setting to "all-at-once" when there are more than one enabled extruders.
+
+ This setting has to be explicitly changed whenever we have more than one enabled extruders to make sure that the
+ Cura UI is properly updated to reset all the UI elements changes that occur due to the one-at-a-time mode (such
+ as the reduced build volume, the different convex hulls of the objects etc.).
+ """
+
+ 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
+ quality_changes_container = self._global_container_stack.qualityChanges
+ print_sequence_quality_changes = quality_changes_container.getProperty(setting_key, "value")
+ print_sequence_user_changes = user_changes_container.getProperty(setting_key, "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)
diff --git a/tests/TestMachineManager.py b/tests/TestMachineManager.py
index 4f15a0670c..788b8eee41 100644
--- a/tests/TestMachineManager.py
+++ b/tests/TestMachineManager.py
@@ -21,7 +21,8 @@ def machine_manager(application, extruder_manager, container_registry, global_st
application.getGlobalContainerStack = MagicMock(return_value = global_stack)
with patch("cura.Settings.CuraContainerRegistry.CuraContainerRegistry.getInstance", MagicMock(return_value=container_registry)):
manager = MachineManager(application)
- manager._onGlobalContainerChanged()
+ with patch.object(MachineManager, "updateNumberExtrudersEnabled", return_value = None):
+ manager._onGlobalContainerChanged()
return manager
@@ -253,4 +254,4 @@ def test_isActiveQualityNotSupported(machine_manager):
def test_isActiveQualityNotSupported_noQualityGroup(machine_manager):
machine_manager.activeQualityGroup = MagicMock(return_value=None)
- assert not machine_manager.isActiveQualitySupported \ No newline at end of file
+ assert not machine_manager.isActiveQualitySupported