Added machine type to load menu

CURA-1263
This commit is contained in:
Jaime van Kessel 2016-12-16 10:38:30 +01:00
parent 2be773c9a3
commit a7135a0f5f
3 changed files with 43 additions and 0 deletions

View file

@ -55,7 +55,9 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
Logger.log("w", "Could not find reader that was able to read the scene data for 3MF workspace")
return WorkspaceReader.PreReadResult.failed
machine_name = ""
machine_type = ""
# Check if there are any conflicts, so we can ask the user.
archive = zipfile.ZipFile(file_name, "r")
cura_file_names = [name for name in archive.namelist() if name.startswith("Cura/")]
@ -77,6 +79,21 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
machine_conflict = True
Job.yieldThread()
definition_container_files = [name for name in cura_file_names if name.endswith(self._definition_container_suffix)]
for definition_container_file in definition_container_files:
container_id = self._stripFileToId(definition_container_file)
definitions = self._container_registry.findDefinitionContainers(id=container_id)
if not definitions:
definition_container = DefinitionContainer(container_id)
definition_container.deserialize(archive.open(definition_container_file).read().decode("utf-8"))
if definition_container.getMetaDataEntry("type") != "extruder":
machine_type = definition_container.getName()
else:
if definitions[0].getMetaDataEntry("type") != "extruder":
machine_type = definitions[0].getName()
Job.yieldThread()
material_labels = []
material_conflict = False
xml_material_profile = self._getXmlProfileClass()
@ -150,6 +167,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
self._dialog.setActiveMode(active_mode)
self._dialog.setMachineName(machine_name)
self._dialog.setMaterialLabels(material_labels)
self._dialog.setMachineType(machine_type)
self._dialog.setHasObjectsOnPlate(Application.getInstance().getPlatformActivity)
self._dialog.show()