From 3d9c27a7f7d4d0b6dd3016fc0b1adf5684194e59 Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Mon, 5 Dec 2016 11:00:33 +0100 Subject: [PATCH 01/34] CURA-2953 Version upgrade 2.3 to 2.4 --- .../VersionUpgrade22to24/VersionUpgrade.py | 90 +++++++++++++++++++ .../VersionUpgrade22to24/__init__.py | 33 +++++++ 2 files changed, 123 insertions(+) create mode 100644 plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py create mode 100644 plugins/VersionUpgrade/VersionUpgrade22to24/__init__.py diff --git a/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py b/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py new file mode 100644 index 0000000000..38710026ac --- /dev/null +++ b/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py @@ -0,0 +1,90 @@ +# Copyright (c) 2016 Ultimaker B.V. +# Cura is released under the terms of the AGPLv3 or higher. + +import configparser #To get version numbers from config files. +import os.path +import io + +from UM import Resources +from UM.VersionUpgrade import VersionUpgrade # Superclass of the plugin. + +class VersionUpgrade22to24(VersionUpgrade): + + def upgradeMachineInstance(self, serialised, filename): + config = configparser.ConfigParser(interpolation = None) + config.read_string(serialised) # Read the input string as config file. + config.set("general", "version", "3") + containers = config.get("general", "containers") + container_list = containers.split(",") + + user_variants = self.__getUserVariants() + name_path_dict = {} + for variant in user_variants: + name_path_dict[variant.get("name")] = variant.get("path") + + user_variant_names = set(container_list).intersection(name_path_dict.keys()) + if len(user_variant_names): + # One of the user defined variants appears in the list of containers in the stack. + + for variant_name in user_variant_names: + # Copy the variant to the machine_instances/*_settings.inst.cfg + variant_config = configparser.ConfigParser(interpolation=None) + variant_path = name_path_dict.get(variant_name) + with open(variant_path, "r") as fhandle: + variant_config.read_file(fhandle) + + if variant_config.has_section("general") and variant_config.has_option("general", "name"): + config_name = variant_config.get("general", "name") + if config_name.endswith("_variant"): + config_name = config_name[:-len("_variant")] + "_settings" + variant_config.set("general", "name", config_name) + + if not variant_config.has_section("metadata"): + variant_config.add_section("metadata") + variant_config.set("metadata", "type", "definition_changes") + + # "_settings.inst.cfg" + resource_path = Resources.getDataStoragePath() + machine_instances_dir = os.path.join(resource_path, "machine_instances") + + if variant_path.endswith("_variant.inst.cfg"): + variant_path = variant_path[:-len("_variant.inst.cfg")] + "_settings.inst.cfg" + + with open(os.path.join(machine_instances_dir, os.path.basename(variant_path)), "w") as fp: + variant_config.write(fp) + + # Change the name of variant and insert empty_variant into the stack. + new_container_list = [] + for item in container_list: + if item == variant_name: + new_container_list.append(config_name) + new_container_list.append("empty_variant") + else: + new_container_list.append(item) + + container_list = new_container_list + + config.set("general", "containers", ",".join(container_list)) + + output = io.StringIO() + config.write(output) + return [filename], [output.getvalue()] + + def __getUserVariants(self): + resource_path = Resources.getDataStoragePath() + variants_dir = os.path.join(resource_path, "variants") + + result = [] + for entry in os.scandir(variants_dir): + if entry.name.endswith('.inst.cfg') and entry.is_file(): + config = configparser.ConfigParser(interpolation = None) + with open(entry.path, "r") as fhandle: + config.read_file(fhandle) + if config.has_section("general") and config.has_option("general", "name"): + result.append( { "path": entry.path, "name": config.get("general", "name") } ) + return result + + def getCfgVersion(self, serialised): + parser = configparser.ConfigParser(interpolation = None) + parser.read_string(serialised) + return int(parser.get("general", "version")) #Explicitly give an exception when this fails. That means that the file format is not recognised. diff --git a/plugins/VersionUpgrade/VersionUpgrade22to24/__init__.py b/plugins/VersionUpgrade/VersionUpgrade22to24/__init__.py new file mode 100644 index 0000000000..1a562abbd5 --- /dev/null +++ b/plugins/VersionUpgrade/VersionUpgrade22to24/__init__.py @@ -0,0 +1,33 @@ +# Copyright (c) 2016 Ultimaker B.V. +# Cura is released under the terms of the AGPLv3 or higher. + +from . import VersionUpgrade + +from UM.i18n import i18nCatalog +catalog = i18nCatalog("cura") + +upgrade = VersionUpgrade.VersionUpgrade22to24() + +def getMetaData(): + return { + "plugin": { + "name": catalog.i18nc("@label", "Version Upgrade 2.2 to 2.4"), + "author": "Ultimaker", + "version": "1.0", + "description": catalog.i18nc("@info:whatsthis", "Upgrades configurations from Cura 2.2 to Cura 2.4."), + "api": 3 + }, + "version_upgrade": { + # From To Upgrade function + ("machine_instance", 2): ("machine_stack", 3, upgrade.upgradeMachineInstance) + }, + "sources": { + "machine_instance": { + "get_version": upgrade.getCfgVersion, + "location": {"./machine_instances"} + } + } + } + +def register(app): + return { "version_upgrade": upgrade } From 724cc99f590891bbdc79c6034a9043c058e23f3c Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Mon, 5 Dec 2016 13:31:24 +0100 Subject: [PATCH 02/34] Make things neater. CURA-2953 Version upgrade 2.3 to 2.4 --- .../VersionUpgrade22to24/VersionUpgrade.py | 60 +++++++++++-------- 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py b/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py index 38710026ac..8c42ec489f 100644 --- a/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py +++ b/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py @@ -11,6 +11,11 @@ from UM.VersionUpgrade import VersionUpgrade # Superclass of the plugin. class VersionUpgrade22to24(VersionUpgrade): def upgradeMachineInstance(self, serialised, filename): + # All of this is needed to upgrade custom variant machines from old Cura to 2.4 where + # `definition_changes` instance container has been introduced. Variant files which + # look like the the handy work of the old machine settings plugin are converted directly + # on disk. + config = configparser.ConfigParser(interpolation = None) config.read_string(serialised) # Read the input string as config file. config.set("general", "version", "3") @@ -26,32 +31,8 @@ class VersionUpgrade22to24(VersionUpgrade): if len(user_variant_names): # One of the user defined variants appears in the list of containers in the stack. - for variant_name in user_variant_names: - # Copy the variant to the machine_instances/*_settings.inst.cfg - variant_config = configparser.ConfigParser(interpolation=None) - variant_path = name_path_dict.get(variant_name) - with open(variant_path, "r") as fhandle: - variant_config.read_file(fhandle) - - if variant_config.has_section("general") and variant_config.has_option("general", "name"): - config_name = variant_config.get("general", "name") - if config_name.endswith("_variant"): - config_name = config_name[:-len("_variant")] + "_settings" - variant_config.set("general", "name", config_name) - - if not variant_config.has_section("metadata"): - variant_config.add_section("metadata") - variant_config.set("metadata", "type", "definition_changes") - - # "_settings.inst.cfg" - resource_path = Resources.getDataStoragePath() - machine_instances_dir = os.path.join(resource_path, "machine_instances") - - if variant_path.endswith("_variant.inst.cfg"): - variant_path = variant_path[:-len("_variant.inst.cfg")] + "_settings.inst.cfg" - - with open(os.path.join(machine_instances_dir, os.path.basename(variant_path)), "w") as fp: - variant_config.write(fp) + for variant_name in user_variant_names: # really there should just be one variant to convert. + config_name = self.__convertVariant(name_path_dict.get(variant_name)) # Change the name of variant and insert empty_variant into the stack. new_container_list = [] @@ -70,6 +51,33 @@ class VersionUpgrade22to24(VersionUpgrade): config.write(output) return [filename], [output.getvalue()] + def __convertVariant(self, variant_path): + # Copy the variant to the machine_instances/*_settings.inst.cfg + variant_config = configparser.ConfigParser(interpolation=None) + with open(variant_path, "r") as fhandle: + variant_config.read_file(fhandle) + + if variant_config.has_section("general") and variant_config.has_option("general", "name"): + config_name = variant_config.get("general", "name") + if config_name.endswith("_variant"): + config_name = config_name[:-len("_variant")] + "_settings" + variant_config.set("general", "name", config_name) + + if not variant_config.has_section("metadata"): + variant_config.add_section("metadata") + variant_config.set("metadata", "type", "definition_changes") + + resource_path = Resources.getDataStoragePath() + machine_instances_dir = os.path.join(resource_path, "machine_instances") + + if variant_path.endswith("_variant.inst.cfg"): + variant_path = variant_path[:-len("_variant.inst.cfg")] + "_settings.inst.cfg" + + with open(os.path.join(machine_instances_dir, os.path.basename(variant_path)), "w") as fp: + variant_config.write(fp) + + return config_name + def __getUserVariants(self): resource_path = Resources.getDataStoragePath() variants_dir = os.path.join(resource_path, "variants") From a65a81e60b63244062b7424824b38df2b7f3f453 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Tue, 6 Dec 2016 14:14:24 +0100 Subject: [PATCH 03/34] colours --- resources/qml/SidebarHeader.qml | 20 ++++++++++---------- resources/themes/cura/theme.json | 15 ++++++++++++++- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml index e894392b06..5053aa7ff1 100644 --- a/resources/qml/SidebarHeader.qml +++ b/resources/qml/SidebarHeader.qml @@ -117,12 +117,12 @@ Column background: Rectangle { border.width: UM.Theme.getSize("default_lining").width - border.color: control.checked ? UM.Theme.getColor("toggle_checked_border") : - control.pressed ? UM.Theme.getColor("toggle_active_border") : - control.hovered ? UM.Theme.getColor("toggle_hovered_border") : UM.Theme.getColor("toggle_unchecked_border") - color: control.checked ? UM.Theme.getColor("toggle_checked") : - control.pressed ? UM.Theme.getColor("toggle_active") : - control.hovered ? UM.Theme.getColor("toggle_hovered") : UM.Theme.getColor("toggle_unchecked") + border.color: control.checked ? UM.Theme.getColor("tab_checked_border") : + control.pressed ? UM.Theme.getColor("tab_active_border") : + control.hovered ? UM.Theme.getColor("tab_hovered_border") : UM.Theme.getColor("tab_unchecked_border") + color: control.checked ? UM.Theme.getColor("tab_checked") : + control.pressed ? UM.Theme.getColor("tab_active") : + control.hovered ? UM.Theme.getColor("tab_hovered") : UM.Theme.getColor("tab_unchecked") Behavior on color { ColorAnimation { duration: 50; } } Rectangle @@ -137,7 +137,7 @@ Column color: model.color border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("toggle_checked") + border.color: UM.Theme.getColor("tab_checked_border") } Label @@ -148,9 +148,9 @@ Column anchors.right: parent.right anchors.rightMargin: UM.Theme.getSize("default_margin").width / 2 - color: control.checked ? UM.Theme.getColor("toggle_checked_text") : - control.pressed ? UM.Theme.getColor("toggle_active_text") : - control.hovered ? UM.Theme.getColor("toggle_hovered_text") : UM.Theme.getColor("toggle_unchecked_text") + color: control.checked ? UM.Theme.getColor("tab_checked_text") : + control.pressed ? UM.Theme.getColor("tab_active_text") : + control.hovered ? UM.Theme.getColor("tab_hovered_text") : UM.Theme.getColor("tab_unchecked_text") font: UM.Theme.getFont("default") text: control.text diff --git a/resources/themes/cura/theme.json b/resources/themes/cura/theme.json index a29aefa143..c352ca64e9 100644 --- a/resources/themes/cura/theme.json +++ b/resources/themes/cura/theme.json @@ -91,7 +91,20 @@ "toggle_hovered_text": [24, 41, 77, 255], "toggle_active": [32, 166, 219, 255], "toggle_active_border": [32, 166, 219, 255], - "toggle_active_text": [255, 255, 255, 255], + "toggle_active_text": [24, 41, 77, 255], + + "tab_checked": [255, 255, 255, 255], + "tab_checked_border": [24, 41, 77, 255], + "tab_checked_text": [24, 41, 77, 255], + "tab_unchecked": [224, 224, 224, 255], + "tab_unchecked_border": [224, 224, 224, 255], + "tab_unchecked_text": [24, 41, 77, 255], + "tab_hovered": [240, 240, 240, 255], + "tab_hovered_border": [128, 128, 128, 255], + "tab_hovered_text": [24, 41, 77, 255], + "tab_active": [255, 255, 255, 255], + "tab_active_border": [24, 41, 77, 255], + "tab_active_text": [24, 41, 77, 255], "action_button": [255, 255, 255, 255], "action_button_text": [24, 41, 77, 255], From 30a74fb2c160ac10f9fef3e98ae3fd17fbdeb1c5 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Tue, 6 Dec 2016 15:49:34 +0100 Subject: [PATCH 04/34] Layout changes, extruders are now displayed as extruder tabs. CURA-2763 --- resources/qml/SidebarHeader.qml | 174 +++++++++++++++++-------------- resources/themes/cura/theme.json | 13 ++- 2 files changed, 105 insertions(+), 82 deletions(-) diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml index 5053aa7ff1..6f9a8781d7 100644 --- a/resources/qml/SidebarHeader.qml +++ b/resources/qml/SidebarHeader.qml @@ -61,103 +61,123 @@ Column } } - ListView + Row { - id: extrudersList - property var index: 0 - - visible: machineExtruderCount.properties.value > 1 && !sidebar.monitoringPrint - height: UM.Theme.getSize("sidebar_header_mode_toggle").height - - boundsBehavior: Flickable.StopAtBounds + id: extruderSelectionRow + height: UM.Theme.getSize("sidebar_tabs").height anchors { left: parent.left - leftMargin: UM.Theme.getSize("default_margin").width right: parent.right - rightMargin: UM.Theme.getSize("default_margin").width } - ExclusiveGroup { id: extruderMenuGroup; } - - orientation: ListView.Horizontal - - model: Cura.ExtrudersModel { id: extrudersModel; addGlobal: false } - - Connections + Rectangle { - target: Cura.MachineManager - onGlobalContainerChanged: - { - forceActiveFocus() // Changing focus applies the currently-being-typed values so it can change the displayed setting values. - var extruder_index = (machineExtruderCount.properties.value == 1) ? -1 : 0 - ExtruderManager.setActiveExtruderIndex(extruder_index); - } + anchors.verticalCenter: parent.verticalCenter + + width: parent.width + height: parent.height + color: UM.Theme.getColor("tab_background") } - delegate: Button + ListView { - height: ListView.view.height - width: ListView.view.width / extrudersModel.rowCount() + id: extrudersList + property var index: 0 - text: model.name - tooltip: model.name - exclusiveGroup: extruderMenuGroup - checked: base.currentExtruderIndex == index + visible: machineExtruderCount.properties.value > 1 && !sidebar.monitoringPrint + height: UM.Theme.getSize("sidebar_header_mode_tabs").height - onClicked: + boundsBehavior: Flickable.StopAtBounds + + anchors { - forceActiveFocus() // Changing focus applies the currently-being-typed values so it can change the displayed setting values. - ExtruderManager.setActiveExtruderIndex(index); + left: parent.left + right: parent.right + bottom: parent.bottom } - style: ButtonStyle + ExclusiveGroup { id: extruderMenuGroup; } + + orientation: ListView.Horizontal + + model: Cura.ExtrudersModel { id: extrudersModel; addGlobal: false } + + Connections { - background: Rectangle + target: Cura.MachineManager + onGlobalContainerChanged: { - border.width: UM.Theme.getSize("default_lining").width - border.color: control.checked ? UM.Theme.getColor("tab_checked_border") : - control.pressed ? UM.Theme.getColor("tab_active_border") : - control.hovered ? UM.Theme.getColor("tab_hovered_border") : UM.Theme.getColor("tab_unchecked_border") - color: control.checked ? UM.Theme.getColor("tab_checked") : - control.pressed ? UM.Theme.getColor("tab_active") : - control.hovered ? UM.Theme.getColor("tab_hovered") : UM.Theme.getColor("tab_unchecked") - Behavior on color { ColorAnimation { duration: 50; } } - - Rectangle - { - id: swatch - visible: index > -1 - height: UM.Theme.getSize("setting_control").height / 2 - width: height - anchors.left: parent.left - anchors.leftMargin: (parent.height - height) / 2 - anchors.verticalCenter: parent.verticalCenter - - color: model.color - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("tab_checked_border") - } - - Label - { - anchors.verticalCenter: parent.verticalCenter - anchors.left: swatch.visible ? swatch.right : parent.left - anchors.leftMargin: swatch.visible ? UM.Theme.getSize("default_margin").width / 2 : UM.Theme.getSize("default_margin").width - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width / 2 - - color: control.checked ? UM.Theme.getColor("tab_checked_text") : - control.pressed ? UM.Theme.getColor("tab_active_text") : - control.hovered ? UM.Theme.getColor("tab_hovered_text") : UM.Theme.getColor("tab_unchecked_text") - - font: UM.Theme.getFont("default") - text: control.text - elide: Text.ElideRight - } + forceActiveFocus() // Changing focus applies the currently-being-typed values so it can change the displayed setting values. + var extruder_index = (machineExtruderCount.properties.value == 1) ? -1 : 0 + ExtruderManager.setActiveExtruderIndex(extruder_index); + } + } + + delegate: Button + { + height: ListView.view.height + width: ListView.view.width / extrudersModel.rowCount() + + text: model.name + tooltip: model.name + exclusiveGroup: extruderMenuGroup + checked: base.currentExtruderIndex == index + + onClicked: + { + forceActiveFocus() // Changing focus applies the currently-being-typed values so it can change the displayed setting values. + ExtruderManager.setActiveExtruderIndex(index); + } + + style: ButtonStyle + { + background: Rectangle + { + border.width: UM.Theme.getSize("default_lining").width + border.color: control.checked ? UM.Theme.getColor("tab_checked_border") : + control.pressed ? UM.Theme.getColor("tab_active_border") : + control.hovered ? UM.Theme.getColor("tab_hovered_border") : UM.Theme.getColor("tab_unchecked_border") + color: control.checked ? UM.Theme.getColor("tab_checked") : + control.pressed ? UM.Theme.getColor("tab_active") : + control.hovered ? UM.Theme.getColor("tab_hovered") : UM.Theme.getColor("tab_unchecked") + Behavior on color { ColorAnimation { duration: 50; } } + + Rectangle + { + id: swatch + visible: index > -1 + height: UM.Theme.getSize("setting_control").height / 2 + width: height + anchors.left: parent.left + anchors.leftMargin: (parent.height - height) / 2 + anchors.verticalCenter: parent.verticalCenter + + color: model.color + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("setting_control_border") + } + + Label + { + anchors.verticalCenter: parent.verticalCenter + anchors.left: swatch.visible ? swatch.right : parent.left + anchors.leftMargin: swatch.visible ? UM.Theme.getSize("default_margin").width / 2 : UM.Theme.getSize("default_margin").width + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width / 2 + + color: control.checked ? UM.Theme.getColor("tab_checked_text") : + control.pressed ? UM.Theme.getColor("tab_active_text") : + control.hovered ? UM.Theme.getColor("tab_hovered_text") : UM.Theme.getColor("tab_unchecked_text") + + font: UM.Theme.getFont("default") + text: control.text + elide: Text.ElideRight + } + } + label: Item { } } - label: Item { } } } } diff --git a/resources/themes/cura/theme.json b/resources/themes/cura/theme.json index c352ca64e9..fab5466a07 100644 --- a/resources/themes/cura/theme.json +++ b/resources/themes/cura/theme.json @@ -94,17 +94,18 @@ "toggle_active_text": [24, 41, 77, 255], "tab_checked": [255, 255, 255, 255], - "tab_checked_border": [24, 41, 77, 255], + "tab_checked_border": [255, 255, 255, 255], "tab_checked_text": [24, 41, 77, 255], "tab_unchecked": [224, 224, 224, 255], "tab_unchecked_border": [224, 224, 224, 255], - "tab_unchecked_text": [24, 41, 77, 255], + "tab_unchecked_text": [152, 152, 152, 255], "tab_hovered": [240, 240, 240, 255], - "tab_hovered_border": [128, 128, 128, 255], - "tab_hovered_text": [24, 41, 77, 255], + "tab_hovered_border": [240, 240, 240, 255], + "tab_hovered_text": [32, 166, 219, 255], "tab_active": [255, 255, 255, 255], - "tab_active_border": [24, 41, 77, 255], + "tab_active_border": [255, 255, 255, 255], "tab_active_text": [24, 41, 77, 255], + "tab_background": [245, 245, 245, 255], "action_button": [255, 255, 255, 255], "action_button_text": [24, 41, 77, 255], @@ -206,8 +207,10 @@ "sidebar_header": [0.0, 4.0], "sidebar_header_highlight": [0.5, 0.5], "sidebar_header_mode_toggle": [0.0, 2.0], + "sidebar_header_mode_tabs": [0.0, 3.0], "sidebar_lining": [0.5, 0.5], "sidebar_setup": [0.0, 2.0], + "sidebar_tabs": [0.0, 4.0], "sidebar_inputfields": [0.0, 2.0], "simple_mode_infill_caption": [0.0, 5.0], "simple_mode_infill_height": [0.0, 8.0], From b120cba148a0f34aee81ca86032b6ed52e903020 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Tue, 6 Dec 2016 15:56:20 +0100 Subject: [PATCH 05/34] Better colors. CURA-2763 --- resources/themes/cura/theme.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/themes/cura/theme.json b/resources/themes/cura/theme.json index fab5466a07..03c5ecbcc6 100644 --- a/resources/themes/cura/theme.json +++ b/resources/themes/cura/theme.json @@ -96,11 +96,11 @@ "tab_checked": [255, 255, 255, 255], "tab_checked_border": [255, 255, 255, 255], "tab_checked_text": [24, 41, 77, 255], - "tab_unchecked": [224, 224, 224, 255], - "tab_unchecked_border": [224, 224, 224, 255], + "tab_unchecked": [245, 245, 245, 255], + "tab_unchecked_border": [245, 245, 245, 255], "tab_unchecked_text": [152, 152, 152, 255], - "tab_hovered": [240, 240, 240, 255], - "tab_hovered_border": [240, 240, 240, 255], + "tab_hovered": [245, 245, 245, 255], + "tab_hovered_border": [245, 245, 245, 255], "tab_hovered_text": [32, 166, 219, 255], "tab_active": [255, 255, 255, 255], "tab_active_border": [255, 255, 255, 255], From 3efc5d63ef951a82a58103f1d0d78c30dcc1d85f Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Tue, 6 Dec 2016 16:11:08 +0100 Subject: [PATCH 06/34] Improved layout, removed material name from extruder name. CURA-2763 --- cura/Settings/ExtrudersModel.py | 2 -- resources/extruders/ultimaker3_extended_extruder_left.def.json | 2 +- resources/extruders/ultimaker3_extended_extruder_right.def.json | 2 +- resources/extruders/ultimaker3_extruder_left.def.json | 2 +- resources/extruders/ultimaker3_extruder_right.def.json | 2 +- resources/qml/SidebarHeader.qml | 2 +- resources/themes/cura/theme.json | 2 +- 7 files changed, 6 insertions(+), 8 deletions(-) diff --git a/cura/Settings/ExtrudersModel.py b/cura/Settings/ExtrudersModel.py index 7e06b95100..af3cb62406 100644 --- a/cura/Settings/ExtrudersModel.py +++ b/cura/Settings/ExtrudersModel.py @@ -140,8 +140,6 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel): for extruder in manager.getMachineExtruders(global_container_stack.getId()): extruder_name = extruder.getName() material = extruder.findContainer({ "type": "material" }) - if material and not self._simple_names: - extruder_name = "%s (%s)" % (material.getName(), extruder_name) position = extruder.getMetaDataEntry("position", default = "0") # Get the position try: position = int(position) diff --git a/resources/extruders/ultimaker3_extended_extruder_left.def.json b/resources/extruders/ultimaker3_extended_extruder_left.def.json index 202272b096..3335e85ae3 100644 --- a/resources/extruders/ultimaker3_extended_extruder_left.def.json +++ b/resources/extruders/ultimaker3_extended_extruder_left.def.json @@ -1,7 +1,7 @@ { "id": "ultimaker3_extended_extruder_left", "version": 2, - "name": "Print core 1", + "name": "Extruder 1", "inherits": "fdmextruder", "metadata": { "machine": "ultimaker3_extended", diff --git a/resources/extruders/ultimaker3_extended_extruder_right.def.json b/resources/extruders/ultimaker3_extended_extruder_right.def.json index 0f85b2dd09..2e072753b1 100644 --- a/resources/extruders/ultimaker3_extended_extruder_right.def.json +++ b/resources/extruders/ultimaker3_extended_extruder_right.def.json @@ -1,7 +1,7 @@ { "id": "ultimaker3_extended_extruder_right", "version": 2, - "name": "Print core 2", + "name": "Extruder 2", "inherits": "fdmextruder", "metadata": { "machine": "ultimaker3_extended", diff --git a/resources/extruders/ultimaker3_extruder_left.def.json b/resources/extruders/ultimaker3_extruder_left.def.json index 83efa25dbb..141fd2f80c 100644 --- a/resources/extruders/ultimaker3_extruder_left.def.json +++ b/resources/extruders/ultimaker3_extruder_left.def.json @@ -1,7 +1,7 @@ { "id": "ultimaker3_extruder_left", "version": 2, - "name": "Print core 1", + "name": "Extruder 1", "inherits": "fdmextruder", "metadata": { "machine": "ultimaker3", diff --git a/resources/extruders/ultimaker3_extruder_right.def.json b/resources/extruders/ultimaker3_extruder_right.def.json index 4a75059c40..50a369e3ed 100644 --- a/resources/extruders/ultimaker3_extruder_right.def.json +++ b/resources/extruders/ultimaker3_extruder_right.def.json @@ -1,7 +1,7 @@ { "id": "ultimaker3_extruder_right", "version": 2, - "name": "Print core 2", + "name": "Extruder 2", "inherits": "fdmextruder", "metadata": { "machine": "ultimaker3", diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml index 6f9a8781d7..105431c3ee 100644 --- a/resources/qml/SidebarHeader.qml +++ b/resources/qml/SidebarHeader.qml @@ -65,6 +65,7 @@ Column { id: extruderSelectionRow height: UM.Theme.getSize("sidebar_tabs").height + visible: machineExtruderCount.properties.value > 1 && !sidebar.monitoringPrint anchors { @@ -86,7 +87,6 @@ Column id: extrudersList property var index: 0 - visible: machineExtruderCount.properties.value > 1 && !sidebar.monitoringPrint height: UM.Theme.getSize("sidebar_header_mode_tabs").height boundsBehavior: Flickable.StopAtBounds diff --git a/resources/themes/cura/theme.json b/resources/themes/cura/theme.json index 03c5ecbcc6..f7aff957f3 100644 --- a/resources/themes/cura/theme.json +++ b/resources/themes/cura/theme.json @@ -210,7 +210,7 @@ "sidebar_header_mode_tabs": [0.0, 3.0], "sidebar_lining": [0.5, 0.5], "sidebar_setup": [0.0, 2.0], - "sidebar_tabs": [0.0, 4.0], + "sidebar_tabs": [0.0, 3.5], "sidebar_inputfields": [0.0, 2.0], "simple_mode_infill_caption": [0.0, 5.0], "simple_mode_infill_height": [0.0, 8.0], From f916c9b4cfc47e8fa99c7a9888b0d12f118503af Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Tue, 6 Dec 2016 16:32:34 +0100 Subject: [PATCH 07/34] Show extruder tabs only in custom mode. CURA-2763 --- resources/qml/Sidebar.qml | 5 +++-- resources/qml/SidebarHeader.qml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 77e82b5f92..afb5e77b8d 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -149,6 +149,7 @@ Rectangle SidebarHeader { id: header width: parent.width + property bool showExtruderTabs: modesListModel.get(base.currentModeIndex).showExtruderTabs anchors.top: sidebarHeaderBar.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height @@ -408,8 +409,8 @@ Rectangle Component.onCompleted: { - modesListModel.append({ text: catalog.i18nc("@title:tab", "Recommended"), item: sidebarSimple, showFilterButton: false }) - modesListModel.append({ text: catalog.i18nc("@title:tab", "Custom"), item: sidebarAdvanced, showFilterButton: true }) + modesListModel.append({ text: catalog.i18nc("@title:tab", "Recommended"), item: sidebarSimple, showFilterButton: false, showExtruderTabs: false }) + modesListModel.append({ text: catalog.i18nc("@title:tab", "Custom"), item: sidebarAdvanced, showFilterButton: true, showExtruderTabs: true }) sidebarContents.push({ "item": modesListModel.get(base.currentModeIndex).item, "immediate": true }); var index = parseInt(UM.Preferences.getValue("cura/active_mode")) diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml index 105431c3ee..58261bf7e6 100644 --- a/resources/qml/SidebarHeader.qml +++ b/resources/qml/SidebarHeader.qml @@ -65,7 +65,7 @@ Column { id: extruderSelectionRow height: UM.Theme.getSize("sidebar_tabs").height - visible: machineExtruderCount.properties.value > 1 && !sidebar.monitoringPrint + visible: showExtruderTabs && machineExtruderCount.properties.value > 1 && !sidebar.monitoringPrint anchors { From e1d7a9faece7ccd357ba506633aed272e03241aa Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Tue, 6 Dec 2016 17:03:35 +0100 Subject: [PATCH 08/34] Properly support the extrauder trains. CURA-2953 Version upgrade 2.3 to 2.4 --- cura/CuraApplication.py | 1 + .../VersionUpgrade22to24/VersionUpgrade.py | 9 +++++++++ .../VersionUpgrade/VersionUpgrade22to24/__init__.py | 11 ++++++++--- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 6ed7759c34..4753955337 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -129,6 +129,7 @@ class CuraApplication(QtApplication): { ("quality", UM.Settings.InstanceContainer.Version): (self.ResourceTypes.QualityInstanceContainer, "application/x-uranium-instancecontainer"), ("machine_stack", UM.Settings.ContainerStack.Version): (self.ResourceTypes.MachineStack, "application/x-uranium-containerstack"), + ("extruder_train", UM.Settings.ContainerStack.Version): (self.ResourceTypes.ExtruderStack, "application/x-uranium-extruderstack"), ("preferences", UM.Preferences.Version): (Resources.Preferences, "application/x-uranium-preferences"), ("user", UM.Settings.InstanceContainer.Version): (self.ResourceTypes.UserInstanceContainer, "application/x-uranium-instancecontainer") } diff --git a/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py b/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py index 8c42ec489f..64c98dea60 100644 --- a/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py +++ b/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py @@ -92,6 +92,15 @@ class VersionUpgrade22to24(VersionUpgrade): result.append( { "path": entry.path, "name": config.get("general", "name") } ) return result + def upgradeExtruderTrain(self, serialised, filename): + config = configparser.ConfigParser(interpolation = None) + config.read_string(serialised) # Read the input string as config file. + config.set("general", "version", "3") # Just bump the version number. That is all we need for now. + + 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 1a562abbd5..85d53199e4 100644 --- a/plugins/VersionUpgrade/VersionUpgrade22to24/__init__.py +++ b/plugins/VersionUpgrade/VersionUpgrade22to24/__init__.py @@ -19,13 +19,18 @@ def getMetaData(): }, "version_upgrade": { # From To Upgrade function - ("machine_instance", 2): ("machine_stack", 3, upgrade.upgradeMachineInstance) + ("machine_instance", 2): ("machine_stack", 3, upgrade.upgradeMachineInstance), + ("extruder_train", 2): ("extruder_train", 3, upgrade.upgradeExtruderTrain) }, "sources": { - "machine_instance": { + "machine_stack": { "get_version": upgrade.getCfgVersion, "location": {"./machine_instances"} - } + }, + "extruder_train": { + "get_version": upgrade.getCfgVersion, + "location": {"./extruders"} + }, } } From 67f1afb9ce2b41e104741cc2ba8878a2a94e8565 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Wed, 7 Dec 2016 14:32:40 +0100 Subject: [PATCH 09/34] Revert "Show extruder tabs only in custom mode. CURA-2763" This reverts commit f916c9b4cfc47e8fa99c7a9888b0d12f118503af. --- resources/qml/Sidebar.qml | 5 ++--- resources/qml/SidebarHeader.qml | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index afb5e77b8d..77e82b5f92 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -149,7 +149,6 @@ Rectangle SidebarHeader { id: header width: parent.width - property bool showExtruderTabs: modesListModel.get(base.currentModeIndex).showExtruderTabs anchors.top: sidebarHeaderBar.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height @@ -409,8 +408,8 @@ Rectangle Component.onCompleted: { - modesListModel.append({ text: catalog.i18nc("@title:tab", "Recommended"), item: sidebarSimple, showFilterButton: false, showExtruderTabs: false }) - modesListModel.append({ text: catalog.i18nc("@title:tab", "Custom"), item: sidebarAdvanced, showFilterButton: true, showExtruderTabs: true }) + modesListModel.append({ text: catalog.i18nc("@title:tab", "Recommended"), item: sidebarSimple, showFilterButton: false }) + modesListModel.append({ text: catalog.i18nc("@title:tab", "Custom"), item: sidebarAdvanced, showFilterButton: true }) sidebarContents.push({ "item": modesListModel.get(base.currentModeIndex).item, "immediate": true }); var index = parseInt(UM.Preferences.getValue("cura/active_mode")) diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml index 58261bf7e6..105431c3ee 100644 --- a/resources/qml/SidebarHeader.qml +++ b/resources/qml/SidebarHeader.qml @@ -65,7 +65,7 @@ Column { id: extruderSelectionRow height: UM.Theme.getSize("sidebar_tabs").height - visible: showExtruderTabs && machineExtruderCount.properties.value > 1 && !sidebar.monitoringPrint + visible: machineExtruderCount.properties.value > 1 && !sidebar.monitoringPrint anchors { From 4ecd1a0fe30e6804c541b4b00578d66b3f6061c4 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Wed, 7 Dec 2016 15:16:47 +0100 Subject: [PATCH 10/34] Simplifying layout by removing unneeded elements. CURA-2763 --- resources/qml/SidebarHeader.qml | 175 +++++++++++++++----------------- 1 file changed, 82 insertions(+), 93 deletions(-) diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml index 105431c3ee..b0b2527357 100644 --- a/resources/qml/SidebarHeader.qml +++ b/resources/qml/SidebarHeader.qml @@ -61,11 +61,25 @@ Column } } - Row + /*Rectangle { - id: extruderSelectionRow - height: UM.Theme.getSize("sidebar_tabs").height - visible: machineExtruderCount.properties.value > 1 && !sidebar.monitoringPrint + id: extruderSeparator + // anchors.verticalCenter: parent.verticalCenter + // anchors.top: machineSelectionRow.bottom + + width: parent.width + height: UM.Theme.getSize("sidebar_lining").height + color: UM.Theme.getColor("sidebar_lining") + }*/ + + ListView + { + id: extrudersList + property var index: 0 + + height: UM.Theme.getSize("sidebar_header_mode_tabs").height + + boundsBehavior: Flickable.StopAtBounds anchors { @@ -73,111 +87,85 @@ Column right: parent.right } - Rectangle - { - anchors.verticalCenter: parent.verticalCenter + ExclusiveGroup { id: extruderMenuGroup; } - width: parent.width - height: parent.height - color: UM.Theme.getColor("tab_background") + orientation: ListView.Horizontal + + model: Cura.ExtrudersModel { id: extrudersModel; addGlobal: false } + + Connections + { + target: Cura.MachineManager + onGlobalContainerChanged: + { + forceActiveFocus() // Changing focus applies the currently-being-typed values so it can change the displayed setting values. + var extruder_index = (machineExtruderCount.properties.value == 1) ? -1 : 0 + ExtruderManager.setActiveExtruderIndex(extruder_index); + } } - ListView + delegate: Button { - id: extrudersList - property var index: 0 + height: ListView.view.height + width: ListView.view.width / extrudersModel.rowCount() - height: UM.Theme.getSize("sidebar_header_mode_tabs").height + text: model.name + tooltip: model.name + exclusiveGroup: extruderMenuGroup + checked: base.currentExtruderIndex == index - boundsBehavior: Flickable.StopAtBounds - - anchors + onClicked: { - left: parent.left - right: parent.right - bottom: parent.bottom + forceActiveFocus() // Changing focus applies the currently-being-typed values so it can change the displayed setting values. + ExtruderManager.setActiveExtruderIndex(index); } - ExclusiveGroup { id: extruderMenuGroup; } - - orientation: ListView.Horizontal - - model: Cura.ExtrudersModel { id: extrudersModel; addGlobal: false } - - Connections + style: ButtonStyle { - target: Cura.MachineManager - onGlobalContainerChanged: + background: Rectangle { - forceActiveFocus() // Changing focus applies the currently-being-typed values so it can change the displayed setting values. - var extruder_index = (machineExtruderCount.properties.value == 1) ? -1 : 0 - ExtruderManager.setActiveExtruderIndex(extruder_index); - } - } + border.width: UM.Theme.getSize("default_lining").width + border.color: control.checked ? UM.Theme.getColor("tab_checked_border") : + control.pressed ? UM.Theme.getColor("tab_active_border") : + control.hovered ? UM.Theme.getColor("tab_hovered_border") : UM.Theme.getColor("tab_unchecked_border") + color: control.checked ? UM.Theme.getColor("tab_checked") : + control.pressed ? UM.Theme.getColor("tab_active") : + control.hovered ? UM.Theme.getColor("tab_hovered") : UM.Theme.getColor("tab_unchecked") + Behavior on color { ColorAnimation { duration: 50; } } - delegate: Button - { - height: ListView.view.height - width: ListView.view.width / extrudersModel.rowCount() - - text: model.name - tooltip: model.name - exclusiveGroup: extruderMenuGroup - checked: base.currentExtruderIndex == index - - onClicked: - { - forceActiveFocus() // Changing focus applies the currently-being-typed values so it can change the displayed setting values. - ExtruderManager.setActiveExtruderIndex(index); - } - - style: ButtonStyle - { - background: Rectangle + Rectangle { + id: swatch + visible: index > -1 + height: UM.Theme.getSize("setting_control").height / 2 + width: height + anchors.left: parent.left + anchors.leftMargin: (parent.height - height) / 2 + anchors.verticalCenter: parent.verticalCenter + + color: model.color border.width: UM.Theme.getSize("default_lining").width - border.color: control.checked ? UM.Theme.getColor("tab_checked_border") : - control.pressed ? UM.Theme.getColor("tab_active_border") : - control.hovered ? UM.Theme.getColor("tab_hovered_border") : UM.Theme.getColor("tab_unchecked_border") - color: control.checked ? UM.Theme.getColor("tab_checked") : - control.pressed ? UM.Theme.getColor("tab_active") : - control.hovered ? UM.Theme.getColor("tab_hovered") : UM.Theme.getColor("tab_unchecked") - Behavior on color { ColorAnimation { duration: 50; } } - - Rectangle - { - id: swatch - visible: index > -1 - height: UM.Theme.getSize("setting_control").height / 2 - width: height - anchors.left: parent.left - anchors.leftMargin: (parent.height - height) / 2 - anchors.verticalCenter: parent.verticalCenter - - color: model.color - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("setting_control_border") - } - - Label - { - anchors.verticalCenter: parent.verticalCenter - anchors.left: swatch.visible ? swatch.right : parent.left - anchors.leftMargin: swatch.visible ? UM.Theme.getSize("default_margin").width / 2 : UM.Theme.getSize("default_margin").width - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width / 2 - - color: control.checked ? UM.Theme.getColor("tab_checked_text") : - control.pressed ? UM.Theme.getColor("tab_active_text") : - control.hovered ? UM.Theme.getColor("tab_hovered_text") : UM.Theme.getColor("tab_unchecked_text") - - font: UM.Theme.getFont("default") - text: control.text - elide: Text.ElideRight - } + border.color: UM.Theme.getColor("setting_control_border") + } + + Label + { + anchors.verticalCenter: parent.verticalCenter + anchors.left: swatch.visible ? swatch.right : parent.left + anchors.leftMargin: swatch.visible ? UM.Theme.getSize("default_margin").width / 2 : UM.Theme.getSize("default_margin").width + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width / 2 + + color: control.checked ? UM.Theme.getColor("tab_checked_text") : + control.pressed ? UM.Theme.getColor("tab_active_text") : + control.hovered ? UM.Theme.getColor("tab_hovered_text") : UM.Theme.getColor("tab_unchecked_text") + + font: UM.Theme.getFont("default") + text: control.text + elide: Text.ElideRight } - label: Item { } } + label: Item { } } } } @@ -195,6 +183,7 @@ Column leftMargin: UM.Theme.getSize("default_margin").width right: parent.right rightMargin: UM.Theme.getSize("default_margin").width + top: extrudersList.bottom } Label From 7694b8f128eae8c485a840e72a8b7377c1b85bfe Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Wed, 7 Dec 2016 15:40:25 +0100 Subject: [PATCH 11/34] Cannot do it simpler. CURA-2763 --- resources/qml/SidebarHeader.qml | 194 +++++++++++++++++--------------- 1 file changed, 101 insertions(+), 93 deletions(-) diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml index b0b2527357..77d45cae26 100644 --- a/resources/qml/SidebarHeader.qml +++ b/resources/qml/SidebarHeader.qml @@ -61,111 +61,120 @@ Column } } - /*Rectangle + Row { - id: extruderSeparator - // anchors.verticalCenter: parent.verticalCenter - // anchors.top: machineSelectionRow.bottom - + id: extruderSelectionRow width: parent.width - height: UM.Theme.getSize("sidebar_lining").height - color: UM.Theme.getColor("sidebar_lining") - }*/ + height: UM.Theme.getSize("sidebar_tabs").height + visible: machineExtruderCount.properties.value > 1 && !sidebar.monitoringPrint - ListView - { - id: extrudersList - property var index: 0 - - height: UM.Theme.getSize("sidebar_header_mode_tabs").height - - boundsBehavior: Flickable.StopAtBounds - - anchors + Rectangle { - left: parent.left - right: parent.right + id: extruderSeparator + visible: machineExtruderCount.properties.value > 1 && !sidebar.monitoringPrint + + width: parent.width + height: parent.height + color: UM.Theme.getColor("sidebar_lining") + + anchors.top: extruderSelectionRow.top } - ExclusiveGroup { id: extruderMenuGroup; } - - orientation: ListView.Horizontal - - model: Cura.ExtrudersModel { id: extrudersModel; addGlobal: false } - - Connections + ListView { - target: Cura.MachineManager - onGlobalContainerChanged: + id: extrudersList + property var index: 0 + + height: UM.Theme.getSize("sidebar_header_mode_tabs").height + boundsBehavior: Flickable.StopAtBounds + + anchors { - forceActiveFocus() // Changing focus applies the currently-being-typed values so it can change the displayed setting values. - var extruder_index = (machineExtruderCount.properties.value == 1) ? -1 : 0 - ExtruderManager.setActiveExtruderIndex(extruder_index); - } - } - - delegate: Button - { - height: ListView.view.height - width: ListView.view.width / extrudersModel.rowCount() - - text: model.name - tooltip: model.name - exclusiveGroup: extruderMenuGroup - checked: base.currentExtruderIndex == index - - onClicked: - { - forceActiveFocus() // Changing focus applies the currently-being-typed values so it can change the displayed setting values. - ExtruderManager.setActiveExtruderIndex(index); + left: parent.left + right: parent.right + bottom: extruderSelectionRow.bottom } - style: ButtonStyle + ExclusiveGroup { id: extruderMenuGroup; } + + orientation: ListView.Horizontal + + model: Cura.ExtrudersModel { id: extrudersModel; addGlobal: false } + + Connections { - background: Rectangle + target: Cura.MachineManager + onGlobalContainerChanged: { - border.width: UM.Theme.getSize("default_lining").width - border.color: control.checked ? UM.Theme.getColor("tab_checked_border") : - control.pressed ? UM.Theme.getColor("tab_active_border") : - control.hovered ? UM.Theme.getColor("tab_hovered_border") : UM.Theme.getColor("tab_unchecked_border") - color: control.checked ? UM.Theme.getColor("tab_checked") : - control.pressed ? UM.Theme.getColor("tab_active") : - control.hovered ? UM.Theme.getColor("tab_hovered") : UM.Theme.getColor("tab_unchecked") - Behavior on color { ColorAnimation { duration: 50; } } - - Rectangle - { - id: swatch - visible: index > -1 - height: UM.Theme.getSize("setting_control").height / 2 - width: height - anchors.left: parent.left - anchors.leftMargin: (parent.height - height) / 2 - anchors.verticalCenter: parent.verticalCenter - - color: model.color - border.width: UM.Theme.getSize("default_lining").width - border.color: UM.Theme.getColor("setting_control_border") - } - - Label - { - anchors.verticalCenter: parent.verticalCenter - anchors.left: swatch.visible ? swatch.right : parent.left - anchors.leftMargin: swatch.visible ? UM.Theme.getSize("default_margin").width / 2 : UM.Theme.getSize("default_margin").width - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width / 2 - - color: control.checked ? UM.Theme.getColor("tab_checked_text") : - control.pressed ? UM.Theme.getColor("tab_active_text") : - control.hovered ? UM.Theme.getColor("tab_hovered_text") : UM.Theme.getColor("tab_unchecked_text") - - font: UM.Theme.getFont("default") - text: control.text - elide: Text.ElideRight - } + forceActiveFocus() // Changing focus applies the currently-being-typed values so it can change the displayed setting values. + var extruder_index = (machineExtruderCount.properties.value == 1) ? -1 : 0 + ExtruderManager.setActiveExtruderIndex(extruder_index); + } + } + + delegate: Button + { + height: ListView.view.height + width: ListView.view.width / extrudersModel.rowCount() + + text: model.name + tooltip: model.name + exclusiveGroup: extruderMenuGroup + checked: base.currentExtruderIndex == index + + onClicked: + { + forceActiveFocus() // Changing focus applies the currently-being-typed values so it can change the displayed setting values. + ExtruderManager.setActiveExtruderIndex(index); + } + + style: ButtonStyle + { + background: Rectangle + { + border.width: UM.Theme.getSize("default_lining").width + border.color: control.checked ? UM.Theme.getColor("tab_checked_border") : + control.pressed ? UM.Theme.getColor("tab_active_border") : + control.hovered ? UM.Theme.getColor("tab_hovered_border") : UM.Theme.getColor("tab_unchecked_border") + color: control.checked ? UM.Theme.getColor("tab_checked") : + control.pressed ? UM.Theme.getColor("tab_active") : + control.hovered ? UM.Theme.getColor("tab_hovered") : UM.Theme.getColor("tab_unchecked") + Behavior on color { ColorAnimation { duration: 50; } } + + Rectangle + { + id: swatch + visible: index > -1 + height: UM.Theme.getSize("setting_control").height / 2 + width: height + anchors.left: parent.left + anchors.leftMargin: (parent.height - height) / 2 + anchors.verticalCenter: parent.verticalCenter + + color: model.color + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("setting_control_border") + } + + Label + { + anchors.verticalCenter: parent.verticalCenter + anchors.left: swatch.visible ? swatch.right : parent.left + anchors.leftMargin: swatch.visible ? UM.Theme.getSize("default_margin").width / 2 : UM.Theme.getSize("default_margin").width + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width / 2 + + color: control.checked ? UM.Theme.getColor("tab_checked_text") : + control.pressed ? UM.Theme.getColor("tab_active_text") : + control.hovered ? UM.Theme.getColor("tab_hovered_text") : UM.Theme.getColor("tab_unchecked_text") + + font: UM.Theme.getFont("default") + text: control.text + elide: Text.ElideRight + } + } + label: Item { } } - label: Item { } } } } @@ -183,7 +192,6 @@ Column leftMargin: UM.Theme.getSize("default_margin").width right: parent.right rightMargin: UM.Theme.getSize("default_margin").width - top: extrudersList.bottom } Label From e642b4ebe95a66d392d0411e371354a39a30eae7 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Wed, 7 Dec 2016 17:41:04 +0100 Subject: [PATCH 12/34] Tweak 2.4 sidebar changes * Make extruder-tabs more clear on badly calibrated displays * Make infill selection same width as other "Recommended" controls * Move printer selection to the top bar * Add animation to support extruder selection combobox --- resources/qml/Sidebar.qml | 62 ++++++++++++++++++++++++++++---- resources/qml/SidebarHeader.qml | 60 +++++++++++-------------------- resources/qml/SidebarSimple.qml | 13 +++---- resources/themes/cura/theme.json | 2 +- 4 files changed, 84 insertions(+), 53 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 77e82b5f92..be08083a16 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -8,6 +8,7 @@ import QtQuick.Layouts 1.1 import UM 1.2 as UM import Cura 1.0 as Cura +import "Menus" Rectangle { @@ -85,12 +86,60 @@ Rectangle Row { anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width; + anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width + spacing: UM.Theme.getSize("default_margin").width + + ToolButton + { + id: machineSelection + text: Cura.MachineManager.activeMachineName + + height: UM.Theme.getSize("setting_control").height + tooltip: Cura.MachineManager.activeMachineName + anchors.verticalCenter: parent.verticalCenter + style: ButtonStyle { + background: Rectangle { + color: UM.Theme.getColor("sidebar_header_bar") + + UM.RecolorImage { + id: downArrow + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width + width: UM.Theme.getSize("standard_arrow").width + height: UM.Theme.getSize("standard_arrow").height + sourceSize.width: width + sourceSize.height: width + color: UM.Theme.getColor("text_reversed") + source: UM.Theme.getIcon("arrow_bottom") + } + Label { + id: sidebarComboBoxLabel + color: UM.Theme.getColor("text_reversed") + text: control.text; + elide: Text.ElideRight; + anchors.left: parent.left; + anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width + anchors.right: downArrow.left; + anchors.rightMargin: control.rightMargin; + anchors.verticalCenter: parent.verticalCenter; + font: UM.Theme.getFont("large") + } + } + label: Label{} + } + + width: parent.width - (showSettings.width + showMonitor.width + 2 * UM.Theme.getSize("default_margin").width) + + menu: PrinterMenu { } + } + Button { id: showSettings - width: (parent.width - UM.Theme.getSize("default_margin").width) / 2 + width: height height: UM.Theme.getSize("sidebar_header").height onClicked: monitoringPrint = false iconSource: UM.Theme.getIcon("tab_settings"); @@ -100,10 +149,11 @@ Rectangle style: UM.Theme.styles.sidebar_header_tab } + Button { id: showMonitor - width: (parent.width - UM.Theme.getSize("default_margin").width) / 2 + width: height height: UM.Theme.getSize("sidebar_header").height onClicked: monitoringPrint = true iconSource: { @@ -151,7 +201,6 @@ Rectangle width: parent.width anchors.top: sidebarHeaderBar.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height onShowTooltip: base.showTooltip(item, location, text) onHideTooltip: base.hideTooltip() @@ -160,10 +209,11 @@ Rectangle Rectangle { id: headerSeparator width: parent.width - height: UM.Theme.getSize("sidebar_lining").height + visible: !monitoringPrint + height: visible ? UM.Theme.getSize("sidebar_lining").height : 0 color: UM.Theme.getColor("sidebar_lining") anchors.top: header.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.topMargin: visible ? UM.Theme.getSize("default_margin").height : 0 } onCurrentModeIndexChanged: diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml index 77d45cae26..3e8f09c807 100644 --- a/resources/qml/SidebarHeader.qml +++ b/resources/qml/SidebarHeader.qml @@ -21,46 +21,6 @@ Column signal showTooltip(Item item, point location, string text) signal hideTooltip() - Row - { - id: machineSelectionRow - height: UM.Theme.getSize("sidebar_setup").height - - anchors - { - left: parent.left - leftMargin: UM.Theme.getSize("default_margin").width - right: parent.right - rightMargin: UM.Theme.getSize("default_margin").width - } - - Label - { - id: machineSelectionLabel - text: catalog.i18nc("@label:listbox", "Printer:"); - anchors.verticalCenter: parent.verticalCenter - font: UM.Theme.getFont("default"); - color: UM.Theme.getColor("text"); - - width: parent.width * 0.45 - UM.Theme.getSize("default_margin").width - } - - ToolButton - { - id: machineSelection - text: Cura.MachineManager.activeMachineName; - - height: UM.Theme.getSize("setting_control").height - tooltip: Cura.MachineManager.activeMachineName - anchors.verticalCenter: parent.verticalCenter - style: UM.Theme.styles.sidebar_header_button - - width: parent.width * 0.55 + UM.Theme.getSize("default_margin").width - - menu: PrinterMenu { } - } - } - Row { id: extruderSelectionRow @@ -86,6 +46,7 @@ Column property var index: 0 height: UM.Theme.getSize("sidebar_header_mode_tabs").height + width: parent.width boundsBehavior: Flickable.StopAtBounds anchors @@ -141,6 +102,17 @@ Column control.hovered ? UM.Theme.getColor("tab_hovered") : UM.Theme.getColor("tab_unchecked") Behavior on color { ColorAnimation { duration: 50; } } + Rectangle + { + id: highlight + visible: control.checked + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + height: UM.Theme.getSize("sidebar_header_highlight").height + color: UM.Theme.getColor("sidebar_header_bar") + } + Rectangle { id: swatch @@ -179,6 +151,14 @@ Column } } + Item + { + id: variantRowSpacer + height: UM.Theme.getSize("default_margin").height / 4 + width: height + visible: !extruderSelectionRow.visible + } + Row { id: variantRow diff --git a/resources/qml/SidebarSimple.qml b/resources/qml/SidebarSimple.qml index c7da237648..499125a6f9 100644 --- a/resources/qml/SidebarSimple.qml +++ b/resources/qml/SidebarSimple.qml @@ -30,7 +30,7 @@ Item id: infillCellLeft anchors.top: parent.top anchors.left: parent.left - width: base.width / 100 * 35 - UM.Theme.getSize("default_margin").width + width: base.width * .45 - UM.Theme.getSize("default_margin").width height: childrenRect.height Label @@ -52,7 +52,7 @@ Item id: infillCellRight height: childrenRect.height; - width: base.width / 100 * 65 + width: base.width * .55 spacing: UM.Theme.getSize("default_margin").width anchors.left: infillCellLeft.right @@ -231,7 +231,7 @@ Item anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.verticalCenter: enableSupportCheckBox.verticalCenter - width: parent.width / 100 * 45 - 3 * UM.Theme.getSize("default_margin").width + width: parent.width * .45 - 3 * UM.Theme.getSize("default_margin").width text: catalog.i18nc("@label", "Enable Support"); font: UM.Theme.getFont("default"); color: UM.Theme.getColor("text"); @@ -279,7 +279,7 @@ Item anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.verticalCenter: supportExtruderCombobox.verticalCenter - width: parent.width / 100 * 45 - 3 * UM.Theme.getSize("default_margin").width + width: parent.width * .45 - 3 * UM.Theme.getSize("default_margin").width text: catalog.i18nc("@label", "Support Extruder"); font: UM.Theme.getFont("default"); color: UM.Theme.getColor("text"); @@ -319,7 +319,7 @@ Item } anchors.left: supportExtruderLabel.right anchors.leftMargin: UM.Theme.getSize("default_margin").width - width: parent.width / 100 * 55 + width: parent.width * .55 height: { if ((supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1)) @@ -332,6 +332,7 @@ Item return 0; } } + Behavior on height { NumberAnimation { duration: 100 } } style: UM.Theme.styles.combobox_color enabled: base.settingsEnabled @@ -377,7 +378,7 @@ Item anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.verticalCenter: adhesionCheckBox.verticalCenter - width: parent.width / 100 * 45 - 3 * UM.Theme.getSize("default_margin").width + width: parent.width * .45 - 3 * UM.Theme.getSize("default_margin").width text: catalog.i18nc("@label", "Build Plate Adhesion"); font: UM.Theme.getFont("default"); color: UM.Theme.getColor("text"); diff --git a/resources/themes/cura/theme.json b/resources/themes/cura/theme.json index f7aff957f3..c86236ea5d 100644 --- a/resources/themes/cura/theme.json +++ b/resources/themes/cura/theme.json @@ -205,7 +205,7 @@ "sidebar": [35.0, 10.0], "sidebar_header": [0.0, 4.0], - "sidebar_header_highlight": [0.5, 0.5], + "sidebar_header_highlight": [0.25, 0.25], "sidebar_header_mode_toggle": [0.0, 2.0], "sidebar_header_mode_tabs": [0.0, 3.0], "sidebar_lining": [0.5, 0.5], From 18fb379fbe23d8ff125c6ad60e066646b5bcde39 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Wed, 7 Dec 2016 19:40:33 +0100 Subject: [PATCH 13/34] Add tooltips for Setup/Monitor and Recommended/Custom tabs --- resources/qml/Sidebar.qml | 70 +++++++++++++++++++++++++++++++- resources/qml/SidebarTooltip.qml | 5 +++ 2 files changed, 73 insertions(+), 2 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index be08083a16..e314ab80c2 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -34,6 +34,18 @@ Rectangle color: UM.Theme.getColor("sidebar"); UM.I18nCatalog { id: catalog; name:"cura"} + Timer { + id: hoverTimer + interval: 500 + repeat: false + property var item + property string text + + onTriggered: + { + base.showTooltip(base, {x:1, y:item.y}, text); + } + } function showTooltip(item, position, text) { @@ -146,6 +158,21 @@ Rectangle checkable: true checked: !monitoringPrint exclusiveGroup: sidebarHeaderBarGroup + property string tooltipText: catalog.i18nc("@tooltip", "Print Setup

Edit or review the settings for the active print job.") + + onHoveredChanged: { + if (hovered) + { + hoverTimer.item = showSettings + hoverTimer.text = tooltipText + hoverTimer.start(); + } + else + { + hoverTimer.stop(); + base.hideTooltip(); + } + } style: UM.Theme.styles.sidebar_header_tab } @@ -189,6 +216,21 @@ Rectangle checkable: true checked: monitoringPrint exclusiveGroup: sidebarHeaderBarGroup + property string tooltipText: catalog.i18nc("@tooltip", "Print Monitor

Monitor the state of the connected printer and the print job in progress.") + + onHoveredChanged: { + if (hovered) + { + hoverTimer.item = showMonitor + hoverTimer.text = tooltipText + hoverTimer.start(); + } + else + { + hoverTimer.stop(); + base.hideTooltip(); + } + } style: UM.Theme.styles.sidebar_header_tab } @@ -262,6 +304,20 @@ Rectangle checked: base.currentModeIndex == index onClicked: base.currentModeIndex = index + onHoveredChanged: { + if (hovered) + { + hoverTimer.item = settingsModeSelection + hoverTimer.text = model.tooltipText + hoverTimer.start(); + } + else + { + hoverTimer.stop(); + base.hideTooltip(); + } + } + style: ButtonStyle { background: Rectangle { border.width: UM.Theme.getSize("default_lining").width @@ -458,8 +514,18 @@ Rectangle Component.onCompleted: { - modesListModel.append({ text: catalog.i18nc("@title:tab", "Recommended"), item: sidebarSimple, showFilterButton: false }) - modesListModel.append({ text: catalog.i18nc("@title:tab", "Custom"), item: sidebarAdvanced, showFilterButton: true }) + modesListModel.append({ + text: catalog.i18nc("@title:tab", "Recommended"), + tooltipText: catalog.i18nc("@tooltip", "Recommended Print Setup

Print with the recommended settings for the selected printer, material and quality."), + item: sidebarSimple, + showFilterButton: false + }) + modesListModel.append({ + text: catalog.i18nc("@title:tab", "Custom"), + tooltipText: catalog.i18nc("@tooltip", "Custom Print Setup

Print with finegrained control over every last bit of the slicing process."), + item: sidebarAdvanced, + showFilterButton: true + }) sidebarContents.push({ "item": modesListModel.get(base.currentModeIndex).item, "immediate": true }); var index = parseInt(UM.Preferences.getValue("cura/active_mode")) diff --git a/resources/qml/SidebarTooltip.qml b/resources/qml/SidebarTooltip.qml index 5cb7ff1f0b..7344834c7e 100644 --- a/resources/qml/SidebarTooltip.qml +++ b/resources/qml/SidebarTooltip.qml @@ -29,6 +29,11 @@ UM.PointingRectangle { } else { x = position.x - base.width; y = position.y - UM.Theme.getSize("tooltip_arrow_margins").height; + if(y < 0) + { + position.y += -y; + y = 0; + } } base.opacity = 1; target = Qt.point(40 , position.y + UM.Theme.getSize("tooltip_arrow_margins").height / 2) From bd4cac53b42fb705d4ac7c6fa9d8f510b409bede Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Wed, 7 Dec 2016 22:10:22 +0100 Subject: [PATCH 14/34] Fix colors to adhere to hig --- resources/themes/cura/theme.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/themes/cura/theme.json b/resources/themes/cura/theme.json index c86236ea5d..d5a95a7104 100644 --- a/resources/themes/cura/theme.json +++ b/resources/themes/cura/theme.json @@ -98,7 +98,7 @@ "tab_checked_text": [24, 41, 77, 255], "tab_unchecked": [245, 245, 245, 255], "tab_unchecked_border": [245, 245, 245, 255], - "tab_unchecked_text": [152, 152, 152, 255], + "tab_unchecked_text": [127, 127, 127, 255], "tab_hovered": [245, 245, 245, 255], "tab_hovered_border": [245, 245, 245, 255], "tab_hovered_text": [32, 166, 219, 255], From d67395b42bd58ad6d055a1d2c475615bdb844d1b Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Wed, 7 Dec 2016 22:23:06 +0100 Subject: [PATCH 15/34] Codestyle & documentation update --- resources/qml/Sidebar.qml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index e314ab80c2..7144c35fd6 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -31,11 +31,11 @@ Rectangle property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0 property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands - color: UM.Theme.getColor("sidebar"); + color: UM.Theme.getColor("sidebar") UM.I18nCatalog { id: catalog; name:"cura"} Timer { - id: hoverTimer + id: tooltipDelayTimer interval: 500 repeat: false property var item @@ -86,7 +86,7 @@ Rectangle } } - // Mode selection buttons for changing between Setting & Monitor print mode + // Printer selection and mode selection buttons for changing between Setting & Monitor print mode Rectangle { id: sidebarHeaderBar @@ -163,13 +163,13 @@ Rectangle onHoveredChanged: { if (hovered) { - hoverTimer.item = showSettings - hoverTimer.text = tooltipText - hoverTimer.start(); + tooltipDelayTimer.item = showSettings + tooltipDelayTimer.text = tooltipText + tooltipDelayTimer.start(); } else { - hoverTimer.stop(); + tooltipDelayTimer.stop(); base.hideTooltip(); } } @@ -221,13 +221,13 @@ Rectangle onHoveredChanged: { if (hovered) { - hoverTimer.item = showMonitor - hoverTimer.text = tooltipText - hoverTimer.start(); + tooltipDelayTimer.item = showMonitor + tooltipDelayTimer.text = tooltipText + tooltipDelayTimer.start(); } else { - hoverTimer.stop(); + tooltipDelayTimer.stop(); base.hideTooltip(); } } @@ -307,13 +307,13 @@ Rectangle onHoveredChanged: { if (hovered) { - hoverTimer.item = settingsModeSelection - hoverTimer.text = model.tooltipText - hoverTimer.start(); + tooltipDelayTimer.item = settingsModeSelection + tooltipDelayTimer.text = model.tooltipText + tooltipDelayTimer.start(); } else { - hoverTimer.stop(); + tooltipDelayTimer.stop(); base.hideTooltip(); } } From ace4bfba1058276d4269176d8757daa83611e0d2 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Wed, 7 Dec 2016 22:30:31 +0100 Subject: [PATCH 16/34] Fix QML error about use of anchors in a row --- resources/qml/SidebarHeader.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml index 3e8f09c807..d997f6a3f8 100644 --- a/resources/qml/SidebarHeader.qml +++ b/resources/qml/SidebarHeader.qml @@ -21,7 +21,7 @@ Column signal showTooltip(Item item, point location, string text) signal hideTooltip() - Row + Item { id: extruderSelectionRow width: parent.width From 96f82c1d73a4aea0cc58eb184669300f09e87482 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 8 Dec 2016 10:54:13 +0100 Subject: [PATCH 17/34] Build volume now works correctly for single extrusion machines CURA-3105 --- cura/BuildVolume.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cura/BuildVolume.py b/cura/BuildVolume.py index 511b66c46b..72cad13468 100644 --- a/cura/BuildVolume.py +++ b/cura/BuildVolume.py @@ -452,7 +452,10 @@ class BuildVolume(SceneNode): if not used_extruders: # If no extruder is used, assume that the active extruder is used (else nothing is drawn) - used_extruders = [extruder_manager.getActiveExtruderStack()] + if extruder_manager.getActiveExtruderStack(): + used_extruders = [extruder_manager.getActiveExtruderStack()] + else: + used_extruders = [self._global_container_stack] result_areas = self._computeDisallowedAreasStatic(disallowed_border_size, used_extruders) #Normal machine disallowed areas can always be added. prime_areas = self._computeDisallowedAreasPrime(disallowed_border_size, used_extruders) From bc8a9c30cfc3a58fd25f9465f2a2f03b44d5b482 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 8 Dec 2016 10:58:17 +0100 Subject: [PATCH 18/34] Use right type for logging CURA-1263 --- plugins/3MFReader/ThreeMFWorkspaceReader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/3MFReader/ThreeMFWorkspaceReader.py b/plugins/3MFReader/ThreeMFWorkspaceReader.py index d50fe8c571..86fe56ff66 100644 --- a/plugins/3MFReader/ThreeMFWorkspaceReader.py +++ b/plugins/3MFReader/ThreeMFWorkspaceReader.py @@ -349,7 +349,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader): global_stack = stack Job.yieldThread() except: - Logger.log("W", "We failed to serialize the stack. Trying to clean up.") + Logger.log("w", "We failed to serialize the stack. Trying to clean up.") # Something went really wrong. Try to remove any data that we added. for container in containers_to_add: self._container_registry.getInstance().removeContainer(container.getId()) From 054e73383dc67baa628a88bacc19a1b89af6a7bc Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Thu, 8 Dec 2016 11:12:48 +0100 Subject: [PATCH 19/34] Added hover color for machine selection. CURA-2763 --- resources/qml/Sidebar.qml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 7144c35fd6..543ca0c26e 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -98,7 +98,6 @@ Rectangle Row { anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.right: parent.right anchors.rightMargin: UM.Theme.getSize("default_margin").width spacing: UM.Theme.getSize("default_margin").width @@ -108,12 +107,15 @@ Rectangle id: machineSelection text: Cura.MachineManager.activeMachineName - height: UM.Theme.getSize("setting_control").height + width: parent.width - (showSettings.width + showMonitor.width + 2 * UM.Theme.getSize("default_margin").width) + height: UM.Theme.getSize("sidebar_header").height tooltip: Cura.MachineManager.activeMachineName + anchors.verticalCenter: parent.verticalCenter style: ButtonStyle { background: Rectangle { - color: UM.Theme.getColor("sidebar_header_bar") + color: control.hovered ? UM.Theme.getColor("button_hover") : + control.pressed ? UM.Theme.getColor("button_hover") : UM.Theme.getColor("sidebar_header_bar") UM.RecolorImage { id: downArrow @@ -133,7 +135,7 @@ Rectangle text: control.text; elide: Text.ElideRight; anchors.left: parent.left; - anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width + anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.right: downArrow.left; anchors.rightMargin: control.rightMargin; anchors.verticalCenter: parent.verticalCenter; @@ -143,8 +145,6 @@ Rectangle label: Label{} } - width: parent.width - (showSettings.width + showMonitor.width + 2 * UM.Theme.getSize("default_margin").width) - menu: PrinterMenu { } } From 0d023a196e1615a3d0dbea8b001cc435d868dd99 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Thu, 8 Dec 2016 11:21:30 +0100 Subject: [PATCH 20/34] Code layout. CURA-2763 --- resources/qml/SidebarHeader.qml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml index d997f6a3f8..78bde0c437 100644 --- a/resources/qml/SidebarHeader.qml +++ b/resources/qml/SidebarHeader.qml @@ -95,11 +95,11 @@ Column { border.width: UM.Theme.getSize("default_lining").width border.color: control.checked ? UM.Theme.getColor("tab_checked_border") : - control.pressed ? UM.Theme.getColor("tab_active_border") : - control.hovered ? UM.Theme.getColor("tab_hovered_border") : UM.Theme.getColor("tab_unchecked_border") + control.pressed ? UM.Theme.getColor("tab_active_border") : + control.hovered ? UM.Theme.getColor("tab_hovered_border") : UM.Theme.getColor("tab_unchecked_border") color: control.checked ? UM.Theme.getColor("tab_checked") : - control.pressed ? UM.Theme.getColor("tab_active") : - control.hovered ? UM.Theme.getColor("tab_hovered") : UM.Theme.getColor("tab_unchecked") + control.pressed ? UM.Theme.getColor("tab_active") : + control.hovered ? UM.Theme.getColor("tab_hovered") : UM.Theme.getColor("tab_unchecked") Behavior on color { ColorAnimation { duration: 50; } } Rectangle @@ -137,8 +137,8 @@ Column anchors.rightMargin: UM.Theme.getSize("default_margin").width / 2 color: control.checked ? UM.Theme.getColor("tab_checked_text") : - control.pressed ? UM.Theme.getColor("tab_active_text") : - control.hovered ? UM.Theme.getColor("tab_hovered_text") : UM.Theme.getColor("tab_unchecked_text") + control.pressed ? UM.Theme.getColor("tab_active_text") : + control.hovered ? UM.Theme.getColor("tab_hovered_text") : UM.Theme.getColor("tab_unchecked_text") font: UM.Theme.getFont("default") text: control.text From 3449108d59d8b0a6a58b61f039dce9b0b9392767 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 8 Dec 2016 11:48:34 +0100 Subject: [PATCH 21/34] Update 3MFWorkspaceReader to handle the new format of ContainerStack Contributes to CURA-3098 --- plugins/3MFReader/ThreeMFWorkspaceReader.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/plugins/3MFReader/ThreeMFWorkspaceReader.py b/plugins/3MFReader/ThreeMFWorkspaceReader.py index 86fe56ff66..aafbe325b9 100644 --- a/plugins/3MFReader/ThreeMFWorkspaceReader.py +++ b/plugins/3MFReader/ThreeMFWorkspaceReader.py @@ -447,9 +447,17 @@ class ThreeMFWorkspaceReader(WorkspaceReader): def _getContainerIdListFromSerialized(self, serialized): parser = configparser.ConfigParser(interpolation=None, empty_lines_in_values=False) parser.read_string(serialized) - container_string = parser["general"].get("containers", "") - container_list = container_string.split(",") - return [container_id for container_id in container_list if container_id != ""] + + container_ids = [] + if "containers" in parser: + for index, container_id in parser.items("containers"): + container_ids.append(container_id) + elif parser.has_option("general", "containers"): + container_string = parser["general"].get("containers", "") + container_list = container_string.split(",") + container_ids = [container_id for container_id in container_list if container_id != ""] + + return container_ids def _getMachineNameFromSerializedStack(self, serialized): parser = configparser.ConfigParser(interpolation=None, empty_lines_in_values=False) @@ -461,4 +469,5 @@ class ThreeMFWorkspaceReader(WorkspaceReader): metadata = data.iterfind("./um:metadata/um:name/um:label", {"um": "http://www.ultimaker.com/material"}) for entry in metadata: return entry.text - pass \ No newline at end of file + pass + From 7ed5a7768a43cd6a43ddf1a01d8f1ff1b9abe287 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 8 Dec 2016 11:59:37 +0100 Subject: [PATCH 22/34] Use logException instead of just log for project loading CURA-1263 --- plugins/3MFReader/ThreeMFWorkspaceReader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/3MFReader/ThreeMFWorkspaceReader.py b/plugins/3MFReader/ThreeMFWorkspaceReader.py index 86fe56ff66..68f982c48f 100644 --- a/plugins/3MFReader/ThreeMFWorkspaceReader.py +++ b/plugins/3MFReader/ThreeMFWorkspaceReader.py @@ -349,7 +349,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader): global_stack = stack Job.yieldThread() except: - Logger.log("w", "We failed to serialize the stack. Trying to clean up.") + Logger.logException("w", "We failed to serialize the stack. Trying to clean up.") # Something went really wrong. Try to remove any data that we added. for container in containers_to_add: self._container_registry.getInstance().removeContainer(container.getId()) From 701eba3a0e6f3a4f52b0c1dc5712fb20f3f7d9b0 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Thu, 8 Dec 2016 12:45:38 +0100 Subject: [PATCH 23/34] Made 3mf mesh centering more robust. --- plugins/3MFReader/ThreeMFReader.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/3MFReader/ThreeMFReader.py b/plugins/3MFReader/ThreeMFReader.py index f7d2cc01f1..397a63c194 100644 --- a/plugins/3MFReader/ThreeMFReader.py +++ b/plugins/3MFReader/ThreeMFReader.py @@ -187,10 +187,12 @@ class ThreeMFReader(MeshReader): build_item_node = self._createNodeFromObject(object, self._base_name + "_" + str(id)) # compensate for original center position, if object(s) is/are not around its zero position - extents = build_item_node.getMeshData().getExtents() - center_vector = Vector(extents.center.x, extents.center.y, extents.center.z) transform_matrix = Matrix() - transform_matrix.setByTranslation(center_vector) + mesh_data = build_item_node.getMeshData() + if mesh_data is not None: + extents = mesh_data.getExtents() + center_vector = Vector(extents.center.x, extents.center.y, extents.center.z) + transform_matrix.setByTranslation(center_vector) # offset with transform from 3mf transform = build_item.get("transform") From c212014d88731090aec053277f405e65e5fa6c34 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 8 Dec 2016 13:15:23 +0100 Subject: [PATCH 24/34] Fix VersionUpgrade to handle both formats of ContainerStack files Contributes to CURA-3098 --- .../VersionUpgrade22to24/VersionUpgrade.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py b/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py index 64c98dea60..c564842c58 100644 --- a/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py +++ b/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py @@ -19,8 +19,14 @@ class VersionUpgrade22to24(VersionUpgrade): config = configparser.ConfigParser(interpolation = None) config.read_string(serialised) # Read the input string as config file. config.set("general", "version", "3") - containers = config.get("general", "containers") - container_list = containers.split(",") + + container_list = [] + if config.has_section("containers"): + for index, container_id in config.items("containers"): + container_list.append(container_id) + elif config.has_option("general", "containers") + containers = config.get("general", "containers") + container_list = containers.split(",") user_variants = self.__getUserVariants() name_path_dict = {} @@ -45,7 +51,13 @@ class VersionUpgrade22to24(VersionUpgrade): container_list = new_container_list - config.set("general", "containers", ",".join(container_list)) + if not config.has_section("containers"): + config.add_section("containers") + + config.remove_option("general", "containers") + + for index in range(len(container_list)): + config.set("containers", index, container_list[index]) output = io.StringIO() config.write(output) From d3f58a049ba5675f2e7ce1f90614febf07b67987 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 8 Dec 2016 13:22:24 +0100 Subject: [PATCH 25/34] Add missing ":" --- 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 c564842c58..28df74b499 100644 --- a/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py +++ b/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py @@ -24,7 +24,7 @@ class VersionUpgrade22to24(VersionUpgrade): if config.has_section("containers"): for index, container_id in config.items("containers"): container_list.append(container_id) - elif config.has_option("general", "containers") + elif config.has_option("general", "containers"): containers = config.get("general", "containers") container_list = containers.split(",") From ae389742ff430d5861c0989e5e1122a7766da068 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 8 Dec 2016 14:23:33 +0100 Subject: [PATCH 26/34] Update OSX removable drive code to handle 10.12 plist format Fixes CURA-2618 --- .../OSXRemovableDrivePlugin.py | 63 ++++++++++++------- 1 file changed, 41 insertions(+), 22 deletions(-) diff --git a/plugins/RemovableDriveOutputDevice/OSXRemovableDrivePlugin.py b/plugins/RemovableDriveOutputDevice/OSXRemovableDrivePlugin.py index c96bf8bacf..6d8b5021ae 100644 --- a/plugins/RemovableDriveOutputDevice/OSXRemovableDrivePlugin.py +++ b/plugins/RemovableDriveOutputDevice/OSXRemovableDrivePlugin.py @@ -17,41 +17,60 @@ class OSXRemovableDrivePlugin(RemovableDrivePlugin.RemovableDrivePlugin): drives = {} p = subprocess.Popen(["system_profiler", "SPUSBDataType", "-xml"], stdout = subprocess.PIPE) plist = plistlib.loads(p.communicate()[0]) - p.wait() - for entry in plist: - if "_items" in entry: - for item in entry["_items"]: - for dev in item["_items"]: - if "removable_media" in dev and dev["removable_media"] == "yes" and "volumes" in dev and len(dev["volumes"]) > 0: - for vol in dev["volumes"]: - if "mount_point" in vol: - volume = vol["mount_point"] - drives[volume] = os.path.basename(volume) + result = self._recursiveSearch(plist, "removable_media") p = subprocess.Popen(["system_profiler", "SPCardReaderDataType", "-xml"], stdout=subprocess.PIPE) plist = plistlib.loads(p.communicate()[0]) - p.wait() - for entry in plist: - if "_items" in entry: - for item in entry["_items"]: - for dev in item["_items"]: - if "removable_media" in dev and dev["removable_media"] == "yes" and "volumes" in dev and len(dev["volumes"]) > 0: - for vol in dev["volumes"]: - if "mount_point" in vol: - volume = vol["mount_point"] - drives[volume] = os.path.basename(volume) + result.extend(self._recursiveSearch(plist, "removable_media")) + + for drive in result: + # Ignore everything not explicitly marked as removable + if drive["removable_media"] != "yes": + continue + + # Ignore any removable device that does not have an actual volume + if "volumes" not in drive or not drive["volumes"]: + continue + + for volume in drive["volumes"]: + if not "mount_point" in volume: + continue + + mount_point = volume["mount_point"] + + if "_name" in volume: + drive_name = volume["_name"] + else: + drive_name = os.path.basename(mount_point) + + drives[mount_point] = drive_name return drives def performEjectDevice(self, device): p = subprocess.Popen(["diskutil", "eject", device.getId()], stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE) output = p.communicate() - Logger.log("d", "umount returned: %s.", repr(output)) return_code = p.wait() if return_code != 0: return False else: - return True \ No newline at end of file + return True + + # Recursively search for key in a plist parsed by plistlib + def _recursiveSearch(self, plist, key): + result = [] + for entry in plist: + if key in entry: + result.append(entry) + continue + + if "_items" in entry: + result.extend(self._recursiveSearch(entry["_items"], key)) + + if "Media" in entry: + result.extend(self._recursiveSearch(entry["Media"], key)) + + return result From 041e9cd96fbaa50c1426b301238c3718fbbfb806 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Thu, 8 Dec 2016 14:38:07 +0100 Subject: [PATCH 27/34] Corrected bed temperature max value warning for UM3 --- resources/definitions/ultimaker3.def.json | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/definitions/ultimaker3.def.json b/resources/definitions/ultimaker3.def.json index 71bbcccbdd..5a6c046256 100644 --- a/resources/definitions/ultimaker3.def.json +++ b/resources/definitions/ultimaker3.def.json @@ -106,6 +106,7 @@ "line_width": { "value": "machine_nozzle_size * 0.875" }, "machine_min_cool_heat_time_window": { "value": "15" }, "default_material_print_temperature": { "value": "200" }, + "material_bed_temperature": { "maximum_value_warning": "115" }, "material_standby_temperature": { "value": "100" }, "multiple_mesh_overlap": { "value": "0" }, "prime_tower_enable": { "value": "True" }, From 78ad92bfcb28dc23c40abdbd406d457c35f337b3 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Thu, 8 Dec 2016 14:39:58 +0100 Subject: [PATCH 28/34] Max bed temperature UM3 --- resources/definitions/ultimaker3.def.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/definitions/ultimaker3.def.json b/resources/definitions/ultimaker3.def.json index 5a6c046256..34c9e22981 100644 --- a/resources/definitions/ultimaker3.def.json +++ b/resources/definitions/ultimaker3.def.json @@ -106,7 +106,7 @@ "line_width": { "value": "machine_nozzle_size * 0.875" }, "machine_min_cool_heat_time_window": { "value": "15" }, "default_material_print_temperature": { "value": "200" }, - "material_bed_temperature": { "maximum_value_warning": "115" }, + "material_bed_temperature": { "maximum_value": "115" }, "material_standby_temperature": { "value": "100" }, "multiple_mesh_overlap": { "value": "0" }, "prime_tower_enable": { "value": "True" }, From 72112159d66cc8180389c090939cb31594944913 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 8 Dec 2016 14:43:28 +0100 Subject: [PATCH 29/34] It's no longer possible to set materials for machines that dont support them CURA-3042 --- resources/qml/Preferences/MaterialsPage.qml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/resources/qml/Preferences/MaterialsPage.qml b/resources/qml/Preferences/MaterialsPage.qml index 83f980bf86..70e3780707 100644 --- a/resources/qml/Preferences/MaterialsPage.qml +++ b/resources/qml/Preferences/MaterialsPage.qml @@ -127,7 +127,7 @@ UM.ManagementPage { text: catalog.i18nc("@action:button", "Activate"); iconName: "list-activate"; - enabled: base.currentItem != null && base.currentItem.id != Cura.MachineManager.activeMaterialId + enabled: base.currentItem != null && base.currentItem.id != Cura.MachineManager.activeMaterialId && Cura.MachineManager.hasMaterials onClicked: Cura.MachineManager.setActiveMaterial(base.currentItem.id) }, Button @@ -144,8 +144,10 @@ UM.ManagementPage { return } - - Cura.MachineManager.setActiveMaterial(material_id) + if(Cura.MachineManager.hasMaterials) + { + Cura.MachineManager.setActiveMaterial(material_id) + } } }, Button From 19a288dcbf342e42d689282d56f007976b2d8249 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Thu, 8 Dec 2016 14:43:41 +0100 Subject: [PATCH 30/34] Max initial layer bed temperature UM3 --- resources/definitions/ultimaker3.def.json | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/definitions/ultimaker3.def.json b/resources/definitions/ultimaker3.def.json index 34c9e22981..5e492bf531 100644 --- a/resources/definitions/ultimaker3.def.json +++ b/resources/definitions/ultimaker3.def.json @@ -107,6 +107,7 @@ "machine_min_cool_heat_time_window": { "value": "15" }, "default_material_print_temperature": { "value": "200" }, "material_bed_temperature": { "maximum_value": "115" }, + "material_bed_temperature_layer_0": { "maximum_value": "115" }, "material_standby_temperature": { "value": "100" }, "multiple_mesh_overlap": { "value": "0" }, "prime_tower_enable": { "value": "True" }, From 4d3e8592af89d90fa4fa36de290534c4aecb2ed3 Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Thu, 8 Dec 2016 14:48:10 +0100 Subject: [PATCH 31/34] CURA-2653 Searching in English while other language set --- resources/qml/Settings/SettingView.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index 5f20f92b20..6af3985527 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -84,7 +84,7 @@ Item onTextChanged: { - definitionsModel.filter = {"label": "*" + text}; + definitionsModel.filter = {"i18n_label": "*" + text}; findingSettings = (text.length > 0); if(findingSettings != lastFindingSettings) { From a32615fb120b833c150bacb780e629546662141f Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Thu, 8 Dec 2016 14:48:50 +0100 Subject: [PATCH 32/34] Added 50ms fade in on hover machine selection. CURA-2763 --- resources/qml/Sidebar.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 543ca0c26e..f9c314d660 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -116,6 +116,7 @@ Rectangle background: Rectangle { color: control.hovered ? UM.Theme.getColor("button_hover") : control.pressed ? UM.Theme.getColor("button_hover") : UM.Theme.getColor("sidebar_header_bar") + Behavior on color { ColorAnimation { duration: 50; } } UM.RecolorImage { id: downArrow From ff270642c01a398d770c8b2fee354804fb3ddd80 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Thu, 8 Dec 2016 14:56:54 +0100 Subject: [PATCH 33/34] Renamed 1st Extruder, 2nd Extruder to Extruder1, 2 in UMODE. CURA-2763 --- resources/extruders/ultimaker_original_dual_1st.def.json | 2 +- resources/extruders/ultimaker_original_dual_2nd.def.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/extruders/ultimaker_original_dual_1st.def.json b/resources/extruders/ultimaker_original_dual_1st.def.json index 058dbf3028..62ec8479c9 100644 --- a/resources/extruders/ultimaker_original_dual_1st.def.json +++ b/resources/extruders/ultimaker_original_dual_1st.def.json @@ -1,7 +1,7 @@ { "id": "ultimaker_original_dual_1st", "version": 2, - "name": "1st Extruder", + "name": "Extruder 1", "inherits": "fdmextruder", "metadata": { "machine": "ultimaker_original_dual", diff --git a/resources/extruders/ultimaker_original_dual_2nd.def.json b/resources/extruders/ultimaker_original_dual_2nd.def.json index 4b600d0281..42a4da524b 100644 --- a/resources/extruders/ultimaker_original_dual_2nd.def.json +++ b/resources/extruders/ultimaker_original_dual_2nd.def.json @@ -1,7 +1,7 @@ { "id": "ultimaker_original_dual_2nd", "version": 2, - "name": "2nd Extruder", + "name": "Extruder 2", "inherits": "fdmextruder", "metadata": { "machine": "ultimaker_original_dual", From 81ffc3ae4b0505cbe7833765a0b6cacfd67ce189 Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Thu, 8 Dec 2016 15:09:26 +0100 Subject: [PATCH 34/34] Import 'os' directly because we use it directly, even though it still works with out it. CURA-2953 --- plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py b/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py index 28df74b499..dce2b311bb 100644 --- a/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py +++ b/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py @@ -2,6 +2,7 @@ # Cura is released under the terms of the AGPLv3 or higher. import configparser #To get version numbers from config files. +import os import os.path import io