mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 14:44:13 -06:00
Merge branch '4.0'
This commit is contained in:
commit
1d25f52df6
10 changed files with 65 additions and 26 deletions
|
@ -537,6 +537,16 @@ class MaterialManager(QObject):
|
|||
return
|
||||
|
||||
nodes_to_remove = [material_group.root_material_node] + material_group.derived_material_node_list
|
||||
# Sort all nodes with respect to the container ID lengths in the ascending order so the base material container
|
||||
# will be the first one to be removed. We need to do this to ensure that all containers get loaded & deleted.
|
||||
nodes_to_remove = sorted(nodes_to_remove, key = lambda x: len(x.getMetaDataEntry("id", "")))
|
||||
# Try to load all containers first. If there is any faulty ones, they will be put into the faulty container
|
||||
# list, so removeContainer() can ignore those ones.
|
||||
for node in nodes_to_remove:
|
||||
container_id = node.getMetaDataEntry("id", "")
|
||||
results = self._container_registry.findContainers(id = container_id)
|
||||
if not results:
|
||||
self._container_registry.addWrongContainerId(container_id)
|
||||
for node in nodes_to_remove:
|
||||
self._container_registry.removeContainer(node.getMetaDataEntry("id", ""))
|
||||
|
||||
|
|
|
@ -338,7 +338,7 @@ class ExtruderManager(QObject):
|
|||
extruder_train.setNextStack(global_stack)
|
||||
extruders_changed = True
|
||||
|
||||
self._fixSingleExtrusionMachineExtruderDefinition(global_stack)
|
||||
self.fixSingleExtrusionMachineExtruderDefinition(global_stack)
|
||||
if extruders_changed:
|
||||
self.extrudersChanged.emit(global_stack_id)
|
||||
self.setActiveExtruderIndex(0)
|
||||
|
@ -346,7 +346,7 @@ class ExtruderManager(QObject):
|
|||
|
||||
# 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.
|
||||
def _fixSingleExtrusionMachineExtruderDefinition(self, global_stack: "GlobalStack") -> None:
|
||||
def fixSingleExtrusionMachineExtruderDefinition(self, global_stack: "GlobalStack") -> None:
|
||||
container_registry = ContainerRegistry.getInstance()
|
||||
expected_extruder_definition_0_id = global_stack.getMetaDataEntry("machine_extruder_trains")["0"]
|
||||
extruder_stack_0 = global_stack.extruders.get("0")
|
||||
|
|
|
@ -357,7 +357,7 @@ class MachineManager(QObject):
|
|||
# Make sure that the default machine actions for this machine have been added
|
||||
self._application.getMachineActionManager().addDefaultMachineActions(global_stack)
|
||||
|
||||
ExtruderManager.getInstance()._fixSingleExtrusionMachineExtruderDefinition(global_stack)
|
||||
ExtruderManager.getInstance().fixSingleExtrusionMachineExtruderDefinition(global_stack)
|
||||
if not global_stack.isValid():
|
||||
# Mark global stack as invalid
|
||||
ConfigurationErrorMessage.getInstance().addFaultyContainers(global_stack.getId())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue