mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Updating when new definition changes should be created when loading project - CURA-4413
This commit is contained in:
parent
ea9d389f99
commit
104926c6ed
2 changed files with 11 additions and 7 deletions
|
@ -222,10 +222,12 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
elif container_type == "definition_changes":
|
elif container_type == "definition_changes":
|
||||||
definition_name = instance_container.getName()
|
definition_name = instance_container.getName()
|
||||||
num_settings_overriden_by_definition_changes += len(instance_container._instances)
|
num_settings_overriden_by_definition_changes += len(instance_container._instances)
|
||||||
|
# Check if definition changes already exists.
|
||||||
definition_changes = self._container_registry.findInstanceContainers(id = container_id)
|
definition_changes = self._container_registry.findInstanceContainers(id = container_id)
|
||||||
containers_found_dict["definition_changes"] = True
|
|
||||||
# Check if there is any difference the loaded settings from the project file and the settings in Cura.
|
# Check if there is any difference the loaded settings from the project file and the settings in Cura.
|
||||||
if definition_changes:
|
if definition_changes:
|
||||||
|
containers_found_dict["definition_changes"] = True
|
||||||
|
# Check if there really is a conflict by comparing the values
|
||||||
if definition_changes[0] != instance_container:
|
if definition_changes[0] != instance_container:
|
||||||
definition_changes_conflict = True
|
definition_changes_conflict = True
|
||||||
elif container_type == "quality":
|
elif container_type == "quality":
|
||||||
|
@ -357,7 +359,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
# - new: create a new container
|
# - new: create a new container
|
||||||
# - override: override the existing container
|
# - override: override the existing container
|
||||||
# - None: There is no conflict, which means containers with the same IDs may or may not be there already.
|
# - None: There is no conflict, which means containers with the same IDs may or may not be there already.
|
||||||
# If there is an existing container, there is no conflict between the them, and default to "override"
|
# If there is an existing container, there is no conflict between them, and default to "override"
|
||||||
# If there is no existing container, default to "new"
|
# If there is no existing container, default to "new"
|
||||||
#
|
#
|
||||||
# Default values
|
# Default values
|
||||||
|
|
|
@ -233,13 +233,15 @@ class WorkspaceDialog(QObject):
|
||||||
self._result["quality_changes"] = None
|
self._result["quality_changes"] = None
|
||||||
if "definition_changes" in self._result and not self._has_definition_changes_conflict:
|
if "definition_changes" in self._result and not self._has_definition_changes_conflict:
|
||||||
self._result["definition_changes"] = None
|
self._result["definition_changes"] = None
|
||||||
|
|
||||||
# If the machine needs to be re-created, the definition_changes should also be re-created.
|
|
||||||
if "machine" in self._result and self._result["machine"] == "new" and self._result["definition_changes"] is None:
|
|
||||||
self._result["definition_changes"] = "new"
|
|
||||||
|
|
||||||
if "material" in self._result and not self._has_material_conflict:
|
if "material" in self._result and not self._has_material_conflict:
|
||||||
self._result["material"] = None
|
self._result["material"] = None
|
||||||
|
|
||||||
|
# If the machine needs to be re-created, the definition_changes should also be re-created.
|
||||||
|
# If the machine strategy is None, it means that there is no name conflict with existing ones. In this case
|
||||||
|
# new definitions changes are created
|
||||||
|
if "machine" in self._result and self._result["machine"] == "new" or self._result["machine"] is None and self._result["definition_changes"] is None:
|
||||||
|
self._result["definition_changes"] = "new"
|
||||||
|
|
||||||
return self._result
|
return self._result
|
||||||
|
|
||||||
def _createViewFromQML(self):
|
def _createViewFromQML(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue