From 0d9b64c8bd437efcd31f4c1d3113c93a060bdd69 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 14 Dec 2016 11:49:20 +0100 Subject: [PATCH 01/13] Fixed race condition which caused kitten to pop up when deleting printer. --- cura/Settings/ExtruderManager.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cura/Settings/ExtruderManager.py b/cura/Settings/ExtruderManager.py index 4d4f66652e..a0db1bbf83 100644 --- a/cura/Settings/ExtruderManager.py +++ b/cura/Settings/ExtruderManager.py @@ -351,8 +351,11 @@ class ExtruderManager(QObject): #The platform adhesion extruder. Not used if using none. if global_stack.getProperty("adhesion_type", "value") != "none": used_extruder_stack_ids.add(self.extruderIds[str(global_stack.getProperty("adhesion_extruder_nr", "value"))]) - - return [container_registry.findContainerStacks(id = stack_id)[0] for stack_id in used_extruder_stack_ids] + try: + return [container_registry.findContainerStacks(id = stack_id)[0] for stack_id in used_extruder_stack_ids] + except IndexError: # One or more of the extruders was not found. + UM.Logger.log("e", "Unable to find one or more of the extruders in %s", used_extruder_stack_ids) + return [] ## Removes the container stack and user profile for the extruders for a specific machine. # From 0bdd06735e81882c57e7ac1865ab2808cfc3c868 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 14 Dec 2016 11:52:02 +0100 Subject: [PATCH 02/13] Fixed another race condition that sometimes triggered when loading projects CURA-1263 --- plugins/SolidView/SolidView.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/SolidView/SolidView.py b/plugins/SolidView/SolidView.py index 33c21acb08..8277813c92 100644 --- a/plugins/SolidView/SolidView.py +++ b/plugins/SolidView/SolidView.py @@ -86,8 +86,10 @@ class SolidView(View): extruder_id = node.callDecoration("getActiveExtruder") if extruder_id: extruder_index = max(0, self._extruders_model.find("id", extruder_id)) - - material_color = self._extruders_model.getItem(extruder_index)["color"] + try: + material_color = self._extruders_model.getItem(extruder_index)["color"] + except KeyError: + material_color = self._extruders_model.defaultColors[0] if extruder_index != ExtruderManager.getInstance().activeExtruderIndex: # Shade objects that are printed with the non-active extruder 25% darker From 0561419a4f888560b8d129ddb29ae02dd90e96ff Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Tue, 13 Dec 2016 11:13:53 +0100 Subject: [PATCH 03/13] Fix bottom of ("other") printer list being overlapped by machine name --- resources/qml/AddMachineDialog.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/qml/AddMachineDialog.qml b/resources/qml/AddMachineDialog.qml index 80ac1213a8..203ef9dfba 100644 --- a/resources/qml/AddMachineDialog.qml +++ b/resources/qml/AddMachineDialog.qml @@ -46,7 +46,8 @@ UM.Dialog left: parent.left; top: parent.top; right: parent.right; - bottom: parent.bottom; + bottom: machineName.top; + bottomMargin: UM.Theme.getSize("default_margin").height } ListView From ca20446752843b7d49a37605a901e900971af740 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Tue, 13 Dec 2016 11:21:34 +0100 Subject: [PATCH 04/13] Increase size of machine sections to include the full section name --- resources/qml/AddMachineDialog.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/AddMachineDialog.qml b/resources/qml/AddMachineDialog.qml index 203ef9dfba..4b99a35458 100644 --- a/resources/qml/AddMachineDialog.qml +++ b/resources/qml/AddMachineDialog.qml @@ -66,6 +66,7 @@ UM.Dialog section.delegate: Button { text: section + width: machineList.width style: ButtonStyle { background: Rectangle From 002605f666e6c5756a16ec2452bc5b630f2dbae7 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Tue, 13 Dec 2016 11:32:12 +0100 Subject: [PATCH 05/13] Fix selecting a printer from the current section when switching sections Broken since this change: 42fc25ab09abd044fcd3a12e87586b4edb286460 --- resources/qml/AddMachineDialog.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/AddMachineDialog.qml b/resources/qml/AddMachineDialog.qml index 4b99a35458..c35008178d 100644 --- a/resources/qml/AddMachineDialog.qml +++ b/resources/qml/AddMachineDialog.qml @@ -104,8 +104,8 @@ UM.Dialog base.activeCategory = section; if (machineList.model.getItem(machineList.currentIndex).section != section) { // Find the first machine from this section - for(var i = 0; i < sortedMachineDefinitionsModel.count; i++) { - var item = sortedMachineDefinitionsModel.getItem(i); + for(var i = 0; i < machineList.model.rowCount(); i++) { + var item = machineList.model.getItem(i); if (item.section == section) { machineList.currentIndex = i; break; From d145eb1f67fd42b2ac565cddaedf16ddb58d77ed Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Tue, 13 Dec 2016 11:40:30 +0100 Subject: [PATCH 06/13] Add label to machine name input field --- resources/qml/AddMachineDialog.qml | 40 +++++++++++++++++++----------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/resources/qml/AddMachineDialog.qml b/resources/qml/AddMachineDialog.qml index c35008178d..8506074b0d 100644 --- a/resources/qml/AddMachineDialog.qml +++ b/resources/qml/AddMachineDialog.qml @@ -46,7 +46,7 @@ UM.Dialog left: parent.left; top: parent.top; right: parent.right; - bottom: machineName.top; + bottom: machineNameRow.top; bottomMargin: UM.Theme.getSize("default_margin").height } @@ -171,21 +171,33 @@ UM.Dialog } } - TextField + Row { - id: machineName; - text: getMachineName() - implicitWidth: UM.Theme.getSize("standard_list_input").width - maximumLength: 40 - //validator: Cura.MachineNameValidator { } //TODO: Gives a segfault in PyQt5.6. For now, we must use a signal on text changed. - validator: RegExpValidator - { - regExp: { - machineName.machine_name_validator.machineNameRegex - } - } - property var machine_name_validator: Cura.MachineNameValidator { } + id: machineNameRow anchors.bottom:parent.bottom + spacing: UM.Theme.getSize("default_margin").width + + Label + { + text: catalog.i18nc("@label", "Printer Name:") + anchors.verticalCenter: machineName.verticalCenter + } + + TextField + { + id: machineName + text: getMachineName() + implicitWidth: UM.Theme.getSize("standard_list_input").width + maximumLength: 40 + //validator: Cura.MachineNameValidator { } //TODO: Gives a segfault in PyQt5.6. For now, we must use a signal on text changed. + validator: RegExpValidator + { + regExp: { + machineName.machine_name_validator.machineNameRegex + } + } + property var machine_name_validator: Cura.MachineNameValidator { } + } } Button From eb5d63e5482796b416fbfa16b88d7da756e81d8b Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 14 Dec 2016 12:04:28 +0100 Subject: [PATCH 07/13] Guard against infill density being 0 Otherwise the logarithm is undefined Contributes to issue CURA-3137. --- resources/definitions/fdmprinter.def.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index 8dec4a307e..e63485ed35 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -1190,7 +1190,7 @@ "type": "int", "minimum_value": "0", "maximum_value_warning": "4", - "maximum_value": "20 - math.log(infill_line_distance) / math.log(2)", + "maximum_value": "(20 - math.log(infill_line_distance) / math.log(2)) if infill_line_distance > 1 else 1", "enabled": "infill_sparse_density > 0 and infill_pattern != 'cubicsubdiv'", "settable_per_mesh": true }, From 2c79efd8bd9b7c04bb57b924f05ec6e3d3944817 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Wed, 14 Dec 2016 13:01:32 +0100 Subject: [PATCH 08/13] Fix [containers] items must be strings --- plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py b/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py index 04267f45f1..a28a9f9208 100644 --- a/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py +++ b/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py @@ -62,7 +62,7 @@ class VersionUpgrade22to24(VersionUpgrade): config.remove_option("general", "containers") for index in range(len(container_list)): - config.set("containers", index, container_list[index]) + config.set("containers", str(index), container_list[index]) output = io.StringIO() config.write(output) From dcae7575e4b8608c80d0df652f1458d2ce35eb56 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Wed, 14 Dec 2016 13:07:12 +0100 Subject: [PATCH 09/13] Fix extraneous empty ("") container being added --- plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py b/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py index a28a9f9208..04700853dd 100644 --- a/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py +++ b/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py @@ -48,6 +48,8 @@ class VersionUpgrade22to24(VersionUpgrade): # Change the name of variant and insert empty_variant into the stack. new_container_list = [] for item in container_list: + if not item: # the last item may be an empty string + continue if item == variant_name: new_container_list.append(config_name) new_container_list.append("empty_variant") From 92505206282ad25b25d4c9f45edb3fe70d5b6e27 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Wed, 14 Dec 2016 13:08:18 +0100 Subject: [PATCH 10/13] Fix variant before definition_changes --- plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py b/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py index 04700853dd..b820306fe1 100644 --- a/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py +++ b/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py @@ -51,8 +51,8 @@ class VersionUpgrade22to24(VersionUpgrade): if not item: # the last item may be an empty string continue if item == variant_name: - new_container_list.append(config_name) new_container_list.append("empty_variant") + new_container_list.append(config_name) else: new_container_list.append(item) From f4fa3ac53f3bde4ce59b6ca4617abfaeb0ab0813 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 14 Dec 2016 13:50:16 +0100 Subject: [PATCH 11/13] Add translation for UM3 and UM3E from XML profiles Otherwise it would remove all spaces and put everything lowercase, but that didn't work for UM3E. Contributes to issue CURA-2575. --- plugins/XmlMaterialProfile/XmlMaterialProfile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index fa0d3d2b8c..a0e80df436 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -594,6 +594,8 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): # Map XML file product names to internal ids # TODO: Move this to definition's metadata __product_id_map = { + "Ultimaker 3": "ultimaker3", + "Ultimaker 3 Extended": "ultimaker3_extended", "Ultimaker 2": "ultimaker2", "Ultimaker 2+": "ultimaker2_plus", "Ultimaker 2 Go": "ultimaker2_go", From 22012bdb1cb572a80e81489b2771056ef92f02be Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Wed, 14 Dec 2016 11:37:29 +0100 Subject: [PATCH 12/13] Show the Z seam related settings after upgrade. CURA-2953 --- .../VersionUpgrade22to24/VersionUpgrade.py | 21 +++++++++++++++++++ .../VersionUpgrade22to24/__init__.py | 6 ++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py b/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py index b820306fe1..1dd6a504ee 100644 --- a/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py +++ b/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py @@ -8,6 +8,7 @@ import io from UM import Resources from UM.VersionUpgrade import VersionUpgrade # Superclass of the plugin. +import UM.VersionUpgrade class VersionUpgrade22to24(VersionUpgrade): @@ -120,6 +121,26 @@ class VersionUpgrade22to24(VersionUpgrade): config.write(output) return [filename], [output.getvalue()] + def upgradePreferences(self, serialised, filename): + config = configparser.ConfigParser(interpolation = None) + config.read_string(serialised) + + if not config.has_section("general"): + raise UM.VersionUpgrade.FormatException("No \"general\" section.") + + # Make z_seam_x and z_seam_y options visible. In a clean 2.4 they are visible by default. + if config.has_option("general", "visible_settings"): + visible_settings = config.get("general", "visible_settings") + visible_set = set(visible_settings.split(";")) + visible_set.add("z_seam_x") + visible_set.add("z_seam_y") + config.set("general", "visible_settings", ";".join(visible_set)) + config.set("general", "version", value="4") + + output = io.StringIO() + config.write(output) + return [filename], [output.getvalue()] + def getCfgVersion(self, serialised): parser = configparser.ConfigParser(interpolation = None) parser.read_string(serialised) diff --git a/plugins/VersionUpgrade/VersionUpgrade22to24/__init__.py b/plugins/VersionUpgrade/VersionUpgrade22to24/__init__.py index 85d53199e4..e1114922d6 100644 --- a/plugins/VersionUpgrade/VersionUpgrade22to24/__init__.py +++ b/plugins/VersionUpgrade/VersionUpgrade22to24/__init__.py @@ -20,8 +20,10 @@ def getMetaData(): "version_upgrade": { # From To Upgrade function ("machine_instance", 2): ("machine_stack", 3, upgrade.upgradeMachineInstance), - ("extruder_train", 2): ("extruder_train", 3, upgrade.upgradeExtruderTrain) - }, + ("extruder_train", 2): ("extruder_train", 3, upgrade.upgradeExtruderTrain), + ("preferences", 3): ("preferences", 4, upgrade.upgradePreferences) + + }, "sources": { "machine_stack": { "get_version": upgrade.getCfgVersion, From 2fe0bab52d2b0eabc2d321e5e3ee561f6fe691cb Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 14 Dec 2016 14:21:02 +0100 Subject: [PATCH 13/13] Inherit gradual infill steps for line distances below 1mm too A miscalculation on my part: A negative result of the logarithm would result in a more positive final result for the maximum value, not a negative final result. Contributes to issue CURA-3137. --- resources/definitions/fdmprinter.def.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index e63485ed35..7725940553 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -1190,7 +1190,7 @@ "type": "int", "minimum_value": "0", "maximum_value_warning": "4", - "maximum_value": "(20 - math.log(infill_line_distance) / math.log(2)) if infill_line_distance > 1 else 1", + "maximum_value": "(20 - math.log(infill_line_distance) / math.log(2)) if infill_line_distance > 0 else 0", "enabled": "infill_sparse_density > 0 and infill_pattern != 'cubicsubdiv'", "settable_per_mesh": true },