diff --git a/plugins/PrepareStage/PrepareMenu.qml b/plugins/PrepareStage/PrepareMenu.qml index ef01625a22..121928e19f 100644 --- a/plugins/PrepareStage/PrepareMenu.qml +++ b/plugins/PrepareStage/PrepareMenu.qml @@ -46,7 +46,7 @@ Item anchors.centerIn: parent - width: 0.9 * prepareMenu.width + width: Math.round(0.9 * prepareMenu.width) height: parent.height spacing: 0 diff --git a/resources/qml/ExpandableComponent.qml b/resources/qml/ExpandableComponent.qml index 8ed6dc5674..c1e3bc7985 100644 --- a/resources/qml/ExpandableComponent.qml +++ b/resources/qml/ExpandableComponent.qml @@ -10,6 +10,13 @@ import UM 1.2 as UM Item { id: base + + // Enumeration with the different possible alignments of the popup with respect of the headerItem + enum PopupAlignment { + AlignLeft, + AlignRight + } + // The headerItem holds the QML item that is always displayed. property alias headerItem: headerItemLoader.sourceComponent @@ -21,6 +28,9 @@ Item property color headerBackgroundColor: UM.Theme.getColor("action_button") property color headerHoverColor: UM.Theme.getColor("action_button_hovered") + // Defines the alignment of the popup with respect of the headerItem, by default to the right + property int popupAlignment: ExpandableComponent.PopupAlignment.AlignRight + // How much spacing is needed around the popupItem property alias popupPadding: popup.padding @@ -42,6 +52,7 @@ Item function togglePopup() { +// print(popupAlignment, popupAlignment == PopupAlignment.AlignRight) if(popup.visible) { popup.close() @@ -116,8 +127,8 @@ Item sourceSize.height: height visible: source != "" width: height - height: 0.2 * base.height - color: "black" + height: Math.round(0.2 * base.height) + color: UM.Theme.getColor("text") } MouseArea @@ -140,13 +151,15 @@ Item // Make the popup right aligned with the rest. The 3x padding is due to left, right and padding between // the button & text. - x: -width + collapseButton.width + headerItemLoader.width + 3 * background.padding + x: popupAlignment == ExpandableComponent.PopupAlignment.AlignRight ? -width + collapseButton.width + headerItemLoader.width + 3 * background.padding : 0 padding: UM.Theme.getSize("default_margin").width closePolicy: Popup.CloseOnPressOutsideParent background: Rectangle { color: popupBackgroundColor + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") } } } diff --git a/resources/qml/MachineSelector.qml b/resources/qml/MachineSelector.qml index c9756d93ba..f029914884 100644 --- a/resources/qml/MachineSelector.qml +++ b/resources/qml/MachineSelector.qml @@ -17,6 +17,8 @@ Cura.ExpandableComponent property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != "" + popupPadding: 0 + popupAlignment: ExpandableComponent.PopupAlignment.AlignLeft iconSource: expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") UM.I18nCatalog @@ -31,6 +33,7 @@ Cura.ExpandableComponent verticalAlignment: Text.AlignVCenter height: parent.height elide: Text.ElideRight + renderType: Text.NativeRendering font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") } @@ -38,26 +41,25 @@ Cura.ExpandableComponent popupItem: Item { id: popup - width: machineSelector.width - 2 * UM.Theme.getSize("default_margin").width - height: 200 + width: UM.Theme.getSize("machine_selector_widget_content").width + height: UM.Theme.getSize("machine_selector_widget_content").height ScrollView { anchors.fill: parent - contentHeight: column.implicitHeight - contentWidth: column.implicitWidth clip: true - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff Column { id: column anchors.fill: parent + Label { - text: catalog.i18nc("@label", "Networked Printers") + text: catalog.i18nc("@label", "Network connected printers") visible: networkedPrintersModel.items.length > 0 height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0 + renderType: Text.NativeRendering font: UM.Theme.getFont("medium_bold") color: UM.Theme.getColor("text") verticalAlignment: Text.AlignVCenter @@ -73,13 +75,12 @@ Cura.ExpandableComponent filter: {"type": "machine", "um_network_key": "*", "hidden": "False"} } - delegate: RoundButton + delegate: Button { text: name width: parent.width - checkable: true - radius: UM.Theme.getSize("default_radius").width + onClicked: { togglePopup() @@ -92,14 +93,14 @@ Cura.ExpandableComponent onActiveMachineNetworkGroupNameChanged: checked = Cura.MachineManager.activeMachineNetworkGroupName == model.metadata["connect_group_name"] } } - } Label { - text: catalog.i18nc("@label", "Virtual Printers") + text: catalog.i18nc("@label", "Preset printers") visible: virtualPrintersModel.items.length > 0 height: visible ? contentHeight + 2 * UM.Theme.getSize("default_margin").height : 0 + renderType: Text.NativeRendering font: UM.Theme.getFont("medium_bold") color: UM.Theme.getColor("text") verticalAlignment: Text.AlignVCenter @@ -115,21 +116,19 @@ Cura.ExpandableComponent filter: {"type": "machine", "um_network_key": null} } - delegate: RoundButton + delegate: Button { text: name width: parent.width checked: Cura.MachineManager.activeMachineId == model.id checkable: true - radius: UM.Theme.getSize("default_radius").width onClicked: { togglePopup() Cura.MachineManager.setActiveMachine(model.id) } } - } } } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index d28611529b..5f52adff14 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -367,11 +367,11 @@ "sizes": { "window_minimum_size": [106, 66], - "main_window_header": [0.0, 4.5], + "main_window_header": [0.0, 4.0], "main_window_header_button": [8, 2.35], "main_window_header_button_icon": [1.2, 1.2], - "stage_menu": [0.0, 4.5], + "stage_menu": [0.0, 4.0], "account_button": [12, 3], @@ -380,14 +380,15 @@ "print_setup_item": [0.0, 2.0], "print_setup_extruder_box": [0.0, 6.0], - "configuration_selector_widget": [35.0, 4.5], + "configuration_selector_widget": [35.0, 4.0], "configuration_selector_mode_tabs": [0.0, 3.0], "action_panel_widget": [25.0, 0.0], "action_panel_information_widget": [20.0, 0.0], "action_panel_button": [15.0, 3.0], - "machine_selector_widget": [16.0, 4.5], + "machine_selector_widget": [20.0, 4.0], + "machine_selector_widget_content": [25.0, 32.0], "views_selector": [0.0, 4.0],