From 7d536e2f8b0c42faa84a38af9d4b5a95809a95f8 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 1 Feb 2017 14:17:23 +0100 Subject: [PATCH] Clarify global container stack checking code in _checkStacksHaveErrors The order of operations was a bit weird. This made the code unclear and also required an extra check in an if-statement. This is simpler and theoretically even a bit faster. Contributes sorta to issue CURA-3291. --- cura/Settings/MachineManager.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index b4cdafa1e9..32664c2ee5 100644 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -381,11 +381,11 @@ class MachineManager(QObject): return UM.Settings.ContainerRegistry.getInstance().createUniqueName(container_type, current_name, new_name, fallback_name) def _checkStacksHaveErrors(self): - if self._global_container_stack is not None and self._global_container_stack.hasErrors(): - return True - - if self._global_container_stack is None: + if self._global_container_stack is None: #No active machine. return False + + if self._global_container_stack.hasErrors(): + return True stacks = list(ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId())) for stack in stacks: if stack.hasErrors():