From da27b0463e1b56cd0fbc10c9d50213a99b3ff60e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 10 Aug 2017 20:14:18 +0200 Subject: [PATCH 1/7] Ignore generated Pirate language This one's auto-generated by 'make extract-messages'. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 3ee62405a2..6a33e104a9 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ __pycache__ docs/html *.log resources/i18n/en +resources/i18n/7s resources/i18n/x-test resources/firmware resources/materials From 5f057f46eaa551b5e8f5f89e994fadc231dcf625 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 10 Aug 2017 20:26:35 +0200 Subject: [PATCH 2/7] Add Pirate language only on Talk Like a Pirate Day Let's see who finds this. --- resources/qml/Preferences/GeneralPage.qml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/resources/qml/Preferences/GeneralPage.qml b/resources/qml/Preferences/GeneralPage.qml index 7c4ad16e10..b35bb6f9ac 100755 --- a/resources/qml/Preferences/GeneralPage.qml +++ b/resources/qml/Preferences/GeneralPage.qml @@ -161,6 +161,12 @@ UM.PreferencesPage append({ text: "Português do Brasil", code: "ptbr" }) append({ text: "Русский", code: "ru" }) append({ text: "Türkçe", code: "tr" }) + + var date_object = new Date(); + if (date_object.getUTCMonth() == 8 && date_object.getUTCDate() == 19) //Only add Pirate on the 19th of September. + { + append({ text: "Pirate", code: "7s" }) + } } } From 1332489391d618dc91c282cad6e63437db8ab858 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 22 Aug 2017 10:42:31 +0200 Subject: [PATCH 3/7] Add comments for upgradeMachineStack() CURA-4188 --- .../VersionUpgrade25to26/VersionUpgrade25to26.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py b/plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py index 9c02d0387e..d270d0f2b7 100644 --- a/plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py +++ b/plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py @@ -114,6 +114,10 @@ class VersionUpgrade25to26(VersionUpgrade): parser.write(output) return [filename], [output.getvalue()] + ## Upgrades a machine stack from version 2.5 to 2.6 + # + # \param serialised The serialised form of a quality profile. + # \param filename The name of the file to upgrade. def upgradeMachineStack(self, serialised, filename): parser = configparser.ConfigParser(interpolation=None) parser.read_string(serialised) From 72575eaf370c99a148edd942636dac28fd4bb0a6 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 22 Aug 2017 10:44:15 +0200 Subject: [PATCH 4/7] Rename function to _acquireNextUniqueCustomFdmPrinterExtruderStackIdIndex() CURA-4188 --- .../VersionUpgrade25to26/VersionUpgrade25to26.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py b/plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py index d270d0f2b7..2b8a5fe69c 100644 --- a/plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py +++ b/plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py @@ -131,7 +131,7 @@ class VersionUpgrade25to26(VersionUpgrade): if definition_container_id == "custom" and not self._checkCustomFdmPrinterHasExtruderStack(machine_id): # go through all extruders and make sure that this custom FDM printer has 8 extruder stacks. - self._getNextUniqueCustomFdmPrinterExtruderStackIdIndex() + self._acquireNextUniqueCustomFdmPrinterExtruderStackIdIndex() for position in range(8): self._createCustomFdmPrinterExtruderStack(machine_id, position, quality_container_id, material_container_id) @@ -145,7 +145,8 @@ class VersionUpgrade25to26(VersionUpgrade): return [filename], [output.getvalue()] - def _getNextUniqueCustomFdmPrinterExtruderStackIdIndex(self): + ## Acquires the next unique extruder stack index number for the Custom FDM Printer. + def _acquireNextUniqueCustomFdmPrinterExtruderStackIdIndex(self): extruder_stack_dir = Resources.getPath(CuraApplication.ResourceTypes.ExtruderStack) file_name_list = os.listdir(extruder_stack_dir) file_name_list = [os.path.basename(file_name) for file_name in file_name_list] From 3d75342a11398c060b189d26225a457d5851d1ca Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 22 Aug 2017 10:51:13 +0200 Subject: [PATCH 5/7] Stop the loop if any extruder is found CURA-4188 --- .../VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py b/plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py index 2b8a5fe69c..88de81d10b 100644 --- a/plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py +++ b/plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py @@ -190,6 +190,7 @@ class VersionUpgrade25to26(VersionUpgrade): if machine_id != parser["metadata"]["machine"]: continue has_extruders = True + break return has_extruders From 812e262f394abdb4c5bab976886e3d106131941b Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 22 Aug 2017 11:28:43 +0200 Subject: [PATCH 6/7] When deserialising a material, also update the material derived from it CURA-4204 --- .../XmlMaterialProfile/XmlMaterialProfile.py | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index 41d45cfc9b..c81e23b219 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -548,7 +548,17 @@ class XmlMaterialProfile(InstanceContainer): if machine_compatibility: new_material_id = self.id + "_" + machine_id - new_material = XmlMaterialProfile(new_material_id) + # The child or derived material container may already exist. This can happen when a material in a + # project file and the a material in Cura have the same ID. + # In the case if a derived material already exists, override that material container because if + # the data in the parent material has been changed, the derived ones should be updated too. + found_materials = ContainerRegistry.getInstance().findInstanceContainers(id = new_material_id) + is_new_material = False + if found_materials: + new_material = found_materials[0] + else: + new_material = XmlMaterialProfile(new_material_id) + is_new_material = True # Update the private directly, as we want to prevent the lookup that is done when using setName new_material._name = self.getName() @@ -562,7 +572,8 @@ class XmlMaterialProfile(InstanceContainer): new_material._dirty = False - ContainerRegistry.getInstance().addContainer(new_material) + if is_new_material: + ContainerRegistry.getInstance().addContainer(new_material) hotends = machine.iterfind("./um:hotend", self.__namespaces) for hotend in hotends: @@ -594,7 +605,15 @@ class XmlMaterialProfile(InstanceContainer): new_hotend_id = self.id + "_" + machine_id + "_" + hotend_id.replace(" ", "_") - new_hotend_material = XmlMaterialProfile(new_hotend_id) + # Same as machine compatibility, keep the derived material containers consistent with the parent + # material + found_materials = ContainerRegistry.getInstance().findInstanceContainers(id = new_hotend_id) + is_new_material = False + if found_materials: + new_hotend_material = found_materials[0] + else: + new_hotend_material = XmlMaterialProfile(new_hotend_id) + is_new_material = True # Update the private directly, as we want to prevent the lookup that is done when using setName new_hotend_material._name = self.getName() @@ -612,7 +631,8 @@ class XmlMaterialProfile(InstanceContainer): new_hotend_material._dirty = False - ContainerRegistry.getInstance().addContainer(new_hotend_material) + if is_new_material: + ContainerRegistry.getInstance().addContainer(new_hotend_material) def _addSettingElement(self, builder, instance): try: From 39ab740adb013023ad408a4a3b2575d19a1a6f11 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 22 Aug 2017 13:35:51 +0200 Subject: [PATCH 7/7] Adding binding for per-object settings to update stack ID CURA-4186 The stack ID to use for a setting in per-object settings is not updated when it is set to limit to extruder. --- .../PerObjectSettingsPanel.qml | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml index c30c6c8d6a..9b235aeac8 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml +++ b/plugins/PerObjectSettingsTool/PerObjectSettingsPanel.qml @@ -151,10 +151,43 @@ Item { UM.SettingPropertyProvider { id: inheritStackProvider - containerStackId: Cura.MachineManager.activeMachineId + containerStackId: UM.ActiveTool.properties.getValue("ContainerID") key: model.key watchedProperties: [ "limit_to_extruder" ] } + + Binding + { + target: provider + property: "containerStackId" + when: model.settable_per_extruder || (inheritStackProvider.properties.limit_to_extruder != null && inheritStackProvider.properties.limit_to_extruder >= 0); + value: + { + // associate this binding with Cura.MachineManager.activeMachineId in the beginning so this + // binding will be triggered when activeMachineId is changed too. + // Otherwise, if this value only depends on the extruderIds, it won't get updated when the + // machine gets changed. + var activeMachineId = Cura.MachineManager.activeMachineId; + + if(!model.settable_per_extruder || machineExtruderCount.properties.value == 1) + { + //Not settable per extruder or there only is global, so we must pick global. + return activeMachineId; + } + if(inheritStackProvider.properties.limit_to_extruder != null && inheritStackProvider.properties.limit_to_extruder >= 0) + { + //We have limit_to_extruder, so pick that stack. + return ExtruderManager.extruderIds[String(inheritStackProvider.properties.limit_to_extruder)]; + } + if(ExtruderManager.activeExtruderStackId) + { + //We're on an extruder tab. Pick the current extruder. + return ExtruderManager.activeExtruderStackId; + } + //No extruder tab is selected. Pick the global stack. Shouldn't happen any more since we removed the global tab. + return activeMachineId; + } + } } } }