From 3516d01f3d750a841e549def7787edc2348031e3 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Tue, 12 Dec 2017 15:30:19 +0100 Subject: [PATCH] Move back machine selection CURA-4234 --- cura/CuraApplication.py | 3 +- resources/qml/Cura.qml | 2 +- resources/qml/Sidebar.qml | 67 +++++++++++++++++++++++++++++++++++++++ resources/qml/Topbar.qml | 67 --------------------------------------- 4 files changed, 69 insertions(+), 70 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 7925a63038..94afec7d5a 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -312,6 +312,7 @@ class CuraApplication(QtApplication): preferences.addPreference("cura/material_settings", "{}") preferences.addPreference("view/invert_zoom", False) + preferences.addPreference("general/sidebar_collapse", False) self._need_to_show_user_agreement = not Preferences.getInstance().getValue("general/accepted_user_agreement") @@ -384,8 +385,6 @@ class CuraApplication(QtApplication): self._plugin_registry.addSupportedPluginExtension("curaplugin", "Cura Plugin") - preferences.addPreference("general/sidebar_collapse", False) - def _onEngineCreated(self): self._engine.addImageProvider("camera", CameraImageProvider.CameraImageProvider()) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index ccd89eb916..8cce20d19f 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -406,7 +406,7 @@ UM.MainWindow anchors { - top: topbar.bottom + top: topbar.top bottom: parent.bottom } diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index ea66aca50f..a45303aab8 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -87,10 +87,77 @@ Rectangle } } + ToolButton + { + id: machineSelection + text: Cura.MachineManager.activeMachineName + + width: base.width + height: UM.Theme.getSize("sidebar_header").height + tooltip: Cura.MachineManager.activeMachineName + + anchors.top: base.top + //anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + style: ButtonStyle + { + background: Rectangle + { + color: + { + if(control.pressed) + { + return UM.Theme.getColor("sidebar_header_active"); + } + else if(control.hovered) + { + return UM.Theme.getColor("sidebar_header_hover"); + } + else + { + return UM.Theme.getColor("sidebar_header_bar"); + } + } + Behavior on color { ColorAnimation { duration: 50; } } + + 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_emphasis") + source: UM.Theme.getIcon("arrow_bottom") + } + Label + { + id: sidebarComboBoxLabel + color: UM.Theme.getColor("sidebar_header_text_active") + text: control.text; + elide: Text.ElideRight; + anchors.left: parent.left; + anchors.leftMargin: UM.Theme.getSize("default_margin").width * 2 + anchors.right: downArrow.left; + anchors.rightMargin: control.rightMargin; + anchors.verticalCenter: parent.verticalCenter; + font: UM.Theme.getFont("large") + } + } + label: Label {} + } + + menu: PrinterMenu { } + } + SidebarHeader { id: header width: parent.width visible: machineExtruderCount.properties.value > 1 || Cura.MachineManager.hasMaterials || Cura.MachineManager.hasVariants + anchors.top: machineSelection.bottom onShowTooltip: base.showTooltip(item, location, text) onHideTooltip: base.hideTooltip() diff --git a/resources/qml/Topbar.qml b/resources/qml/Topbar.qml index 99910b24a2..796eb6fce5 100644 --- a/resources/qml/Topbar.qml +++ b/resources/qml/Topbar.qml @@ -46,8 +46,6 @@ Rectangle { anchors.left: logo.right anchors.leftMargin: UM.Theme.getSize("topbar_logo_right_margin").width - anchors.right: machineSelection.left - anchors.rightMargin: UM.Theme.getSize("default_margin").width spacing: UM.Theme.getSize("default_margin").width // The topbar is dynamically filled with all available stages @@ -76,71 +74,6 @@ Rectangle ExclusiveGroup { id: topbarMenuGroup } } - ToolButton - { - id: machineSelection - text: Cura.MachineManager.activeMachineName - - width: UM.Theme.getSize("sidebar").width - height: UM.Theme.getSize("sidebar_header").height - tooltip: Cura.MachineManager.activeMachineName - - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - style: ButtonStyle - { - background: Rectangle - { - color: - { - if(control.pressed) - { - return UM.Theme.getColor("sidebar_header_active"); - } - else if(control.hovered) - { - return UM.Theme.getColor("sidebar_header_hover"); - } - else - { - return UM.Theme.getColor("sidebar_header_bar"); - } - } - Behavior on color { ColorAnimation { duration: 50; } } - - 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_emphasis") - source: UM.Theme.getIcon("arrow_bottom") - } - Label - { - id: sidebarComboBoxLabel - color: UM.Theme.getColor("sidebar_header_text_active") - text: control.text; - elide: Text.ElideRight; - anchors.left: parent.left; - anchors.leftMargin: UM.Theme.getSize("default_margin").width * 2 - anchors.right: downArrow.left; - anchors.rightMargin: control.rightMargin; - anchors.verticalCenter: parent.verticalCenter; - font: UM.Theme.getFont("large") - } - } - label: Label {} - } - - menu: PrinterMenu { } - } - // View orientation Item Row {