mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Added machine type to load menu
CURA-1263
This commit is contained in:
parent
2be773c9a3
commit
a7135a0f5f
3 changed files with 43 additions and 0 deletions
|
@ -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")
|
Logger.log("w", "Could not find reader that was able to read the scene data for 3MF workspace")
|
||||||
return WorkspaceReader.PreReadResult.failed
|
return WorkspaceReader.PreReadResult.failed
|
||||||
|
|
||||||
|
|
||||||
machine_name = ""
|
machine_name = ""
|
||||||
|
machine_type = ""
|
||||||
# Check if there are any conflicts, so we can ask the user.
|
# Check if there are any conflicts, so we can ask the user.
|
||||||
archive = zipfile.ZipFile(file_name, "r")
|
archive = zipfile.ZipFile(file_name, "r")
|
||||||
cura_file_names = [name for name in archive.namelist() if name.startswith("Cura/")]
|
cura_file_names = [name for name in archive.namelist() if name.startswith("Cura/")]
|
||||||
|
@ -77,6 +79,21 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
machine_conflict = True
|
machine_conflict = True
|
||||||
Job.yieldThread()
|
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_labels = []
|
||||||
material_conflict = False
|
material_conflict = False
|
||||||
xml_material_profile = self._getXmlProfileClass()
|
xml_material_profile = self._getXmlProfileClass()
|
||||||
|
@ -150,6 +167,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
self._dialog.setActiveMode(active_mode)
|
self._dialog.setActiveMode(active_mode)
|
||||||
self._dialog.setMachineName(machine_name)
|
self._dialog.setMachineName(machine_name)
|
||||||
self._dialog.setMaterialLabels(material_labels)
|
self._dialog.setMaterialLabels(material_labels)
|
||||||
|
self._dialog.setMachineType(machine_type)
|
||||||
self._dialog.setHasObjectsOnPlate(Application.getInstance().getPlatformActivity)
|
self._dialog.setHasObjectsOnPlate(Application.getInstance().getPlatformActivity)
|
||||||
self._dialog.show()
|
self._dialog.show()
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ class WorkspaceDialog(QObject):
|
||||||
self._num_settings_overriden_by_quality_changes = 0
|
self._num_settings_overriden_by_quality_changes = 0
|
||||||
self._quality_type = ""
|
self._quality_type = ""
|
||||||
self._machine_name = ""
|
self._machine_name = ""
|
||||||
|
self._machine_type = ""
|
||||||
self._material_labels = []
|
self._material_labels = []
|
||||||
self._objects_on_plate = False
|
self._objects_on_plate = False
|
||||||
|
|
||||||
|
@ -57,6 +58,15 @@ class WorkspaceDialog(QObject):
|
||||||
materialLabelsChanged = pyqtSignal()
|
materialLabelsChanged = pyqtSignal()
|
||||||
objectsOnPlateChanged = pyqtSignal()
|
objectsOnPlateChanged = pyqtSignal()
|
||||||
numUserSettingsChanged = pyqtSignal()
|
numUserSettingsChanged = pyqtSignal()
|
||||||
|
machineTypeChanged = pyqtSignal()
|
||||||
|
|
||||||
|
@pyqtProperty(str, notify=machineTypeChanged)
|
||||||
|
def machineType(self):
|
||||||
|
return self._machine_type
|
||||||
|
|
||||||
|
def setMachineType(self, machine_type):
|
||||||
|
self._machine_type = machine_type
|
||||||
|
self.machineTypeChanged.emit()
|
||||||
|
|
||||||
def setNumUserSettings(self, num_user_settings):
|
def setNumUserSettings(self, num_user_settings):
|
||||||
self._num_user_settings = num_user_settings
|
self._num_user_settings = num_user_settings
|
||||||
|
|
|
@ -82,6 +82,21 @@ UM.Dialog
|
||||||
text: catalog.i18nc("@action:label", "Printer settings")
|
text: catalog.i18nc("@action:label", "Printer settings")
|
||||||
font.bold: true
|
font.bold: true
|
||||||
}
|
}
|
||||||
|
Row
|
||||||
|
{
|
||||||
|
width: parent.width
|
||||||
|
height: childrenRect.height
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
text: catalog.i18nc("@action:label", "Type")
|
||||||
|
width: parent.width / 3
|
||||||
|
}
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
text: manager.machineType
|
||||||
|
width: parent.width / 3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Row
|
Row
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue