From c15089cd59c2f97145f49ac804cb7c7911a0f946 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 7 Feb 2019 14:13:00 +0100 Subject: [PATCH 1/3] Some minor cleanup of the QML CURA-5916 --- .../Menus/ConfigurationMenu/CustomConfiguration.qml | 11 +++++------ resources/themes/cura-light/theme.json | 1 - 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index 663e2497ed..fc4272dc93 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -185,7 +185,7 @@ Item Row { - height: UM.Theme.getSize("print_setup_item").height + height: visible ? childrenRect.height : 0 visible: extrudersModel.count > 1 // If there is only one extruder, there is no point to enable/disable that. Label @@ -222,7 +222,7 @@ Item Row { - height: UM.Theme.getSize("print_setup_big_item").height + height: visible ? childrenRect.height: 0 visible: Cura.MachineManager.hasMaterials Label @@ -246,8 +246,8 @@ Item text: Cura.MachineManager.activeStack != null ? Cura.MachineManager.activeStack.material.name : "" tooltip: text - height: UM.Theme.getSize("print_setup_big_item").height width: selectors.controlWidth + height: UM.Theme.getSize("print_setup_big_item").height style: UM.Theme.styles.print_setup_header_button activeFocusOnPress: true @@ -260,7 +260,7 @@ Item Row { - height: UM.Theme.getSize("print_setup_big_item").height + height: visible ? childrenRect.height: 0 visible: Cura.MachineManager.hasVariants Label @@ -279,7 +279,6 @@ Item id: variantSelection text: Cura.MachineManager.activeVariantName tooltip: Cura.MachineManager.activeVariantName - height: UM.Theme.getSize("print_setup_big_item").height width: selectors.controlWidth style: UM.Theme.styles.print_setup_header_button @@ -292,7 +291,7 @@ Item Row { id: warnings - height: UM.Theme.getSize("print_setup_big_item").height + height: visible ? childrenRect.height : 0 visible: buildplateCompatibilityError || buildplateCompatibilityWarning property bool buildplateCompatibilityError: !Cura.MachineManager.variantBuildplateCompatible && !Cura.MachineManager.variantBuildplateUsable diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 3b54b00911..a942ef9149 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -442,7 +442,6 @@ "print_setup_widget": [38.0, 30.0], "print_setup_mode_toggle": [0.0, 2.0], - "print_setup_item": [0.0, 2.0], "print_setup_extruder_box": [0.0, 6.0], "print_setup_slider_groove": [0.16, 0.16], "print_setup_slider_handle": [1.0, 1.0], From eb6f65d4ec7bed5204347c3afff94dc3d744e465 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 7 Feb 2019 15:19:46 +0100 Subject: [PATCH 2/3] Add print-guideline icon CURA-5916 --- resources/themes/cura-light/icons/printing-guideline.svg | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 resources/themes/cura-light/icons/printing-guideline.svg diff --git a/resources/themes/cura-light/icons/printing-guideline.svg b/resources/themes/cura-light/icons/printing-guideline.svg new file mode 100644 index 0000000000..d306d046f9 --- /dev/null +++ b/resources/themes/cura-light/icons/printing-guideline.svg @@ -0,0 +1,9 @@ + + + + Icon/ guideline on hover + Created with Sketch. + + + + \ No newline at end of file From 5c94a8223d30d32e5006f7f14e90523bc04cf947 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 7 Feb 2019 16:08:50 +0100 Subject: [PATCH 3/3] Added button that is shown when instruction_link is set in the profile CURA-5916 --- .../XmlMaterialProfile/XmlMaterialProfile.py | 4 +-- .../ConfigurationMenu/CustomConfiguration.qml | 34 ++++++++++++++++++- ...g-guideline.svg => printing_guideline.svg} | 0 3 files changed, 35 insertions(+), 3 deletions(-) rename resources/themes/cura-light/icons/{printing-guideline.svg => printing_guideline.svg} (100%) diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index 011941eec7..ac63270a8e 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -6,7 +6,7 @@ import io import json #To parse the product-to-id mapping file. import os.path #To find the product-to-id mapping. import sys -from typing import Any, Dict, List, Optional, Tuple, cast +from typing import Any, Dict, List, Optional, Tuple, cast, Set import xml.etree.ElementTree as ET from UM.Resources import Resources @@ -117,7 +117,7 @@ class XmlMaterialProfile(InstanceContainer): ## Overridden from InstanceContainer # base file: common settings + supported machines # machine / variant combination: only changes for itself. - def serialize(self, ignored_metadata_keys: Optional[set] = None): + def serialize(self, ignored_metadata_keys: Optional[Set[str]] = None): registry = ContainerRegistry.getInstance() base_file = self.getMetaDataEntry("base_file", "") diff --git a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml index fc4272dc93..4568ed8f32 100644 --- a/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml +++ b/resources/qml/Menus/ConfigurationMenu/CustomConfiguration.qml @@ -181,7 +181,18 @@ Item readonly property real paddedWidth: parent.width - padding * 2 property real textWidth: Math.round(paddedWidth * 0.3) - property real controlWidth: paddedWidth - textWidth + property real controlWidth: + { + if(instructionLink == "") + { + return paddedWidth - textWidth + } + else + { + return paddedWidth - textWidth - UM.Theme.getSize("print_setup_big_item").height * 0.5 - UM.Theme.getSize("default_margin").width + } + } + property string instructionLink:Cura.ContainerManager.getContainerMetaDataEntry(Cura.MachineManager.activeStack.material.id, "instruction_link", "") Row { @@ -256,6 +267,27 @@ Item extruderIndex: Cura.ExtruderManager.activeExtruderIndex } } + Item + { + width: instructionButton.width + 2 * UM.Theme.getSize("default_margin").width + height: instructionButton.visible ? materialSelection.height: 0 + Button + { + id: instructionButton + hoverEnabled: true + contentItem: Item {} + height: 0.5 * materialSelection.height + width: height + anchors.centerIn: parent + background: UM.RecolorImage + { + source: UM.Theme.getIcon("printing_guideline") + color: instructionButton.hovered ? UM.Theme.getColor("primary") : UM.Theme.getColor("icon") + } + visible: selectors.instructionLink != "" + onClicked:Qt.openUrlExternally(selectors.instructionLink) + } + } } Row diff --git a/resources/themes/cura-light/icons/printing-guideline.svg b/resources/themes/cura-light/icons/printing_guideline.svg similarity index 100% rename from resources/themes/cura-light/icons/printing-guideline.svg rename to resources/themes/cura-light/icons/printing_guideline.svg