mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-13 01:37:51 -06:00
Implemented quality_changes resolve strategy
This enables the creation of a new quality_changes profile if the user chose to do this CURA-1263
This commit is contained in:
parent
377752397f
commit
990736b5c6
1 changed files with 24 additions and 1 deletions
|
@ -162,7 +162,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
if self._resolve_strategies["quality_changes"] == "override":
|
if self._resolve_strategies["quality_changes"] == "override":
|
||||||
quality_changes[0].deserialize(archive.open(instance_container_file).read().decode("utf-8"))
|
quality_changes[0].deserialize(archive.open(instance_container_file).read().decode("utf-8"))
|
||||||
else:
|
else:
|
||||||
quality_changes.deserialize(archive.open(instance_container_file).read().decode("utf-8"))
|
instance_container.deserialize(archive.open(instance_container_file).read().decode("utf-8"))
|
||||||
quality_changes_instance_containers.append(instance_container)
|
quality_changes_instance_containers.append(instance_container)
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
|
@ -195,6 +195,29 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
else:
|
else:
|
||||||
global_stack = stack
|
global_stack = stack
|
||||||
|
|
||||||
|
if self._resolve_strategies["quality_changes"] == "new":
|
||||||
|
# Quality changes needs to get a new ID, added to registry and to the right stacks
|
||||||
|
for container in quality_changes_instance_containers:
|
||||||
|
old_id = container.getId()
|
||||||
|
container.setName(self._container_registry.uniqueName(container.getName()))
|
||||||
|
# We're not really supposed to change the ID in normal cases, but this is an exception.
|
||||||
|
container._id = self._container_registry.uniqueName(container.getId())
|
||||||
|
|
||||||
|
# The container was not added yet, as it didn't have an unique ID. It does now, so add it.
|
||||||
|
self._container_registry.addContainer(container)
|
||||||
|
|
||||||
|
# Replace the quality changes container
|
||||||
|
old_container = global_stack.findContainer({"type": "quality_changes"})
|
||||||
|
if old_container.getId() == old_id:
|
||||||
|
quality_changes_index = global_stack.getContainerIndex(old_container)
|
||||||
|
global_stack.replaceContainer(quality_changes_index, container)
|
||||||
|
|
||||||
|
for stack in extruder_stacks:
|
||||||
|
old_container = stack.findContainer({"type": "quality_changes"})
|
||||||
|
if old_container.getId() == old_id:
|
||||||
|
quality_changes_index = stack.getContainerIndex(old_container)
|
||||||
|
stack.replaceContainer(quality_changes_index, container)
|
||||||
|
|
||||||
# Notify everything/one that is to notify about changes.
|
# Notify everything/one that is to notify about changes.
|
||||||
for container in global_stack.getContainers():
|
for container in global_stack.getContainers():
|
||||||
global_stack.containersChanged.emit(container)
|
global_stack.containersChanged.emit(container)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue