mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 15:44:04 -06:00
CURA-4680 Checking if there is global stack in the ExtruderManager.
Intead of checking for it in all the methods in MachineManager, now the check is done in ExtruderManager when there is no printer in the list.
This commit is contained in:
parent
c0a502f99c
commit
9561827bda
2 changed files with 5 additions and 22 deletions
|
@ -356,14 +356,16 @@ class ExtruderManager(QObject):
|
||||||
# \return \type{List[ContainerStack]} a list of
|
# \return \type{List[ContainerStack]} a list of
|
||||||
def getActiveExtruderStacks(self) -> List["ExtruderStack"]:
|
def getActiveExtruderStacks(self) -> List["ExtruderStack"]:
|
||||||
global_stack = Application.getInstance().getGlobalContainerStack()
|
global_stack = Application.getInstance().getGlobalContainerStack()
|
||||||
|
if not global_stack:
|
||||||
|
return None
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
machine_extruder_count = global_stack.getProperty("machine_extruder_count", "value")
|
if global_stack.getId() in self._extruder_trains:
|
||||||
|
|
||||||
if global_stack and global_stack.getId() in self._extruder_trains:
|
|
||||||
for extruder in sorted(self._extruder_trains[global_stack.getId()]):
|
for extruder in sorted(self._extruder_trains[global_stack.getId()]):
|
||||||
result.append(self._extruder_trains[global_stack.getId()][extruder])
|
result.append(self._extruder_trains[global_stack.getId()][extruder])
|
||||||
|
|
||||||
|
machine_extruder_count = global_stack.getProperty("machine_extruder_count", "value")
|
||||||
|
|
||||||
return result[:machine_extruder_count]
|
return result[:machine_extruder_count]
|
||||||
|
|
||||||
def __globalContainerStackChanged(self) -> None:
|
def __globalContainerStackChanged(self) -> None:
|
||||||
|
|
|
@ -499,10 +499,6 @@ class MachineManager(QObject):
|
||||||
def activeVariantNames(self) -> List[str]:
|
def activeVariantNames(self) -> List[str]:
|
||||||
result = []
|
result = []
|
||||||
|
|
||||||
# it can happen when there is no active machine
|
|
||||||
if self._global_container_stack is None:
|
|
||||||
return result
|
|
||||||
|
|
||||||
active_stacks = ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks()
|
active_stacks = ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks()
|
||||||
if active_stacks is not None:
|
if active_stacks is not None:
|
||||||
for stack in active_stacks:
|
for stack in active_stacks:
|
||||||
|
@ -516,10 +512,6 @@ class MachineManager(QObject):
|
||||||
def activeMaterialNames(self) -> List[str]:
|
def activeMaterialNames(self) -> List[str]:
|
||||||
result = []
|
result = []
|
||||||
|
|
||||||
# it can happen when there is no active machine
|
|
||||||
if self._global_container_stack is None:
|
|
||||||
return result
|
|
||||||
|
|
||||||
active_stacks = ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks()
|
active_stacks = ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks()
|
||||||
if active_stacks is not None:
|
if active_stacks is not None:
|
||||||
for stack in active_stacks:
|
for stack in active_stacks:
|
||||||
|
@ -541,10 +533,6 @@ class MachineManager(QObject):
|
||||||
def allActiveVariantIds(self) -> Dict[str, str]:
|
def allActiveVariantIds(self) -> Dict[str, str]:
|
||||||
result = {}
|
result = {}
|
||||||
|
|
||||||
# it can happen when there is no active machine
|
|
||||||
if self._global_container_stack is None:
|
|
||||||
return result
|
|
||||||
|
|
||||||
active_stacks = ExtruderManager.getInstance().getActiveExtruderStacks()
|
active_stacks = ExtruderManager.getInstance().getActiveExtruderStacks()
|
||||||
if active_stacks is not None: #If we have a global stack.
|
if active_stacks is not None: #If we have a global stack.
|
||||||
for stack in active_stacks:
|
for stack in active_stacks:
|
||||||
|
@ -564,14 +552,7 @@ class MachineManager(QObject):
|
||||||
def allActiveMaterialIds(self) -> Dict[str, str]:
|
def allActiveMaterialIds(self) -> Dict[str, str]:
|
||||||
result = {}
|
result = {}
|
||||||
|
|
||||||
# it can happen when there is no active machine
|
|
||||||
if self._global_container_stack is None:
|
|
||||||
return result
|
|
||||||
|
|
||||||
active_stacks = ExtruderManager.getInstance().getActiveExtruderStacks()
|
active_stacks = ExtruderManager.getInstance().getActiveExtruderStacks()
|
||||||
|
|
||||||
result[self._global_container_stack.getId()] = self._global_container_stack.material.getId()
|
|
||||||
|
|
||||||
if active_stacks is not None: # If we have extruder stacks
|
if active_stacks is not None: # If we have extruder stacks
|
||||||
for stack in active_stacks:
|
for stack in active_stacks:
|
||||||
material_container = stack.material
|
material_container = stack.material
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue