From 9dd352750488cd700704511c90bc1f36b24be0cd Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 5 Jul 2017 16:03:57 +0200 Subject: [PATCH 01/10] Blur setting text fields when clicking buttons Otherwise the setting is not applied yet by the time you duplicate or export a profile. Contributes to issue CURA-4011. --- resources/qml/Preferences/MaterialsPage.qml | 25 ++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/resources/qml/Preferences/MaterialsPage.qml b/resources/qml/Preferences/MaterialsPage.qml index e5051dd5d3..b4ee4d5c49 100644 --- a/resources/qml/Preferences/MaterialsPage.qml +++ b/resources/qml/Preferences/MaterialsPage.qml @@ -1,5 +1,5 @@ -// Copyright (c) 2016 Ultimaker B.V. -// Cura is released under the terms of the AGPLv3 or higher. +//Copyright (c) 2017 Ultimaker B.V. +//Cura is released under the terms of the AGPLv3 or higher. import QtQuick 2.1 import QtQuick.Controls 1.1 @@ -139,6 +139,7 @@ UM.ManagementPage enabled: base.currentItem != null && base.currentItem.id != Cura.MachineManager.activeMaterialId && Cura.MachineManager.hasMaterials onClicked: { + forceActiveFocus(); Cura.MachineManager.setActiveMaterial(base.currentItem.id) currentItem = base.model.getItem(base.objectList.currentIndex) // Refresh the current item. } @@ -149,6 +150,7 @@ UM.ManagementPage iconName: "list-add" onClicked: { + forceActiveFocus(); var material_id = Cura.ContainerManager.createMaterial() if(material_id == "") { @@ -168,6 +170,7 @@ UM.ManagementPage enabled: base.currentItem != null onClicked: { + forceActiveFocus(); var base_file = Cura.ContainerManager.getContainerMetaDataEntry(base.currentItem.id, "base_file") // We need to copy the base container instead of the specific variant. var material_id = base_file == "" ? Cura.ContainerManager.duplicateMaterial(base.currentItem.id): Cura.ContainerManager.duplicateMaterial(base_file) @@ -187,20 +190,32 @@ UM.ManagementPage text: catalog.i18nc("@action:button", "Remove"); iconName: "list-remove"; enabled: base.currentItem != null && !base.currentItem.readOnly && !Cura.ContainerManager.isContainerUsed(base.currentItem.id) - onClicked: confirmDialog.open() + onClicked: + { + forceActiveFocus(); + confirmDialog.open(); + } }, Button { text: catalog.i18nc("@action:button", "Import"); iconName: "document-import"; - onClicked: importDialog.open(); + onClicked: + { + forceActiveFocus(); + importDialog.open(); + } visible: true; }, Button { text: catalog.i18nc("@action:button", "Export") iconName: "document-export" - onClicked: exportDialog.open() + onClicked: + { + forceActiveFocus(); + exportDialog.open(); + } enabled: currentItem != null } ] From 271d4a30f06964f0bd85e6a46f712f95e7ed2400 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 5 Jul 2017 16:22:24 +0200 Subject: [PATCH 02/10] Set Support Z Distance equal to what it's at for UM3 The old value was giving a warning and the new value was better tested for UM3. We knew that this was sorta wrong. Suggested by the materials team. --- resources/quality/ultimaker2_plus/um2p_tpu_0.25_high.inst.cfg | 2 +- resources/quality/ultimaker2_plus/um2p_tpu_0.4_normal.inst.cfg | 3 +-- resources/quality/ultimaker2_plus/um2p_tpu_0.6_fast.inst.cfg | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/resources/quality/ultimaker2_plus/um2p_tpu_0.25_high.inst.cfg b/resources/quality/ultimaker2_plus/um2p_tpu_0.25_high.inst.cfg index ed526b705c..36a8c479a7 100644 --- a/resources/quality/ultimaker2_plus/um2p_tpu_0.25_high.inst.cfg +++ b/resources/quality/ultimaker2_plus/um2p_tpu_0.25_high.inst.cfg @@ -31,7 +31,7 @@ infill_sparse_density = 10 cool_fan_speed = 60 speed_travel = 150 speed_support = 40 -support_z_distance = 0.45 +support_z_distance = =layer_height * 2 cool_fan_speed_min = =cool_fan_speed * 35 / 60 brim_line_count = 8 retraction_hop_enabled = 0.2 diff --git a/resources/quality/ultimaker2_plus/um2p_tpu_0.4_normal.inst.cfg b/resources/quality/ultimaker2_plus/um2p_tpu_0.4_normal.inst.cfg index 76f09c0db9..00e4b59181 100644 --- a/resources/quality/ultimaker2_plus/um2p_tpu_0.4_normal.inst.cfg +++ b/resources/quality/ultimaker2_plus/um2p_tpu_0.4_normal.inst.cfg @@ -13,7 +13,7 @@ setting_version = 1 [values] support_xy_distance = 0.65 speed_travel = 150 -support_z_distance = 0.45 +support_z_distance = =layer_height * 2 speed_wall_x = 35 cool_min_speed = 15 cool_fan_speed = 60 @@ -37,4 +37,3 @@ speed_print = 40 support_angle = 45 cool_min_layer_time = 10 raft_base_line_width = 0.8 - diff --git a/resources/quality/ultimaker2_plus/um2p_tpu_0.6_fast.inst.cfg b/resources/quality/ultimaker2_plus/um2p_tpu_0.6_fast.inst.cfg index 22fda17c62..ed15c13f94 100644 --- a/resources/quality/ultimaker2_plus/um2p_tpu_0.6_fast.inst.cfg +++ b/resources/quality/ultimaker2_plus/um2p_tpu_0.6_fast.inst.cfg @@ -33,7 +33,7 @@ support_angle = 45 infill_sparse_density = 10 cool_fan_speed = 60 speed_support = 40 -support_z_distance = 0.45 +support_z_distance = =layer_height * 2 cool_fan_speed_min = =cool_fan_speed * 35 / 60 brim_line_count = 8 retraction_hop_enabled = 0.2 From bb68f488dbf9af533b59b11ae3908e5c9b137e3a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 6 Jul 2017 09:41:28 +0200 Subject: [PATCH 03/10] Make material finding more robust The .findContainer technique is obsolete since we now just have a field for this. Hopefully contributes to issue #2053. --- plugins/CuraEngineBackend/ProcessSlicedLayersJob.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py b/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py index ecaebb816d..58c75fff3f 100644 --- a/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py +++ b/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py @@ -173,19 +173,16 @@ class ProcessSlicedLayersJob(Job): if extruders: material_color_map = numpy.zeros((len(extruders), 4), dtype=numpy.float32) for extruder in extruders: - material = extruder.findContainer({"type": "material"}) position = int(extruder.getMetaDataEntry("position", default="0")) # Get the position - color_code = material.getMetaDataEntry("color_code", default="#e0e000") + color_code = extruder.material.getMetaDataEntry("color_code", default="#e0e000") color = colorCodeToRGBA(color_code) material_color_map[position, :] = color else: # Single extruder via global stack. material_color_map = numpy.zeros((1, 4), dtype=numpy.float32) - material = global_container_stack.findContainer({"type": "material"}) color_code = "#e0e000" - if material: - if material.getMetaDataEntry("color_code") is not None: - color_code = material.getMetaDataEntry("color_code") + if global_container_stack.material.getMetaDataEntry("color_code") is not None: + color_code = global_container_stack.material.getMetaDataEntry("color_code") color = colorCodeToRGBA(color_code) material_color_map[0, :] = color From 6cac15de7d9b9eaf98fd8bef291ba4b6f0470791 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 6 Jul 2017 09:48:36 +0200 Subject: [PATCH 04/10] Use default parameter to obtain default colour There is a built-in mechanism for this, so we don't need to do this ourselves. --- plugins/CuraEngineBackend/ProcessSlicedLayersJob.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py b/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py index 58c75fff3f..15cda75eb8 100644 --- a/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py +++ b/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py @@ -1,5 +1,5 @@ -# Copyright (c) 2016 Ultimaker B.V. -# Cura is released under the terms of the AGPLv3 or higher. +#Copyright (c) 2017 Ultimaker B.V. +#Cura is released under the terms of the AGPLv3 or higher. import gc @@ -180,9 +180,7 @@ class ProcessSlicedLayersJob(Job): else: # Single extruder via global stack. material_color_map = numpy.zeros((1, 4), dtype=numpy.float32) - color_code = "#e0e000" - if global_container_stack.material.getMetaDataEntry("color_code") is not None: - color_code = global_container_stack.material.getMetaDataEntry("color_code") + color_code = global_container_stack.material.getMetaDataEntry("color_code", default="#e0e000") color = colorCodeToRGBA(color_code) material_color_map[0, :] = color From 2cab0977160a40862f885eb703664591749198bf Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 5 Jul 2017 15:28:08 +0200 Subject: [PATCH 05/10] Rename "Not Supported" quality files CURA-3975 Rename quality profiles with name "Not Supported" to have actual quality names. Note that the "Not Supported" only ones are renamed to "Fast_Print". --- ...pported_Quality.inst.cfg => um3_aa0.4_PVA_Fast_Print.inst.cfg} | 0 ...ported_Quality.inst.cfg => um3_aa0.8_CPEP_Fast_Print.inst.cfg} | 0 ..._Quality.inst.cfg => um3_aa0.8_CPEP_Superdraft_Print.inst.cfg} | 0 ...t_Quality.inst.cfg => um3_aa0.8_CPEP_Verydraft_Print.inst.cfg} | 0 ...upported_Quality.inst.cfg => um3_aa0.8_PC_Fast_Print.inst.cfg} | 0 ...ft_Quality.inst.cfg => um3_aa0.8_PC_Superdraft_Print.inst.cfg} | 0 ...aft_Quality.inst.cfg => um3_aa0.8_PC_Verydraft_Print.inst.cfg} | 0 ...pported_Quality.inst.cfg => um3_aa0.8_PVA_Fast_Print.inst.cfg} | 0 ...t_Quality.inst.cfg => um3_aa0.8_PVA_Superdraft_Print.inst.cfg} | 0 ...pported_Quality.inst.cfg => um3_bb0.4_ABS_Fast_Print.inst.cfg} | 0 ...t_Quality.inst.cfg => um3_bb0.4_ABS_Superdraft_Print.inst.cfg} | 0 ...ported_Quality.inst.cfg => um3_bb0.4_CPEP_Fast_Print.inst.cfg} | 0 ..._Quality.inst.cfg => um3_bb0.4_CPEP_Superdraft_Print.inst.cfg} | 0 ...pported_Quality.inst.cfg => um3_bb0.4_CPE_Fast_Print.inst.cfg} | 0 ...t_Quality.inst.cfg => um3_bb0.4_CPE_Superdraft_Print.inst.cfg} | 0 ...orted_Quality.inst.cfg => um3_bb0.4_Nylon_Fast_Print.inst.cfg} | 0 ...Quality.inst.cfg => um3_bb0.4_Nylon_Superdraft_Print.inst.cfg} | 0 ...upported_Quality.inst.cfg => um3_bb0.4_PC_Fast_Print.inst.cfg} | 0 ...pported_Quality.inst.cfg => um3_bb0.4_PLA_Fast_Print.inst.cfg} | 0 ...t_Quality.inst.cfg => um3_bb0.4_PLA_Superdraft_Print.inst.cfg} | 0 ...pported_Quality.inst.cfg => um3_bb0.4_TPU_Fast_Print.inst.cfg} | 0 ...t_Quality.inst.cfg => um3_bb0.4_TPU_Superdraft_Print.inst.cfg} | 0 ...pported_Quality.inst.cfg => um3_bb0.8_ABS_Fast_Print.inst.cfg} | 0 ...t_Quality.inst.cfg => um3_bb0.8_ABS_Superdraft_Print.inst.cfg} | 0 ...ported_Quality.inst.cfg => um3_bb0.8_CPEP_Fast_Print.inst.cfg} | 0 ..._Quality.inst.cfg => um3_bb0.8_CPEP_Superdraft_Print.inst.cfg} | 0 ...pported_Quality.inst.cfg => um3_bb0.8_CPE_Fast_Print.inst.cfg} | 0 ...t_Quality.inst.cfg => um3_bb0.8_CPE_Superdraft_Print.inst.cfg} | 0 ...orted_Quality.inst.cfg => um3_bb0.8_Nylon_Fast_Print.inst.cfg} | 0 ...Quality.inst.cfg => um3_bb0.8_Nylon_Superdraft_Print.inst.cfg} | 0 ...upported_Quality.inst.cfg => um3_bb0.8_PC_Fast_Print.inst.cfg} | 0 ...ft_Quality.inst.cfg => um3_bb0.8_PC_Superdraft_Print.inst.cfg} | 0 ...pported_Quality.inst.cfg => um3_bb0.8_PLA_Fast_Print.inst.cfg} | 0 ...t_Quality.inst.cfg => um3_bb0.8_PLA_Superdraft_Print.inst.cfg} | 0 ...pported_Quality.inst.cfg => um3_bb0.8_TPU_Fast_print.inst.cfg} | 0 ...t_Quality.inst.cfg => um3_bb0.8_TPU_Superdraft_Print.inst.cfg} | 0 36 files changed, 0 insertions(+), 0 deletions(-) rename resources/quality/ultimaker3/{um3_aa0.4_PVA_Not_Supported_Quality.inst.cfg => um3_aa0.4_PVA_Fast_Print.inst.cfg} (100%) rename resources/quality/ultimaker3/{um3_aa0.8_CPEP_Not_Supported_Quality.inst.cfg => um3_aa0.8_CPEP_Fast_Print.inst.cfg} (100%) rename resources/quality/ultimaker3/{um3_aa0.8_CPEP_Not_Supported_Superdraft_Quality.inst.cfg => um3_aa0.8_CPEP_Superdraft_Print.inst.cfg} (100%) rename resources/quality/ultimaker3/{um3_aa0.8_CPEP_Not_Supported_Verydraft_Quality.inst.cfg => um3_aa0.8_CPEP_Verydraft_Print.inst.cfg} (100%) rename resources/quality/ultimaker3/{um3_aa0.8_PC_Not_Supported_Quality.inst.cfg => um3_aa0.8_PC_Fast_Print.inst.cfg} (100%) rename resources/quality/ultimaker3/{um3_aa0.8_PC_Not_Supported_Superdraft_Quality.inst.cfg => um3_aa0.8_PC_Superdraft_Print.inst.cfg} (100%) rename resources/quality/ultimaker3/{um3_aa0.8_PC_Not_Supported_Verydraft_Quality.inst.cfg => um3_aa0.8_PC_Verydraft_Print.inst.cfg} (100%) rename resources/quality/ultimaker3/{um3_aa0.8_PVA_Not_Supported_Quality.inst.cfg => um3_aa0.8_PVA_Fast_Print.inst.cfg} (100%) mode change 100755 => 100644 rename resources/quality/ultimaker3/{um3_aa0.8_PVA_Not_Supported_Superdraft_Quality.inst.cfg => um3_aa0.8_PVA_Superdraft_Print.inst.cfg} (100%) mode change 100755 => 100644 rename resources/quality/ultimaker3/{um3_bb0.4_ABS_Not_Supported_Quality.inst.cfg => um3_bb0.4_ABS_Fast_Print.inst.cfg} (100%) rename resources/quality/ultimaker3/{um3_bb0.4_ABS_Not_Supported_Superdraft_Quality.inst.cfg => um3_bb0.4_ABS_Superdraft_Print.inst.cfg} (100%) mode change 100755 => 100644 rename resources/quality/ultimaker3/{um3_bb0.4_CPEP_Not_Supported_Quality.inst.cfg => um3_bb0.4_CPEP_Fast_Print.inst.cfg} (100%) mode change 100755 => 100644 rename resources/quality/ultimaker3/{um3_bb0.4_CPEP_Not_Supported_Superdraft_Quality.inst.cfg => um3_bb0.4_CPEP_Superdraft_Print.inst.cfg} (100%) mode change 100755 => 100644 rename resources/quality/ultimaker3/{um3_bb0.4_CPE_Not_Supported_Quality.inst.cfg => um3_bb0.4_CPE_Fast_Print.inst.cfg} (100%) rename resources/quality/ultimaker3/{um3_bb0.4_CPE_Not_Supported_Superdraft_Quality.inst.cfg => um3_bb0.4_CPE_Superdraft_Print.inst.cfg} (100%) mode change 100755 => 100644 rename resources/quality/ultimaker3/{um3_bb0.4_Nylon_Not_Supported_Quality.inst.cfg => um3_bb0.4_Nylon_Fast_Print.inst.cfg} (100%) rename resources/quality/ultimaker3/{um3_bb0.4_Nylon_Not_Supported_Superdraft_Quality.inst.cfg => um3_bb0.4_Nylon_Superdraft_Print.inst.cfg} (100%) mode change 100755 => 100644 rename resources/quality/ultimaker3/{um3_bb0.4_PC_Not_Supported_Quality.inst.cfg => um3_bb0.4_PC_Fast_Print.inst.cfg} (100%) mode change 100755 => 100644 rename resources/quality/ultimaker3/{um3_bb0.4_PLA_Not_Supported_Quality.inst.cfg => um3_bb0.4_PLA_Fast_Print.inst.cfg} (100%) rename resources/quality/ultimaker3/{um3_bb0.4_PLA_Not_Supported_Superdraft_Quality.inst.cfg => um3_bb0.4_PLA_Superdraft_Print.inst.cfg} (100%) mode change 100755 => 100644 rename resources/quality/ultimaker3/{um3_bb0.4_TPU_Not_Supported_Quality.inst.cfg => um3_bb0.4_TPU_Fast_Print.inst.cfg} (100%) mode change 100755 => 100644 rename resources/quality/ultimaker3/{um3_bb0.4_TPU_Not_Supported_Superdraft_Quality.inst.cfg => um3_bb0.4_TPU_Superdraft_Print.inst.cfg} (100%) mode change 100755 => 100644 rename resources/quality/ultimaker3/{um3_bb0.8_ABS_Not_Supported_Quality.inst.cfg => um3_bb0.8_ABS_Fast_Print.inst.cfg} (100%) mode change 100755 => 100644 rename resources/quality/ultimaker3/{um3_bb0.8_ABS_Not_Supported_Superdraft_Quality.inst.cfg => um3_bb0.8_ABS_Superdraft_Print.inst.cfg} (100%) mode change 100755 => 100644 rename resources/quality/ultimaker3/{um3_bb0.8_CPEP_Not_Supported_Quality.inst.cfg => um3_bb0.8_CPEP_Fast_Print.inst.cfg} (100%) mode change 100755 => 100644 rename resources/quality/ultimaker3/{um3_bb0.8_CPEP_Not_Supported_Superdraft_Quality.inst.cfg => um3_bb0.8_CPEP_Superdraft_Print.inst.cfg} (100%) mode change 100755 => 100644 rename resources/quality/ultimaker3/{um3_bb0.8_CPE_Not_Supported_Quality.inst.cfg => um3_bb0.8_CPE_Fast_Print.inst.cfg} (100%) mode change 100755 => 100644 rename resources/quality/ultimaker3/{um3_bb0.8_CPE_Not_Supported_Superdraft_Quality.inst.cfg => um3_bb0.8_CPE_Superdraft_Print.inst.cfg} (100%) mode change 100755 => 100644 rename resources/quality/ultimaker3/{um3_bb0.8_Nylon_Not_Supported_Quality.inst.cfg => um3_bb0.8_Nylon_Fast_Print.inst.cfg} (100%) mode change 100755 => 100644 rename resources/quality/ultimaker3/{um3_bb0.8_Nylon_Not_Supported_Superdraft_Quality.inst.cfg => um3_bb0.8_Nylon_Superdraft_Print.inst.cfg} (100%) mode change 100755 => 100644 rename resources/quality/ultimaker3/{um3_bb0.8_PC_Not_Supported_Quality.inst.cfg => um3_bb0.8_PC_Fast_Print.inst.cfg} (100%) mode change 100755 => 100644 rename resources/quality/ultimaker3/{um3_bb0.8_PC_Not_Supported_Superdraft_Quality.inst.cfg => um3_bb0.8_PC_Superdraft_Print.inst.cfg} (100%) mode change 100755 => 100644 rename resources/quality/ultimaker3/{um3_bb0.8_PLA_Not_Supported_Quality.inst.cfg => um3_bb0.8_PLA_Fast_Print.inst.cfg} (100%) mode change 100755 => 100644 rename resources/quality/ultimaker3/{um3_bb0.8_PLA_Not_Supported_Superdraft_Quality.inst.cfg => um3_bb0.8_PLA_Superdraft_Print.inst.cfg} (100%) mode change 100755 => 100644 rename resources/quality/ultimaker3/{um3_bb0.8_TPU_Not_Supported_Quality.inst.cfg => um3_bb0.8_TPU_Fast_print.inst.cfg} (100%) mode change 100755 => 100644 rename resources/quality/ultimaker3/{um3_bb0.8_TPU_Not_Supported_Superdraft_Quality.inst.cfg => um3_bb0.8_TPU_Superdraft_Print.inst.cfg} (100%) mode change 100755 => 100644 diff --git a/resources/quality/ultimaker3/um3_aa0.4_PVA_Not_Supported_Quality.inst.cfg b/resources/quality/ultimaker3/um3_aa0.4_PVA_Fast_Print.inst.cfg similarity index 100% rename from resources/quality/ultimaker3/um3_aa0.4_PVA_Not_Supported_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_aa0.4_PVA_Fast_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_aa0.8_CPEP_Not_Supported_Quality.inst.cfg b/resources/quality/ultimaker3/um3_aa0.8_CPEP_Fast_Print.inst.cfg similarity index 100% rename from resources/quality/ultimaker3/um3_aa0.8_CPEP_Not_Supported_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_aa0.8_CPEP_Fast_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_aa0.8_CPEP_Not_Supported_Superdraft_Quality.inst.cfg b/resources/quality/ultimaker3/um3_aa0.8_CPEP_Superdraft_Print.inst.cfg similarity index 100% rename from resources/quality/ultimaker3/um3_aa0.8_CPEP_Not_Supported_Superdraft_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_aa0.8_CPEP_Superdraft_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_aa0.8_CPEP_Not_Supported_Verydraft_Quality.inst.cfg b/resources/quality/ultimaker3/um3_aa0.8_CPEP_Verydraft_Print.inst.cfg similarity index 100% rename from resources/quality/ultimaker3/um3_aa0.8_CPEP_Not_Supported_Verydraft_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_aa0.8_CPEP_Verydraft_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_aa0.8_PC_Not_Supported_Quality.inst.cfg b/resources/quality/ultimaker3/um3_aa0.8_PC_Fast_Print.inst.cfg similarity index 100% rename from resources/quality/ultimaker3/um3_aa0.8_PC_Not_Supported_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_aa0.8_PC_Fast_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_aa0.8_PC_Not_Supported_Superdraft_Quality.inst.cfg b/resources/quality/ultimaker3/um3_aa0.8_PC_Superdraft_Print.inst.cfg similarity index 100% rename from resources/quality/ultimaker3/um3_aa0.8_PC_Not_Supported_Superdraft_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_aa0.8_PC_Superdraft_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_aa0.8_PC_Not_Supported_Verydraft_Quality.inst.cfg b/resources/quality/ultimaker3/um3_aa0.8_PC_Verydraft_Print.inst.cfg similarity index 100% rename from resources/quality/ultimaker3/um3_aa0.8_PC_Not_Supported_Verydraft_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_aa0.8_PC_Verydraft_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_aa0.8_PVA_Not_Supported_Quality.inst.cfg b/resources/quality/ultimaker3/um3_aa0.8_PVA_Fast_Print.inst.cfg old mode 100755 new mode 100644 similarity index 100% rename from resources/quality/ultimaker3/um3_aa0.8_PVA_Not_Supported_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_aa0.8_PVA_Fast_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_aa0.8_PVA_Not_Supported_Superdraft_Quality.inst.cfg b/resources/quality/ultimaker3/um3_aa0.8_PVA_Superdraft_Print.inst.cfg old mode 100755 new mode 100644 similarity index 100% rename from resources/quality/ultimaker3/um3_aa0.8_PVA_Not_Supported_Superdraft_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_aa0.8_PVA_Superdraft_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.4_ABS_Not_Supported_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_ABS_Fast_Print.inst.cfg similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.4_ABS_Not_Supported_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.4_ABS_Fast_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.4_ABS_Not_Supported_Superdraft_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_ABS_Superdraft_Print.inst.cfg old mode 100755 new mode 100644 similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.4_ABS_Not_Supported_Superdraft_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.4_ABS_Superdraft_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.4_CPEP_Not_Supported_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_CPEP_Fast_Print.inst.cfg old mode 100755 new mode 100644 similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.4_CPEP_Not_Supported_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.4_CPEP_Fast_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.4_CPEP_Not_Supported_Superdraft_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_CPEP_Superdraft_Print.inst.cfg old mode 100755 new mode 100644 similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.4_CPEP_Not_Supported_Superdraft_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.4_CPEP_Superdraft_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.4_CPE_Not_Supported_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_CPE_Fast_Print.inst.cfg similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.4_CPE_Not_Supported_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.4_CPE_Fast_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.4_CPE_Not_Supported_Superdraft_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_CPE_Superdraft_Print.inst.cfg old mode 100755 new mode 100644 similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.4_CPE_Not_Supported_Superdraft_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.4_CPE_Superdraft_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.4_Nylon_Not_Supported_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_Nylon_Fast_Print.inst.cfg similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.4_Nylon_Not_Supported_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.4_Nylon_Fast_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.4_Nylon_Not_Supported_Superdraft_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_Nylon_Superdraft_Print.inst.cfg old mode 100755 new mode 100644 similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.4_Nylon_Not_Supported_Superdraft_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.4_Nylon_Superdraft_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.4_PC_Not_Supported_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_PC_Fast_Print.inst.cfg old mode 100755 new mode 100644 similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.4_PC_Not_Supported_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.4_PC_Fast_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.4_PLA_Not_Supported_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_PLA_Fast_Print.inst.cfg similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.4_PLA_Not_Supported_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.4_PLA_Fast_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.4_PLA_Not_Supported_Superdraft_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_PLA_Superdraft_Print.inst.cfg old mode 100755 new mode 100644 similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.4_PLA_Not_Supported_Superdraft_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.4_PLA_Superdraft_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.4_TPU_Not_Supported_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_TPU_Fast_Print.inst.cfg old mode 100755 new mode 100644 similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.4_TPU_Not_Supported_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.4_TPU_Fast_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.4_TPU_Not_Supported_Superdraft_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_TPU_Superdraft_Print.inst.cfg old mode 100755 new mode 100644 similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.4_TPU_Not_Supported_Superdraft_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.4_TPU_Superdraft_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.8_ABS_Not_Supported_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.8_ABS_Fast_Print.inst.cfg old mode 100755 new mode 100644 similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.8_ABS_Not_Supported_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.8_ABS_Fast_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.8_ABS_Not_Supported_Superdraft_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.8_ABS_Superdraft_Print.inst.cfg old mode 100755 new mode 100644 similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.8_ABS_Not_Supported_Superdraft_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.8_ABS_Superdraft_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.8_CPEP_Not_Supported_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.8_CPEP_Fast_Print.inst.cfg old mode 100755 new mode 100644 similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.8_CPEP_Not_Supported_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.8_CPEP_Fast_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.8_CPEP_Not_Supported_Superdraft_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.8_CPEP_Superdraft_Print.inst.cfg old mode 100755 new mode 100644 similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.8_CPEP_Not_Supported_Superdraft_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.8_CPEP_Superdraft_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.8_CPE_Not_Supported_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.8_CPE_Fast_Print.inst.cfg old mode 100755 new mode 100644 similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.8_CPE_Not_Supported_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.8_CPE_Fast_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.8_CPE_Not_Supported_Superdraft_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.8_CPE_Superdraft_Print.inst.cfg old mode 100755 new mode 100644 similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.8_CPE_Not_Supported_Superdraft_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.8_CPE_Superdraft_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.8_Nylon_Not_Supported_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.8_Nylon_Fast_Print.inst.cfg old mode 100755 new mode 100644 similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.8_Nylon_Not_Supported_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.8_Nylon_Fast_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.8_Nylon_Not_Supported_Superdraft_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.8_Nylon_Superdraft_Print.inst.cfg old mode 100755 new mode 100644 similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.8_Nylon_Not_Supported_Superdraft_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.8_Nylon_Superdraft_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.8_PC_Not_Supported_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.8_PC_Fast_Print.inst.cfg old mode 100755 new mode 100644 similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.8_PC_Not_Supported_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.8_PC_Fast_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.8_PC_Not_Supported_Superdraft_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.8_PC_Superdraft_Print.inst.cfg old mode 100755 new mode 100644 similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.8_PC_Not_Supported_Superdraft_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.8_PC_Superdraft_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.8_PLA_Not_Supported_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.8_PLA_Fast_Print.inst.cfg old mode 100755 new mode 100644 similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.8_PLA_Not_Supported_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.8_PLA_Fast_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.8_PLA_Not_Supported_Superdraft_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.8_PLA_Superdraft_Print.inst.cfg old mode 100755 new mode 100644 similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.8_PLA_Not_Supported_Superdraft_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.8_PLA_Superdraft_Print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.8_TPU_Not_Supported_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.8_TPU_Fast_print.inst.cfg old mode 100755 new mode 100644 similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.8_TPU_Not_Supported_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.8_TPU_Fast_print.inst.cfg diff --git a/resources/quality/ultimaker3/um3_bb0.8_TPU_Not_Supported_Superdraft_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.8_TPU_Superdraft_Print.inst.cfg old mode 100755 new mode 100644 similarity index 100% rename from resources/quality/ultimaker3/um3_bb0.8_TPU_Not_Supported_Superdraft_Quality.inst.cfg rename to resources/quality/ultimaker3/um3_bb0.8_TPU_Superdraft_Print.inst.cfg From afb923401e347b01f83d4e87a975515b528c2610 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 5 Jul 2017 16:27:48 +0200 Subject: [PATCH 06/10] Set versions correctly for container stacks and preferences CURA-3975 The upgrade for machine and extruder stacks and the preferences files don't work because the current version registering doesn't take into account the 1000000 multiplier and the settings_version. --- cura/CuraApplication.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index a1f5aaa6de..2683c48108 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -179,9 +179,9 @@ class CuraApplication(QtApplication): UM.VersionUpgradeManager.VersionUpgradeManager.getInstance().setCurrentVersions( { ("quality_changes", InstanceContainer.Version * 1000000 + self.SettingVersion): (self.ResourceTypes.QualityInstanceContainer, "application/x-uranium-instancecontainer"), - ("machine_stack", ContainerStack.Version): (self.ResourceTypes.MachineStack, "application/x-uranium-containerstack"), - ("extruder_train", ContainerStack.Version): (self.ResourceTypes.ExtruderStack, "application/x-uranium-extruderstack"), - ("preferences", Preferences.Version): (Resources.Preferences, "application/x-uranium-preferences"), + ("machine_stack", ContainerStack.Version * 1000000 + self.SettingVersion): (self.ResourceTypes.MachineStack, "application/x-uranium-containerstack"), + ("extruder_train", ContainerStack.Version * 1000000 + self.SettingVersion): (self.ResourceTypes.ExtruderStack, "application/x-uranium-extruderstack"), + ("preferences", Preferences.Version * 1000000 + self.SettingVersion): (Resources.Preferences, "application/x-uranium-preferences"), ("user", InstanceContainer.Version * 1000000 + self.SettingVersion): (self.ResourceTypes.UserInstanceContainer, "application/x-uranium-instancecontainer"), ("definition_changes", InstanceContainer.Version * 1000000 + self.SettingVersion): (self.ResourceTypes.DefinitionChangesContainer, "application/x-uranium-instancecontainer"), } From 16a078b9a66b7cf77b1bfd5c2a134f0be058f15e Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 6 Jul 2017 10:22:15 +0200 Subject: [PATCH 07/10] Update SettingVersion to 2 for renaming the quality profiles CURA-3975 Update SettingVersion to 2 so we can create an upgrade to rename the quality profiles. --- cura/CuraApplication.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 2683c48108..99fb4f8a05 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -105,7 +105,7 @@ class CuraApplication(QtApplication): # SettingVersion represents the set of settings available in the machine/extruder definitions. # You need to make sure that this version number needs to be increased if there is any non-backwards-compatible # changes of the settings. - SettingVersion = 1 + SettingVersion = 2 class ResourceTypes: QmlFiles = Resources.UserType + 1 From 42858b47152060557d9258744ff1538e2dd64697 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 6 Jul 2017 10:22:31 +0200 Subject: [PATCH 08/10] Add upgrade script for 2.6 to 2.7 to rename quality profiles CURA-3975 --- .../VersionUpgrade26to27.py | 120 +++++++++++ .../VersionUpgrade26to27/__init__.py | 31 +++ .../VersionUpgrade26to27/plugin.json | 8 + .../tests/TestVersionUpgrade26to27.py | 191 ++++++++++++++++++ 4 files changed, 350 insertions(+) create mode 100644 plugins/VersionUpgrade/VersionUpgrade26to27/VersionUpgrade26to27.py create mode 100644 plugins/VersionUpgrade/VersionUpgrade26to27/__init__.py create mode 100644 plugins/VersionUpgrade/VersionUpgrade26to27/plugin.json create mode 100644 plugins/VersionUpgrade/VersionUpgrade26to27/tests/TestVersionUpgrade26to27.py diff --git a/plugins/VersionUpgrade/VersionUpgrade26to27/VersionUpgrade26to27.py b/plugins/VersionUpgrade/VersionUpgrade26to27/VersionUpgrade26to27.py new file mode 100644 index 0000000000..c0e085bcfb --- /dev/null +++ b/plugins/VersionUpgrade/VersionUpgrade26to27/VersionUpgrade26to27.py @@ -0,0 +1,120 @@ +# Copyright (c) 2017 Ultimaker B.V. +# Cura is released under the terms of the AGPLv3 or higher. + +import configparser #To parse the files we need to upgrade and write the new files. +import io #To serialise configparser output to a string. + +from UM.VersionUpgrade import VersionUpgrade +from cura.CuraApplication import CuraApplication + +# a dict of renamed quality profiles: : +_renamed_quality_profiles = { + "um3_aa0.4_PVA_Not_Supported_Quality": "um3_aa0.4_PVA_Fast_Print", + + "um3_aa0.8_CPEP_Not_Supported_Quality": "um3_aa0.8_CPEP_Fast_Print", + "um3_aa0.8_CPEP_Not_Supported_Superdraft_Quality": "um3_aa0.8_CPEP_Superdraft_Print", + "um3_aa0.8_CPEP_Not_Supported_Verydraft_Quality": "um3_aa0.8_CPEP_Verydraft_Print", + + "um3_aa0.8_PC_Not_Supported_Quality": "um3_aa0.8_PC_Fast_Print", + "um3_aa0.8_PC_Not_Supported_Superdraft_Quality": "um3_aa0.8_PC_Superdraft_Print", + "um3_aa0.8_PC_Not_Supported_Verydraft_Quality": "um3_aa0.8_PC_Verydraft_Print", + + "um3_aa0.8_PVA_Not_Supported_Quality": "um3_aa0.8_PVA_Fast_Print", + "um3_aa0.8_PVA_Not_Supported_Superdraft_Quality": "um3_aa0.8_PVA_Superdraft_Print", + + "um3_bb0.4_ABS_Not_Supported_Quality": "um3_bb0.4_ABS_Fast_print", + "um3_bb0.4_ABS_Not_Supported_Superdraft_Quality": "um3_bb0.4_ABS_Superdraft_Print", + + "um3_bb0.4_CPE_Not_Supported_Quality": "um3_bb0.4_CPE_Fast_Print", + "um3_bb0.4_CPE_Not_Supported_Superdraft_Quality": "um3_bb0.4_CPE_Superdraft_Print", + + "um3_bb0.4_CPEP_Not_Supported_Quality": "um3_bb0.4_CPEP_Fast_Print", + "um3_bb0.4_CPEP_Not_Supported_Superdraft_Quality": "um3_bb0.4_CPEP_Superdraft_Print", + + "um3_bb0.4_Nylon_Not_Supported_Quality": "um3_bb0.4_Nylon_Fast_Print", + "um3_bb0.4_Nylon_Not_Supported_Superdraft_Quality": "um3_bb0.4_Nylon_Superdraft_Print", + + "um3_bb0.4_PC_Not_Supported_Quality": "um3_bb0.4_PC_Fast_Print", + + "um3_bb0.4_PLA_Not_Supported_Quality": "um3_bb0.4_PLA_Fast_Print", + "um3_bb0.4_PLA_Not_Supported_Superdraft_Quality": "um3_bb0.4_PLA_Superdraft_Print", + + "um3_bb0.4_TPU_Not_Supported_Quality": "um3_bb0.4_TPU_Fast_Print", + "um3_bb0.4_TPU_Not_Supported_Superdraft_Quality": "um3_bb0.4_TPU_Superdraft_Print", + + "um3_bb0.8_ABS_Not_Supported_Quality": "um3_bb0.8_ABS_Fast_Print", + "um3_bb0.8_ABS_Not_Supported_Superdraft_Quality": "um3_bb0.8_ABS_Superdraft_Print", + + "um3_bb0.8_CPE_Not_Supported_Quality": "um3_bb0.8_CPE_Fast_Print", + "um3_bb0.8_CPE_Not_Supported_Superdraft_Quality": "um3_bb0.8_CPE_Superdraft_Print", + + "um3_bb0.8_CPEP_Not_Supported_Quality": "um3_bb0.um3_bb0.8_CPEP_Fast_Print", + "um3_bb0.8_CPEP_Not_Supported_Superdraft_Quality": "um3_bb0.8_CPEP_Superdraft_Print", + + "um3_bb0.8_Nylon_Not_Supported_Quality": "um3_bb0.8_Nylon_Fast_Print", + "um3_bb0.8_Nylon_Not_Supported_Superdraft_Quality": "um3_bb0.8_Nylon_Superdraft_Print", + + "um3_bb0.8_PC_Not_Supported_Quality": "um3_bb0.8_PC_Fast_Print", + "um3_bb0.8_PC_Not_Supported_Superdraft_Quality": "um3_bb0.8_PC_Superdraft_Print", + + "um3_bb0.8_PLA_Not_Supported_Quality": "um3_bb0.8_PLA_Fast_Print", + "um3_bb0.8_PLA_Not_Supported_Superdraft_Quality": "um3_bb0.8_PLA_Superdraft_Print", + + "um3_bb0.8_TPU_Not_Supported_Quality": "um3_bb0.8_TPU_Fast_print", + "um3_bb0.8_TPU_Not_Supported_Superdraft_Quality": "um3_bb0.8_TPU_Superdraft_Print", +} + +## A collection of functions that convert the configuration of the user in Cura +# 2.6 to a configuration for Cura 2.7. +# +# All of these methods are essentially stateless. +class VersionUpgrade26to27(VersionUpgrade): + ## Gets the version number from a CFG file in Uranium's 2.6 format. + # + # Since the format may change, this is implemented for the 2.6 format only + # and needs to be included in the version upgrade system rather than + # globally in Uranium. + # + # \param serialised The serialised form of a CFG file. + # \return The version number stored in the CFG file. + # \raises ValueError The format of the version number in the file is + # incorrect. + # \raises KeyError The format of the file is incorrect. + def getCfgVersion(self, serialised): + parser = configparser.ConfigParser(interpolation = None) + parser.read_string(serialised) + format_version = int(parser.get("general", "version")) #Explicitly give an exception when this fails. That means that the file format is not recognised. + setting_version = int(parser.get("metadata", "setting_version", fallback = 0)) + return format_version * 1000000 + setting_version + + ## Upgrades a container stack from version 2.6 to 2.7. + # + # \param serialised The serialised form of a container stack. + # \param filename The name of the file to upgrade. + def upgradeStack(self, serialised, filename): + parser = configparser.ConfigParser(interpolation = None) + parser.read_string(serialised) + + # Update IDs of the renamed quality profiles + if parser.has_section("containers"): + key_list = [key for key in parser["containers"].keys()] + for key in key_list: + container_id = parser.get("containers", key) + new_id = _renamed_quality_profiles.get(container_id) + if new_id is not None: + parser.set("containers", key, new_id) + + for each_section in ("general", "metadata"): + if not parser.has_section(each_section): + parser.add_section(each_section) + + # Change the version number in the file. + parser["metadata"]["setting_version"] = str(CuraApplication.SettingVersion) + + # Update version + parser["general"]["version"] = "4" + + # Re-serialise the file. + output = io.StringIO() + parser.write(output) + return [filename], [output.getvalue()] diff --git a/plugins/VersionUpgrade/VersionUpgrade26to27/__init__.py b/plugins/VersionUpgrade/VersionUpgrade26to27/__init__.py new file mode 100644 index 0000000000..8ddf4aa7ea --- /dev/null +++ b/plugins/VersionUpgrade/VersionUpgrade26to27/__init__.py @@ -0,0 +1,31 @@ +# Copyright (c) 2017 Ultimaker B.V. +# Cura is released under the terms of the AGPLv3 or higher. + +from . import VersionUpgrade26to27 + +from UM.i18n import i18nCatalog +catalog = i18nCatalog("cura") + +upgrade = VersionUpgrade26to27.VersionUpgrade26to27() + +def getMetaData(): + return { + "version_upgrade": { + # From To Upgrade function + ("machine_stack", 3000000): ("machine_stack", 3000002, upgrade.upgradeStack), + ("extruder_train", 3000000): ("extruder_train", 3000002, upgrade.upgradeStack), + }, + "sources": { + "machine_stack": { + "get_version": upgrade.getCfgVersion, + "location": {"./machine_instances"} + }, + "extruder_train": { + "get_version": upgrade.getCfgVersion, + "location": {"./extruders"} + }, + } + } + +def register(app): + return { "version_upgrade": upgrade } diff --git a/plugins/VersionUpgrade/VersionUpgrade26to27/plugin.json b/plugins/VersionUpgrade/VersionUpgrade26to27/plugin.json new file mode 100644 index 0000000000..3c3d7fff8c --- /dev/null +++ b/plugins/VersionUpgrade/VersionUpgrade26to27/plugin.json @@ -0,0 +1,8 @@ + { + "name": "Version Upgrade 2.6 to 2.7", + "author": "Ultimaker B.V.", + "version": "1.0.0", + "description": "Upgrades configurations from Cura 2.6 to Cura 2.7.", + "api": 4, + "i18n-catalog": "cura" +} diff --git a/plugins/VersionUpgrade/VersionUpgrade26to27/tests/TestVersionUpgrade26to27.py b/plugins/VersionUpgrade/VersionUpgrade26to27/tests/TestVersionUpgrade26to27.py new file mode 100644 index 0000000000..f8e3561b38 --- /dev/null +++ b/plugins/VersionUpgrade/VersionUpgrade26to27/tests/TestVersionUpgrade26to27.py @@ -0,0 +1,191 @@ +# Copyright (c) 2017 Ultimaker B.V. +# Cura is released under the terms of the AGPLv3 or higher. + +import configparser #To check whether the appropriate exceptions are raised. +import pytest #To register tests with. + +import VersionUpgrade26to27 #The module we're testing. + +## Creates an instance of the upgrader to test with. +@pytest.fixture +def upgrader(): + return VersionUpgrade26to27.VersionUpgrade26to27() + +test_cfg_version_good_data = [ + { + "test_name": "Simple", + "file_data": """[general] +version = 1 +""", + "version": 1000000 + }, + { + "test_name": "Other Data Around", + "file_data": """[nonsense] +life = good + +[general] +version = 3 + +[values] +layer_height = 0.12 +infill_sparse_density = 42 +""", + "version": 3000000 + }, + { + "test_name": "Negative Version", #Why not? + "file_data": """[general] +version = -20 +""", + "version": -20000000 + }, + { + "test_name": "Setting Version", + "file_data": """[general] +version = 1 +[metadata] +setting_version = 1 +""", + "version": 1000001 + }, + { + "test_name": "Negative Setting Version", + "file_data": """[general] +version = 1 +[metadata] +setting_version = -3 +""", + "version": 999997 + } +] + +## Tests the technique that gets the version number from CFG files. +# +# \param data The parametrised data to test with. It contains a test name +# to debug with, the serialised contents of a CFG file and the correct +# version number in that CFG file. +# \param upgrader The instance of the upgrade class to test. +@pytest.mark.parametrize("data", test_cfg_version_good_data) +def test_cfgVersionGood(data, upgrader): + version = upgrader.getCfgVersion(data["file_data"]) + assert version == data["version"] + +test_cfg_version_bad_data = [ + { + "test_name": "Empty", + "file_data": "", + "exception": configparser.Error #Explicitly not specified further which specific error we're getting, because that depends on the implementation of configparser. + }, + { + "test_name": "No General", + "file_data": """[values] +layer_height = 0.1337 +""", + "exception": configparser.Error + }, + { + "test_name": "No Version", + "file_data": """[general] +true = false +""", + "exception": configparser.Error + }, + { + "test_name": "Not a Number", + "file_data": """[general] +version = not-a-text-version-number +""", + "exception": ValueError + }, + { + "test_name": "Setting Value NaN", + "file_data": """[general] +version = 4 +[metadata] +setting_version = latest_or_something +""", + "exception": ValueError + }, + { + "test_name": "Major-Minor", + "file_data": """[general] +version = 1.2 +""", + "exception": ValueError + } +] + +## Tests whether getting a version number from bad CFG files gives an +# exception. +# +# \param data The parametrised data to test with. It contains a test name +# to debug with, the serialised contents of a CFG file and the class of +# exception it needs to throw. +# \param upgrader The instance of the upgrader to test. +@pytest.mark.parametrize("data", test_cfg_version_bad_data) +def test_cfgVersionBad(data, upgrader): + with pytest.raises(data["exception"]): + upgrader.getCfgVersion(data["file_data"]) + +test_upgrade_stacks_with_not_supported_data = [ + { + "test_name": "Global stack with Not Supported quality profile", + "file_data": """[general] +version = 3 +name = Ultimaker 3 +id = Ultimaker 3 + +[metadata] +type = machine + +[containers] +0 = Ultimaker 3_user +1 = empty +2 = um3_global_Normal_Quality +3 = empty +4 = empty +5 = empty +6 = ultimaker3 +""" + }, + { + "test_name": "Extruder stack left with Not Supported quality profile", + "file_data": """[general] +version = 3 +name = Extruder 1 +id = ultimaker3_extruder_left #2 + +[metadata] +position = 0 +machine = Ultimaker 3 +type = extruder_train + +[containers] +0 = ultimaker3_extruder_left #2_user +1 = empty +2 = um3_aa0.4_PVA_Not_Supported_Quality +3 = generic_pva_ultimaker3_AA_0.4 +4 = ultimaker3_aa04 +5 = ultimaker3_extruder_left #2_settings +6 = ultimaker3_extruder_left +""" + } +] + +## Tests whether the "Not Supported" quality profiles in the global and extruder stacks are renamed for the 2.7 +# version of preferences. +@pytest.mark.parametrize("data", test_upgrade_stacks_with_not_supported_data) +def test_upgradeStacksWithNotSupportedQuality(data, upgrader): + # Read old file + original_parser = configparser.ConfigParser(interpolation = None) + original_parser.read_string(data["file_data"]) + + # Perform the upgrade. + _, upgraded_stacks = upgrader.upgradeStack(data["file_data"], "") + upgraded_stack = upgraded_stacks[0] + + # Find whether the not supported profile has been renamed + parser = configparser.ConfigParser(interpolation = None) + parser.read_string(upgraded_stack) + assert("Not_Supported" not in parser.get("containers", "2")) From 3d48024a47479875fe2773d7466ee8e77961af1d Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 6 Jul 2017 10:22:36 +0200 Subject: [PATCH 09/10] Override getConfigurationTypeFromSerialized for GlobalStack CURA-3975 GlobalStack has metadata type "machine", which is different from what is registered in the VersionUpgradeManager "machine_stack". This commit makes sure that Cura can find the correct upgrade route for the GlobalStack files. --- cura/Settings/GlobalStack.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cura/Settings/GlobalStack.py b/cura/Settings/GlobalStack.py index 4e7bcdf486..e49b1a25de 100755 --- a/cura/Settings/GlobalStack.py +++ b/cura/Settings/GlobalStack.py @@ -1,7 +1,7 @@ # Copyright (c) 2017 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. -from typing import Any, Dict +from typing import Any, Dict, Optional from PyQt5.QtCore import pyqtProperty @@ -42,6 +42,17 @@ class GlobalStack(CuraContainerStack): def getLoadingPriority(cls) -> int: return 2 + def getConfigurationTypeFromSerialized(self, serialized: str) -> Optional[str]: + configuration_type = None + try: + parser = self._readAndValidateSerialized(serialized) + configuration_type = parser["metadata"].get("type") + if configuration_type == "machine": + configuration_type = "machine_stack" + except Exception as e: + Logger.log("e", "Could not get configuration type: %s", e) + return configuration_type + ## Add an extruder to the list of extruders of this stack. # # \param extruder The extruder to add. From c196a4bf00b53cd59232b71c92179f9a5e101f9d Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 6 Jul 2017 10:42:24 +0200 Subject: [PATCH 10/10] Fix stack file version number in VersionUpgrade26to27 CURA-3975 --- .../VersionUpgrade/VersionUpgrade26to27/VersionUpgrade26to27.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/VersionUpgrade/VersionUpgrade26to27/VersionUpgrade26to27.py b/plugins/VersionUpgrade/VersionUpgrade26to27/VersionUpgrade26to27.py index c0e085bcfb..38031765d5 100644 --- a/plugins/VersionUpgrade/VersionUpgrade26to27/VersionUpgrade26to27.py +++ b/plugins/VersionUpgrade/VersionUpgrade26to27/VersionUpgrade26to27.py @@ -112,7 +112,7 @@ class VersionUpgrade26to27(VersionUpgrade): parser["metadata"]["setting_version"] = str(CuraApplication.SettingVersion) # Update version - parser["general"]["version"] = "4" + parser["general"]["version"] = "3" # Re-serialise the file. output = io.StringIO()