From 8ce5593eec741f47bf7b8463a64a8deebdcc80fe Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Fri, 29 May 2020 12:28:26 +0200 Subject: [PATCH 1/7] Add visible scrollbar to list of printer profiles --- .../AddLocalPrinterScrollView.qml | 4 +- resources/qml/Widgets/ScrollView.qml | 45 +++++++++++++++++++ resources/qml/qmldir | 1 + 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 resources/qml/Widgets/ScrollView.qml diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index 50ceeff8a9..cf89d7a345 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -5,7 +5,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 import UM 1.3 as UM -import Cura 1.0 as Cura +import Cura 1.1 as Cura // @@ -68,7 +68,7 @@ Item height: childrenRect.height // ScrollView + ListView for selecting a local printer to add - ScrollView + Cura.ScrollView { id: scrollView anchors.left: parent.left diff --git a/resources/qml/Widgets/ScrollView.qml b/resources/qml/Widgets/ScrollView.qml new file mode 100644 index 0000000000..43a80204f7 --- /dev/null +++ b/resources/qml/Widgets/ScrollView.qml @@ -0,0 +1,45 @@ +// Copyright (c) 2020 Ultimaker B.V. +// Toolbox is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.10 +import QtQuick.Controls 2.3 + +import UM 1.1 as UM + +ScrollView +{ + clip: true + // Setting this property to false hides the scrollbar both when the scrollbar is not needed (child height < height) + // and when the scrollbar is not actively being hovered or pressed + property bool scrollAlwaysVisible: true + + ScrollBar.vertical: ScrollBar + { + hoverEnabled: true + policy: parent.scrollAlwaysVisible ? ScrollBar.AlwaysOn : ScrollBar.AsNeeded + anchors.top: parent.top + anchors.right: parent.right + anchors.bottom: parent.bottom + + contentItem: Rectangle + { + implicitWidth: UM.Theme.getSize("scrollbar").width + opacity: (parent.active || parent.parent.scrollAlwaysVisible) ? 1.0 : 0.0 + radius: Math.round(width / 2) + color: + { + if (parent.pressed) + { + return UM.Theme.getColor("scrollbar_handle_down") + } + else if (parent.hovered) + { + return UM.Theme.getColor("scrollbar_handle_hover") + } + return UM.Theme.getColor("scrollbar_handle") + } + Behavior on color { ColorAnimation { duration: 100; } } + Behavior on opacity { NumberAnimation { duration: 100 } } + } + } +} \ No newline at end of file diff --git a/resources/qml/qmldir b/resources/qml/qmldir index dcc2e410c9..ab61101778 100644 --- a/resources/qml/qmldir +++ b/resources/qml/qmldir @@ -35,6 +35,7 @@ RadioButton 1.0 RadioButton.qml Scrollable 1.0 Scrollable.qml TabButton 1.0 TabButton.qml TextField 1.0 TextField.qml +ScrollView 1.0 ScrollView.qml # Cura/MachineSettings From 7c8c1838e0154d51cc7f672ebf9dba2a2c87b9b9 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Fri, 29 May 2020 16:21:18 +0200 Subject: [PATCH 2/7] Make printer name field look less like a search field --- .../AddLocalPrinterScrollView.qml | 148 ++++++++++++------ 1 file changed, 99 insertions(+), 49 deletions(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index cf89d7a345..eb6c49281c 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -29,7 +29,7 @@ Item "Custom": -1 } - property int maxItemCountAtOnce: 10 // show at max 10 items at once, otherwise you need to scroll. + property int maxItemCountAtOnce: 11 // show at max 11 items at once, otherwise you need to scroll. // User-editable printer name property alias printerName: printerNameTextField.text @@ -54,12 +54,27 @@ Item } } + function getMachineName() + { + return machineList.model.getItem(machineList.currentIndex) != undefined ? machineList.model.getItem(machineList.currentIndex).name : ""; + } + + function getMachineMetaDataEntry(key) + { + var metadata = machineList.model.getItem(machineList.currentIndex) != undefined ? machineList.model.getItem(machineList.currentIndex).metadata : undefined; + if (metadata) + { + return metadata[key]; + } + return undefined; + } + Component.onCompleted: { updateCurrentItemUponSectionChange() } - Item + Row { id: localPrinterSelectionItem anchors.left: parent.left @@ -71,16 +86,9 @@ Item Cura.ScrollView { id: scrollView - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top height: (maxItemCountAtOnce * UM.Theme.getSize("action_button").height) - UM.Theme.getSize("default_margin").height - - ScrollBar.horizontal.policy: ScrollBar.AlwaysOff - ScrollBar.vertical.policy: ScrollBar.AsNeeded - - clip: true + width: Math.floor(parent.width * 0.4) ListView { @@ -183,52 +191,94 @@ Item } } } - } - // Horizontal line - Rectangle - { - id: horizontalLine - anchors.top: localPrinterSelectionItem.bottom - anchors.left: parent.left - anchors.right: parent.right - height: UM.Theme.getSize("default_lining").height - color: UM.Theme.getColor("lining") - } - - // User-editable printer name row - Row - { - anchors.top: horizontalLine.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.topMargin: UM.Theme.getSize("default_lining").height - anchors.leftMargin: UM.Theme.getSize("default_margin").width - - spacing: UM.Theme.getSize("default_margin").width - - Label + // Vertical line + Rectangle { - text: catalog.i18nc("@label", "Printer name") - anchors.verticalCenter: parent.verticalCenter - font: UM.Theme.getFont("medium") - color: UM.Theme.getColor("text") - verticalAlignment: Text.AlignVCenter - renderType: Text.NativeRendering + id: verticalLine + anchors.top: parent.top + anchors.bottom: parent.bottom + width: UM.Theme.getSize("default_lining").height + color: UM.Theme.getColor("lining") } - Cura.TextField + // User-editable printer name row + Column { - id: printerNameTextField - anchors.verticalCenter: parent.verticalCenter - width: (parent.width / 2) | 0 - placeholderText: catalog.i18nc("@text", "Please give your printer a name") - maximumLength: 40 - validator: RegExpValidator + width: Math.floor(parent.width * 0.6) + + spacing: UM.Theme.getSize("default_margin").width + padding: UM.Theme.getSize("default_margin").width + + Label { - regExp: printerNameTextField.machineNameValidator.machineNameRegex + width: parent.width + wrapMode: Text.WordWrap + text: base.getMachineName() + color: UM.Theme.getColor("primary_button") + font: UM.Theme.getFont("huge") + elide: Text.ElideRight + } + Grid + { + width: parent.width + columns: 2 + rowSpacing: UM.Theme.getSize("default_lining").height + columnSpacing: UM.Theme.getSize("default_margin").width + + verticalItemAlignment: Grid.AlignVCenter + + Label + { + text: catalog.i18nc("@label", "Manufacturer") + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + renderType: Text.NativeRendering + } + Label + { + text: base.getMachineMetaDataEntry("manufacturer") + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + renderType: Text.NativeRendering + } + Label + { + text: catalog.i18nc("@label", "Author") + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + renderType: Text.NativeRendering + } + Label + { + text: base.getMachineMetaDataEntry("author") + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + renderType: Text.NativeRendering + } + + Label + { + text: catalog.i18nc("@label", "Printer name") + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + renderType: Text.NativeRendering + } + + Cura.TextField + { + id: printerNameTextField + placeholderText: catalog.i18nc("@text", "Please give your printer a name") + maximumLength: 40 + validator: RegExpValidator + { + regExp: printerNameTextField.machineNameValidator.machineNameRegex + } + property var machineNameValidator: Cura.MachineNameValidator { } + } } - property var machineNameValidator: Cura.MachineNameValidator { } } + + } } From cb73cfb0f3b8ada076ab46d37b63dae9c26796f3 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Fri, 29 May 2020 17:22:46 +0200 Subject: [PATCH 3/7] Make add printer dialog resize-aware --- resources/qml/WelcomePages/AddLocalPrinterScrollView.qml | 4 ++-- .../qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml | 6 ++++++ resources/qml/Widgets/ScrollView.qml | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index eb6c49281c..8b8606be73 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -87,7 +87,7 @@ Item { id: scrollView - height: (maxItemCountAtOnce * UM.Theme.getSize("action_button").height) - UM.Theme.getSize("default_margin").height + height: childrenHeight width: Math.floor(parent.width * 0.4) ListView @@ -197,7 +197,7 @@ Item { id: verticalLine anchors.top: parent.top - anchors.bottom: parent.bottom + height: childrenHeight - UM.Theme.getSize("default_lining").height width: UM.Theme.getSize("default_lining").height color: UM.Theme.getColor("lining") } diff --git a/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml b/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml index b6f715aa0b..6ac567b0b1 100644 --- a/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml +++ b/resources/qml/WelcomePages/AddNetworkOrLocalPrinterContent.qml @@ -108,6 +108,12 @@ Item AddLocalPrinterScrollView { id: localPrinterView + property int childrenHeight: backButton.y - addLocalPrinterDropDown.y - UM.Theme.getSize("expandable_component_content_header").height - UM.Theme.getSize("default_margin").height + + onChildrenHeightChanged: + { + addLocalPrinterDropDown.children[1].height = childrenHeight + } } } } diff --git a/resources/qml/Widgets/ScrollView.qml b/resources/qml/Widgets/ScrollView.qml index 43a80204f7..9e7531994c 100644 --- a/resources/qml/Widgets/ScrollView.qml +++ b/resources/qml/Widgets/ScrollView.qml @@ -9,6 +9,7 @@ import UM 1.1 as UM ScrollView { clip: true + // Setting this property to false hides the scrollbar both when the scrollbar is not needed (child height < height) // and when the scrollbar is not actively being hovered or pressed property bool scrollAlwaysVisible: true From aa2ed1aa4bb17f6bb7034e88a302f05f9075de84 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Fri, 29 May 2020 21:34:00 +0200 Subject: [PATCH 4/7] Remove now defunct variable --- resources/qml/WelcomePages/AddLocalPrinterScrollView.qml | 2 -- 1 file changed, 2 deletions(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index 8b8606be73..04c5de47ac 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -29,8 +29,6 @@ Item "Custom": -1 } - property int maxItemCountAtOnce: 11 // show at max 11 items at once, otherwise you need to scroll. - // User-editable printer name property alias printerName: printerNameTextField.text property alias isPrinterNameValid: printerNameTextField.acceptableInput From 33eaebe39799fc83811f457adddfbaaa4a157b97 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Fri, 5 Jun 2020 11:42:11 +0200 Subject: [PATCH 5/7] Change wording --- resources/qml/WelcomePages/AddLocalPrinterScrollView.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index 04c5de47ac..cecbf5b4ed 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -242,7 +242,7 @@ Item } Label { - text: catalog.i18nc("@label", "Author") + text: catalog.i18nc("@label", "Profile author") font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") renderType: Text.NativeRendering From 1a0474467951339fef65e49fcf79151a6207966a Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 16 Jun 2020 09:50:18 +0200 Subject: [PATCH 6/7] Prevent crash when starting the firmware update twice CURA-6Q --- cura/PrinterOutput/FirmwareUpdater.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cura/PrinterOutput/FirmwareUpdater.py b/cura/PrinterOutput/FirmwareUpdater.py index 8688c5a623..c4f3948c20 100644 --- a/cura/PrinterOutput/FirmwareUpdater.py +++ b/cura/PrinterOutput/FirmwareUpdater.py @@ -7,6 +7,8 @@ from enum import IntEnum from threading import Thread from typing import Union +from UM.Logger import Logger + MYPY = False if MYPY: from cura.PrinterOutput.PrinterOutputDevice import PrinterOutputDevice @@ -38,8 +40,10 @@ class FirmwareUpdater(QObject): return self._setFirmwareUpdateState(FirmwareUpdateState.updating) - - self._update_firmware_thread.start() + try: + self._update_firmware_thread.start() + except RuntimeError: + Logger.warning("Could not start the update thread, since it's still running!") def _updateFirmware(self) -> None: raise NotImplementedError("_updateFirmware needs to be implemented") From 58218d76c2acd3c83b62bc4ad2daff247a00b94c Mon Sep 17 00:00:00 2001 From: Kostas Karmas Date: Tue, 16 Jun 2020 16:35:22 +0200 Subject: [PATCH 7/7] Fix missing visibility in the RowLayout of the ConfigurationMenu This fixes the issue of the "Select configuration" label appearing on top of the extruders in the configuration menu. This could be observed when adding a UM2 with Olsson block. --- resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index cb498bcef0..a499242c94 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -41,6 +41,7 @@ Cura.ExpandablePopup RowLayout { anchors.fill: parent + visible: Cura.MachineManager.activeMachine ? Cura.MachineManager.activeMachine.hasMaterials : false Repeater { model: extrudersModel