mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 21:48:58 +08:00
Check if there is an active machine before doing anything else
CURA-4680
This commit is contained in:
parent
aa727df525
commit
c0a502f99c
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user