From 0211122b1209d55db109cb00d8a442d30b4c970b Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 22 Nov 2018 14:46:13 +0100 Subject: [PATCH] Add a proper component with a label and a rectangle in the background that shows the type of printer. Contributes to CURA-5942. --- .../qml/PrinterSelector/MachineSelector.qml | 1 + .../PrinterSelector/MachineSelectorButton.qml | 24 ++++++++++++++++--- resources/qml/ViewOrientationControls.qml | 2 +- resources/themes/cura-light/theme.json | 5 +++- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/resources/qml/PrinterSelector/MachineSelector.qml b/resources/qml/PrinterSelector/MachineSelector.qml index 9280c45cf4..66ed4d4a2c 100644 --- a/resources/qml/PrinterSelector/MachineSelector.qml +++ b/resources/qml/PrinterSelector/MachineSelector.qml @@ -84,6 +84,7 @@ Cura.ExpandableComponent { text: model.metadata["connect_group_name"] checked: Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"] + outputDevice: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null Connections { diff --git a/resources/qml/PrinterSelector/MachineSelectorButton.qml b/resources/qml/PrinterSelector/MachineSelectorButton.qml index 5ba229c31c..44b162d00d 100644 --- a/resources/qml/PrinterSelector/MachineSelectorButton.qml +++ b/resources/qml/PrinterSelector/MachineSelectorButton.qml @@ -17,7 +17,7 @@ Button leftPadding: Math.round(1.5 * UM.Theme.getSize("default_margin").width) checkable: true - property var outputDevice: Cura.MachineManager.printerOutputDevices[0] + property var outputDevice: null property var printerTypesList: [] function setPrinterTypesList() @@ -63,9 +63,27 @@ Button Repeater { model: printerTypesList - delegate: Label + delegate: Item { - text: modelData + width: UM.Theme.getSize("printer_type_label").width + height: UM.Theme.getSize("printer_type_label").height + + Rectangle + { + anchors.fill: parent + color: UM.Theme.getColor("printer_type_label_background") + } + + Label + { + id: printerTypeLabel + text: modelData + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + renderType: Text.NativeRendering + font: UM.Theme.getFont("very_small") + color: UM.Theme.getColor("text") + } } } } diff --git a/resources/qml/ViewOrientationControls.qml b/resources/qml/ViewOrientationControls.qml index acf75b1b48..fa5a51181d 100644 --- a/resources/qml/ViewOrientationControls.qml +++ b/resources/qml/ViewOrientationControls.qml @@ -21,7 +21,7 @@ Row { iconSource: UM.Theme.getIcon("view_3d") style: UM.Theme.styles.small_tool_button - onClicked:UM.Controller.rotateView("3d", 0) + onClicked: UM.Controller.rotateView("3d", 0) } // #2 Front view diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 2f86829f11..94a89342e7 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -81,7 +81,6 @@ "lining": [192, 193, 194, 255], "viewport_overlay": [0, 0, 0, 192], - "primary": [50, 130, 255, 255], "primary_hover": [48, 182, 231, 255], "primary_text": [255, 255, 255, 255], @@ -114,6 +113,8 @@ "toolbar_background": [255, 255, 255, 255], + "printer_type_label_background": [171, 171, 191, 255], + "text": [0, 0, 0, 255], "text_detail": [174, 174, 174, 128], "text_link": [50, 130, 255, 255], @@ -398,6 +399,8 @@ "views_selector": [0.0, 4.0], + "printer_type_label": [3.5, 1.5], + "default_radius": [0.25, 0.25], "wide_lining": [0.5, 0.5],