mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-18 04:07:57 -06:00
Switch early fail around to reduce indentation
Makes this more readable. Contributes to issue CURA-6793.
This commit is contained in:
parent
b137e6a36d
commit
dd8ee2e3d8
1 changed files with 24 additions and 23 deletions
|
@ -323,35 +323,36 @@ class ExtruderManager(QObject):
|
||||||
## Adds the extruders of the currently active machine.
|
## Adds the extruders of the currently active machine.
|
||||||
def _addCurrentMachineExtruders(self) -> None:
|
def _addCurrentMachineExtruders(self) -> None:
|
||||||
global_stack = self._application.getGlobalContainerStack()
|
global_stack = self._application.getGlobalContainerStack()
|
||||||
|
if not global_stack:
|
||||||
|
return
|
||||||
|
|
||||||
extruders_changed = False
|
extruders_changed = False
|
||||||
|
container_registry = ContainerRegistry.getInstance()
|
||||||
|
global_stack_id = global_stack.getId()
|
||||||
|
|
||||||
if global_stack:
|
# Gets the extruder trains that we just created as well as any that still existed.
|
||||||
container_registry = ContainerRegistry.getInstance()
|
extruder_trains = container_registry.findContainerStacks(type = "extruder_train", machine = global_stack_id)
|
||||||
global_stack_id = global_stack.getId()
|
|
||||||
|
|
||||||
# Gets the extruder trains that we just created as well as any that still existed.
|
# Make sure the extruder trains for the new machine can be placed in the set of sets
|
||||||
extruder_trains = container_registry.findContainerStacks(type = "extruder_train", machine = global_stack_id)
|
if global_stack_id not in self._extruder_trains:
|
||||||
|
self._extruder_trains[global_stack_id] = {}
|
||||||
|
extruders_changed = True
|
||||||
|
|
||||||
# Make sure the extruder trains for the new machine can be placed in the set of sets
|
# Register the extruder trains by position
|
||||||
if global_stack_id not in self._extruder_trains:
|
for extruder_train in extruder_trains:
|
||||||
self._extruder_trains[global_stack_id] = {}
|
extruder_position = extruder_train.getMetaDataEntry("position")
|
||||||
extruders_changed = True
|
self._extruder_trains[global_stack_id][extruder_position] = extruder_train
|
||||||
|
|
||||||
# Register the extruder trains by position
|
# regardless of what the next stack is, we have to set it again, because of signal routing. ???
|
||||||
for extruder_train in extruder_trains:
|
extruder_train.setParent(global_stack)
|
||||||
extruder_position = extruder_train.getMetaDataEntry("position")
|
extruder_train.setNextStack(global_stack)
|
||||||
self._extruder_trains[global_stack_id][extruder_position] = extruder_train
|
extruders_changed = True
|
||||||
|
|
||||||
# regardless of what the next stack is, we have to set it again, because of signal routing. ???
|
self.fixSingleExtrusionMachineExtruderDefinition(global_stack)
|
||||||
extruder_train.setParent(global_stack)
|
if extruders_changed:
|
||||||
extruder_train.setNextStack(global_stack)
|
self.extrudersChanged.emit(global_stack_id)
|
||||||
extruders_changed = True
|
self.setActiveExtruderIndex(0)
|
||||||
|
self.activeExtruderChanged.emit()
|
||||||
self.fixSingleExtrusionMachineExtruderDefinition(global_stack)
|
|
||||||
if extruders_changed:
|
|
||||||
self.extrudersChanged.emit(global_stack_id)
|
|
||||||
self.setActiveExtruderIndex(0)
|
|
||||||
self.activeExtruderChanged.emit()
|
|
||||||
|
|
||||||
# After 3.4, all single-extrusion machines have their own extruder definition files instead of reusing
|
# After 3.4, all single-extrusion machines have their own extruder definition files instead of reusing
|
||||||
# "fdmextruder". We need to check a machine here so its extruder definition is correct according to this.
|
# "fdmextruder". We need to check a machine here so its extruder definition is correct according to this.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue