mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Merge branch '3.4'
This commit is contained in:
commit
8202b62343
4 changed files with 17 additions and 10 deletions
|
@ -1243,7 +1243,7 @@ class MachineManager(QObject):
|
||||||
## Given a printer definition name, select the right machine instance. In case it doesn't exist, create a new
|
## Given a printer definition name, select the right machine instance. In case it doesn't exist, create a new
|
||||||
# instance with the same network key.
|
# instance with the same network key.
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
def switchPrinterType(self, machine_name: str):
|
def switchPrinterType(self, machine_name: str) -> None:
|
||||||
# Don't switch if the user tries to change to the same type of printer
|
# Don't switch if the user tries to change to the same type of printer
|
||||||
if self.activeMachineDefinitionName == machine_name:
|
if self.activeMachineDefinitionName == machine_name:
|
||||||
return
|
return
|
||||||
|
@ -1254,6 +1254,8 @@ class MachineManager(QObject):
|
||||||
# If there is no machine, then create a new one and set it to the non-hidden instance
|
# If there is no machine, then create a new one and set it to the non-hidden instance
|
||||||
if not new_machine:
|
if not new_machine:
|
||||||
new_machine = CuraStackBuilder.createMachine(machine_definition_id + "_sync", machine_definition_id)
|
new_machine = CuraStackBuilder.createMachine(machine_definition_id + "_sync", machine_definition_id)
|
||||||
|
if not new_machine:
|
||||||
|
return
|
||||||
new_machine.addMetaDataEntry("um_network_key", self.activeMachineNetworkKey)
|
new_machine.addMetaDataEntry("um_network_key", self.activeMachineNetworkKey)
|
||||||
new_machine.addMetaDataEntry("connect_group_name", self.activeMachineNetworkGroupName)
|
new_machine.addMetaDataEntry("connect_group_name", self.activeMachineNetworkGroupName)
|
||||||
new_machine.addMetaDataEntry("hidden", False)
|
new_machine.addMetaDataEntry("hidden", False)
|
||||||
|
|
|
@ -606,6 +606,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
machine_name = self._container_registry.uniqueName(self._machine_info.name)
|
machine_name = self._container_registry.uniqueName(self._machine_info.name)
|
||||||
|
|
||||||
global_stack = CuraStackBuilder.createMachine(machine_name, self._machine_info.definition_id)
|
global_stack = CuraStackBuilder.createMachine(machine_name, self._machine_info.definition_id)
|
||||||
|
if global_stack: #Only switch if creating the machine was successful.
|
||||||
extruder_stack_dict = global_stack.extruders
|
extruder_stack_dict = global_stack.extruders
|
||||||
|
|
||||||
self._container_registry.addContainer(global_stack)
|
self._container_registry.addContainer(global_stack)
|
||||||
|
|
|
@ -518,9 +518,10 @@ class XmlMaterialProfile(InstanceContainer):
|
||||||
meta_data["name"] = label.text
|
meta_data["name"] = label.text
|
||||||
else:
|
else:
|
||||||
meta_data["name"] = self._profile_name(material.text, color.text)
|
meta_data["name"] = self._profile_name(material.text, color.text)
|
||||||
meta_data["brand"] = brand.text
|
|
||||||
meta_data["material"] = material.text
|
meta_data["brand"] = brand.text if brand.text is not None else "Unknown Brand"
|
||||||
meta_data["color_name"] = color.text
|
meta_data["material"] = material.text if material.text is not None else "Unknown Type"
|
||||||
|
meta_data["color_name"] = color.text if color.text is not None else "Unknown Color"
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# setting_version is derived from the "version" tag in the schema earlier, so don't set it here
|
# setting_version is derived from the "version" tag in the schema earlier, so don't set it here
|
||||||
|
@ -811,9 +812,10 @@ class XmlMaterialProfile(InstanceContainer):
|
||||||
base_metadata["name"] = label.text
|
base_metadata["name"] = label.text
|
||||||
else:
|
else:
|
||||||
base_metadata["name"] = cls._profile_name(material.text, color.text)
|
base_metadata["name"] = cls._profile_name(material.text, color.text)
|
||||||
base_metadata["brand"] = brand.text
|
|
||||||
base_metadata["material"] = material.text
|
base_metadata["brand"] = brand.text if brand.text is not None else "Unknown Brand"
|
||||||
base_metadata["color_name"] = color.text
|
base_metadata["material"] = material.text if material.text is not None else "Unknown Type"
|
||||||
|
base_metadata["color_name"] = color.text if color.text is not None else "Unknown Color"
|
||||||
continue
|
continue
|
||||||
|
|
||||||
#Setting_version is derived from the "version" tag in the schema earlier, so don't set it here.
|
#Setting_version is derived from the "version" tag in the schema earlier, so don't set it here.
|
||||||
|
@ -976,6 +978,8 @@ class XmlMaterialProfile(InstanceContainer):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _profile_name(cls, material_name, color_name):
|
def _profile_name(cls, material_name, color_name):
|
||||||
|
if material_name is None:
|
||||||
|
return "Unknown Material"
|
||||||
if color_name != "Generic":
|
if color_name != "Generic":
|
||||||
return "%s %s" % (color_name, material_name)
|
return "%s %s" % (color_name, material_name)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -482,7 +482,7 @@ Item
|
||||||
{
|
{
|
||||||
var currentItem = materialsModel.getItem(materialListView.currentIndex);
|
var currentItem = materialsModel.getItem(materialListView.currentIndex);
|
||||||
|
|
||||||
materialProperties.name = currentItem.name;
|
materialProperties.name = currentItem.name ? currentItem.name : "Unknown";
|
||||||
materialProperties.guid = currentItem.guid;
|
materialProperties.guid = currentItem.guid;
|
||||||
|
|
||||||
materialProperties.brand = currentItem.brand ? currentItem.brand : "Unknown";
|
materialProperties.brand = currentItem.brand ? currentItem.brand : "Unknown";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue