mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-24 07:03:56 -06:00
Check if there is an active machine before doing anything else
CURA-4680
This commit is contained in:
parent
aa727df525
commit
c0a502f99c
1 changed files with 20 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue