diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index f1bb8b6648..253c5f793c 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -498,6 +498,11 @@ class MachineManager(QObject): @pyqtProperty("QVariantList", notify=activeVariantChanged) def activeVariantNames(self) -> List[str]: result = [] + + # it can happen when there is no active machine + if self._global_container_stack is None: + return result + active_stacks = ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks() if active_stacks is not None: for stack in active_stacks: @@ -510,6 +515,11 @@ class MachineManager(QObject): @pyqtProperty("QVariantList", notify = activeMaterialChanged) def activeMaterialNames(self) -> List[str]: result = [] + + # it can happen when there is no active machine + if self._global_container_stack is None: + return result + active_stacks = ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks() if active_stacks is not None: for stack in active_stacks: @@ -530,6 +540,11 @@ class MachineManager(QObject): @pyqtProperty("QVariantMap", notify = activeVariantChanged) def allActiveVariantIds(self) -> Dict[str, str]: result = {} + + # it can happen when there is no active machine + if self._global_container_stack is None: + return result + active_stacks = ExtruderManager.getInstance().getActiveExtruderStacks() if active_stacks is not None: #If we have a global stack. for stack in active_stacks: @@ -548,6 +563,11 @@ class MachineManager(QObject): @pyqtProperty("QVariantMap", notify = activeMaterialChanged) def allActiveMaterialIds(self) -> Dict[str, str]: result = {} + + # it can happen when there is no active machine + if self._global_container_stack is None: + return result + active_stacks = ExtruderManager.getInstance().getActiveExtruderStacks() result[self._global_container_stack.getId()] = self._global_container_stack.material.getId()