From a1d7eefc425d6865115e76ea2c749376764741e9 Mon Sep 17 00:00:00 2001 From: Kostas Karmas Date: Mon, 16 Dec 2019 14:04:16 +0100 Subject: [PATCH 1/2] Fix PPA crashing on single-extruder printers The machine manager was leading to a crash when trying to enable the second extruder in single-extrusion printers, because the check for the second extruder was not correctly implemented. This commit fixes that issue by checking if the global stack has the specified extruder. If it does not, then the function returns while logging the issue. CURA-7048 --- cura/Settings/MachineManager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index de6e270a86..3167bf78b9 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -894,8 +894,8 @@ class MachineManager(QObject): @pyqtSlot(int, bool) def setExtruderEnabled(self, position: int, enabled: bool) -> None: - if self._global_container_stack is None: - Logger.log("w", "Could not find extruder on position %s", position) + if self._global_container_stack is None or position not in self._global_container_stack.extruders: + Logger.log("w", "Could not find extruder on position %s.", position) return extruder = self._global_container_stack.extruderList[position] From 50b8ff235250983cd958b6dfeb0f821fb9f1664a Mon Sep 17 00:00:00 2001 From: Kostas Karmas Date: Tue, 17 Dec 2019 09:43:13 +0100 Subject: [PATCH 2/2] Fix check that finds the extruder in a position CURA-7048 --- cura/Settings/MachineManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 3167bf78b9..7774a5a52e 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -894,7 +894,7 @@ class MachineManager(QObject): @pyqtSlot(int, bool) def setExtruderEnabled(self, position: int, enabled: bool) -> None: - if self._global_container_stack is None or position not in self._global_container_stack.extruders: + if self._global_container_stack is None or str(position) not in self._global_container_stack.extruders: Logger.log("w", "Could not find extruder on position %s.", position) return extruder = self._global_container_stack.extruderList[position]