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.
This commit is contained in:
Ghostkeeper 2017-02-01 14:17:23 +01:00
parent 31e88aa5af
commit 7d536e2f8b
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75

View file

@ -381,11 +381,11 @@ class MachineManager(QObject):
return UM.Settings.ContainerRegistry.getInstance().createUniqueName(container_type, current_name, new_name, fallback_name) return UM.Settings.ContainerRegistry.getInstance().createUniqueName(container_type, current_name, new_name, fallback_name)
def _checkStacksHaveErrors(self): def _checkStacksHaveErrors(self):
if self._global_container_stack is not None and self._global_container_stack.hasErrors(): if self._global_container_stack is None: #No active machine.
return True
if self._global_container_stack is None:
return False return False
if self._global_container_stack.hasErrors():
return True
stacks = list(ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId())) stacks = list(ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId()))
for stack in stacks: for stack in stacks:
if stack.hasErrors(): if stack.hasErrors():