mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Conflict checker for machine now also checks if there is an actual difference
CURA-1263
This commit is contained in:
parent
053f0ca031
commit
42be3c7472
1 changed files with 16 additions and 4 deletions
|
@ -15,6 +15,7 @@ from cura.Settings.ExtruderManager import ExtruderManager
|
||||||
|
|
||||||
import zipfile
|
import zipfile
|
||||||
import io
|
import io
|
||||||
|
import configparser
|
||||||
|
|
||||||
i18n_catalog = i18nCatalog("cura")
|
i18n_catalog = i18nCatalog("cura")
|
||||||
|
|
||||||
|
@ -62,6 +63,10 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
container_id = self._stripFileToId(container_stack_file)
|
container_id = self._stripFileToId(container_stack_file)
|
||||||
stacks = self._container_registry.findContainerStacks(id=container_id)
|
stacks = self._container_registry.findContainerStacks(id=container_id)
|
||||||
if stacks:
|
if stacks:
|
||||||
|
# Check if there are any changes at all in any of the container stacks.
|
||||||
|
id_list = self._getContainerIdListFromSerialized(archive.open(container_stack_file).read().decode("utf-8"))
|
||||||
|
for index, container_id in enumerate(id_list):
|
||||||
|
if stacks[0].getContainer(index).getId() != container_id:
|
||||||
machine_conflict = True
|
machine_conflict = True
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -161,7 +166,6 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
material_container.deserialize(archive.open(material_container_file).read().decode("utf-8"))
|
material_container.deserialize(archive.open(material_container_file).read().decode("utf-8"))
|
||||||
self._container_registry.addContainer(material_container)
|
self._container_registry.addContainer(material_container)
|
||||||
else:
|
else:
|
||||||
if self._resolve_strategies["material"] == "override":
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -328,3 +332,11 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
for type_name, container_type in self._container_registry.getContainerTypes():
|
for type_name, container_type in self._container_registry.getContainerTypes():
|
||||||
if type_name == "XmlMaterialProfile":
|
if type_name == "XmlMaterialProfile":
|
||||||
return container_type
|
return container_type
|
||||||
|
|
||||||
|
## Get the list of ID's of all containers in a container stack by partially parsing it's serialized data.
|
||||||
|
def _getContainerIdListFromSerialized(self, serialized):
|
||||||
|
parser = configparser.ConfigParser(interpolation=None, empty_lines_in_values=False)
|
||||||
|
parser.read_string(serialized)
|
||||||
|
container_string = parser["general"].get("containers", "")
|
||||||
|
container_list = container_string.split(",")
|
||||||
|
return [container_id for container_id in container_list if container_id != ""]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue