From 853f915f2a1fabfeb8dbe4fce2edcc1bd1c063ad Mon Sep 17 00:00:00 2001 From: casper Date: Fri, 26 Nov 2021 10:06:50 +0100 Subject: [PATCH 01/77] Add basic onboarding banner to the market place --- .../Marketplace/resources/qml/Marketplace.qml | 4 + .../resources/qml/OnboardBanner.qml | 79 +++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 plugins/Marketplace/resources/qml/OnboardBanner.qml diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index c04aa7eb6a..3fcc0bb3fd 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -48,6 +48,10 @@ Window spacing: UM.Theme.getSize("default_margin").height + OnboardBanner + { + } + // Page title. Item { diff --git a/plugins/Marketplace/resources/qml/OnboardBanner.qml b/plugins/Marketplace/resources/qml/OnboardBanner.qml new file mode 100644 index 0000000000..b91a9a52f7 --- /dev/null +++ b/plugins/Marketplace/resources/qml/OnboardBanner.qml @@ -0,0 +1,79 @@ +// Copyright (c) 2021 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import QtQuick.Layouts 1.1 + +import UM 1.6 as UM +import Cura 1.6 as Cura + +// Onboarding banner. +Rectangle +{ + Layout.preferredHeight: childrenRect.height + 2 * UM.Theme.getSize("default_margin").height + anchors + { + margins: UM.Theme.getSize("default_margin").width + left: parent.left + right: parent.right + top: parent.top + } + + color: UM.Theme.getColor("action_panel_secondary") + + // Icon + Rectangle + { + id: onboardingIcon + anchors + { + top: parent.top + left: parent.left + margins: UM.Theme.getSize("default_margin").width + } + width: UM.Theme.getSize("button_icon").width + height: UM.Theme.getSize("button_icon").height + color: "transparent" + UM.RecolorImage + { + anchors.fill: parent + color: UM.Theme.getColor("primary_text") + source: UM.Theme.getIcon("Shop") + } + } + + // Close button + UM.SimpleButton + { + id: onboardingClose + anchors + { + top: parent.top + right: parent.right + margins: UM.Theme.getSize("default_margin").width + } + width: UM.Theme.getSize("message_close").width + height: UM.Theme.getSize("message_close").height + color: UM.Theme.getColor("primary_text") + hoverColor: UM.Theme.getColor("primary_text_hover") + iconSource: UM.Theme.getIcon("Cancel") + onClicked: confirmDeleteDialog.visible = true + } + + // Body + Text { + anchors + { + top: parent.top + left: onboardingIcon.right + right: onboardingClose.left + margins: UM.Theme.getSize("default_margin").width + } + + font: UM.Theme.getFont("medium") + color: UM.Theme.getColor("primary_text") + wrapMode: Text.WordWrap + text: catalog.i18nc("@text", "Streamline your workflow and customize your Ultimaker Cura experience with plugins contributed by our amazing community of users.") + } +} \ No newline at end of file From 20f94add47835ace7d5c16d37ff88ef1f6318d9f Mon Sep 17 00:00:00 2001 From: casper Date: Fri, 26 Nov 2021 10:10:09 +0100 Subject: [PATCH 02/77] Display different content on each of the marketplace onboarding banners --- .../resources/qml/ManagedPackages.qml | 1 + .../Marketplace/resources/qml/Marketplace.qml | 1 + .../Marketplace/resources/qml/Materials.qml | 1 + .../resources/qml/OnboardBanner.qml | 20 +++++++++++++++++-- .../Marketplace/resources/qml/Packages.qml | 2 ++ plugins/Marketplace/resources/qml/Plugins.qml | 1 + 6 files changed, 24 insertions(+), 2 deletions(-) diff --git a/plugins/Marketplace/resources/qml/ManagedPackages.qml b/plugins/Marketplace/resources/qml/ManagedPackages.qml index 243d5bf12e..c53384bf77 100644 --- a/plugins/Marketplace/resources/qml/ManagedPackages.qml +++ b/plugins/Marketplace/resources/qml/ManagedPackages.qml @@ -10,6 +10,7 @@ import UM 1.4 as UM Packages { pageTitle: catalog.i18nc("@header", "Manage packages") + bannerType: "__MANAGE_PACKAGES__" model: Marketplace.LocalPackageList { } diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index 3fcc0bb3fd..7293a61a80 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -50,6 +50,7 @@ Window OnboardBanner { + bannerType: content.item && content.item.bannerType } // Page title. diff --git a/plugins/Marketplace/resources/qml/Materials.qml b/plugins/Marketplace/resources/qml/Materials.qml index 1d1572976a..dff63305bf 100644 --- a/plugins/Marketplace/resources/qml/Materials.qml +++ b/plugins/Marketplace/resources/qml/Materials.qml @@ -6,6 +6,7 @@ import Marketplace 1.0 as Marketplace Packages { pageTitle: catalog.i18nc("@header", "Install Materials") + bannerType: "__MATERIALS__" model: Marketplace.RemotePackageList { packageTypeFilter: "material" diff --git a/plugins/Marketplace/resources/qml/OnboardBanner.qml b/plugins/Marketplace/resources/qml/OnboardBanner.qml index b91a9a52f7..8a1048018c 100644 --- a/plugins/Marketplace/resources/qml/OnboardBanner.qml +++ b/plugins/Marketplace/resources/qml/OnboardBanner.qml @@ -11,6 +11,8 @@ import Cura 1.6 as Cura // Onboarding banner. Rectangle { + property var bannerType + Layout.preferredHeight: childrenRect.height + 2 * UM.Theme.getSize("default_margin").height anchors { @@ -39,7 +41,14 @@ Rectangle { anchors.fill: parent color: UM.Theme.getColor("primary_text") - source: UM.Theme.getIcon("Shop") + source: { + switch (bannerType) { + case "__PLUGINS__" : return UM.Theme.getIcon("Shop"); + case "__MATERIALS__" : return UM.Theme.getIcon("Spool"); + case "__MANAGE_PACKAGES__" : return UM.Theme.getIcon("ArrowDoubleCircleRight"); + default: return ""; + } + } } } @@ -74,6 +83,13 @@ Rectangle font: UM.Theme.getFont("medium") color: UM.Theme.getColor("primary_text") wrapMode: Text.WordWrap - text: catalog.i18nc("@text", "Streamline your workflow and customize your Ultimaker Cura experience with plugins contributed by our amazing community of users.") + text: { + switch (bannerType) { + case "__PLUGINS__" : return catalog.i18nc("@text", "Streamline your workflow and customize your Ultimaker Cura experience with plugins contributed by our amazing community of users."); + case "__MATERIALS__" : return catalog.i18nc("@text", "Select and install material profiles optimised for your Ultimaker 3D printers."); + case "__MANAGE_PACKAGES__" : return catalog.i18nc("@text", "Manage your Ultimaker Cura plugins and material profiles here. Make sure to keep your plugins up to date and backup your setup regularly."); + default: return ""; + } + } } } \ No newline at end of file diff --git a/plugins/Marketplace/resources/qml/Packages.qml b/plugins/Marketplace/resources/qml/Packages.qml index 79b4bf23a5..345aecf822 100644 --- a/plugins/Marketplace/resources/qml/Packages.qml +++ b/plugins/Marketplace/resources/qml/Packages.qml @@ -11,6 +11,8 @@ ListView id: packages property string pageTitle + property string bannerType + width: parent.width clip: true diff --git a/plugins/Marketplace/resources/qml/Plugins.qml b/plugins/Marketplace/resources/qml/Plugins.qml index ef5d92c2e8..24381e3027 100644 --- a/plugins/Marketplace/resources/qml/Plugins.qml +++ b/plugins/Marketplace/resources/qml/Plugins.qml @@ -6,6 +6,7 @@ import Marketplace 1.0 as Marketplace Packages { pageTitle: catalog.i18nc("@header", "Install Plugins") + bannerType: "__PLUGINS__" model: Marketplace.RemotePackageList { packageTypeFilter: "plugin" From 60b174177fc887552ba00f5e766c9c87366e919e Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 26 Nov 2021 14:21:18 +0100 Subject: [PATCH 03/77] Also set correct size for package card title --- plugins/Marketplace/resources/qml/PackageCard.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index 433b77a54d..63909ef049 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -66,7 +66,7 @@ Rectangle left: packageItem.right right: parent.right top: parent.top - topMargin: UM.Theme.getSize("default_margin").height + topMargin: UM.Theme.getSize("narrow_margin").height leftMargin: UM.Theme.getSize("default_margin").width rightMargin:UM.Theme.getSize("thick_margin").width } @@ -74,7 +74,7 @@ Rectangle Label { text: packageData.displayName - font: UM.Theme.getFont("large_bold") + font: UM.Theme.getFont("medium_bold") color: UM.Theme.getColor("text") verticalAlignment: Text.AlignTop } From 09a569fdd1fa416367d47f7b68eb2bc7443b149f Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 26 Nov 2021 14:14:43 +0100 Subject: [PATCH 04/77] Change fonts to default No idea why they were medium, but the design clearly shows that it should be the default font --- plugins/Marketplace/resources/qml/PackageCard.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index 63909ef049..e80b352978 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -204,7 +204,7 @@ Rectangle property real lastLineWidth: 0; //Store the width of the last line, to properly position the elision. text: packageData.description - font: UM.Theme.getFont("medium") + font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") maximumLineCount: 2 wrapMode: Text.Wrap @@ -328,6 +328,6 @@ Rectangle FontMetrics { id: fontMetrics - font: UM.Theme.getFont("medium") + font: UM.Theme.getFont("default") } } From 3ddfa6486b3d45ba16be1e059c2d6613ce905bde Mon Sep 17 00:00:00 2001 From: casper Date: Fri, 26 Nov 2021 14:49:00 +0100 Subject: [PATCH 05/77] Remove banners when clicking close button --- cura/CuraApplication.py | 31 +++++++++++++++++++ .../resources/qml/ManagedPackages.qml | 10 +++++- .../Marketplace/resources/qml/Marketplace.qml | 5 ++- .../Marketplace/resources/qml/Materials.qml | 10 +++++- .../resources/qml/OnboardBanner.qml | 28 ++++++----------- .../Marketplace/resources/qml/Packages.qml | 5 ++- plugins/Marketplace/resources/qml/Plugins.qml | 10 +++++- 7 files changed, 76 insertions(+), 23 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 3d4ec1209f..6cf2593bbf 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -572,6 +572,10 @@ class CuraApplication(QtApplication): preferences.addPreference("general/accepted_user_agreement", False) + preferences.addPreference("cura/market_place_show_plugin_banner", True) + preferences.addPreference("cura/market_place_show_material_banner", True) + preferences.addPreference("cura/market_place_show_manage_packages_banner", True) + for key in [ "dialog_load_path", # dialog_save_path is in LocalFileOutputDevicePlugin "dialog_profile_path", @@ -2011,6 +2015,33 @@ class CuraApplication(QtApplication): show_whatsnew_only = has_active_machine and has_app_just_upgraded return show_whatsnew_only + @pyqtSlot(result = bool) + def shouldShowMarketPlacePluginBanner(self) -> bool: + return self._preferences.getValue("cura/market_place_show_plugin_banner") + + @pyqtSlot(result = bool) + def shouldShowMarketPlaceMaterialBanner(self) -> bool: + return self._preferences.getValue("cura/market_place_show_material_banner") + + @pyqtSlot(result = bool) + def shouldShowMarketPlaceManagePackagesBanner(self) -> bool: + return self._preferences.getValue("cura/market_place_show_manage_packages_banner") + + @pyqtSlot() + def closeMarketPlacePluginBanner(self) -> None: + Logger.log("i", "Close market place plugin banner") + self._preferences.setValue("cura/market_place_show_plugin_banner", False) + + @pyqtSlot() + def closeMarketPlaceMaterialBanner(self) -> None: + Logger.log("i", "Close market place material banner") + self._preferences.setValue("cura/market_place_show_material_banner", False) + + @pyqtSlot() + def closeMarketPlaceManagePackagesBanner(self) -> None: + Logger.log("i", "Close market place manage packages banner") + self._preferences.setValue("cura/market_place_show_manage_packages_banner", False) + @pyqtSlot(result = int) def appWidth(self) -> int: main_window = QtApplication.getInstance().getMainWindow() diff --git a/plugins/Marketplace/resources/qml/ManagedPackages.qml b/plugins/Marketplace/resources/qml/ManagedPackages.qml index c53384bf77..a329d992e5 100644 --- a/plugins/Marketplace/resources/qml/ManagedPackages.qml +++ b/plugins/Marketplace/resources/qml/ManagedPackages.qml @@ -10,7 +10,15 @@ import UM 1.4 as UM Packages { pageTitle: catalog.i18nc("@header", "Manage packages") - bannerType: "__MANAGE_PACKAGES__" + + bannerVisible: CuraApplication.shouldShowMarketPlaceManagePackagesBanner() + bannerIcon: "ArrowDoubleCircleRight" + bannerBody: catalog.i18nc("@text", "Manage your Ultimaker Cura plugins and material profiles here. Make sure to keep your plugins up to date and backup your setup regularly.") + onRemoveBanner: function() { + CuraApplication.closeMarketPlaceManagePackagesBanner(); + bannerVisible = false; + } + model: Marketplace.LocalPackageList { } diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index 7293a61a80..14de458e95 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -50,7 +50,10 @@ Window OnboardBanner { - bannerType: content.item && content.item.bannerType + bannerVisible: content.item && content.item.bannerVisible + bannerBody: content.item && content.item.bannerBody + bannerIcon: content.item && content.item.bannerIcon + onRemoveBanner: content.item && content.item.onRemoveBanner } // Page title. diff --git a/plugins/Marketplace/resources/qml/Materials.qml b/plugins/Marketplace/resources/qml/Materials.qml index dff63305bf..32d2c2213a 100644 --- a/plugins/Marketplace/resources/qml/Materials.qml +++ b/plugins/Marketplace/resources/qml/Materials.qml @@ -6,7 +6,15 @@ import Marketplace 1.0 as Marketplace Packages { pageTitle: catalog.i18nc("@header", "Install Materials") - bannerType: "__MATERIALS__" + + bannerVisible: CuraApplication.shouldShowMarketPlaceMaterialBanner() + bannerIcon: "Spool" + bannerBody: catalog.i18nc("@text", "Streamline your workflow and customize your Ultimaker Cura experience with plugins contributed by our amazing community of users.") + onRemoveBanner: function() { + CuraApplication.closeMarketPlaceMaterialBanner(); + bannerVisible = false; + } + model: Marketplace.RemotePackageList { packageTypeFilter: "material" diff --git a/plugins/Marketplace/resources/qml/OnboardBanner.qml b/plugins/Marketplace/resources/qml/OnboardBanner.qml index 8a1048018c..8a29030514 100644 --- a/plugins/Marketplace/resources/qml/OnboardBanner.qml +++ b/plugins/Marketplace/resources/qml/OnboardBanner.qml @@ -11,7 +11,12 @@ import Cura 1.6 as Cura // Onboarding banner. Rectangle { - property var bannerType + property bool bannerVisible + property string bannerIcon + property string bannerBody + property var onRemoveBanner + + visible: bannerVisible Layout.preferredHeight: childrenRect.height + 2 * UM.Theme.getSize("default_margin").height anchors @@ -41,14 +46,7 @@ Rectangle { anchors.fill: parent color: UM.Theme.getColor("primary_text") - source: { - switch (bannerType) { - case "__PLUGINS__" : return UM.Theme.getIcon("Shop"); - case "__MATERIALS__" : return UM.Theme.getIcon("Spool"); - case "__MANAGE_PACKAGES__" : return UM.Theme.getIcon("ArrowDoubleCircleRight"); - default: return ""; - } - } + source: UM.Theme.getIcon(bannerIcon) } } @@ -67,7 +65,8 @@ Rectangle color: UM.Theme.getColor("primary_text") hoverColor: UM.Theme.getColor("primary_text_hover") iconSource: UM.Theme.getIcon("Cancel") - onClicked: confirmDeleteDialog.visible = true + + onClicked: onRemoveBanner() } // Body @@ -83,13 +82,6 @@ Rectangle font: UM.Theme.getFont("medium") color: UM.Theme.getColor("primary_text") wrapMode: Text.WordWrap - text: { - switch (bannerType) { - case "__PLUGINS__" : return catalog.i18nc("@text", "Streamline your workflow and customize your Ultimaker Cura experience with plugins contributed by our amazing community of users."); - case "__MATERIALS__" : return catalog.i18nc("@text", "Select and install material profiles optimised for your Ultimaker 3D printers."); - case "__MANAGE_PACKAGES__" : return catalog.i18nc("@text", "Manage your Ultimaker Cura plugins and material profiles here. Make sure to keep your plugins up to date and backup your setup regularly."); - default: return ""; - } - } + text: bannerBody } } \ No newline at end of file diff --git a/plugins/Marketplace/resources/qml/Packages.qml b/plugins/Marketplace/resources/qml/Packages.qml index 345aecf822..91f6448994 100644 --- a/plugins/Marketplace/resources/qml/Packages.qml +++ b/plugins/Marketplace/resources/qml/Packages.qml @@ -11,7 +11,10 @@ ListView id: packages property string pageTitle - property string bannerType + property bool bannerVisible + property string bannerIcon + property string bannerBody + property var onRemoveBanner width: parent.width diff --git a/plugins/Marketplace/resources/qml/Plugins.qml b/plugins/Marketplace/resources/qml/Plugins.qml index 24381e3027..b9d38c6e2b 100644 --- a/plugins/Marketplace/resources/qml/Plugins.qml +++ b/plugins/Marketplace/resources/qml/Plugins.qml @@ -6,7 +6,15 @@ import Marketplace 1.0 as Marketplace Packages { pageTitle: catalog.i18nc("@header", "Install Plugins") - bannerType: "__PLUGINS__" + + bannerVisible: CuraApplication.shouldShowMarketPlacePluginBanner() + bannerIcon: "Shop" + bannerBody: catalog.i18nc("@text", "Select and install material profiles optimised for your Ultimaker 3D printers.") + onRemoveBanner: function() { + CuraApplication.closeMarketPlacePluginBanner(); + bannerVisible = false; + } + model: Marketplace.RemotePackageList { packageTypeFilter: "plugin" From a715274ca7336e8032675e891bc6224dced00dc4 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 26 Nov 2021 16:04:23 +0100 Subject: [PATCH 06/77] Add a StackView around Marketplace to allow extra pages on top This allows a sort of full-screen pop-up to replace the entire Marketplace window contents, on top of the normal contents. The normal contents are kept as they are, but out of view. Contributes to issue CURA-8565. --- .../Marketplace/resources/qml/Marketplace.qml | 242 +++++++++--------- .../resources/qml/PackageDetails.qml | 10 + .../Marketplace/resources/qml/Packages.qml | 15 +- 3 files changed, 149 insertions(+), 118 deletions(-) create mode 100644 plugins/Marketplace/resources/qml/PackageDetails.qml diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index c04aa7eb6a..b293d21f92 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -42,143 +42,153 @@ Window anchors.fill: parent color: UM.Theme.getColor("main_background") - ColumnLayout + //The Marketplace can have a page in front of everything with package details. The stack view controls its visibility. + StackView { + id: contextStack anchors.fill: parent - spacing: UM.Theme.getSize("default_margin").height + initialItem: packageBrowse - // Page title. - Item + ColumnLayout { - Layout.preferredWidth: parent.width - Layout.preferredHeight: childrenRect.height + UM.Theme.getSize("default_margin").height + id: packageBrowse + anchors.fill: parent - Label + spacing: UM.Theme.getSize("default_margin").height + + // Page title. + Item { - id: pageTitle - anchors + Layout.preferredWidth: parent.width + Layout.preferredHeight: childrenRect.height + UM.Theme.getSize("default_margin").height + + Label { - left: parent.left - leftMargin: UM.Theme.getSize("default_margin").width - right: parent.right - rightMargin: UM.Theme.getSize("default_margin").width - bottom: parent.bottom - } - - font: UM.Theme.getFont("large") - color: UM.Theme.getColor("text") - text: content.item ? content.item.pageTitle: catalog.i18nc("@title", "Loading...") - } - } - - // Search & Top-Level Tabs - Item - { - Layout.preferredHeight: childrenRect.height - Layout.preferredWidth: parent.width - 2 * UM.Theme.getSize("thin_margin").width - RowLayout - { - width: parent.width - height: UM.Theme.getSize("button_icon").height + UM.Theme.getSize("default_margin").height - spacing: UM.Theme.getSize("thin_margin").width - - Rectangle - { - color: "transparent" - Layout.preferredHeight: parent.height - Layout.preferredWidth: searchBar.visible ? UM.Theme.getSize("thin_margin").width : 0 - Layout.fillWidth: ! searchBar.visible - } - - Cura.SearchBar - { - id: searchBar - Layout.preferredHeight: UM.Theme.getSize("button_icon").height - Layout.fillWidth: true - onTextEdited: searchStringChanged(text) - } - - // Page selection. - TabBar - { - id: pageSelectionTabBar - anchors.right: parent.right - height: UM.Theme.getSize("button_icon").height - spacing: 0 - background: Rectangle { color: "transparent" } - - PackageTypeTab + id: pageTitle + anchors { - id: pluginTabText - width: implicitWidth - text: catalog.i18nc("@button", "Plugins") - onClicked: + left: parent.left + leftMargin: UM.Theme.getSize("default_margin").width + right: parent.right + rightMargin: UM.Theme.getSize("default_margin").width + bottom: parent.bottom + } + + font: UM.Theme.getFont("large") + color: UM.Theme.getColor("text") + text: content.item ? content.item.pageTitle: catalog.i18nc("@title", "Loading...") + } + } + + // Search & Top-Level Tabs + Item + { + Layout.preferredHeight: childrenRect.height + Layout.preferredWidth: parent.width - 2 * UM.Theme.getSize("thin_margin").width + RowLayout + { + width: parent.width + height: UM.Theme.getSize("button_icon").height + UM.Theme.getSize("default_margin").height + spacing: UM.Theme.getSize("thin_margin").width + + Rectangle + { + color: "transparent" + Layout.preferredHeight: parent.height + Layout.preferredWidth: searchBar.visible ? UM.Theme.getSize("thin_margin").width : 0 + Layout.fillWidth: ! searchBar.visible + } + + Cura.SearchBar + { + id: searchBar + Layout.preferredHeight: UM.Theme.getSize("button_icon").height + Layout.fillWidth: true + onTextEdited: searchStringChanged(text) + } + + // Page selection. + TabBar + { + id: pageSelectionTabBar + anchors.right: parent.right + height: UM.Theme.getSize("button_icon").height + spacing: 0 + background: Rectangle { color: "transparent" } + + PackageTypeTab { - searchBar.text = "" - searchBar.visible = true - content.source = "Plugins.qml" + id: pluginTabText + width: implicitWidth + text: catalog.i18nc("@button", "Plugins") + onClicked: + { + searchBar.text = "" + searchBar.visible = true + content.source = "Plugins.qml" + } + } + PackageTypeTab + { + id: materialsTabText + width: implicitWidth + text: catalog.i18nc("@button", "Materials") + onClicked: + { + searchBar.text = "" + searchBar.visible = true + content.source = "Materials.qml" + } + } + ManagePackagesButton + { + onClicked: content.source = "ManagedPackages.qml" } } - PackageTypeTab - { - id: materialsTabText - width: implicitWidth - text: catalog.i18nc("@button", "Materials") - onClicked: - { - searchBar.text = "" - searchBar.visible = true - content.source = "Materials.qml" - } - } - ManagePackagesButton - { - onClicked: content.source = "ManagedPackages.qml" - } - } - TextMetrics - { - id: pluginTabTextMetrics - text: pluginTabText.text - font: pluginTabText.font + TextMetrics + { + id: pluginTabTextMetrics + text: pluginTabText.text + font: pluginTabText.font + } + TextMetrics + { + id: materialsTabTextMetrics + text: materialsTabText.text + font: materialsTabText.font + } } - TextMetrics - { - id: materialsTabTextMetrics - text: materialsTabText.text - font: materialsTabText.font - } } - } - - // Page contents. - Rectangle - { - Layout.preferredWidth: parent.width - Layout.fillHeight: true - color: UM.Theme.getColor("detail_background") // Page contents. - Loader + Rectangle { - id: content - anchors.fill: parent - anchors.margins: UM.Theme.getSize("default_margin").width - source: "Plugins.qml" + Layout.preferredWidth: parent.width + Layout.fillHeight: true + color: UM.Theme.getColor("detail_background") - Connections + // Page contents. + Loader { - target: content - function onLoaded() + id: content + anchors.fill: parent + anchors.margins: UM.Theme.getSize("default_margin").width + source: "Plugins.qml" + + Connections { - pageTitle.text = content.item.pageTitle - searchStringChanged.connect(handleSearchStringChanged) - } - function handleSearchStringChanged(new_search) - { - content.item.model.searchString = new_search + target: content + function onLoaded() + { + pageTitle.text = content.item.pageTitle + searchStringChanged.connect(handleSearchStringChanged) + } + function handleSearchStringChanged(new_search) + { + content.item.model.searchString = new_search + } } } } diff --git a/plugins/Marketplace/resources/qml/PackageDetails.qml b/plugins/Marketplace/resources/qml/PackageDetails.qml new file mode 100644 index 0000000000..4ad376e490 --- /dev/null +++ b/plugins/Marketplace/resources/qml/PackageDetails.qml @@ -0,0 +1,10 @@ +// Copyright (c) 2021 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.15 +import QtQuick.Controls 2.15 + +Label +{ + text: "Test!" +} \ No newline at end of file diff --git a/plugins/Marketplace/resources/qml/Packages.qml b/plugins/Marketplace/resources/qml/Packages.qml index 79b4bf23a5..def8d40acb 100644 --- a/plugins/Marketplace/resources/qml/Packages.qml +++ b/plugins/Marketplace/resources/qml/Packages.qml @@ -62,9 +62,20 @@ ListView } } - delegate: PackageCard + delegate: MouseArea { - packageData: model.package + width: parent.width + height: childrenRect.height + + onClicked: + { + contextStack.push(Qt.resolvedUrl("PackageDetails.qml")) + } + + PackageCard + { + packageData: model.package + } } //Wrapper item to add spacing between content and footer. From 0d05e71f9da49cfdeb1b2b4af7bf9da2144f4dee Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 26 Nov 2021 16:48:02 +0100 Subject: [PATCH 07/77] Basis of header line I think the icon on the button is too small, but that's not currently configurable. Will have to look into that. Contributes to issue CURA-8565. --- .../resources/qml/PackageDetails.qml | 41 ++++++++++++++++++- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/plugins/Marketplace/resources/qml/PackageDetails.qml b/plugins/Marketplace/resources/qml/PackageDetails.qml index 4ad376e490..0dd196c26b 100644 --- a/plugins/Marketplace/resources/qml/PackageDetails.qml +++ b/plugins/Marketplace/resources/qml/PackageDetails.qml @@ -3,8 +3,45 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 +import QtQuick.Layouts 1.3 -Label +import Cura 1.0 as Cura +import UM 1.0 as UM + +Item { - text: "Test!" + Column + { + anchors.fill: parent + anchors.margins: UM.Theme.getSize("default_margin").width + + RowLayout + { + spacing: UM.Theme.getSize("default_margin").width + + Cura.SecondaryButton + { + Layout.alignment: Qt.AlignVCenter + Layout.preferredHeight: UM.Theme.getSize("action_button").height + Layout.preferredWidth: height + + onClicked: contextStack.pop() //Remove this page, returning to the main package list or whichever thing is beneath it. + + tooltip: catalog.i18nc("@button:tooltip", "Back") + toolTipContentAlignment: Cura.ToolTip.ContentAlignment.AlignRight + iconSource: UM.Theme.getIcon("ArrowLeft") + leftPadding: UM.Theme.getSize("narrow_margin").width + rightPadding: leftPadding + } + + Label + { + Layout.alignment: Qt.AlignVCenter + + text: "Install Plug-ins" //TODO: Depend on package type, and translate. + font: UM.Theme.getFont("large") + color: UM.Theme.getColor("text") + } + } + } } \ No newline at end of file From feb3046eacb924bcb5290cfad5d0716f113f9f5b Mon Sep 17 00:00:00 2001 From: casper Date: Sat, 27 Nov 2021 13:31:34 +0100 Subject: [PATCH 08/77] Add "readmore" button --- .../resources/qml/OnboardBanner.qml | 55 ++++++++++++++++++- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/plugins/Marketplace/resources/qml/OnboardBanner.qml b/plugins/Marketplace/resources/qml/OnboardBanner.qml index 8a29030514..150377eaf3 100644 --- a/plugins/Marketplace/resources/qml/OnboardBanner.qml +++ b/plugins/Marketplace/resources/qml/OnboardBanner.qml @@ -70,7 +70,8 @@ Rectangle } // Body - Text { + Label { + id: infoText anchors { top: parent.top @@ -80,8 +81,56 @@ Rectangle } font: UM.Theme.getFont("medium") - color: UM.Theme.getColor("primary_text") - wrapMode: Text.WordWrap text: bannerBody + + renderType: Text.NativeRendering + color: "white" + wrapMode: Text.Wrap + elide: Text.ElideRight + + onLineLaidOut: + { + if(line.isLast) + { + // Check if read more button still fits after the body text + if (line.implicitWidth + readMoreButton.width + UM.Theme.getSize("default_margin").width > width) + { + // If it does place it after the body text + readMoreButton.anchors.left = infoText.left; + readMoreButton.anchors.bottom = infoText.bottom; + readMoreButton.anchors.bottomMargin = -(fontMetrics.height + UM.Theme.getSize("thin_margin").height); + readMoreButton.anchors.leftMargin = 0; + } + else + { + // Otherwise place it under the text + readMoreButton.anchors.left = infoText.left; + readMoreButton.anchors.bottom = infoText.bottom; + readMoreButton.anchors.leftMargin = line.implicitWidth + UM.Theme.getSize("default_margin").width; + readMoreButton.anchors.bottomMargin = 0; + } + } + } + } + + FontMetrics + { + id: fontMetrics + font: UM.Theme.getFont("default") + } + + Cura.TertiaryButton + { + id: readMoreButton + text: "Learn More" + textFont: UM.Theme.getFont("default") + textColor: infoText.color + leftPadding: 0 + rightPadding: 0 + iconSource: UM.Theme.getIcon("LinkExternal") + isIconOnRightSide: true + height: fontMetrics.height + + onClicked: print("TODO") } } \ No newline at end of file From 964de6c7fbe3cc229a5608de110d3c691f7f04d0 Mon Sep 17 00:00:00 2001 From: casper Date: Sat, 27 Nov 2021 13:31:47 +0100 Subject: [PATCH 09/77] Change font size in banner --- plugins/Marketplace/resources/qml/OnboardBanner.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Marketplace/resources/qml/OnboardBanner.qml b/plugins/Marketplace/resources/qml/OnboardBanner.qml index 150377eaf3..cbd151bed2 100644 --- a/plugins/Marketplace/resources/qml/OnboardBanner.qml +++ b/plugins/Marketplace/resources/qml/OnboardBanner.qml @@ -80,7 +80,7 @@ Rectangle margins: UM.Theme.getSize("default_margin").width } - font: UM.Theme.getFont("medium") + font: UM.Theme.getFont("default") text: bannerBody renderType: Text.NativeRendering From f1ef1c283ea7283c269ec3c13af47420d7fcd4e6 Mon Sep 17 00:00:00 2001 From: casper Date: Sat, 27 Nov 2021 13:48:38 +0100 Subject: [PATCH 10/77] Add links to read me support pages Note that since the support pages are not yet ready the "read more" buttons are hidden. Once the correct link is added they become visible again. --- plugins/Marketplace/resources/qml/ManagedPackages.qml | 1 + plugins/Marketplace/resources/qml/Marketplace.qml | 1 + plugins/Marketplace/resources/qml/Materials.qml | 1 + plugins/Marketplace/resources/qml/OnboardBanner.qml | 4 +++- plugins/Marketplace/resources/qml/Packages.qml | 1 + plugins/Marketplace/resources/qml/Plugins.qml | 1 + 6 files changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/Marketplace/resources/qml/ManagedPackages.qml b/plugins/Marketplace/resources/qml/ManagedPackages.qml index a329d992e5..e8e54d77b5 100644 --- a/plugins/Marketplace/resources/qml/ManagedPackages.qml +++ b/plugins/Marketplace/resources/qml/ManagedPackages.qml @@ -14,6 +14,7 @@ Packages bannerVisible: CuraApplication.shouldShowMarketPlaceManagePackagesBanner() bannerIcon: "ArrowDoubleCircleRight" bannerBody: catalog.i18nc("@text", "Manage your Ultimaker Cura plugins and material profiles here. Make sure to keep your plugins up to date and backup your setup regularly.") + readMoreUrl: "" // TODO add when support page is ready onRemoveBanner: function() { CuraApplication.closeMarketPlaceManagePackagesBanner(); bannerVisible = false; diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index 14de458e95..2bdd0a509d 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -54,6 +54,7 @@ Window bannerBody: content.item && content.item.bannerBody bannerIcon: content.item && content.item.bannerIcon onRemoveBanner: content.item && content.item.onRemoveBanner + readMoreUrl: content.item.readMoreUrl && content.item.readMoreUrl } // Page title. diff --git a/plugins/Marketplace/resources/qml/Materials.qml b/plugins/Marketplace/resources/qml/Materials.qml index 32d2c2213a..fc4869dac5 100644 --- a/plugins/Marketplace/resources/qml/Materials.qml +++ b/plugins/Marketplace/resources/qml/Materials.qml @@ -10,6 +10,7 @@ Packages bannerVisible: CuraApplication.shouldShowMarketPlaceMaterialBanner() bannerIcon: "Spool" bannerBody: catalog.i18nc("@text", "Streamline your workflow and customize your Ultimaker Cura experience with plugins contributed by our amazing community of users.") + readMoreUrl: "" // TODO add when support page is ready onRemoveBanner: function() { CuraApplication.closeMarketPlaceMaterialBanner(); bannerVisible = false; diff --git a/plugins/Marketplace/resources/qml/OnboardBanner.qml b/plugins/Marketplace/resources/qml/OnboardBanner.qml index cbd151bed2..4b5e494be5 100644 --- a/plugins/Marketplace/resources/qml/OnboardBanner.qml +++ b/plugins/Marketplace/resources/qml/OnboardBanner.qml @@ -15,6 +15,7 @@ Rectangle property string bannerIcon property string bannerBody property var onRemoveBanner + property string readMoreUrl visible: bannerVisible @@ -121,6 +122,7 @@ Rectangle Cura.TertiaryButton { + visible: readMoreUrl !== "" id: readMoreButton text: "Learn More" textFont: UM.Theme.getFont("default") @@ -131,6 +133,6 @@ Rectangle isIconOnRightSide: true height: fontMetrics.height - onClicked: print("TODO") + onClicked: Qt.openUrlExternally(readMoreUrl) } } \ No newline at end of file diff --git a/plugins/Marketplace/resources/qml/Packages.qml b/plugins/Marketplace/resources/qml/Packages.qml index 91f6448994..9ef35a31b3 100644 --- a/plugins/Marketplace/resources/qml/Packages.qml +++ b/plugins/Marketplace/resources/qml/Packages.qml @@ -14,6 +14,7 @@ ListView property bool bannerVisible property string bannerIcon property string bannerBody + property string readMoreUrl property var onRemoveBanner width: parent.width diff --git a/plugins/Marketplace/resources/qml/Plugins.qml b/plugins/Marketplace/resources/qml/Plugins.qml index b9d38c6e2b..f0c101153c 100644 --- a/plugins/Marketplace/resources/qml/Plugins.qml +++ b/plugins/Marketplace/resources/qml/Plugins.qml @@ -10,6 +10,7 @@ Packages bannerVisible: CuraApplication.shouldShowMarketPlacePluginBanner() bannerIcon: "Shop" bannerBody: catalog.i18nc("@text", "Select and install material profiles optimised for your Ultimaker 3D printers.") + readMoreUrl: "" // TODO add when support page is ready onRemoveBanner: function() { CuraApplication.closeMarketPlacePluginBanner(); bannerVisible = false; From e5c8d5456de7e288905ccb92d7673ac6f13590ff Mon Sep 17 00:00:00 2001 From: casper Date: Mon, 29 Nov 2021 11:50:52 +0100 Subject: [PATCH 11/77] Directly use bindings in banner pages CURA-8564 --- cura/CuraApplication.py | 27 ------------------- .../resources/qml/ManagedPackages.qml | 4 +-- .../Marketplace/resources/qml/Materials.qml | 5 ++-- plugins/Marketplace/resources/qml/Plugins.qml | 5 ++-- 4 files changed, 8 insertions(+), 33 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 6cf2593bbf..21924a2680 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -2015,33 +2015,6 @@ class CuraApplication(QtApplication): show_whatsnew_only = has_active_machine and has_app_just_upgraded return show_whatsnew_only - @pyqtSlot(result = bool) - def shouldShowMarketPlacePluginBanner(self) -> bool: - return self._preferences.getValue("cura/market_place_show_plugin_banner") - - @pyqtSlot(result = bool) - def shouldShowMarketPlaceMaterialBanner(self) -> bool: - return self._preferences.getValue("cura/market_place_show_material_banner") - - @pyqtSlot(result = bool) - def shouldShowMarketPlaceManagePackagesBanner(self) -> bool: - return self._preferences.getValue("cura/market_place_show_manage_packages_banner") - - @pyqtSlot() - def closeMarketPlacePluginBanner(self) -> None: - Logger.log("i", "Close market place plugin banner") - self._preferences.setValue("cura/market_place_show_plugin_banner", False) - - @pyqtSlot() - def closeMarketPlaceMaterialBanner(self) -> None: - Logger.log("i", "Close market place material banner") - self._preferences.setValue("cura/market_place_show_material_banner", False) - - @pyqtSlot() - def closeMarketPlaceManagePackagesBanner(self) -> None: - Logger.log("i", "Close market place manage packages banner") - self._preferences.setValue("cura/market_place_show_manage_packages_banner", False) - @pyqtSlot(result = int) def appWidth(self) -> int: main_window = QtApplication.getInstance().getMainWindow() diff --git a/plugins/Marketplace/resources/qml/ManagedPackages.qml b/plugins/Marketplace/resources/qml/ManagedPackages.qml index e8e54d77b5..677a9ee574 100644 --- a/plugins/Marketplace/resources/qml/ManagedPackages.qml +++ b/plugins/Marketplace/resources/qml/ManagedPackages.qml @@ -11,12 +11,12 @@ Packages { pageTitle: catalog.i18nc("@header", "Manage packages") - bannerVisible: CuraApplication.shouldShowMarketPlaceManagePackagesBanner() + bannerVisible: UM.Preferences.getValue("cura/market_place_show_manage_packages_banner"); bannerIcon: "ArrowDoubleCircleRight" bannerBody: catalog.i18nc("@text", "Manage your Ultimaker Cura plugins and material profiles here. Make sure to keep your plugins up to date and backup your setup regularly.") readMoreUrl: "" // TODO add when support page is ready onRemoveBanner: function() { - CuraApplication.closeMarketPlaceManagePackagesBanner(); + UM.Preferences.setValue("cura/market_place_show_manage_packages_banner", false); bannerVisible = false; } diff --git a/plugins/Marketplace/resources/qml/Materials.qml b/plugins/Marketplace/resources/qml/Materials.qml index fc4869dac5..e4cd554334 100644 --- a/plugins/Marketplace/resources/qml/Materials.qml +++ b/plugins/Marketplace/resources/qml/Materials.qml @@ -2,17 +2,18 @@ // Cura is released under the terms of the LGPLv3 or higher. import Marketplace 1.0 as Marketplace +import UM 1.4 as UM Packages { pageTitle: catalog.i18nc("@header", "Install Materials") - bannerVisible: CuraApplication.shouldShowMarketPlaceMaterialBanner() + bannerVisible: UM.Preferences.getValue("cura/market_place_show_material_banner") bannerIcon: "Spool" bannerBody: catalog.i18nc("@text", "Streamline your workflow and customize your Ultimaker Cura experience with plugins contributed by our amazing community of users.") readMoreUrl: "" // TODO add when support page is ready onRemoveBanner: function() { - CuraApplication.closeMarketPlaceMaterialBanner(); + UM.Preferences.setValue("cura/market_place_show_material_banner", false); bannerVisible = false; } diff --git a/plugins/Marketplace/resources/qml/Plugins.qml b/plugins/Marketplace/resources/qml/Plugins.qml index f0c101153c..11aabedb85 100644 --- a/plugins/Marketplace/resources/qml/Plugins.qml +++ b/plugins/Marketplace/resources/qml/Plugins.qml @@ -2,17 +2,18 @@ // Cura is released under the terms of the LGPLv3 or higher. import Marketplace 1.0 as Marketplace +import UM 1.4 as UM Packages { pageTitle: catalog.i18nc("@header", "Install Plugins") - bannerVisible: CuraApplication.shouldShowMarketPlacePluginBanner() + bannerVisible: UM.Preferences.getValue("cura/market_place_show_plugin_banner") bannerIcon: "Shop" bannerBody: catalog.i18nc("@text", "Select and install material profiles optimised for your Ultimaker 3D printers.") readMoreUrl: "" // TODO add when support page is ready onRemoveBanner: function() { - CuraApplication.closeMarketPlacePluginBanner(); + UM.Preferences.setValue("cura/market_place_show_plugin_banner", false) bannerVisible = false; } From 00135e574dc464f1562c277ea389511dbc6735fb Mon Sep 17 00:00:00 2001 From: casper Date: Mon, 29 Nov 2021 11:53:35 +0100 Subject: [PATCH 12/77] Rename property `bannerBody` to `bannerText` CURA-8564 --- plugins/Marketplace/resources/qml/ManagedPackages.qml | 2 +- plugins/Marketplace/resources/qml/Marketplace.qml | 2 +- plugins/Marketplace/resources/qml/Materials.qml | 2 +- plugins/Marketplace/resources/qml/OnboardBanner.qml | 4 ++-- plugins/Marketplace/resources/qml/Packages.qml | 2 +- plugins/Marketplace/resources/qml/Plugins.qml | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/Marketplace/resources/qml/ManagedPackages.qml b/plugins/Marketplace/resources/qml/ManagedPackages.qml index 677a9ee574..0d1472bb6a 100644 --- a/plugins/Marketplace/resources/qml/ManagedPackages.qml +++ b/plugins/Marketplace/resources/qml/ManagedPackages.qml @@ -13,7 +13,7 @@ Packages bannerVisible: UM.Preferences.getValue("cura/market_place_show_manage_packages_banner"); bannerIcon: "ArrowDoubleCircleRight" - bannerBody: catalog.i18nc("@text", "Manage your Ultimaker Cura plugins and material profiles here. Make sure to keep your plugins up to date and backup your setup regularly.") + bannerText: catalog.i18nc("@text", "Manage your Ultimaker Cura plugins and material profiles here. Make sure to keep your plugins up to date and backup your setup regularly.") readMoreUrl: "" // TODO add when support page is ready onRemoveBanner: function() { UM.Preferences.setValue("cura/market_place_show_manage_packages_banner", false); diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index 2bdd0a509d..fe1c967a42 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -51,7 +51,7 @@ Window OnboardBanner { bannerVisible: content.item && content.item.bannerVisible - bannerBody: content.item && content.item.bannerBody + bannerText: content.item && content.item.bannerText bannerIcon: content.item && content.item.bannerIcon onRemoveBanner: content.item && content.item.onRemoveBanner readMoreUrl: content.item.readMoreUrl && content.item.readMoreUrl diff --git a/plugins/Marketplace/resources/qml/Materials.qml b/plugins/Marketplace/resources/qml/Materials.qml index e4cd554334..a1d6d91f8c 100644 --- a/plugins/Marketplace/resources/qml/Materials.qml +++ b/plugins/Marketplace/resources/qml/Materials.qml @@ -10,7 +10,7 @@ Packages bannerVisible: UM.Preferences.getValue("cura/market_place_show_material_banner") bannerIcon: "Spool" - bannerBody: catalog.i18nc("@text", "Streamline your workflow and customize your Ultimaker Cura experience with plugins contributed by our amazing community of users.") + bannerText: catalog.i18nc("@text", "Streamline your workflow and customize your Ultimaker Cura experience with plugins contributed by our amazing community of users.") readMoreUrl: "" // TODO add when support page is ready onRemoveBanner: function() { UM.Preferences.setValue("cura/market_place_show_material_banner", false); diff --git a/plugins/Marketplace/resources/qml/OnboardBanner.qml b/plugins/Marketplace/resources/qml/OnboardBanner.qml index 4b5e494be5..8d68512878 100644 --- a/plugins/Marketplace/resources/qml/OnboardBanner.qml +++ b/plugins/Marketplace/resources/qml/OnboardBanner.qml @@ -13,7 +13,7 @@ Rectangle { property bool bannerVisible property string bannerIcon - property string bannerBody + property string bannerText property var onRemoveBanner property string readMoreUrl @@ -82,7 +82,7 @@ Rectangle } font: UM.Theme.getFont("default") - text: bannerBody + text: bannerText renderType: Text.NativeRendering color: "white" diff --git a/plugins/Marketplace/resources/qml/Packages.qml b/plugins/Marketplace/resources/qml/Packages.qml index 9ef35a31b3..e98818299c 100644 --- a/plugins/Marketplace/resources/qml/Packages.qml +++ b/plugins/Marketplace/resources/qml/Packages.qml @@ -13,7 +13,7 @@ ListView property string pageTitle property bool bannerVisible property string bannerIcon - property string bannerBody + property string bannerText property string readMoreUrl property var onRemoveBanner diff --git a/plugins/Marketplace/resources/qml/Plugins.qml b/plugins/Marketplace/resources/qml/Plugins.qml index 11aabedb85..884529c3e0 100644 --- a/plugins/Marketplace/resources/qml/Plugins.qml +++ b/plugins/Marketplace/resources/qml/Plugins.qml @@ -10,7 +10,7 @@ Packages bannerVisible: UM.Preferences.getValue("cura/market_place_show_plugin_banner") bannerIcon: "Shop" - bannerBody: catalog.i18nc("@text", "Select and install material profiles optimised for your Ultimaker 3D printers.") + bannerText: catalog.i18nc("@text", "Select and install material profiles optimised for your Ultimaker 3D printers.") readMoreUrl: "" // TODO add when support page is ready onRemoveBanner: function() { UM.Preferences.setValue("cura/market_place_show_plugin_banner", false) From f8d9f1e39c98546a31705d4b6fe489427f750810 Mon Sep 17 00:00:00 2001 From: casper Date: Mon, 29 Nov 2021 11:55:33 +0100 Subject: [PATCH 13/77] Use `visible` property of `Rectangle` rather than defining a separate property CURA-8564 --- plugins/Marketplace/resources/qml/Marketplace.qml | 2 +- plugins/Marketplace/resources/qml/OnboardBanner.qml | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index fe1c967a42..1ae82adfff 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -50,7 +50,7 @@ Window OnboardBanner { - bannerVisible: content.item && content.item.bannerVisible + visible: content.item && content.item.bannerVisible bannerText: content.item && content.item.bannerText bannerIcon: content.item && content.item.bannerIcon onRemoveBanner: content.item && content.item.onRemoveBanner diff --git a/plugins/Marketplace/resources/qml/OnboardBanner.qml b/plugins/Marketplace/resources/qml/OnboardBanner.qml index 8d68512878..4a65297816 100644 --- a/plugins/Marketplace/resources/qml/OnboardBanner.qml +++ b/plugins/Marketplace/resources/qml/OnboardBanner.qml @@ -11,14 +11,11 @@ import Cura 1.6 as Cura // Onboarding banner. Rectangle { - property bool bannerVisible property string bannerIcon property string bannerText property var onRemoveBanner property string readMoreUrl - visible: bannerVisible - Layout.preferredHeight: childrenRect.height + 2 * UM.Theme.getSize("default_margin").height anchors { From 0337c1c77605baaa3b7fb4e9b0897e31c47f2ea7 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 29 Nov 2021 11:57:12 +0100 Subject: [PATCH 14/77] Allow changing the icon size But use the same default as what was previously hard-coded. Now we can have buttons with non-standard icon sizes then, e.g. if the button size itself is also non-standard. Contributes to issue CURA-8565. --- resources/qml/ActionButton.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index 62bea5df3b..f129e8c976 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -15,6 +15,7 @@ Button property bool isIconOnRightSide: false property alias iconSource: buttonIconLeft.source + property real iconSize: UM.Theme.getSize("action_button_icon").height property alias textFont: buttonText.font property alias cornerRadius: backgroundRect.radius property alias tooltip: tooltip.tooltipText @@ -158,7 +159,7 @@ Button { id: buttonIconRight source: buttonIconLeft.source - height: visible ? UM.Theme.getSize("action_button_icon").height : 0 + height: visible ? button.iconSize : 0 width: visible ? height : 0 sourceSize.width: width sourceSize.height: height From 6d1ffbde6920fd9dd08be8823f67a6f78fd91b24 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 29 Nov 2021 11:59:46 +0100 Subject: [PATCH 15/77] Remove superfluous anchors.fill This is already set by the StackView, which (logically) requires that the children fill the entire space taken by the StackView. Contributes to issue CURA-8565. --- plugins/Marketplace/resources/qml/Marketplace.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index b293d21f92..951de77f19 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -53,7 +53,6 @@ Window ColumnLayout { id: packageBrowse - anchors.fill: parent spacing: UM.Theme.getSize("default_margin").height From f1a9bbd7914b3dbdce17e0e2ec4d02b779c6acf1 Mon Sep 17 00:00:00 2001 From: casper Date: Mon, 29 Nov 2021 12:01:42 +0100 Subject: [PATCH 16/77] Use the `Item` element instead of `Rectangle` for banner icon To prevent un-necessary draw checks as the background is transparent CURA-8564 --- plugins/Marketplace/resources/qml/OnboardBanner.qml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/Marketplace/resources/qml/OnboardBanner.qml b/plugins/Marketplace/resources/qml/OnboardBanner.qml index 4a65297816..982bc0f501 100644 --- a/plugins/Marketplace/resources/qml/OnboardBanner.qml +++ b/plugins/Marketplace/resources/qml/OnboardBanner.qml @@ -28,7 +28,7 @@ Rectangle color: UM.Theme.getColor("action_panel_secondary") // Icon - Rectangle + Item { id: onboardingIcon anchors @@ -39,7 +39,6 @@ Rectangle } width: UM.Theme.getSize("button_icon").width height: UM.Theme.getSize("button_icon").height - color: "transparent" UM.RecolorImage { anchors.fill: parent From c117b61503d9091cf321997f9abfc9ace82b264b Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 29 Nov 2021 12:03:03 +0100 Subject: [PATCH 17/77] Also use proper icon size for left icon Almost forgot! Contributes to issue CURA-8565. --- resources/qml/ActionButton.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/ActionButton.qml b/resources/qml/ActionButton.qml index f129e8c976..942c0ee578 100644 --- a/resources/qml/ActionButton.qml +++ b/resources/qml/ActionButton.qml @@ -110,7 +110,7 @@ Button { id: buttonIconLeft source: "" - height: visible ? UM.Theme.getSize("action_button_icon").height : 0 + height: visible ? button.iconSize : 0 width: visible ? height : 0 sourceSize.width: width sourceSize.height: height From 07ee729cdefe566f0efb0f7b1011545a9ef21127 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 29 Nov 2021 12:03:29 +0100 Subject: [PATCH 18/77] Increase size of icon to fit button exactly Contributes to issue CURA-8565. --- plugins/Marketplace/resources/qml/PackageDetails.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/Marketplace/resources/qml/PackageDetails.qml b/plugins/Marketplace/resources/qml/PackageDetails.qml index 0dd196c26b..6cf29e9f45 100644 --- a/plugins/Marketplace/resources/qml/PackageDetails.qml +++ b/plugins/Marketplace/resources/qml/PackageDetails.qml @@ -29,9 +29,10 @@ Item tooltip: catalog.i18nc("@button:tooltip", "Back") toolTipContentAlignment: Cura.ToolTip.ContentAlignment.AlignRight - iconSource: UM.Theme.getIcon("ArrowLeft") leftPadding: UM.Theme.getSize("narrow_margin").width rightPadding: leftPadding + iconSource: UM.Theme.getIcon("ArrowLeft") + iconSize: height - leftPadding * 2 } Label From 0ca20e9b3d0f6716cb3fff68442661375bc712e3 Mon Sep 17 00:00:00 2001 From: casper Date: Mon, 29 Nov 2021 12:16:52 +0100 Subject: [PATCH 19/77] Use an `alias` property for the banner icon CURA-8564 --- plugins/Marketplace/resources/qml/ManagedPackages.qml | 2 +- plugins/Marketplace/resources/qml/Materials.qml | 2 +- plugins/Marketplace/resources/qml/OnboardBanner.qml | 10 ++-------- plugins/Marketplace/resources/qml/Packages.qml | 2 +- plugins/Marketplace/resources/qml/Plugins.qml | 2 +- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/plugins/Marketplace/resources/qml/ManagedPackages.qml b/plugins/Marketplace/resources/qml/ManagedPackages.qml index 0d1472bb6a..9ce8408f8e 100644 --- a/plugins/Marketplace/resources/qml/ManagedPackages.qml +++ b/plugins/Marketplace/resources/qml/ManagedPackages.qml @@ -12,7 +12,7 @@ Packages pageTitle: catalog.i18nc("@header", "Manage packages") bannerVisible: UM.Preferences.getValue("cura/market_place_show_manage_packages_banner"); - bannerIcon: "ArrowDoubleCircleRight" + bannerIcon: UM.Theme.getIcon("ArrowDoubleCircleRight") bannerText: catalog.i18nc("@text", "Manage your Ultimaker Cura plugins and material profiles here. Make sure to keep your plugins up to date and backup your setup regularly.") readMoreUrl: "" // TODO add when support page is ready onRemoveBanner: function() { diff --git a/plugins/Marketplace/resources/qml/Materials.qml b/plugins/Marketplace/resources/qml/Materials.qml index a1d6d91f8c..de075af031 100644 --- a/plugins/Marketplace/resources/qml/Materials.qml +++ b/plugins/Marketplace/resources/qml/Materials.qml @@ -9,7 +9,7 @@ Packages pageTitle: catalog.i18nc("@header", "Install Materials") bannerVisible: UM.Preferences.getValue("cura/market_place_show_material_banner") - bannerIcon: "Spool" + bannerIcon: UM.Theme.getIcon("Spool") bannerText: catalog.i18nc("@text", "Streamline your workflow and customize your Ultimaker Cura experience with plugins contributed by our amazing community of users.") readMoreUrl: "" // TODO add when support page is ready onRemoveBanner: function() { diff --git a/plugins/Marketplace/resources/qml/OnboardBanner.qml b/plugins/Marketplace/resources/qml/OnboardBanner.qml index 982bc0f501..b44295c90a 100644 --- a/plugins/Marketplace/resources/qml/OnboardBanner.qml +++ b/plugins/Marketplace/resources/qml/OnboardBanner.qml @@ -11,7 +11,7 @@ import Cura 1.6 as Cura // Onboarding banner. Rectangle { - property string bannerIcon + property alias bannerIcon: onboardingIcon.source; property string bannerText property var onRemoveBanner property string readMoreUrl @@ -28,7 +28,7 @@ Rectangle color: UM.Theme.getColor("action_panel_secondary") // Icon - Item + UM.RecolorImage { id: onboardingIcon anchors @@ -39,12 +39,6 @@ Rectangle } width: UM.Theme.getSize("button_icon").width height: UM.Theme.getSize("button_icon").height - UM.RecolorImage - { - anchors.fill: parent - color: UM.Theme.getColor("primary_text") - source: UM.Theme.getIcon(bannerIcon) - } } // Close button diff --git a/plugins/Marketplace/resources/qml/Packages.qml b/plugins/Marketplace/resources/qml/Packages.qml index e98818299c..722ad0ccda 100644 --- a/plugins/Marketplace/resources/qml/Packages.qml +++ b/plugins/Marketplace/resources/qml/Packages.qml @@ -12,7 +12,7 @@ ListView property string pageTitle property bool bannerVisible - property string bannerIcon + property var bannerIcon property string bannerText property string readMoreUrl property var onRemoveBanner diff --git a/plugins/Marketplace/resources/qml/Plugins.qml b/plugins/Marketplace/resources/qml/Plugins.qml index 884529c3e0..2922a39c9b 100644 --- a/plugins/Marketplace/resources/qml/Plugins.qml +++ b/plugins/Marketplace/resources/qml/Plugins.qml @@ -9,7 +9,7 @@ Packages pageTitle: catalog.i18nc("@header", "Install Plugins") bannerVisible: UM.Preferences.getValue("cura/market_place_show_plugin_banner") - bannerIcon: "Shop" + bannerIcon: UM.Theme.getIcon("Shop") bannerText: catalog.i18nc("@text", "Select and install material profiles optimised for your Ultimaker 3D printers.") readMoreUrl: "" // TODO add when support page is ready onRemoveBanner: function() { From 6909085733a46bda1e99fe36c2eaba07ae6ed32d Mon Sep 17 00:00:00 2001 From: casper Date: Mon, 29 Nov 2021 12:26:48 +0100 Subject: [PATCH 20/77] Use color from theme for the market place banner banner text CURA-8564 --- plugins/Marketplace/resources/qml/OnboardBanner.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Marketplace/resources/qml/OnboardBanner.qml b/plugins/Marketplace/resources/qml/OnboardBanner.qml index b44295c90a..148a279cd2 100644 --- a/plugins/Marketplace/resources/qml/OnboardBanner.qml +++ b/plugins/Marketplace/resources/qml/OnboardBanner.qml @@ -75,7 +75,7 @@ Rectangle text: bannerText renderType: Text.NativeRendering - color: "white" + color: UM.Theme.getColor("primary_text") wrapMode: Text.Wrap elide: Text.ElideRight From b53c1ba3061b4fc3dbeb46e161f7f186fa399ceb Mon Sep 17 00:00:00 2001 From: casper Date: Mon, 29 Nov 2021 12:34:25 +0100 Subject: [PATCH 21/77] Move static anchor properties inside the `TertiaryButton` element CURA-8564 --- plugins/Marketplace/resources/qml/OnboardBanner.qml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/Marketplace/resources/qml/OnboardBanner.qml b/plugins/Marketplace/resources/qml/OnboardBanner.qml index 148a279cd2..62f6b96356 100644 --- a/plugins/Marketplace/resources/qml/OnboardBanner.qml +++ b/plugins/Marketplace/resources/qml/OnboardBanner.qml @@ -87,16 +87,12 @@ Rectangle if (line.implicitWidth + readMoreButton.width + UM.Theme.getSize("default_margin").width > width) { // If it does place it after the body text - readMoreButton.anchors.left = infoText.left; - readMoreButton.anchors.bottom = infoText.bottom; readMoreButton.anchors.bottomMargin = -(fontMetrics.height + UM.Theme.getSize("thin_margin").height); readMoreButton.anchors.leftMargin = 0; } else { // Otherwise place it under the text - readMoreButton.anchors.left = infoText.left; - readMoreButton.anchors.bottom = infoText.bottom; readMoreButton.anchors.leftMargin = line.implicitWidth + UM.Theme.getSize("default_margin").width; readMoreButton.anchors.bottomMargin = 0; } @@ -114,6 +110,8 @@ Rectangle { visible: readMoreUrl !== "" id: readMoreButton + anchors.left: infoText.left + anchors.bottom: infoText.bottom text: "Learn More" textFont: UM.Theme.getFont("default") textColor: infoText.color From 5dd2dcce906e87919722a170e0bff8453b27c289 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 29 Nov 2021 12:57:36 +0100 Subject: [PATCH 22/77] Split page in header and contents This requires a small refactor here. Contributes to issue CURA-8565. --- .../resources/qml/PackageDetails.qml | 71 ++++++++++++------- 1 file changed, 45 insertions(+), 26 deletions(-) diff --git a/plugins/Marketplace/resources/qml/PackageDetails.qml b/plugins/Marketplace/resources/qml/PackageDetails.qml index 6cf29e9f45..4b4b2123c7 100644 --- a/plugins/Marketplace/resources/qml/PackageDetails.qml +++ b/plugins/Marketplace/resources/qml/PackageDetails.qml @@ -10,39 +10,58 @@ import UM 1.0 as UM Item { - Column + RowLayout { - anchors.fill: parent - anchors.margins: UM.Theme.getSize("default_margin").width - - RowLayout + id: header + anchors { - spacing: UM.Theme.getSize("default_margin").width + top: parent.top + topMargin: UM.Theme.getSize("default_margin").height + left: parent.left + leftMargin: UM.Theme.getSize("default_margin").width + right: parent.right + rightMargin: anchors.leftMargin + } - Cura.SecondaryButton - { - Layout.alignment: Qt.AlignVCenter - Layout.preferredHeight: UM.Theme.getSize("action_button").height - Layout.preferredWidth: height + spacing: UM.Theme.getSize("default_margin").width - onClicked: contextStack.pop() //Remove this page, returning to the main package list or whichever thing is beneath it. + Cura.SecondaryButton + { + Layout.alignment: Qt.AlignVCenter + Layout.preferredHeight: UM.Theme.getSize("action_button").height + Layout.preferredWidth: height - tooltip: catalog.i18nc("@button:tooltip", "Back") - toolTipContentAlignment: Cura.ToolTip.ContentAlignment.AlignRight - leftPadding: UM.Theme.getSize("narrow_margin").width - rightPadding: leftPadding - iconSource: UM.Theme.getIcon("ArrowLeft") - iconSize: height - leftPadding * 2 - } + onClicked: contextStack.pop() //Remove this page, returning to the main package list or whichever thing is beneath it. - Label - { - Layout.alignment: Qt.AlignVCenter + tooltip: catalog.i18nc("@button:tooltip", "Back") + toolTipContentAlignment: Cura.ToolTip.ContentAlignment.AlignRight + leftPadding: UM.Theme.getSize("narrow_margin").width + rightPadding: leftPadding + iconSource: UM.Theme.getIcon("ArrowLeft") + iconSize: height - leftPadding * 2 + } - text: "Install Plug-ins" //TODO: Depend on package type, and translate. - font: UM.Theme.getFont("large") - color: UM.Theme.getColor("text") - } + Label + { + Layout.alignment: Qt.AlignVCenter + Layout.fillWidth: true + + text: "Install Plug-ins" //TODO: Depend on package type, and translate. + font: UM.Theme.getFont("large") + color: UM.Theme.getColor("text") } } + + Rectangle + { + anchors + { + top: header.bottom + topMargin: UM.Theme.getSize("default_margin").height + left: parent.left + right: parent.right + bottom: parent.bottom + } + color: UM.Theme.getColor("detail_background") + } } \ No newline at end of file From c136deb430b1a0f9a82195eea28e6fbc0bcf2c3e Mon Sep 17 00:00:00 2001 From: casper Date: Mon, 29 Nov 2021 14:34:15 +0100 Subject: [PATCH 23/77] Remove top anchor from an element used in ColumnLayout This element did need additional margins at the top. Added margins to the ColumnLayout element instead. CURA-8564 --- plugins/Marketplace/resources/qml/Marketplace.qml | 4 ++-- plugins/Marketplace/resources/qml/OnboardBanner.qml | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index 1ae82adfff..e1936d6e44 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -40,6 +40,7 @@ Window Rectangle { anchors.fill: parent + anchors.topMargin: UM.Theme.getSize("default_margin").height color: UM.Theme.getColor("main_background") ColumnLayout @@ -61,7 +62,7 @@ Window Item { Layout.preferredWidth: parent.width - Layout.preferredHeight: childrenRect.height + UM.Theme.getSize("default_margin").height + Layout.preferredHeight: childrenRect.height Label { @@ -72,7 +73,6 @@ Window leftMargin: UM.Theme.getSize("default_margin").width right: parent.right rightMargin: UM.Theme.getSize("default_margin").width - bottom: parent.bottom } font: UM.Theme.getFont("large") diff --git a/plugins/Marketplace/resources/qml/OnboardBanner.qml b/plugins/Marketplace/resources/qml/OnboardBanner.qml index 62f6b96356..0107d6d816 100644 --- a/plugins/Marketplace/resources/qml/OnboardBanner.qml +++ b/plugins/Marketplace/resources/qml/OnboardBanner.qml @@ -22,7 +22,6 @@ Rectangle margins: UM.Theme.getSize("default_margin").width left: parent.left right: parent.right - top: parent.top } color: UM.Theme.getColor("action_panel_secondary") From d5cfaa1e0a714bbff9fd3b535dc11618cd62c752 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 29 Nov 2021 14:50:48 +0100 Subject: [PATCH 24/77] Add package card to detail page The card has the wrong layout, but it's a start. The data is communicated in any case. Contributes to issue CURA-8565. --- .../Marketplace/resources/qml/PackageDetails.qml | 8 ++++++++ plugins/Marketplace/resources/qml/Packages.qml | 16 ++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/plugins/Marketplace/resources/qml/PackageDetails.qml b/plugins/Marketplace/resources/qml/PackageDetails.qml index 4b4b2123c7..49e4d97633 100644 --- a/plugins/Marketplace/resources/qml/PackageDetails.qml +++ b/plugins/Marketplace/resources/qml/PackageDetails.qml @@ -10,6 +10,9 @@ import UM 1.0 as UM Item { + id: detailPage + property var packageData: packages.selectedPackage + RowLayout { id: header @@ -63,5 +66,10 @@ Item bottom: parent.bottom } color: UM.Theme.getColor("detail_background") + + PackageCard + { + packageData: detailPage.packageData + } } } \ No newline at end of file diff --git a/plugins/Marketplace/resources/qml/Packages.qml b/plugins/Marketplace/resources/qml/Packages.qml index def8d40acb..89254f2526 100644 --- a/plugins/Marketplace/resources/qml/Packages.qml +++ b/plugins/Marketplace/resources/qml/Packages.qml @@ -9,9 +9,10 @@ import UM 1.4 as UM ListView { id: packages + width: parent.width property string pageTitle - width: parent.width + property var selectedPackage clip: true @@ -69,7 +70,8 @@ ListView onClicked: { - contextStack.push(Qt.resolvedUrl("PackageDetails.qml")) + packages.selectedPackage = model.package; + contextStack.push(packageDetailsComponent); } PackageCard @@ -78,6 +80,16 @@ ListView } } + Component + { + id: packageDetailsComponent + + PackageDetails + { + packageData: packages.selectedPackage + } + } + //Wrapper item to add spacing between content and footer. footer: Item { From 6ca20ba863a71cc81e0f477d89a88ad04189d1db Mon Sep 17 00:00:00 2001 From: casper Date: Mon, 29 Nov 2021 15:09:33 +0100 Subject: [PATCH 25/77] Rename properties in marketplace onboarding banner CURA-8564 --- plugins/Marketplace/resources/qml/ManagedPackages.qml | 2 +- plugins/Marketplace/resources/qml/Marketplace.qml | 8 ++++---- plugins/Marketplace/resources/qml/Materials.qml | 2 +- plugins/Marketplace/resources/qml/OnboardBanner.qml | 9 ++++----- plugins/Marketplace/resources/qml/Packages.qml | 2 +- plugins/Marketplace/resources/qml/Plugins.qml | 2 +- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/plugins/Marketplace/resources/qml/ManagedPackages.qml b/plugins/Marketplace/resources/qml/ManagedPackages.qml index 9ce8408f8e..2610f7cd9d 100644 --- a/plugins/Marketplace/resources/qml/ManagedPackages.qml +++ b/plugins/Marketplace/resources/qml/ManagedPackages.qml @@ -14,7 +14,7 @@ Packages bannerVisible: UM.Preferences.getValue("cura/market_place_show_manage_packages_banner"); bannerIcon: UM.Theme.getIcon("ArrowDoubleCircleRight") bannerText: catalog.i18nc("@text", "Manage your Ultimaker Cura plugins and material profiles here. Make sure to keep your plugins up to date and backup your setup regularly.") - readMoreUrl: "" // TODO add when support page is ready + bannerReadMoreUrl: "" // TODO add when support page is ready onRemoveBanner: function() { UM.Preferences.setValue("cura/market_place_show_manage_packages_banner", false); bannerVisible = false; diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index e1936d6e44..1866d7512d 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -52,10 +52,10 @@ Window OnboardBanner { visible: content.item && content.item.bannerVisible - bannerText: content.item && content.item.bannerText - bannerIcon: content.item && content.item.bannerIcon - onRemoveBanner: content.item && content.item.onRemoveBanner - readMoreUrl: content.item.readMoreUrl && content.item.readMoreUrl + text: content.item && content.item.bannerText + icon: content.item && content.item.bannerIcon + onRemove: content.item && content.item.onRemoveBanner + readMoreUrl: content.item && content.item.bannerReadMoreUrl } // Page title. diff --git a/plugins/Marketplace/resources/qml/Materials.qml b/plugins/Marketplace/resources/qml/Materials.qml index de075af031..2634f7b328 100644 --- a/plugins/Marketplace/resources/qml/Materials.qml +++ b/plugins/Marketplace/resources/qml/Materials.qml @@ -11,7 +11,7 @@ Packages bannerVisible: UM.Preferences.getValue("cura/market_place_show_material_banner") bannerIcon: UM.Theme.getIcon("Spool") bannerText: catalog.i18nc("@text", "Streamline your workflow and customize your Ultimaker Cura experience with plugins contributed by our amazing community of users.") - readMoreUrl: "" // TODO add when support page is ready + bannerReadMoreUrl: "" // TODO add when support page is ready onRemoveBanner: function() { UM.Preferences.setValue("cura/market_place_show_material_banner", false); bannerVisible = false; diff --git a/plugins/Marketplace/resources/qml/OnboardBanner.qml b/plugins/Marketplace/resources/qml/OnboardBanner.qml index 0107d6d816..0dbe2cb897 100644 --- a/plugins/Marketplace/resources/qml/OnboardBanner.qml +++ b/plugins/Marketplace/resources/qml/OnboardBanner.qml @@ -11,9 +11,9 @@ import Cura 1.6 as Cura // Onboarding banner. Rectangle { - property alias bannerIcon: onboardingIcon.source; - property string bannerText - property var onRemoveBanner + property alias icon: onboardingIcon.source + property alias text: infoText.text + property var onRemove property string readMoreUrl Layout.preferredHeight: childrenRect.height + 2 * UM.Theme.getSize("default_margin").height @@ -56,7 +56,7 @@ Rectangle hoverColor: UM.Theme.getColor("primary_text_hover") iconSource: UM.Theme.getIcon("Cancel") - onClicked: onRemoveBanner() + onClicked: onRemove() } // Body @@ -71,7 +71,6 @@ Rectangle } font: UM.Theme.getFont("default") - text: bannerText renderType: Text.NativeRendering color: UM.Theme.getColor("primary_text") diff --git a/plugins/Marketplace/resources/qml/Packages.qml b/plugins/Marketplace/resources/qml/Packages.qml index 722ad0ccda..46ebe8a661 100644 --- a/plugins/Marketplace/resources/qml/Packages.qml +++ b/plugins/Marketplace/resources/qml/Packages.qml @@ -14,7 +14,7 @@ ListView property bool bannerVisible property var bannerIcon property string bannerText - property string readMoreUrl + property string bannerReadMoreUrl property var onRemoveBanner width: parent.width diff --git a/plugins/Marketplace/resources/qml/Plugins.qml b/plugins/Marketplace/resources/qml/Plugins.qml index 2922a39c9b..29b264c702 100644 --- a/plugins/Marketplace/resources/qml/Plugins.qml +++ b/plugins/Marketplace/resources/qml/Plugins.qml @@ -11,7 +11,7 @@ Packages bannerVisible: UM.Preferences.getValue("cura/market_place_show_plugin_banner") bannerIcon: UM.Theme.getIcon("Shop") bannerText: catalog.i18nc("@text", "Select and install material profiles optimised for your Ultimaker 3D printers.") - readMoreUrl: "" // TODO add when support page is ready + bannerReadMoreUrl: "" // TODO add when support page is ready onRemoveBanner: function() { UM.Preferences.setValue("cura/market_place_show_plugin_banner", false) bannerVisible = false; From 616bf479e55c0352c35b7f9ab116e99235e28a1f Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 29 Nov 2021 16:11:15 +0100 Subject: [PATCH 26/77] Set position and width of card in details page This means that the card itself shouldn't specify a width. It should get a width from how it's used. Contributes to issue CURA-8565. --- plugins/Marketplace/resources/qml/PackageCard.qml | 1 - plugins/Marketplace/resources/qml/PackageDetails.qml | 9 +++++++++ plugins/Marketplace/resources/qml/Packages.qml | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index e80b352978..4cf3b84713 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -12,7 +12,6 @@ Rectangle { property var packageData - width: parent ? parent.width - UM.Theme.getSize("default_margin").width - UM.Theme.getSize("narrow_margin").width: 0 height: UM.Theme.getSize("card").height color: UM.Theme.getColor("main_background") radius: UM.Theme.getSize("default_radius").width diff --git a/plugins/Marketplace/resources/qml/PackageDetails.qml b/plugins/Marketplace/resources/qml/PackageDetails.qml index 49e4d97633..7db46300a8 100644 --- a/plugins/Marketplace/resources/qml/PackageDetails.qml +++ b/plugins/Marketplace/resources/qml/PackageDetails.qml @@ -70,6 +70,15 @@ Item PackageCard { packageData: detailPage.packageData + anchors + { + left: parent.left + leftMargin: UM.Theme.getSize("default_margin").width + right: parent.right + rightMargin: anchors.leftMargin + top: parent.top + topMargin: UM.Theme.getSize("default_margin").height + } } } } \ No newline at end of file diff --git a/plugins/Marketplace/resources/qml/Packages.qml b/plugins/Marketplace/resources/qml/Packages.qml index 89254f2526..47318d5a72 100644 --- a/plugins/Marketplace/resources/qml/Packages.qml +++ b/plugins/Marketplace/resources/qml/Packages.qml @@ -77,6 +77,7 @@ ListView PackageCard { packageData: model.package + width: parent.width - UM.Theme.getSize("default_margin").width - UM.Theme.getSize("narrow_margin").width } } From 61fdd5dc723e7390277ca7d8fe010ab8da192b00 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 29 Nov 2021 16:32:55 +0100 Subject: [PATCH 27/77] Restore check for parent before getting its width Delegates that are outside of the viewport may have no parent any more. Don't attempt to find their parents' width. Contributes to issue CURA-8565. --- plugins/Marketplace/resources/qml/Packages.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Marketplace/resources/qml/Packages.qml b/plugins/Marketplace/resources/qml/Packages.qml index 47318d5a72..49fca00fdb 100644 --- a/plugins/Marketplace/resources/qml/Packages.qml +++ b/plugins/Marketplace/resources/qml/Packages.qml @@ -65,7 +65,7 @@ ListView delegate: MouseArea { - width: parent.width + width: parent ? parent.width : 0 height: childrenRect.height onClicked: From 8ecd2f86a4f055012ea8f84b4ef036c3d37fb897 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 29 Nov 2021 16:38:24 +0100 Subject: [PATCH 28/77] Communicate to PackageCard whether it is a detailed card or not If it is detailed, it currently hides the short description. That is not quite enough, but we'll expand that behaviour. Contributes to issue CURA-8565. --- plugins/Marketplace/resources/qml/PackageCard.qml | 7 ++++--- plugins/Marketplace/resources/qml/PackageDetails.qml | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index 4cf3b84713..9a9d59efe7 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -11,6 +11,7 @@ import Cura 1.6 as Cura Rectangle { property var packageData + property bool expanded: false height: UM.Theme.getSize("card").height color: UM.Theme.getColor("main_background") @@ -21,7 +22,7 @@ Rectangle State { name: "Folded" - when: true // TODO + when: !expanded PropertyChanges { target: descriptionArea @@ -30,8 +31,8 @@ Rectangle }, State { - name: "Header" - when: false // TODO + name: "Expanded" + when: expanded PropertyChanges { target: descriptionArea diff --git a/plugins/Marketplace/resources/qml/PackageDetails.qml b/plugins/Marketplace/resources/qml/PackageDetails.qml index 7db46300a8..c1ef765a14 100644 --- a/plugins/Marketplace/resources/qml/PackageDetails.qml +++ b/plugins/Marketplace/resources/qml/PackageDetails.qml @@ -69,7 +69,6 @@ Item PackageCard { - packageData: detailPage.packageData anchors { left: parent.left @@ -79,6 +78,9 @@ Item top: parent.top topMargin: UM.Theme.getSize("default_margin").height } + + packageData: detailPage.packageData + expanded: true } } } \ No newline at end of file From d7058ef520206c073acfdb2c96706434abe95a08 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 29 Nov 2021 17:40:53 +0100 Subject: [PATCH 29/77] Change card summary information into a column This is necessary because we can't anchor to the bottom of the card here, and because we want to swap out the description for a download count in the extended detail card. Contributes to issue CURA-8565. --- .../Marketplace/resources/qml/PackageCard.qml | 430 +++++++++--------- 1 file changed, 213 insertions(+), 217 deletions(-) diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index 9a9d59efe7..6832d30074 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -57,271 +57,267 @@ Rectangle source: packageData.iconUrl != "" ? packageData.iconUrl : "../images/placeholder.svg" } - // Title row. - RowLayout + ColumnLayout { - id: titleBar anchors { left: packageItem.right + leftMargin: UM.Theme.getSize("default_margin").width right: parent.right + rightMargin: UM.Theme.getSize("thick_margin").width top: parent.top topMargin: UM.Theme.getSize("narrow_margin").height - leftMargin: UM.Theme.getSize("default_margin").width - rightMargin:UM.Theme.getSize("thick_margin").width } + height: packageItem.height + packageItem.anchors.margins * 2 - Label + // Title row. + RowLayout { - text: packageData.displayName - font: UM.Theme.getFont("medium_bold") - color: UM.Theme.getColor("text") - verticalAlignment: Text.AlignTop - } + id: titleBar + Layout.preferredWidth: parent.width + Layout.preferredHeight: childrenRect.height - Control - { - Layout.preferredWidth: UM.Theme.getSize("card_tiny_icon").width - Layout.preferredHeight: UM.Theme.getSize("card_tiny_icon").height - - - enabled: packageData.isCheckedByUltimaker - visible: packageData.isCheckedByUltimaker - - Cura.ToolTip + Label { - tooltipText: - { - switch(packageData.packageType) - { - case "plugin": return catalog.i18nc("@info", "Ultimaker Verified Plug-in"); - case "material": return catalog.i18nc("@info", "Ultimaker Certified Material"); - default: return catalog.i18nc("@info", "Ultimaker Verified Package"); - } - } - visible: parent.hovered - targetPoint: Qt.point(0, Math.round(parent.y + parent.height / 2)) + text: packageData.displayName + font: UM.Theme.getFont("medium_bold") + color: UM.Theme.getColor("text") + verticalAlignment: Text.AlignTop } - Rectangle + Control { - anchors.fill: parent - color: UM.Theme.getColor("action_button_hovered") - radius: width + Layout.preferredWidth: UM.Theme.getSize("card_tiny_icon").width + Layout.preferredHeight: UM.Theme.getSize("card_tiny_icon").height + + + enabled: packageData.isCheckedByUltimaker + visible: packageData.isCheckedByUltimaker + + Cura.ToolTip + { + tooltipText: + { + switch(packageData.packageType) + { + case "plugin": return catalog.i18nc("@info", "Ultimaker Verified Plug-in"); + case "material": return catalog.i18nc("@info", "Ultimaker Certified Material"); + default: return catalog.i18nc("@info", "Ultimaker Verified Package"); + } + } + visible: parent.hovered + targetPoint: Qt.point(0, Math.round(parent.y + parent.height / 2)) + } + + Rectangle + { + anchors.fill: parent + color: UM.Theme.getColor("action_button_hovered") + radius: width + UM.RecolorImage + { + anchors.fill: parent + color: UM.Theme.getColor("primary") + source: packageData.packageType == "plugin" ? UM.Theme.getIcon("CheckCircle") : UM.Theme.getIcon("Certified") + } + } + + //NOTE: Can we link to something here? (Probably a static link explaining what verified is): + // onClicked: Qt.openUrlExternally( XXXXXX ) + } + + Control + { + Layout.preferredWidth: UM.Theme.getSize("card_tiny_icon").width + Layout.preferredHeight: UM.Theme.getSize("card_tiny_icon").height + Layout.alignment: Qt.AlignCenter + enabled: false // remove! + visible: false // replace packageInfo.XXXXXX + // TODO: waiting for materials card implementation + + Cura.ToolTip + { + tooltipText: "" // TODO + visible: parent.hovered + } + UM.RecolorImage { anchors.fill: parent + color: UM.Theme.getColor("primary") - source: packageData.packageType == "plugin" ? UM.Theme.getIcon("CheckCircle") : UM.Theme.getIcon("Certified") + source: UM.Theme.getIcon("CheckCircle") // TODO } + + // onClicked: Qt.openUrlExternally( XXXXXX ) // TODO } - //NOTE: Can we link to something here? (Probably a static link explaining what verified is): - // onClicked: Qt.openUrlExternally( XXXXXX ) - } - - Control - { - Layout.preferredWidth: UM.Theme.getSize("card_tiny_icon").width - Layout.preferredHeight: UM.Theme.getSize("card_tiny_icon").height - Layout.alignment: Qt.AlignCenter - enabled: false // remove! - visible: false // replace packageInfo.XXXXXX - // TODO: waiting for materials card implementation - - Cura.ToolTip + Label { - tooltipText: "" // TODO - visible: parent.hovered + id: packageVersionLabel + text: packageData.packageVersion + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + Layout.fillWidth: true } - UM.RecolorImage + Button { - anchors.fill: parent + id: externalLinkButton - color: UM.Theme.getColor("primary") - source: UM.Theme.getIcon("CheckCircle") // TODO - } + // For some reason if i set padding, they don't match up. If i set all of them explicitly, it does work? + leftPadding: UM.Theme.getSize("narrow_margin").width + rightPadding: UM.Theme.getSize("narrow_margin").width + topPadding: UM.Theme.getSize("narrow_margin").width + bottomPadding: UM.Theme.getSize("narrow_margin").width - // onClicked: Qt.openUrlExternally( XXXXXX ) // TODO - } - - Label - { - id: packageVersionLabel - text: packageData.packageVersion - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - Layout.fillWidth: true - } - - Button - { - id: externalLinkButton - - // For some reason if i set padding, they don't match up. If i set all of them explicitly, it does work? - leftPadding: UM.Theme.getSize("narrow_margin").width - rightPadding: UM.Theme.getSize("narrow_margin").width - topPadding: UM.Theme.getSize("narrow_margin").width - bottomPadding: UM.Theme.getSize("narrow_margin").width - - Layout.preferredWidth: UM.Theme.getSize("card_tiny_icon").width + 2 * padding - Layout.preferredHeight: UM.Theme.getSize("card_tiny_icon").width + 2 * padding - contentItem: UM.RecolorImage - { - source: UM.Theme.getIcon("LinkExternal") - color: UM.Theme.getColor("icon") - implicitWidth: UM.Theme.getSize("card_tiny_icon").width - implicitHeight: UM.Theme.getSize("card_tiny_icon").height - } - - background: Rectangle - { - color: externalLinkButton.hovered ? UM.Theme.getColor("action_button_hovered"): "transparent" - radius: externalLinkButton.width / 2 - } - onClicked: Qt.openUrlExternally(packageData.authorInfoUrl) - } - - } - - Item - { - id: descriptionArea - height: descriptionLabel.height - anchors - { - top: titleBar.bottom - left: packageItem.right - right: parent.right - rightMargin: UM.Theme.getSize("default_margin").width - leftMargin: UM.Theme.getSize("default_margin").width - } - Label - { - id: descriptionLabel - width: parent.width - property real lastLineWidth: 0; //Store the width of the last line, to properly position the elision. - - text: packageData.description - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - maximumLineCount: 2 - wrapMode: Text.Wrap - elide: Text.ElideRight - - onLineLaidOut: - { - if(truncated && line.isLast) + Layout.preferredWidth: UM.Theme.getSize("card_tiny_icon").width + 2 * padding + Layout.preferredHeight: UM.Theme.getSize("card_tiny_icon").width + 2 * padding + contentItem: UM.RecolorImage { - let max_line_width = parent.width - readMoreButton.width - fontMetrics.advanceWidth("… ") - 2 * UM.Theme.getSize("default_margin").width; - if(line.implicitWidth > max_line_width) - { - line.width = max_line_width; - } - else - { - line.width = line.implicitWidth - fontMetrics.advanceWidth("…"); //Truncate the ellipsis. We're adding this ourselves. - } - descriptionLabel.lastLineWidth = line.implicitWidth; + source: UM.Theme.getIcon("LinkExternal") + color: UM.Theme.getColor("icon") + implicitWidth: UM.Theme.getSize("card_tiny_icon").width + implicitHeight: UM.Theme.getSize("card_tiny_icon").height } + + background: Rectangle + { + color: externalLinkButton.hovered ? UM.Theme.getColor("action_button_hovered"): "transparent" + radius: externalLinkButton.width / 2 + } + onClicked: Qt.openUrlExternally(packageData.authorInfoUrl) } } - Label + + Item { - id: tripleDotLabel - anchors.left: parent.left - anchors.leftMargin: descriptionLabel.lastLineWidth - anchors.bottom: readMoreButton.bottom + id: descriptionArea + Layout.preferredWidth: parent.width + Layout.fillHeight: true - text: "… " - font: descriptionLabel.font - color: descriptionLabel.color - visible: descriptionLabel.truncated - } - Cura.TertiaryButton - { - id: readMoreButton - anchors.left: tripleDotLabel.right - anchors.bottom: parent.bottom - height: fontMetrics.height //Height of a single line. + Label + { + id: descriptionLabel + width: parent.width + property real lastLineWidth: 0; //Store the width of the last line, to properly position the elision. - text: catalog.i18nc("@info", "Read more") - iconSource: UM.Theme.getIcon("LinkExternal") + text: packageData.description + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + maximumLineCount: 2 + wrapMode: Text.Wrap + elide: Text.ElideRight - visible: descriptionLabel.truncated - enabled: visible - leftPadding: UM.Theme.getSize("default_margin").width - rightPadding: UM.Theme.getSize("wide_margin").width - textFont: descriptionLabel.font - isIconOnRightSide: true + onLineLaidOut: + { + if(truncated && line.isLast) + { + let max_line_width = parent.width - readMoreButton.width - fontMetrics.advanceWidth("… ") - 2 * UM.Theme.getSize("default_margin").width; + if(line.implicitWidth > max_line_width) + { + line.width = max_line_width; + } + else + { + line.width = line.implicitWidth - fontMetrics.advanceWidth("…"); //Truncate the ellipsis. We're adding this ourselves. + } + descriptionLabel.lastLineWidth = line.implicitWidth; + } + } + } + Label + { + id: tripleDotLabel + anchors.left: parent.left + anchors.leftMargin: descriptionLabel.lastLineWidth + anchors.bottom: readMoreButton.bottom - onClicked: Qt.openUrlExternally(packageData.packageInfoUrl) - } - } + text: "… " + font: descriptionLabel.font + color: descriptionLabel.color + visible: descriptionLabel.truncated + } + Cura.TertiaryButton + { + id: readMoreButton + anchors.right: parent.right + anchors.bottom: parent.bottom + height: fontMetrics.height //Height of a single line. - // Author and action buttons. - RowLayout - { - id: authorAndActionButton - width: parent.width - anchors - { - bottom: parent.bottom - left: packageItem.right - margins: UM.Theme.getSize("default_margin").height - } - spacing: UM.Theme.getSize("narrow_margin").width + text: catalog.i18nc("@info", "Read more") + iconSource: UM.Theme.getIcon("LinkExternal") - Label - { - id: authorBy - Layout.alignment: Qt.AlignTop + visible: descriptionLabel.truncated + enabled: visible + leftPadding: UM.Theme.getSize("default_margin").width + rightPadding: UM.Theme.getSize("wide_margin").width + textFont: descriptionLabel.font + isIconOnRightSide: true - text: catalog.i18nc("@label", "By") - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") + onClicked: Qt.openUrlExternally(packageData.packageInfoUrl) + } } - Cura.TertiaryButton + // Author and action buttons. + RowLayout { - Layout.fillWidth: true - Layout.preferredHeight: authorBy.height - Layout.alignment: Qt.AlignTop + id: authorAndActionButton + Layout.preferredWidth: parent.width + Layout.preferredHeight: childrenRect.height - text: packageData.authorName - textFont: UM.Theme.getFont("default_bold") - textColor: UM.Theme.getColor("text") // override normal link color - leftPadding: 0 - rightPadding: 0 - iconSource: UM.Theme.getIcon("LinkExternal") - isIconOnRightSide: true + spacing: UM.Theme.getSize("narrow_margin").width - onClicked: Qt.openUrlExternally(packageData.authorInfoUrl) - } + Label + { + id: authorBy + Layout.alignment: Qt.AlignTop - Cura.SecondaryButton - { - id: disableButton - Layout.alignment: Qt.AlignTop - text: catalog.i18nc("@button", "Disable") - visible: false // not functional right now, also only when unfolding and required - } + text: catalog.i18nc("@label", "By") + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + } - Cura.SecondaryButton - { - id: uninstallButton - Layout.alignment: Qt.AlignTop - text: catalog.i18nc("@button", "Uninstall") - visible: false // not functional right now, also only when unfolding and required - } + Cura.TertiaryButton + { + Layout.fillWidth: true + Layout.preferredHeight: authorBy.height + Layout.alignment: Qt.AlignTop - Cura.PrimaryButton - { - id: installButton - Layout.alignment: Qt.AlignTop - text: catalog.i18nc("@button", "Update") // OR Download, if new! - visible: false // not functional right now, also only when unfolding and required + text: packageData.authorName + textFont: UM.Theme.getFont("default_bold") + textColor: UM.Theme.getColor("text") // override normal link color + leftPadding: 0 + rightPadding: 0 + iconSource: UM.Theme.getIcon("LinkExternal") + isIconOnRightSide: true + + onClicked: Qt.openUrlExternally(packageData.authorInfoUrl) + } + + Cura.SecondaryButton + { + id: disableButton + Layout.alignment: Qt.AlignTop + text: catalog.i18nc("@button", "Disable") + visible: false // not functional right now, also only when unfolding and required + } + + Cura.SecondaryButton + { + id: uninstallButton + Layout.alignment: Qt.AlignTop + text: catalog.i18nc("@button", "Uninstall") + visible: false // not functional right now, also only when unfolding and required + } + + Cura.PrimaryButton + { + id: installButton + Layout.alignment: Qt.AlignTop + text: catalog.i18nc("@button", "Update") // OR Download, if new! + visible: false // not functional right now, also only when unfolding and required + } } } From 443ba67455964fa52b2528a56717f82b3b31e289 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 29 Nov 2021 17:49:11 +0100 Subject: [PATCH 30/77] Align ellipsis to text again It used to be fine, but the font of the button got made different from the font of the description. It should be the same as the description, so this should remain correct even if the fonts change again. Contributes to issue CURA-8565. --- plugins/Marketplace/resources/qml/PackageCard.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index 6832d30074..77fd98f031 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -231,7 +231,7 @@ Rectangle id: tripleDotLabel anchors.left: parent.left anchors.leftMargin: descriptionLabel.lastLineWidth - anchors.bottom: readMoreButton.bottom + anchors.bottom: descriptionLabel.bottom text: "… " font: descriptionLabel.font From 0dcc28032ae6b87edaf924940d911e4b23e2e3ff Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 29 Nov 2021 18:03:42 +0100 Subject: [PATCH 31/77] Add download count design to detail card Just the design. The data is just a placeholder so far. Contributes to issue CURA-8565. --- .../Marketplace/resources/qml/PackageCard.qml | 42 +++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index 77fd98f031..ef22ff04b8 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -25,9 +25,14 @@ Rectangle when: !expanded PropertyChanges { - target: descriptionArea + target: shortDescription visible: true } + PropertyChanges + { + target: downloadCount + visible: false + } }, State { @@ -35,9 +40,14 @@ Rectangle when: expanded PropertyChanges { - target: descriptionArea + target: shortDescription visible: false } + PropertyChanges + { + target: downloadCount + visible: true + } } ] @@ -192,7 +202,7 @@ Rectangle Item { - id: descriptionArea + id: shortDescription Layout.preferredWidth: parent.width Layout.fillHeight: true @@ -259,6 +269,32 @@ Rectangle } } + Row + { + id: downloadCount + Layout.preferredWidth: parent.width + Layout.fillHeight: true + + UM.RecolorImage + { + id: downloadsIcon + width: UM.Theme.getSize("card_tiny_icon").width + height: UM.Theme.getSize("card_tiny_icon").height + + source: UM.Theme.getIcon("Download") + color: UM.Theme.getColor("text") + } + + Label + { + anchors.verticalCenter: downloadsIcon.verticalCenter + + color: UM.Theme.getColor("text") + font: UM.Theme.getFont("default") + text: "123456789" + } + } + // Author and action buttons. RowLayout { From cfd29b268d8a7f1d06b0e92ef6138f9be7dc05ee Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 29 Nov 2021 18:05:53 +0100 Subject: [PATCH 32/77] Use actual download count for packages Quite easy. It turned out the model already had this information, due to foresight when the card itself got implemented. Contributes to issue CURA-8565. --- plugins/Marketplace/resources/qml/PackageCard.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index ef22ff04b8..59bd90de9b 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -291,7 +291,7 @@ Rectangle color: UM.Theme.getColor("text") font: UM.Theme.getFont("default") - text: "123456789" + text: packageData.downloadCount } } From 0546f58e575a61977ab3a449956161a765ba2acd Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 29 Nov 2021 18:26:28 +0100 Subject: [PATCH 33/77] Add extended description header Wrapping the whole content so far in another column so that we can have a wider part below, automatically aligned. Contributes to issue CURA-8565. --- .../Marketplace/resources/qml/PackageCard.qml | 596 ++++++++++-------- 1 file changed, 316 insertions(+), 280 deletions(-) diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index 59bd90de9b..1a9e32b03b 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -13,7 +13,7 @@ Rectangle property var packageData property bool expanded: false - height: UM.Theme.getSize("card").height + height: childrenRect.height color: UM.Theme.getColor("main_background") radius: UM.Theme.getSize("default_radius").width @@ -33,6 +33,11 @@ Rectangle target: downloadCount visible: false } + PropertyChanges + { + target: extendedDescription + visible: false + } }, State { @@ -48,311 +53,342 @@ Rectangle target: downloadCount visible: true } + PropertyChanges + { + target: extendedDescription + visible: true + } } ] - // Separate column for icon on the left. - Image + Column { - id: packageItem - anchors - { - top: parent.top - left: parent.left - margins: UM.Theme.getSize("default_margin").width - } - width: UM.Theme.getSize("card_icon").width - height: width + width: parent.width - source: packageData.iconUrl != "" ? packageData.iconUrl : "../images/placeholder.svg" - } - - ColumnLayout - { - anchors - { - left: packageItem.right - leftMargin: UM.Theme.getSize("default_margin").width - right: parent.right - rightMargin: UM.Theme.getSize("thick_margin").width - top: parent.top - topMargin: UM.Theme.getSize("narrow_margin").height - } - height: packageItem.height + packageItem.anchors.margins * 2 - - // Title row. - RowLayout - { - id: titleBar - Layout.preferredWidth: parent.width - Layout.preferredHeight: childrenRect.height - - Label - { - text: packageData.displayName - font: UM.Theme.getFont("medium_bold") - color: UM.Theme.getColor("text") - verticalAlignment: Text.AlignTop - } - - Control - { - Layout.preferredWidth: UM.Theme.getSize("card_tiny_icon").width - Layout.preferredHeight: UM.Theme.getSize("card_tiny_icon").height - - - enabled: packageData.isCheckedByUltimaker - visible: packageData.isCheckedByUltimaker - - Cura.ToolTip - { - tooltipText: - { - switch(packageData.packageType) - { - case "plugin": return catalog.i18nc("@info", "Ultimaker Verified Plug-in"); - case "material": return catalog.i18nc("@info", "Ultimaker Certified Material"); - default: return catalog.i18nc("@info", "Ultimaker Verified Package"); - } - } - visible: parent.hovered - targetPoint: Qt.point(0, Math.round(parent.y + parent.height / 2)) - } - - Rectangle - { - anchors.fill: parent - color: UM.Theme.getColor("action_button_hovered") - radius: width - UM.RecolorImage - { - anchors.fill: parent - color: UM.Theme.getColor("primary") - source: packageData.packageType == "plugin" ? UM.Theme.getIcon("CheckCircle") : UM.Theme.getIcon("Certified") - } - } - - //NOTE: Can we link to something here? (Probably a static link explaining what verified is): - // onClicked: Qt.openUrlExternally( XXXXXX ) - } - - Control - { - Layout.preferredWidth: UM.Theme.getSize("card_tiny_icon").width - Layout.preferredHeight: UM.Theme.getSize("card_tiny_icon").height - Layout.alignment: Qt.AlignCenter - enabled: false // remove! - visible: false // replace packageInfo.XXXXXX - // TODO: waiting for materials card implementation - - Cura.ToolTip - { - tooltipText: "" // TODO - visible: parent.hovered - } - - UM.RecolorImage - { - anchors.fill: parent - - color: UM.Theme.getColor("primary") - source: UM.Theme.getIcon("CheckCircle") // TODO - } - - // onClicked: Qt.openUrlExternally( XXXXXX ) // TODO - } - - Label - { - id: packageVersionLabel - text: packageData.packageVersion - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - Layout.fillWidth: true - } - - Button - { - id: externalLinkButton - - // For some reason if i set padding, they don't match up. If i set all of them explicitly, it does work? - leftPadding: UM.Theme.getSize("narrow_margin").width - rightPadding: UM.Theme.getSize("narrow_margin").width - topPadding: UM.Theme.getSize("narrow_margin").width - bottomPadding: UM.Theme.getSize("narrow_margin").width - - Layout.preferredWidth: UM.Theme.getSize("card_tiny_icon").width + 2 * padding - Layout.preferredHeight: UM.Theme.getSize("card_tiny_icon").width + 2 * padding - contentItem: UM.RecolorImage - { - source: UM.Theme.getIcon("LinkExternal") - color: UM.Theme.getColor("icon") - implicitWidth: UM.Theme.getSize("card_tiny_icon").width - implicitHeight: UM.Theme.getSize("card_tiny_icon").height - } - - background: Rectangle - { - color: externalLinkButton.hovered ? UM.Theme.getColor("action_button_hovered"): "transparent" - radius: externalLinkButton.width / 2 - } - onClicked: Qt.openUrlExternally(packageData.authorInfoUrl) - } - } + spacing: 0 Item { - id: shortDescription - Layout.preferredWidth: parent.width - Layout.fillHeight: true + width: parent.width + height: UM.Theme.getSize("card").height - Label + Image { - id: descriptionLabel - width: parent.width - property real lastLineWidth: 0; //Store the width of the last line, to properly position the elision. - - text: packageData.description - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - maximumLineCount: 2 - wrapMode: Text.Wrap - elide: Text.ElideRight - - onLineLaidOut: + id: packageItem + anchors { - if(truncated && line.isLast) + top: parent.top + left: parent.left + margins: UM.Theme.getSize("default_margin").width + } + width: UM.Theme.getSize("card_icon").width + height: width + + source: packageData.iconUrl != "" ? packageData.iconUrl : "../images/placeholder.svg" + } + + ColumnLayout + { + anchors + { + left: packageItem.right + leftMargin: UM.Theme.getSize("default_margin").width + right: parent.right + rightMargin: UM.Theme.getSize("thick_margin").width + top: parent.top + topMargin: UM.Theme.getSize("narrow_margin").height + } + height: packageItem.height + packageItem.anchors.margins * 2 + + // Title row. + RowLayout + { + id: titleBar + Layout.preferredWidth: parent.width + Layout.preferredHeight: childrenRect.height + + Label { - let max_line_width = parent.width - readMoreButton.width - fontMetrics.advanceWidth("… ") - 2 * UM.Theme.getSize("default_margin").width; - if(line.implicitWidth > max_line_width) + text: packageData.displayName + font: UM.Theme.getFont("medium_bold") + color: UM.Theme.getColor("text") + verticalAlignment: Text.AlignTop + } + + Control + { + Layout.preferredWidth: UM.Theme.getSize("card_tiny_icon").width + Layout.preferredHeight: UM.Theme.getSize("card_tiny_icon").height + + + enabled: packageData.isCheckedByUltimaker + visible: packageData.isCheckedByUltimaker + + Cura.ToolTip { - line.width = max_line_width; + tooltipText: + { + switch(packageData.packageType) + { + case "plugin": return catalog.i18nc("@info", "Ultimaker Verified Plug-in"); + case "material": return catalog.i18nc("@info", "Ultimaker Certified Material"); + default: return catalog.i18nc("@info", "Ultimaker Verified Package"); + } + } + visible: parent.hovered + targetPoint: Qt.point(0, Math.round(parent.y + parent.height / 2)) } - else + + Rectangle { - line.width = line.implicitWidth - fontMetrics.advanceWidth("…"); //Truncate the ellipsis. We're adding this ourselves. + anchors.fill: parent + color: UM.Theme.getColor("action_button_hovered") + radius: width + UM.RecolorImage + { + anchors.fill: parent + color: UM.Theme.getColor("primary") + source: packageData.packageType == "plugin" ? UM.Theme.getIcon("CheckCircle") : UM.Theme.getIcon("Certified") + } } - descriptionLabel.lastLineWidth = line.implicitWidth; + + //NOTE: Can we link to something here? (Probably a static link explaining what verified is): + // onClicked: Qt.openUrlExternally( XXXXXX ) + } + + Control + { + Layout.preferredWidth: UM.Theme.getSize("card_tiny_icon").width + Layout.preferredHeight: UM.Theme.getSize("card_tiny_icon").height + Layout.alignment: Qt.AlignCenter + enabled: false // remove! + visible: false // replace packageInfo.XXXXXX + // TODO: waiting for materials card implementation + + Cura.ToolTip + { + tooltipText: "" // TODO + visible: parent.hovered + } + + UM.RecolorImage + { + anchors.fill: parent + + color: UM.Theme.getColor("primary") + source: UM.Theme.getIcon("CheckCircle") // TODO + } + + // onClicked: Qt.openUrlExternally( XXXXXX ) // TODO + } + + Label + { + id: packageVersionLabel + text: packageData.packageVersion + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + Layout.fillWidth: true + } + + Button + { + id: externalLinkButton + + // For some reason if i set padding, they don't match up. If i set all of them explicitly, it does work? + leftPadding: UM.Theme.getSize("narrow_margin").width + rightPadding: UM.Theme.getSize("narrow_margin").width + topPadding: UM.Theme.getSize("narrow_margin").width + bottomPadding: UM.Theme.getSize("narrow_margin").width + + Layout.preferredWidth: UM.Theme.getSize("card_tiny_icon").width + 2 * padding + Layout.preferredHeight: UM.Theme.getSize("card_tiny_icon").width + 2 * padding + contentItem: UM.RecolorImage + { + source: UM.Theme.getIcon("LinkExternal") + color: UM.Theme.getColor("icon") + implicitWidth: UM.Theme.getSize("card_tiny_icon").width + implicitHeight: UM.Theme.getSize("card_tiny_icon").height + } + + background: Rectangle + { + color: externalLinkButton.hovered ? UM.Theme.getColor("action_button_hovered"): "transparent" + radius: externalLinkButton.width / 2 + } + onClicked: Qt.openUrlExternally(packageData.authorInfoUrl) + } + } + + Item + { + id: shortDescription + Layout.preferredWidth: parent.width + Layout.fillHeight: true + + Label + { + id: descriptionLabel + width: parent.width + property real lastLineWidth: 0; //Store the width of the last line, to properly position the elision. + + text: packageData.description + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + maximumLineCount: 2 + wrapMode: Text.Wrap + elide: Text.ElideRight + + onLineLaidOut: + { + if(truncated && line.isLast) + { + let max_line_width = parent.width - readMoreButton.width - fontMetrics.advanceWidth("… ") - 2 * UM.Theme.getSize("default_margin").width; + if(line.implicitWidth > max_line_width) + { + line.width = max_line_width; + } + else + { + line.width = line.implicitWidth - fontMetrics.advanceWidth("…"); //Truncate the ellipsis. We're adding this ourselves. + } + descriptionLabel.lastLineWidth = line.implicitWidth; + } + } + } + Label + { + id: tripleDotLabel + anchors.left: parent.left + anchors.leftMargin: descriptionLabel.lastLineWidth + anchors.bottom: descriptionLabel.bottom + + text: "… " + font: descriptionLabel.font + color: descriptionLabel.color + visible: descriptionLabel.truncated + } + Cura.TertiaryButton + { + id: readMoreButton + anchors.right: parent.right + anchors.bottom: parent.bottom + height: fontMetrics.height //Height of a single line. + + text: catalog.i18nc("@info", "Read more") + iconSource: UM.Theme.getIcon("LinkExternal") + + visible: descriptionLabel.truncated + enabled: visible + leftPadding: UM.Theme.getSize("default_margin").width + rightPadding: UM.Theme.getSize("wide_margin").width + textFont: descriptionLabel.font + isIconOnRightSide: true + + onClicked: Qt.openUrlExternally(packageData.packageInfoUrl) + } + } + + Row + { + id: downloadCount + Layout.preferredWidth: parent.width + Layout.fillHeight: true + + UM.RecolorImage + { + id: downloadsIcon + width: UM.Theme.getSize("card_tiny_icon").width + height: UM.Theme.getSize("card_tiny_icon").height + + source: UM.Theme.getIcon("Download") + color: UM.Theme.getColor("text") + } + + Label + { + anchors.verticalCenter: downloadsIcon.verticalCenter + + color: UM.Theme.getColor("text") + font: UM.Theme.getFont("default") + text: packageData.downloadCount + } + } + + // Author and action buttons. + RowLayout + { + id: authorAndActionButton + Layout.preferredWidth: parent.width + Layout.preferredHeight: childrenRect.height + + spacing: UM.Theme.getSize("narrow_margin").width + + Label + { + id: authorBy + Layout.alignment: Qt.AlignTop + + text: catalog.i18nc("@label", "By") + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + } + + Cura.TertiaryButton + { + Layout.fillWidth: true + Layout.preferredHeight: authorBy.height + Layout.alignment: Qt.AlignTop + + text: packageData.authorName + textFont: UM.Theme.getFont("default_bold") + textColor: UM.Theme.getColor("text") // override normal link color + leftPadding: 0 + rightPadding: 0 + iconSource: UM.Theme.getIcon("LinkExternal") + isIconOnRightSide: true + + onClicked: Qt.openUrlExternally(packageData.authorInfoUrl) + } + + Cura.SecondaryButton + { + id: disableButton + Layout.alignment: Qt.AlignTop + text: catalog.i18nc("@button", "Disable") + visible: false // not functional right now, also only when unfolding and required + } + + Cura.SecondaryButton + { + id: uninstallButton + Layout.alignment: Qt.AlignTop + text: catalog.i18nc("@button", "Uninstall") + visible: false // not functional right now, also only when unfolding and required + } + + Cura.PrimaryButton + { + id: installButton + Layout.alignment: Qt.AlignTop + text: catalog.i18nc("@button", "Update") // OR Download, if new! + visible: false // not functional right now, also only when unfolding and required } } } - Label - { - id: tripleDotLabel - anchors.left: parent.left - anchors.leftMargin: descriptionLabel.lastLineWidth - anchors.bottom: descriptionLabel.bottom - - text: "… " - font: descriptionLabel.font - color: descriptionLabel.color - visible: descriptionLabel.truncated - } - Cura.TertiaryButton - { - id: readMoreButton - anchors.right: parent.right - anchors.bottom: parent.bottom - height: fontMetrics.height //Height of a single line. - - text: catalog.i18nc("@info", "Read more") - iconSource: UM.Theme.getIcon("LinkExternal") - - visible: descriptionLabel.truncated - enabled: visible - leftPadding: UM.Theme.getSize("default_margin").width - rightPadding: UM.Theme.getSize("wide_margin").width - textFont: descriptionLabel.font - isIconOnRightSide: true - - onClicked: Qt.openUrlExternally(packageData.packageInfoUrl) - } } - Row + Column { - id: downloadCount - Layout.preferredWidth: parent.width - Layout.fillHeight: true - - UM.RecolorImage - { - id: downloadsIcon - width: UM.Theme.getSize("card_tiny_icon").width - height: UM.Theme.getSize("card_tiny_icon").height - - source: UM.Theme.getIcon("Download") - color: UM.Theme.getColor("text") - } + id: extendedDescription + padding: UM.Theme.getSize("default_margin").width + topPadding: 0 Label { - anchors.verticalCenter: downloadsIcon.verticalCenter - + text: catalog.i18nc("@header", "Description") + font: UM.Theme.getFont("medium_bold") color: UM.Theme.getColor("text") - font: UM.Theme.getFont("default") - text: packageData.downloadCount - } - } - - // Author and action buttons. - RowLayout - { - id: authorAndActionButton - Layout.preferredWidth: parent.width - Layout.preferredHeight: childrenRect.height - - spacing: UM.Theme.getSize("narrow_margin").width - - Label - { - id: authorBy - Layout.alignment: Qt.AlignTop - - text: catalog.i18nc("@label", "By") - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - } - - Cura.TertiaryButton - { - Layout.fillWidth: true - Layout.preferredHeight: authorBy.height - Layout.alignment: Qt.AlignTop - - text: packageData.authorName - textFont: UM.Theme.getFont("default_bold") - textColor: UM.Theme.getColor("text") // override normal link color - leftPadding: 0 - rightPadding: 0 - iconSource: UM.Theme.getIcon("LinkExternal") - isIconOnRightSide: true - - onClicked: Qt.openUrlExternally(packageData.authorInfoUrl) - } - - Cura.SecondaryButton - { - id: disableButton - Layout.alignment: Qt.AlignTop - text: catalog.i18nc("@button", "Disable") - visible: false // not functional right now, also only when unfolding and required - } - - Cura.SecondaryButton - { - id: uninstallButton - Layout.alignment: Qt.AlignTop - text: catalog.i18nc("@button", "Uninstall") - visible: false // not functional right now, also only when unfolding and required - } - - Cura.PrimaryButton - { - id: installButton - Layout.alignment: Qt.AlignTop - text: catalog.i18nc("@button", "Update") // OR Download, if new! - visible: false // not functional right now, also only when unfolding and required } } } From e173fa2d9d6fd119859d1498d5ad00dbd3e97418 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 29 Nov 2021 18:33:58 +0100 Subject: [PATCH 34/77] Add package description in full to detail card I realise that this might cause the card to become taller than the window. Might need to do something about that. Contributes to issue CURA-8565. --- .../Marketplace/resources/qml/PackageCard.qml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index 1a9e32b03b..e435699717 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -381,14 +381,30 @@ Rectangle Column { id: extendedDescription + width: parent.width + padding: UM.Theme.getSize("default_margin").width topPadding: 0 + spacing: UM.Theme.getSize("default_margin").height Label { + width: parent.width - parent.padding * 2 + text: catalog.i18nc("@header", "Description") - font: UM.Theme.getFont("medium_bold") + font: UM.Theme.getFont("default_bold") color: UM.Theme.getColor("text") + elide: Text.ElideRight + } + + Label + { + width: parent.width - parent.padding * 2 + + text: packageData.description + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + wrapMode: Text.Wrap } } } From 09b4bd2ac235252c4a75017f728a2df9b73159ae Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 29 Nov 2021 18:37:54 +0100 Subject: [PATCH 35/77] Add forgotten ArrowLeft icon I've been using this for a while. It should've been included with the commit that added the button, but oh well. Contributes to issue CURA-8565. --- resources/themes/cura-light/icons/default/ArrowLeft.svg | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 resources/themes/cura-light/icons/default/ArrowLeft.svg diff --git a/resources/themes/cura-light/icons/default/ArrowLeft.svg b/resources/themes/cura-light/icons/default/ArrowLeft.svg new file mode 100644 index 0000000000..d722b8ae8d --- /dev/null +++ b/resources/themes/cura-light/icons/default/ArrowLeft.svg @@ -0,0 +1,3 @@ + + + From ffd1a4d8125422ac3dcb83f70fd79726195c9675 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 29 Nov 2021 18:46:56 +0100 Subject: [PATCH 36/77] Add button to visit plug-in website There are a lot of buttons leading to websites now: An arrow leading to the author website. An author name leading to the author website. A 'read more' label leading to the plug-in website and this new button leading to the plug-in website. Maybe we should raise this with the designer. Contributes to issue CURA-8565. --- plugins/Marketplace/resources/qml/PackageCard.qml | 10 ++++++++++ resources/themes/cura-light/icons/default/Globe.svg | 3 +++ 2 files changed, 13 insertions(+) create mode 100644 resources/themes/cura-light/icons/default/Globe.svg diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index e435699717..ada49c5f53 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -406,6 +406,16 @@ Rectangle color: UM.Theme.getColor("text") wrapMode: Text.Wrap } + + Cura.SecondaryButton + { + anchors.horizontalCenter: parent.horizontalCenter + + text: catalog.i18nc("@button", "Visit plug-in website") + iconSource: UM.Theme.getIcon("Globe") + outlineColor: "transparent" + onClicked: Qt.openUrlExternally(packageData.packageInfoUrl) + } } } diff --git a/resources/themes/cura-light/icons/default/Globe.svg b/resources/themes/cura-light/icons/default/Globe.svg new file mode 100644 index 0000000000..4d955e9615 --- /dev/null +++ b/resources/themes/cura-light/icons/default/Globe.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file From d511c4542ab3748d7bb45db8ef491c13b388eefb Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 29 Nov 2021 19:04:30 +0100 Subject: [PATCH 37/77] Make package detail page scroll if details are too long Some plug-ins could have very long descriptions now. We show all of it, but that could go off the screen in theory. This makes the content scrollable if it goes off the screen. Contributes to issue CURA-8565. --- .../resources/qml/PackageDetails.qml | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/plugins/Marketplace/resources/qml/PackageDetails.qml b/plugins/Marketplace/resources/qml/PackageDetails.qml index c1ef765a14..1ccb3dc4fd 100644 --- a/plugins/Marketplace/resources/qml/PackageDetails.qml +++ b/plugins/Marketplace/resources/qml/PackageDetails.qml @@ -67,20 +67,30 @@ Item } color: UM.Theme.getColor("detail_background") - PackageCard + ScrollView { - anchors - { - left: parent.left - leftMargin: UM.Theme.getSize("default_margin").width - right: parent.right - rightMargin: anchors.leftMargin - top: parent.top - topMargin: UM.Theme.getSize("default_margin").height - } + anchors.fill: parent - packageData: detailPage.packageData - expanded: true + clip: true //Need to clip, not for the bottom (which is off the window) but for the top (which would overlap the header). + ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + contentHeight: expandedPackageCard.height + UM.Theme.getSize("default_margin").height * 2 + + PackageCard + { + id: expandedPackageCard + anchors + { + left: parent.left + leftMargin: UM.Theme.getSize("default_margin").width + right: parent.right + rightMargin: anchors.leftMargin + top: parent.top + topMargin: UM.Theme.getSize("default_margin").height + } + + packageData: detailPage.packageData + expanded: true + } } } } \ No newline at end of file From b5c7dfe9a261d7f7bc76bc29621e63bb34bfacba Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 29 Nov 2021 19:29:33 +0100 Subject: [PATCH 38/77] Format links in descriptions to be clickable Took some fiddling to get the regex right. But it's nice now. Contributes to issue CURA-8565. --- plugins/Marketplace/PackageModel.py | 18 ++++++++++++++---- .../Marketplace/resources/qml/PackageCard.qml | 4 ++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/plugins/Marketplace/PackageModel.py b/plugins/Marketplace/PackageModel.py index 93d73bbc83..294b34c8b3 100644 --- a/plugins/Marketplace/PackageModel.py +++ b/plugins/Marketplace/PackageModel.py @@ -2,10 +2,9 @@ # Cura is released under the terms of the LGPLv3 or higher. from PyQt5.QtCore import pyqtProperty, QObject +import re from typing import Any, Dict, Optional -from UM.Util import parseBool - from UM.i18n import i18nCatalog # To translate placeholder names if data is not present. catalog = i18nCatalog("cura") @@ -35,9 +34,9 @@ class PackageModel(QObject): self._package_version = package_data.get("package_version", "") # Display purpose, no need for 'UM.Version'. self._package_info_url = package_data.get("website", "") # Not to be confused with 'download_url'. self._download_count = package_data.get("download_count", 0) - self._description = package_data.get("description", "") + self._description = self._format(package_data.get("description", "")) - self._download_url = package_data.get("download_url", "") # Not used yet, will be. + self._download_url = package_data.get("download_url", "") self._release_notes = package_data.get("release_notes", "") # Not used yet, propose to add to description? author_data = package_data.get("author", {}) @@ -49,6 +48,17 @@ class PackageModel(QObject): self._section_title = section_title # Note that there's a lot more info in the package_data than just these specified here. + def _format(self, text): + """ + Formats a user-readable block of text for display. + :return: A block of rich text with formatting embedded. + """ + # Turn all in-line hyperlinks into actual links. + url_regex = re.compile(r"(((http|https)://)[a-zA-Z0-9@:%._+~#?&/=]{2,256}\.[a-z]{2,12}(/[a-zA-Z0-9@:%.-_+~#?&/=]*)?)") + text = re.sub(url_regex, r'\1', text) + + return text + @pyqtProperty(str, constant = True) def packageId(self) -> str: return self._package_id diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index ada49c5f53..2c0aaa250a 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -404,7 +404,11 @@ Rectangle text: packageData.description font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") + linkColor: UM.Theme.getColor("text_link") wrapMode: Text.Wrap + textFormat: Text.RichText + + onLinkActivated: UM.UrlUtil.openUrl(link, ["http", "https"]) } Cura.SecondaryButton From d96284ee3eafcb5d9e26656bb29cb25bcb484ffc Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 29 Nov 2021 19:35:57 +0100 Subject: [PATCH 39/77] Only show formatted description in detail page We can't show rich text in the package list, because the we use the onLineLaidOut signal there, which doesn't work with Rich Text. So for the package list we should NOT use the formatted version of the description because that will contain ugly HTML tags that the user wouldn't want to see. Show the original description there. Use the formatted description only in the detail page where we don't use onLineLaidOut. Contributes to issue CURA-8565. --- plugins/Marketplace/PackageModel.py | 9 +++++++-- plugins/Marketplace/resources/qml/PackageCard.qml | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/Marketplace/PackageModel.py b/plugins/Marketplace/PackageModel.py index 294b34c8b3..7528a71440 100644 --- a/plugins/Marketplace/PackageModel.py +++ b/plugins/Marketplace/PackageModel.py @@ -34,7 +34,8 @@ class PackageModel(QObject): self._package_version = package_data.get("package_version", "") # Display purpose, no need for 'UM.Version'. self._package_info_url = package_data.get("website", "") # Not to be confused with 'download_url'. self._download_count = package_data.get("download_count", 0) - self._description = self._format(package_data.get("description", "")) + self._description = package_data.get("description", "") + self._formatted_description = self._format(self._description) self._download_url = package_data.get("download_url", "") self._release_notes = package_data.get("release_notes", "") # Not used yet, propose to add to description? @@ -48,7 +49,7 @@ class PackageModel(QObject): self._section_title = section_title # Note that there's a lot more info in the package_data than just these specified here. - def _format(self, text): + def _format(self, text: str) -> str: """ Formats a user-readable block of text for display. :return: A block of rich text with formatting embedded. @@ -95,6 +96,10 @@ class PackageModel(QObject): def description(self): return self._description + @pyqtProperty(str, constant = True) + def formattedDescription(self) -> str: + return self._formatted_description + @pyqtProperty(str, constant=True) def authorName(self): return self._author_name diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index 2c0aaa250a..8f94dc990b 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -233,6 +233,7 @@ Rectangle property real lastLineWidth: 0; //Store the width of the last line, to properly position the elision. text: packageData.description + textFormat: Text.PlainText //Must be plain text, or we won't get onLineLaidOut signals. Don't auto-detect! font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") maximumLineCount: 2 @@ -401,7 +402,7 @@ Rectangle { width: parent.width - parent.padding * 2 - text: packageData.description + text: packageData.formattedDescription font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") linkColor: UM.Theme.getColor("text_link") From d0eee2cffe4f75229fc77080c701ec41d60a6dbd Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 29 Nov 2021 19:41:25 +0100 Subject: [PATCH 40/77] Make header of detail page depend on header of origin It's the same as the list of packages you came from, now. Contributes to issue CURA-8565. --- plugins/Marketplace/resources/qml/PackageDetails.qml | 3 ++- plugins/Marketplace/resources/qml/Packages.qml | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/Marketplace/resources/qml/PackageDetails.qml b/plugins/Marketplace/resources/qml/PackageDetails.qml index 1ccb3dc4fd..fdf1c8f92c 100644 --- a/plugins/Marketplace/resources/qml/PackageDetails.qml +++ b/plugins/Marketplace/resources/qml/PackageDetails.qml @@ -12,6 +12,7 @@ Item { id: detailPage property var packageData: packages.selectedPackage + property string title: catalog.i18nc("@header", "Package details") RowLayout { @@ -49,7 +50,7 @@ Item Layout.alignment: Qt.AlignVCenter Layout.fillWidth: true - text: "Install Plug-ins" //TODO: Depend on package type, and translate. + text: detailPage.title font: UM.Theme.getFont("large") color: UM.Theme.getColor("text") } diff --git a/plugins/Marketplace/resources/qml/Packages.qml b/plugins/Marketplace/resources/qml/Packages.qml index 49fca00fdb..75207bc2e6 100644 --- a/plugins/Marketplace/resources/qml/Packages.qml +++ b/plugins/Marketplace/resources/qml/Packages.qml @@ -19,8 +19,6 @@ ListView Component.onCompleted: model.updatePackages() Component.onDestruction: model.abortUpdating() - //ScrollBar.vertical.policy: ScrollBar.AlwaysOff - spacing: UM.Theme.getSize("default_margin").height section.property: "package.sectionTitle" @@ -88,6 +86,7 @@ ListView PackageDetails { packageData: packages.selectedPackage + title: packages.pageTitle } } From f385e3d6394d3fefa0c382a5af115140b4dd340f Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 29 Nov 2021 19:59:43 +0100 Subject: [PATCH 41/77] Don't show elision or read more if there is no description at all Apparently Qt marks it as 'truncated' then, even though it's not really. Don't show the ... nor the 'read more' button if there is nothing more to read. Contributes to issue CURA-8565. --- plugins/Marketplace/resources/qml/PackageCard.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index 8f94dc990b..9f0dda920c 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -239,6 +239,7 @@ Rectangle maximumLineCount: 2 wrapMode: Text.Wrap elide: Text.ElideRight + visible: text !== "" onLineLaidOut: { @@ -267,7 +268,7 @@ Rectangle text: "… " font: descriptionLabel.font color: descriptionLabel.color - visible: descriptionLabel.truncated + visible: descriptionLabel.truncated && descriptionLabel.text !== "" } Cura.TertiaryButton { @@ -279,7 +280,7 @@ Rectangle text: catalog.i18nc("@info", "Read more") iconSource: UM.Theme.getIcon("LinkExternal") - visible: descriptionLabel.truncated + visible: descriptionLabel.truncated && descriptionLabel.text !== "" enabled: visible leftPadding: UM.Theme.getSize("default_margin").width rightPadding: UM.Theme.getSize("wide_margin").width From cac623b509127640e2bcaceb2532c68782edc295 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 30 Nov 2021 10:49:49 +0100 Subject: [PATCH 42/77] Use medium font size for extended description The design appears more balanced then, quoth the designer of the layout. Contributes to issue CURA-8565. --- plugins/Marketplace/resources/qml/PackageCard.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index 9f0dda920c..bb43f926b6 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -394,7 +394,7 @@ Rectangle width: parent.width - parent.padding * 2 text: catalog.i18nc("@header", "Description") - font: UM.Theme.getFont("default_bold") + font: UM.Theme.getFont("medium_bold") color: UM.Theme.getColor("text") elide: Text.ElideRight } @@ -404,7 +404,7 @@ Rectangle width: parent.width - parent.padding * 2 text: packageData.formattedDescription - font: UM.Theme.getFont("default") + font: UM.Theme.getFont("medium") color: UM.Theme.getColor("text") linkColor: UM.Theme.getColor("text_link") wrapMode: Text.Wrap From d96ba0dcf35f1270d4dfadc7112799090b85fd35 Mon Sep 17 00:00:00 2001 From: casper Date: Tue, 30 Nov 2021 10:51:43 +0100 Subject: [PATCH 43/77] Easy navigation to Cloud marketplace CURA-8563 --- plugins/Marketplace/resources/qml/ManagedPackages.qml | 1 + plugins/Marketplace/resources/qml/Marketplace.qml | 11 +++++++++++ plugins/Marketplace/resources/qml/Materials.qml | 1 + plugins/Marketplace/resources/qml/Packages.qml | 1 + plugins/Marketplace/resources/qml/Plugins.qml | 1 + 5 files changed, 15 insertions(+) diff --git a/plugins/Marketplace/resources/qml/ManagedPackages.qml b/plugins/Marketplace/resources/qml/ManagedPackages.qml index 2610f7cd9d..b90bffd723 100644 --- a/plugins/Marketplace/resources/qml/ManagedPackages.qml +++ b/plugins/Marketplace/resources/qml/ManagedPackages.qml @@ -19,6 +19,7 @@ Packages UM.Preferences.setValue("cura/market_place_show_manage_packages_banner", false); bannerVisible = false; } + searchInBrowserUrl: "https://marketplace.ultimaker.com/app/cura/plugins" model: Marketplace.LocalPackageList { diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index 1866d7512d..4fd8c9e999 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -162,6 +162,17 @@ Window } } + Cura.TertiaryButton + { + text: catalog.i18nc("@info", "Search in the browser") + iconSource: UM.Theme.getIcon("LinkExternal") + + isIconOnRightSide: true + font: UM.Theme.getFont("default") + + onClicked: content.item && Qt.openUrlExternally(content.item.searchInBrowserUrl) + } + // Page contents. Rectangle { diff --git a/plugins/Marketplace/resources/qml/Materials.qml b/plugins/Marketplace/resources/qml/Materials.qml index 2634f7b328..3afe7b412a 100644 --- a/plugins/Marketplace/resources/qml/Materials.qml +++ b/plugins/Marketplace/resources/qml/Materials.qml @@ -16,6 +16,7 @@ Packages UM.Preferences.setValue("cura/market_place_show_material_banner", false); bannerVisible = false; } + searchInBrowserUrl: "https://marketplace.ultimaker.com/app/cura/materials" model: Marketplace.RemotePackageList { diff --git a/plugins/Marketplace/resources/qml/Packages.qml b/plugins/Marketplace/resources/qml/Packages.qml index 46ebe8a661..c192cc5dd9 100644 --- a/plugins/Marketplace/resources/qml/Packages.qml +++ b/plugins/Marketplace/resources/qml/Packages.qml @@ -11,6 +11,7 @@ ListView id: packages property string pageTitle + property string searchInBrowserUrl property bool bannerVisible property var bannerIcon property string bannerText diff --git a/plugins/Marketplace/resources/qml/Plugins.qml b/plugins/Marketplace/resources/qml/Plugins.qml index 29b264c702..c473a3a48e 100644 --- a/plugins/Marketplace/resources/qml/Plugins.qml +++ b/plugins/Marketplace/resources/qml/Plugins.qml @@ -16,6 +16,7 @@ Packages UM.Preferences.setValue("cura/market_place_show_plugin_banner", false) bannerVisible = false; } + searchInBrowserUrl: "https://marketplace.ultimaker.com/app/cura/plugins" model: Marketplace.RemotePackageList { From 49db5be3aa731f8c9be6fe39f77ccbb8ee26f622 Mon Sep 17 00:00:00 2001 From: casper Date: Tue, 30 Nov 2021 10:52:15 +0100 Subject: [PATCH 44/77] Decrease margin sizes They were way bigger compared to the UX design CURA-8563 --- plugins/Marketplace/resources/qml/Marketplace.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index 4fd8c9e999..a825e712f7 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -47,7 +47,7 @@ Window { anchors.fill: parent - spacing: UM.Theme.getSize("default_margin").height + spacing: UM.Theme.getSize("thin_margin").height OnboardBanner { @@ -89,7 +89,7 @@ Window RowLayout { width: parent.width - height: UM.Theme.getSize("button_icon").height + UM.Theme.getSize("default_margin").height + height: UM.Theme.getSize("button_icon").height + UM.Theme.getSize("thin_margin").height spacing: UM.Theme.getSize("thin_margin").width Rectangle From 82d148d0773ad2ec11041a2b0139f74b1193685c Mon Sep 17 00:00:00 2001 From: casper Date: Tue, 30 Nov 2021 12:08:09 +0100 Subject: [PATCH 45/77] Add correct text to material and plugins onboarding banners CURA-8564 --- plugins/Marketplace/resources/qml/Materials.qml | 2 +- plugins/Marketplace/resources/qml/Plugins.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Marketplace/resources/qml/Materials.qml b/plugins/Marketplace/resources/qml/Materials.qml index 2634f7b328..cbab3a354e 100644 --- a/plugins/Marketplace/resources/qml/Materials.qml +++ b/plugins/Marketplace/resources/qml/Materials.qml @@ -10,7 +10,7 @@ Packages bannerVisible: UM.Preferences.getValue("cura/market_place_show_material_banner") bannerIcon: UM.Theme.getIcon("Spool") - bannerText: catalog.i18nc("@text", "Streamline your workflow and customize your Ultimaker Cura experience with plugins contributed by our amazing community of users.") + bannerText: catalog.i18nc("@text", "Select and install material profiles optimised for your Ultimaker 3D printers.") bannerReadMoreUrl: "" // TODO add when support page is ready onRemoveBanner: function() { UM.Preferences.setValue("cura/market_place_show_material_banner", false); diff --git a/plugins/Marketplace/resources/qml/Plugins.qml b/plugins/Marketplace/resources/qml/Plugins.qml index 29b264c702..635c0a8d22 100644 --- a/plugins/Marketplace/resources/qml/Plugins.qml +++ b/plugins/Marketplace/resources/qml/Plugins.qml @@ -10,7 +10,7 @@ Packages bannerVisible: UM.Preferences.getValue("cura/market_place_show_plugin_banner") bannerIcon: UM.Theme.getIcon("Shop") - bannerText: catalog.i18nc("@text", "Select and install material profiles optimised for your Ultimaker 3D printers.") + bannerText: catalog.i18nc("@text", "Streamline your workflow and customize your Ultimaker Cura experience with plugins contributed by our amazing community of users.") bannerReadMoreUrl: "" // TODO add when support page is ready onRemoveBanner: function() { UM.Preferences.setValue("cura/market_place_show_plugin_banner", false) From ca602067284f48a4b84157d7dc9f2c803f5bd109 Mon Sep 17 00:00:00 2001 From: casper Date: Tue, 30 Nov 2021 12:10:55 +0100 Subject: [PATCH 46/77] Always show read more button in on boarding banner Even if there is no link CURA-8564 --- plugins/Marketplace/resources/qml/OnboardBanner.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/Marketplace/resources/qml/OnboardBanner.qml b/plugins/Marketplace/resources/qml/OnboardBanner.qml index 0dbe2cb897..90af5f9b4f 100644 --- a/plugins/Marketplace/resources/qml/OnboardBanner.qml +++ b/plugins/Marketplace/resources/qml/OnboardBanner.qml @@ -106,7 +106,6 @@ Rectangle Cura.TertiaryButton { - visible: readMoreUrl !== "" id: readMoreButton anchors.left: infoText.left anchors.bottom: infoText.bottom From 8e6210fb2cb87425221baba7a53d24154a6dbba0 Mon Sep 17 00:00:00 2001 From: casper Date: Tue, 30 Nov 2021 12:11:32 +0100 Subject: [PATCH 47/77] Change margins of read more button in marketplace onboarding banner To comply with UX design CURA-8564 --- plugins/Marketplace/resources/qml/OnboardBanner.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Marketplace/resources/qml/OnboardBanner.qml b/plugins/Marketplace/resources/qml/OnboardBanner.qml index 90af5f9b4f..a2c1613bcb 100644 --- a/plugins/Marketplace/resources/qml/OnboardBanner.qml +++ b/plugins/Marketplace/resources/qml/OnboardBanner.qml @@ -85,8 +85,8 @@ Rectangle if (line.implicitWidth + readMoreButton.width + UM.Theme.getSize("default_margin").width > width) { // If it does place it after the body text - readMoreButton.anchors.bottomMargin = -(fontMetrics.height + UM.Theme.getSize("thin_margin").height); - readMoreButton.anchors.leftMargin = 0; + readMoreButton.anchors.bottomMargin = -(fontMetrics.height); + readMoreButton.anchors.leftMargin = UM.Theme.getSize("thin_margin").width; } else { From 5a148e459f7c5a8284ad592d8079bd5b191fd124 Mon Sep 17 00:00:00 2001 From: casper Date: Tue, 30 Nov 2021 12:19:32 +0100 Subject: [PATCH 48/77] Decrease size of the icons in the marketplace onboarding banners CURA-8564 --- plugins/Marketplace/resources/qml/OnboardBanner.qml | 4 ++-- resources/themes/cura-light/theme.json | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/Marketplace/resources/qml/OnboardBanner.qml b/plugins/Marketplace/resources/qml/OnboardBanner.qml index a2c1613bcb..f77f8bee97 100644 --- a/plugins/Marketplace/resources/qml/OnboardBanner.qml +++ b/plugins/Marketplace/resources/qml/OnboardBanner.qml @@ -36,8 +36,8 @@ Rectangle left: parent.left margins: UM.Theme.getSize("default_margin").width } - width: UM.Theme.getSize("button_icon").width - height: UM.Theme.getSize("button_icon").height + width: UM.Theme.getSize("banner_icon_size").width + height: UM.Theme.getSize("banner_icon_size").height } // Close button diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 81885faaf0..c29ddc2a86 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -683,6 +683,8 @@ "table_row": [2.0, 2.0], "welcome_wizard_content_image_big": [18, 15], - "welcome_wizard_cloud_content_image": [4, 4] + "welcome_wizard_cloud_content_image": [4, 4], + + "banner_icon_size": [2.0, 2.0] } } From d291ea85a28ff5bea76c7a0fea4f78655d34cbdb Mon Sep 17 00:00:00 2001 From: casper Date: Tue, 30 Nov 2021 12:20:21 +0100 Subject: [PATCH 49/77] Place the on boarding banners in the correct place in the marketplace To comply with the UX design CURA-8564 --- .../Marketplace/resources/qml/Marketplace.qml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index 1866d7512d..53a1f189bc 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -49,15 +49,6 @@ Window spacing: UM.Theme.getSize("default_margin").height - OnboardBanner - { - visible: content.item && content.item.bannerVisible - text: content.item && content.item.bannerText - icon: content.item && content.item.bannerIcon - onRemove: content.item && content.item.onRemoveBanner - readMoreUrl: content.item && content.item.bannerReadMoreUrl - } - // Page title. Item { @@ -81,6 +72,15 @@ Window } } + OnboardBanner + { + visible: content.item && content.item.bannerVisible + text: content.item && content.item.bannerText + icon: content.item && content.item.bannerIcon + onRemove: content.item && content.item.onRemoveBanner + readMoreUrl: content.item && content.item.bannerReadMoreUrl + } + // Search & Top-Level Tabs Item { From c62b21ad44b5c9adb4619f949a7876d226d74957 Mon Sep 17 00:00:00 2001 From: casper Date: Tue, 30 Nov 2021 12:57:22 +0100 Subject: [PATCH 50/77] Revert "Decrease margin sizes" This reverts commit 49db5be3aa731f8c9be6fe39f77ccbb8ee26f622. --- plugins/Marketplace/resources/qml/Marketplace.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index a825e712f7..4fd8c9e999 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -47,7 +47,7 @@ Window { anchors.fill: parent - spacing: UM.Theme.getSize("thin_margin").height + spacing: UM.Theme.getSize("default_margin").height OnboardBanner { @@ -89,7 +89,7 @@ Window RowLayout { width: parent.width - height: UM.Theme.getSize("button_icon").height + UM.Theme.getSize("thin_margin").height + height: UM.Theme.getSize("button_icon").height + UM.Theme.getSize("default_margin").height spacing: UM.Theme.getSize("thin_margin").width Rectangle From 97ba4489ffc47360be7c51a0ac96c5b3915be1ed Mon Sep 17 00:00:00 2001 From: casper Date: Tue, 30 Nov 2021 13:01:45 +0100 Subject: [PATCH 51/77] Remove unneeded margin from search bar Cura 8563 --- plugins/Marketplace/resources/qml/Marketplace.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index 4fd8c9e999..7b975e1c2f 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -89,7 +89,7 @@ Window RowLayout { width: parent.width - height: UM.Theme.getSize("button_icon").height + UM.Theme.getSize("default_margin").height + height: UM.Theme.getSize("button_icon").height spacing: UM.Theme.getSize("thin_margin").width Rectangle From 7eca00565927234fc793d221acdb2b624c984e9f Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 30 Nov 2021 13:24:12 +0100 Subject: [PATCH 52/77] Increase size of icons on action buttons We want those to be 1.5em now. This has an effect on all action buttons with icons in the interface! Contributes to issue CURA-8565. --- resources/themes/cura-light/theme.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 81885faaf0..c56a983049 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -563,7 +563,7 @@ "button_lining": [0, 0], "action_button": [15.0, 2.5], - "action_button_icon": [1.0, 1.0], + "action_button_icon": [1.5, 1.5], "action_button_radius": [0.15, 0.15], "dialog_primary_button_padding": [3.0, 0], From b0275cfba9e9150adc6af952f4c40a0a39774d5c Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 30 Nov 2021 14:17:40 +0100 Subject: [PATCH 53/77] Add campaign links CURA-8563 --- plugins/Marketplace/resources/qml/ManagedPackages.qml | 2 +- plugins/Marketplace/resources/qml/Materials.qml | 2 +- plugins/Marketplace/resources/qml/Plugins.qml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/Marketplace/resources/qml/ManagedPackages.qml b/plugins/Marketplace/resources/qml/ManagedPackages.qml index b90bffd723..f44fbd0a9b 100644 --- a/plugins/Marketplace/resources/qml/ManagedPackages.qml +++ b/plugins/Marketplace/resources/qml/ManagedPackages.qml @@ -19,7 +19,7 @@ Packages UM.Preferences.setValue("cura/market_place_show_manage_packages_banner", false); bannerVisible = false; } - searchInBrowserUrl: "https://marketplace.ultimaker.com/app/cura/plugins" + searchInBrowserUrl: "https://marketplace.ultimaker.com/app/cura/plugins?utm_source=cura&utm_medium=software&utm_campaign=marketplace-search-plugins-browser" model: Marketplace.LocalPackageList { diff --git a/plugins/Marketplace/resources/qml/Materials.qml b/plugins/Marketplace/resources/qml/Materials.qml index 3afe7b412a..489915aa10 100644 --- a/plugins/Marketplace/resources/qml/Materials.qml +++ b/plugins/Marketplace/resources/qml/Materials.qml @@ -16,7 +16,7 @@ Packages UM.Preferences.setValue("cura/market_place_show_material_banner", false); bannerVisible = false; } - searchInBrowserUrl: "https://marketplace.ultimaker.com/app/cura/materials" + searchInBrowserUrl: "https://marketplace.ultimaker.com/app/cura/materials?utm_source=cura&utm_medium=software&utm_campaign=marketplace-search-materials-browser" model: Marketplace.RemotePackageList { diff --git a/plugins/Marketplace/resources/qml/Plugins.qml b/plugins/Marketplace/resources/qml/Plugins.qml index c473a3a48e..3b0b5d7c23 100644 --- a/plugins/Marketplace/resources/qml/Plugins.qml +++ b/plugins/Marketplace/resources/qml/Plugins.qml @@ -16,7 +16,7 @@ Packages UM.Preferences.setValue("cura/market_place_show_plugin_banner", false) bannerVisible = false; } - searchInBrowserUrl: "https://marketplace.ultimaker.com/app/cura/plugins" + searchInBrowserUrl: "https://marketplace.ultimaker.com/app/cura/plugins?utm_source=cura&utm_medium=software&utm_campaign=marketplace-search-plugins-browser" model: Marketplace.RemotePackageList { From 7529483cb0242694a5496a60b5bf74d233adf477 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 30 Nov 2021 14:42:12 +0100 Subject: [PATCH 54/77] Don't show download count for bundled plug-ins I considered rewriting the section title property to be QML-only and translate it from the QML, but this is a bit simpler in the end, even though there is data duplication now. Contributes to issue CURA-8565. --- plugins/Marketplace/LocalPackageList.py | 2 +- plugins/Marketplace/PackageModel.py | 8 +++++++- plugins/Marketplace/RemotePackageList.py | 3 ++- plugins/Marketplace/resources/qml/PackageCard.qml | 2 ++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/plugins/Marketplace/LocalPackageList.py b/plugins/Marketplace/LocalPackageList.py index 6acbaa8500..7e9bd82cdb 100644 --- a/plugins/Marketplace/LocalPackageList.py +++ b/plugins/Marketplace/LocalPackageList.py @@ -90,4 +90,4 @@ class LocalPackageList(PackageList): bundled_or_installed = "installed" if self._manager.isUserInstalledPackage(package_info["package_id"]) else "bundled" package_type = package_info["package_type"] section_title = self.PACKAGE_SECTION_HEADER[bundled_or_installed][package_type] - return PackageModel(package_info, section_title = section_title, parent = self) + return PackageModel(package_info, installation_status = bundled_or_installed, section_title = section_title, parent = self) diff --git a/plugins/Marketplace/PackageModel.py b/plugins/Marketplace/PackageModel.py index 7528a71440..c4389434e4 100644 --- a/plugins/Marketplace/PackageModel.py +++ b/plugins/Marketplace/PackageModel.py @@ -17,10 +17,11 @@ class PackageModel(QObject): QML. The model can also be constructed directly from a response received by the API. """ - def __init__(self, package_data: Dict[str, Any], section_title: Optional[str] = None, parent: Optional[QObject] = None) -> None: + def __init__(self, package_data: Dict[str, Any], installation_status: str, section_title: Optional[str] = None, parent: Optional[QObject] = None) -> None: """ Constructs a new model for a single package. :param package_data: The data received from the Marketplace API about the package to create. + :param installation_status: Whether the package is `not_installed`, `installed` or `bundled`. :param section_title: If the packages are to be categorized per section provide the section_title :param parent: The parent QML object that controls the lifetime of this model (normally a PackageList). """ @@ -46,6 +47,7 @@ class PackageModel(QObject): if not self._icon_url or self._icon_url == "": self._icon_url = author_data.get("icon_url", "") + self._installation_status = installation_status self._section_title = section_title # Note that there's a lot more info in the package_data than just these specified here. @@ -108,6 +110,10 @@ class PackageModel(QObject): def authorInfoUrl(self): return self._author_info_url + @pyqtProperty(str, constant = True) + def installationStatus(self) -> str: + return self._installation_status + @pyqtProperty(str, constant = True) def sectionTitle(self) -> Optional[str]: return self._section_title diff --git a/plugins/Marketplace/RemotePackageList.py b/plugins/Marketplace/RemotePackageList.py index e7df498fbf..6241ce0d2c 100644 --- a/plugins/Marketplace/RemotePackageList.py +++ b/plugins/Marketplace/RemotePackageList.py @@ -134,8 +134,9 @@ class RemotePackageList(PackageList): return for package_data in response_data["data"]: + installation_status = "installed" if CuraApplication.getInstance().getPackageManager().isUserInstalledPackage(package_data["package_id"]) else "not_installed" try: - package = PackageModel(package_data, parent = self) + package = PackageModel(package_data, installation_status, parent = self) self.appendItem({"package": package}) # Add it to this list model. except RuntimeError: # Setting the ownership of this object to not qml can still result in a RuntimeError. Which can occur when quickly toggling diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index bb43f926b6..1c4066f64e 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -303,6 +303,7 @@ Rectangle width: UM.Theme.getSize("card_tiny_icon").width height: UM.Theme.getSize("card_tiny_icon").height + visible: packageData.installationStatus !== "bundled" //Don't show download count for packages that are bundled. It'll usually be 0. source: UM.Theme.getIcon("Download") color: UM.Theme.getColor("text") } @@ -311,6 +312,7 @@ Rectangle { anchors.verticalCenter: downloadsIcon.verticalCenter + visible: packageData.installationStatus !== "bundled" //Don't show download count for packages that are bundled. It'll usually be 0. color: UM.Theme.getColor("text") font: UM.Theme.getFont("default") text: packageData.downloadCount From c48c449354276c61f7dadc93cf79767e51d39e76 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 30 Nov 2021 14:50:45 +0100 Subject: [PATCH 55/77] Show hover colour when hovering a card This signals to the user they can select one. Contributes to issue CURA-8565. --- plugins/Marketplace/resources/qml/Packages.qml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/Marketplace/resources/qml/Packages.qml b/plugins/Marketplace/resources/qml/Packages.qml index 75207bc2e6..94f594c6cf 100644 --- a/plugins/Marketplace/resources/qml/Packages.qml +++ b/plugins/Marketplace/resources/qml/Packages.qml @@ -63,9 +63,11 @@ ListView delegate: MouseArea { + id: cardMouseArea width: parent ? parent.width : 0 height: childrenRect.height + hoverEnabled: true onClicked: { packages.selectedPackage = model.package; @@ -76,6 +78,7 @@ ListView { packageData: model.package width: parent.width - UM.Theme.getSize("default_margin").width - UM.Theme.getSize("narrow_margin").width + color: cardMouseArea.containsMouse ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("main_background") } } From c1f0fb1faf5b6caba4b6d989220bc159fc0c84af Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 30 Nov 2021 14:56:09 +0100 Subject: [PATCH 56/77] Make icons smaller for tertiary buttons These are typically visually smaller buttons, since they don't have an outline. It makes more sense to use the size of the text then, or something thereabouts. Contributes to issue CURA-8565. --- resources/qml/TertiaryButton.qml | 1 + resources/themes/cura-light/theme.json | 1 + 2 files changed, 2 insertions(+) diff --git a/resources/qml/TertiaryButton.qml b/resources/qml/TertiaryButton.qml index 76684b6ef2..8171188232 100644 --- a/resources/qml/TertiaryButton.qml +++ b/resources/qml/TertiaryButton.qml @@ -16,4 +16,5 @@ Cura.ActionButton textDisabledColor: UM.Theme.getColor("action_button_disabled_text") hoverColor: "transparent" underlineTextOnHover: true + iconSize: UM.Theme.getSize("action_button_icon_small").height } diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index c56a983049..a6cec6de8b 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -564,6 +564,7 @@ "action_button": [15.0, 2.5], "action_button_icon": [1.5, 1.5], + "action_button_icon_small": [1.0, 1.0], "action_button_radius": [0.15, 0.15], "dialog_primary_button_padding": [3.0, 0], From 02cf4ac440ed9f31213a8071170fed07f70f97ec Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 30 Nov 2021 15:01:39 +0100 Subject: [PATCH 57/77] Fix newline rendering in extended display Rich Text is rendered a bit like HTML, where all of the whitespace gets changed into a single space. This is normally not so bad, but with newlines it's annoying. This preserves the newlines from the description. Contributes to issue CURA-8565. --- plugins/Marketplace/PackageModel.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/Marketplace/PackageModel.py b/plugins/Marketplace/PackageModel.py index c4389434e4..a0d68969f1 100644 --- a/plugins/Marketplace/PackageModel.py +++ b/plugins/Marketplace/PackageModel.py @@ -60,6 +60,9 @@ class PackageModel(QObject): url_regex = re.compile(r"(((http|https)://)[a-zA-Z0-9@:%._+~#?&/=]{2,256}\.[a-z]{2,12}(/[a-zA-Z0-9@:%.-_+~#?&/=]*)?)") text = re.sub(url_regex, r'\1', text) + # Turn newlines into
so that they get displayed as newlines when rendering as rich text. + text = text.replace("\n", "
") + return text @pyqtProperty(str, constant = True) From cd09af885d1ab25fd688b8698575a2f92450cf32 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 30 Nov 2021 15:57:44 +0100 Subject: [PATCH 58/77] Fix resetting when Marketplace is closed and re-opened Previously, this would cause the Marketplace to freeze. We're still not entirely sure why. It seems to be a bug in Qt, but it's rather hard to deal with. This new solution is nicer in some ways but not as neat in others. - We're no longer clearing the content of the loader, so the QML and the package data remains in memory while the Marketplace is closed. We deem this to not be a problem, because the memory usage of this package data is only a couple of kB, nothing compared to the memory used by the slicer when it loads a model. - On the other hand, it's now possible to programmatically change the tab there, instead of manually having to click the buttons. - Fixes a bug where the highlighted tab of of the tab bar doesn't update when closing and re-opening the Marketplace. And a bug where there was a search bar for the manage page while it didn't work. Contributes to issue CURA-8565. --- .../Marketplace/resources/qml/Marketplace.qml | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index 951de77f19..a02c0e0d5f 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -21,8 +21,14 @@ Window width: minimumWidth height: minimumHeight - // Set and unset the content. No need to keep things in memory if it's not visible. - onVisibleChanged: content.source = visible ? "Plugins.qml" : "" + onVisibleChanged: + { + pageSelectionTabBar.currentIndex = 0; //Go back to the initial tab. + while(contextStack.depth > 1) + { + contextStack.pop(); //Do NOT use the StackView.Immediate transition here, since it causes the window to stay empty. Seemingly a Qt bug: https://bugreports.qt.io/browse/QTBUG-60670? + } + } Connections { @@ -116,33 +122,33 @@ Window spacing: 0 background: Rectangle { color: "transparent" } + onCurrentIndexChanged: + { + searchBar.text = ""; + searchBar.visible = currentItem.hasSearch; + content.source = currentItem.sourcePage; + } + PackageTypeTab { id: pluginTabText width: implicitWidth text: catalog.i18nc("@button", "Plugins") - onClicked: - { - searchBar.text = "" - searchBar.visible = true - content.source = "Plugins.qml" - } + property string sourcePage: "Plugins.qml" + property bool hasSearch: true } PackageTypeTab { id: materialsTabText width: implicitWidth text: catalog.i18nc("@button", "Materials") - onClicked: - { - searchBar.text = "" - searchBar.visible = true - content.source = "Materials.qml" - } + property string sourcePage: "Materials.qml" + property bool hasSearch: true } ManagePackagesButton { - onClicked: content.source = "ManagedPackages.qml" + property string sourcePage: "ManagedPackages.qml" + property bool hasSearch: false } } From b4020614d5deb0ef72883a598ee964e162236285 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 30 Nov 2021 17:17:50 +0100 Subject: [PATCH 59/77] Add material links to package model They will not be initialised for plug-ins. Contributes to issue CURA-8585. --- plugins/Marketplace/PackageModel.py | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/plugins/Marketplace/PackageModel.py b/plugins/Marketplace/PackageModel.py index a0d68969f1..8049a1aed3 100644 --- a/plugins/Marketplace/PackageModel.py +++ b/plugins/Marketplace/PackageModel.py @@ -41,6 +41,11 @@ class PackageModel(QObject): self._download_url = package_data.get("download_url", "") self._release_notes = package_data.get("release_notes", "") # Not used yet, propose to add to description? + subdata = package_data.get("data", {}) + self._technical_data_sheet = self._findLink(subdata, "technical_data_sheet") + self._safety_data_sheet = self._findLink(subdata, "safety_data_sheet") + self._where_to_buy = self._findLink(subdata, "where_to_buy") + author_data = package_data.get("author", {}) self._author_name = author_data.get("display_name", catalog.i18nc("@label:property", "Unknown Author")) self._author_info_url = author_data.get("website", "") @@ -51,6 +56,22 @@ class PackageModel(QObject): self._section_title = section_title # Note that there's a lot more info in the package_data than just these specified here. + def _findLink(self, subdata: Dict[str, Any], link_type: str) -> str: + """ + Searches the package data for a link of a certain type. + + The links are not in a fixed path in the package data. We need to iterate over the available links to find them. + :param subdata: The "data" element in the package data, which should contain links. + :param link_type: The type of link to find. + :return: A URL of where the link leads, or an empty string if there is no link of that type in the package data. + """ + links = subdata.get("links", []) + for link in links: + if link.get("type", "") == link_type: + return link.get("url", "") + else: + return "" # No link with the correct type was found. + def _format(self, text: str) -> str: """ Formats a user-readable block of text for display. @@ -120,3 +141,15 @@ class PackageModel(QObject): @pyqtProperty(str, constant = True) def sectionTitle(self) -> Optional[str]: return self._section_title + + @pyqtProperty(str, constant = True) + def technicalDataSheet(self) -> str: + return self._technical_data_sheet + + @pyqtProperty(str, constant = True) + def safetyDataSheet(self) -> str: + return self._safety_data_sheet + + @pyqtProperty(str, constant = True) + def whereToBuy(self) -> str: + return self._where_to_buy From 4ffca8da986fa36de68d16b2a2ccd08d68c3ba0d Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 30 Nov 2021 17:29:28 +0100 Subject: [PATCH 60/77] Implement getting the compatible printers of a package Again, only really applicable to materials for now. But it's simple to keep this class generic. Contributes to issue CURA-8585. --- plugins/Marketplace/PackageModel.py | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/plugins/Marketplace/PackageModel.py b/plugins/Marketplace/PackageModel.py index 8049a1aed3..578b73a82e 100644 --- a/plugins/Marketplace/PackageModel.py +++ b/plugins/Marketplace/PackageModel.py @@ -3,7 +3,7 @@ from PyQt5.QtCore import pyqtProperty, QObject import re -from typing import Any, Dict, Optional +from typing import Any, Dict, List, Optional from UM.i18n import i18nCatalog # To translate placeholder names if data is not present. catalog = i18nCatalog("cura") @@ -45,6 +45,7 @@ class PackageModel(QObject): self._technical_data_sheet = self._findLink(subdata, "technical_data_sheet") self._safety_data_sheet = self._findLink(subdata, "safety_data_sheet") self._where_to_buy = self._findLink(subdata, "where_to_buy") + self._compatible_printers = self._getCompatiblePrinters(subdata) author_data = package_data.get("author", {}) self._author_name = author_data.get("display_name", catalog.i18nc("@label:property", "Unknown Author")) @@ -86,6 +87,28 @@ class PackageModel(QObject): return text + def _getCompatiblePrinters(self, subdata: Dict[str, Any]) -> List[str]: + """ + Gets the list of printers that this package provides material compatibility with. + + Any printer is listed, even if it's only for a single nozzle on a single material in the package. + :param subdata: The "data" element in the package data, which should contain this compatibility information. + :return: A list of printer names that this package provides material compatibility with. + """ + result = set() + + for material in subdata.get("materials", []): + for compatibility in material.get("compatibility", []): + printer_name = compatibility.get("machine_name") + if printer_name is None: + continue # Missing printer name information. Skip this one. + for subcompatibility in compatibility.get("compatibilities", []): + if subcompatibility.get("hardware_compatible", False): + result.add(printer_name) + break + + return list(sorted(result)) + @pyqtProperty(str, constant = True) def packageId(self) -> str: return self._package_id @@ -153,3 +176,7 @@ class PackageModel(QObject): @pyqtProperty(str, constant = True) def whereToBuy(self) -> str: return self._where_to_buy + + @pyqtProperty("QVariantList", constant = True) + def compatiblePrinters(self) -> List[str]: + return self._compatible_printers From 02c1e017887f32d90b456748e34ecadddfe8f6e0 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 30 Nov 2021 17:42:29 +0100 Subject: [PATCH 61/77] Parse list of compatible support materials This one is quite complex because the support material names are in their profiles, so we need to consult the profiles, if present. Contributes to issue CURA-8585. --- plugins/Marketplace/PackageModel.py | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/plugins/Marketplace/PackageModel.py b/plugins/Marketplace/PackageModel.py index 578b73a82e..605674ca16 100644 --- a/plugins/Marketplace/PackageModel.py +++ b/plugins/Marketplace/PackageModel.py @@ -5,7 +5,9 @@ from PyQt5.QtCore import pyqtProperty, QObject import re from typing import Any, Dict, List, Optional +from cura.Settings.CuraContainerRegistry import CuraContainerRegistry # To get names of materials we're compatible with. from UM.i18n import i18nCatalog # To translate placeholder names if data is not present. + catalog = i18nCatalog("cura") @@ -46,6 +48,7 @@ class PackageModel(QObject): self._safety_data_sheet = self._findLink(subdata, "safety_data_sheet") self._where_to_buy = self._findLink(subdata, "where_to_buy") self._compatible_printers = self._getCompatiblePrinters(subdata) + self._compatible_support_materials = self._getCompatibleSupportMaterials(subdata) author_data = package_data.get("author", {}) self._author_name = author_data.get("display_name", catalog.i18nc("@label:property", "Unknown Author")) @@ -109,6 +112,35 @@ class PackageModel(QObject): return list(sorted(result)) + def _getCompatibleSupportMaterials(self, subdata: Dict[str, Any]) -> List[str]: + """ + Gets the list of support materials that the materials in this package are compatible with. + + Since the materials are individually encoded as keys in the API response, only PVA and Breakaway are currently + supported. + :param subdata: The "data" element in the package data, which should contain this compatibility information. + :return: A list of support materials that the materials in this package are compatible with. + """ + result = set() + + container_registry = CuraContainerRegistry.getInstance() + try: + pva_name = container_registry.findContainersMetadata(id = "ultimaker_pva")[0].get("name", "Ultimaker PVA") + except IndexError: + pva_name = "Ultimaker PVA" + try: + breakaway_name = container_registry.findContainersMetadata(id = "ultimaker_bam")[0].get("name", "Ultimaker Breakaway") + except IndexError: + breakaway_name = "Ultimaker Breakaway" + + for material in subdata.get("materials", []): + if material.get("pva_compatible", False): + result.add(pva_name) + if material.get("breakaway_compatible", False): + result.add(breakaway_name) + + return list(sorted(result)) + @pyqtProperty(str, constant = True) def packageId(self) -> str: return self._package_id @@ -180,3 +212,7 @@ class PackageModel(QObject): @pyqtProperty("QVariantList", constant = True) def compatiblePrinters(self) -> List[str]: return self._compatible_printers + + @pyqtProperty("QVariantList", constant = True) + def compatibleSupportMaterials(self) -> List[str]: + return self._compatible_support_materials From 1418bb072c4474a81ded376eaba46b159799c917 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 30 Nov 2021 17:50:39 +0100 Subject: [PATCH 62/77] Parse compatibility information of air manager and material station The union vs. intersection here is a guess. I'm guessing the online Marketplace displays compatibility if ANY materials/combinations are compatible, not requiring that ALL materials/combinations are compatible. We'll have to review that. Contributes to issue CURA-8585. --- plugins/Marketplace/PackageModel.py | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/plugins/Marketplace/PackageModel.py b/plugins/Marketplace/PackageModel.py index 605674ca16..5f7b66b935 100644 --- a/plugins/Marketplace/PackageModel.py +++ b/plugins/Marketplace/PackageModel.py @@ -49,6 +49,8 @@ class PackageModel(QObject): self._where_to_buy = self._findLink(subdata, "where_to_buy") self._compatible_printers = self._getCompatiblePrinters(subdata) self._compatible_support_materials = self._getCompatibleSupportMaterials(subdata) + self._is_compatible_material_station = self._isCompatibleMaterialStation(subdata) + self._is_compatible_air_manager = self._isCompatibleAirManager(subdata) author_data = package_data.get("author", {}) self._author_name = author_data.get("display_name", catalog.i18nc("@label:property", "Unknown Author")) @@ -141,6 +143,30 @@ class PackageModel(QObject): return list(sorted(result)) + def _isCompatibleMaterialStation(self, subdata: Dict[str, Any]) -> bool: + """ + Finds out if this package provides any material that is compatible with the material station. + :param subdata: The "data" element in the package data, which should contain this compatibility information. + :return: Whether this package provides any material that is compatible with the material station. + """ + for material in subdata.get("materials", []): + for compatibility in material.get("compatibilities", []): + if compatibility.get("material_station_optimized", False): + return True + return False + + def _isCompatibleAirManager(self, subdata: Dict[str, Any]) -> bool: + """ + Finds out if this package provides any material that is compatible with the air manager. + :param subdata: The "data" element in the package data, which should contain this compatibility information. + :return: Whether this package provides any material that is compatible with the air manager. + """ + for material in subdata.get("materials", []): + for compatibility in material.get("compatibilities", []): + if compatibility.get("air_manager_optimized", False): + return True + return False + @pyqtProperty(str, constant = True) def packageId(self) -> str: return self._package_id @@ -216,3 +242,11 @@ class PackageModel(QObject): @pyqtProperty("QVariantList", constant = True) def compatibleSupportMaterials(self) -> List[str]: return self._compatible_support_materials + + @pyqtProperty(bool, constant = True) + def isCompatibleMaterialStation(self) -> bool: + return self._is_compatible_material_station + + @pyqtProperty(bool, constant = True) + def isCompatibleAirManager(self) -> bool: + return self._is_compatible_air_manager From 9c51d620b2abd4fa3de93924c0fcf75297403204 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 30 Nov 2021 18:07:13 +0100 Subject: [PATCH 63/77] Use QStringList rather than QVariantList We know that they are strings after all. Contributes to issue CURA-8585. --- plugins/Marketplace/PackageModel.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Marketplace/PackageModel.py b/plugins/Marketplace/PackageModel.py index 5f7b66b935..752016e12f 100644 --- a/plugins/Marketplace/PackageModel.py +++ b/plugins/Marketplace/PackageModel.py @@ -235,11 +235,11 @@ class PackageModel(QObject): def whereToBuy(self) -> str: return self._where_to_buy - @pyqtProperty("QVariantList", constant = True) + @pyqtProperty("QStringList", constant = True) def compatiblePrinters(self) -> List[str]: return self._compatible_printers - @pyqtProperty("QVariantList", constant = True) + @pyqtProperty("QStringList", constant = True) def compatibleSupportMaterials(self) -> List[str]: return self._compatible_support_materials From fd026e472f665ea58189055c3ae8b65a16b224bc Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 30 Nov 2021 18:08:42 +0100 Subject: [PATCH 64/77] Show compatible printers for materials Contributes to issue CURA-8585. --- .../Marketplace/resources/qml/PackageCard.qml | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index 1c4066f64e..25ba92886e 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -415,6 +415,40 @@ Rectangle onLinkActivated: UM.UrlUtil.openUrl(link, ["http", "https"]) } + Column //Separate column to have no spacing between compatible printers. + { + id: compatiblePrinterColumn + width: parent.width - parent.padding * 2 + + visible: packageData.packageType === "material" + spacing: 0 + + Label + { + width: parent.width + + text: catalog.i18nc("@header", "Compatible printers") + font: UM.Theme.getFont("medium_bold") + color: UM.Theme.getColor("text") + elide: Text.ElideRight + } + + Repeater + { + model: packageData.compatiblePrinters + + Label + { + width: compatiblePrinterColumn.width + + text: modelData + font: UM.Theme.getFont("medium") + color: UM.Theme.getColor("text") + elide: Text.ElideRight + } + } + } + Cura.SecondaryButton { anchors.horizontalCenter: parent.horizontalCenter From cfdb01caaf088ca3a48b07e8f6bb78c78f58fec3 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 30 Nov 2021 18:13:06 +0100 Subject: [PATCH 65/77] Show list of compatible support materials Contributes to issue CURA-8585. --- .../Marketplace/resources/qml/PackageCard.qml | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index 25ba92886e..98059d9938 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -449,6 +449,40 @@ Rectangle } } + Column + { + id: compatibleSupportMaterialColumn + width: parent.width - parent.padding * 2 + + visible: packageData.packageType === "material" + spacing: 0 + + Label + { + width: parent.width + + text: catalog.i18nc("@header", "Compatible support materials") + font: UM.Theme.getFont("medium_bold") + color: UM.THeme.getColor("text") + elide: Text.ElideRight + } + + Repeater + { + model: packageData.compatibleSupportMaterials + + Label + { + width: compatibleSupportMaterialColumn.width + + text: modelData + font: UM.Theme.getFont("medium") + color: UM.Theme.getColor("text") + elide: Text.ElideRight + } + } + } + Cura.SecondaryButton { anchors.horizontalCenter: parent.horizontalCenter From b854025daa017013211d5287694886e2b800c555 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 30 Nov 2021 18:22:34 +0100 Subject: [PATCH 66/77] Fix name of compatibility category I had the nesting wrong. 'compatibilities' is the nested sub-dict in each of these compatibility entries. Contributes to issue CURA-8585. --- plugins/Marketplace/PackageModel.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Marketplace/PackageModel.py b/plugins/Marketplace/PackageModel.py index 752016e12f..859c6c46f0 100644 --- a/plugins/Marketplace/PackageModel.py +++ b/plugins/Marketplace/PackageModel.py @@ -150,7 +150,7 @@ class PackageModel(QObject): :return: Whether this package provides any material that is compatible with the material station. """ for material in subdata.get("materials", []): - for compatibility in material.get("compatibilities", []): + for compatibility in material.get("compatibility", []): if compatibility.get("material_station_optimized", False): return True return False @@ -162,7 +162,7 @@ class PackageModel(QObject): :return: Whether this package provides any material that is compatible with the air manager. """ for material in subdata.get("materials", []): - for compatibility in material.get("compatibilities", []): + for compatibility in material.get("compatibility", []): if compatibility.get("air_manager_optimized", False): return True return False From aba3e755f4e0abd9c3e95e27415781e9307ae06c Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 30 Nov 2021 18:22:55 +0100 Subject: [PATCH 67/77] Show compatibility with material station Contributes to issue CURA-8585. --- .../Marketplace/resources/qml/PackageCard.qml | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index 98059d9938..36c7338232 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -463,7 +463,7 @@ Rectangle text: catalog.i18nc("@header", "Compatible support materials") font: UM.Theme.getFont("medium_bold") - color: UM.THeme.getColor("text") + color: UM.Theme.getColor("text") elide: Text.ElideRight } @@ -483,6 +483,34 @@ Rectangle } } + Column + { + width: parent.width - parent.padding * 2 + + visible: packageData.packageType === "material" + spacing: 0 + + Label + { + width: parent.width + + text: catalog.i18nc("@header", "Compatible with material station") + font: UM.Theme.getFont("medium_bold") + color: UM.Theme.getColor("text") + elide: Text.ElideRight + } + + Label + { + width: parent.width + + text: packageData.isCompatibleMaterialStation ? catalog.i18nc("@info", "Yes") : catalog.i18nc("@info", "No") + font: UM.Theme.getFont("medium") + color: UM.Theme.getColor("text") + elide: Text.ElideRight + } + } + Cura.SecondaryButton { anchors.horizontalCenter: parent.horizontalCenter From 39f540ff529770a681de5512978b74e40e9af88b Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 30 Nov 2021 18:25:24 +0100 Subject: [PATCH 68/77] Add information on compatibilities with air manager Similar to the Material Station. Contributes to issue CURA-8585. --- .../Marketplace/resources/qml/PackageCard.qml | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index 36c7338232..e978f41396 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -494,7 +494,7 @@ Rectangle { width: parent.width - text: catalog.i18nc("@header", "Compatible with material station") + text: catalog.i18nc("@header", "Compatible with Material Station") font: UM.Theme.getFont("medium_bold") color: UM.Theme.getColor("text") elide: Text.ElideRight @@ -511,6 +511,34 @@ Rectangle } } + Column + { + width: parent.width - parent.padding * 2 + + visible: packageData.packageType === "material" + spacing: 0 + + Label + { + width: parent.width + + text: catalog.i18nc("@header", "Optimized for Air Manager") + font: UM.Theme.getFont("medium_bold") + color: UM.Theme.getColor("text") + elide: Text.ElideRight + } + + Label + { + width: parent.width + + text: packageData.isCompatibleAirManager ? catalog.i18nc("@info", "Yes") : catalog.i18nc("@info", "No") + font: UM.Theme.getFont("medium") + color: UM.Theme.getColor("text") + elide: Text.ElideRight + } + } + Cura.SecondaryButton { anchors.horizontalCenter: parent.horizontalCenter From 58cefcb68c39aaa69f4599934b04f7171c22af20 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 30 Nov 2021 19:00:08 +0100 Subject: [PATCH 69/77] Add additional buttons at the bottom for materials with links to data sheets And where to buy it. Contributes to issue CURA-8585. --- .../Marketplace/resources/qml/PackageCard.qml | 41 ++++++++++++++++--- .../icons/default/DocumentFilled.svg | 3 ++ .../cura-light/icons/default/ShoppingCart.svg | 3 ++ 3 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 resources/themes/cura-light/icons/default/DocumentFilled.svg create mode 100644 resources/themes/cura-light/icons/default/ShoppingCart.svg diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index e978f41396..be20b92ddd 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -539,14 +539,45 @@ Rectangle } } - Cura.SecondaryButton + Row { + id: externalButtonRow anchors.horizontalCenter: parent.horizontalCenter - text: catalog.i18nc("@button", "Visit plug-in website") - iconSource: UM.Theme.getIcon("Globe") - outlineColor: "transparent" - onClicked: Qt.openUrlExternally(packageData.packageInfoUrl) + Cura.SecondaryButton + { + text: packageData.packageType === "plugin" ? catalog.i18nc("@button", "Visit plug-in website") : catalog.i18nc("@button", "Website") + iconSource: UM.Theme.getIcon("Globe") + outlineColor: "transparent" + onClicked: Qt.openUrlExternally(packageData.packageInfoUrl) + } + + Cura.SecondaryButton + { + visible: packageData.packageType === "material" + text: catalog.i18nc("@button", "Buy spool") + iconSource: UM.Theme.getIcon("ShoppingCart") + outlineColor: "transparent" + onClicked: Qt.openUrlExternally(packageData.whereToBuy) + } + + Cura.SecondaryButton + { + visible: packageData.packageType === "material" + text: catalog.i18nc("@button", "Safety datasheet") + iconSource: UM.Theme.getIcon("Warning") + outlineColor: "transparent" + onClicked: Qt.openUrlExternally(packageData.safetyDataSheet) + } + + Cura.SecondaryButton + { + visible: packageData.packageType === "material" + text: catalog.i18nc("@button", "Technical datasheet") + iconSource: UM.Theme.getIcon("DocumentFilled") + outlineColor: "transparent" + onClicked: Qt.openUrlExternally(packageData.technicalDataSheet) + } } } } diff --git a/resources/themes/cura-light/icons/default/DocumentFilled.svg b/resources/themes/cura-light/icons/default/DocumentFilled.svg new file mode 100644 index 0000000000..bb654fea33 --- /dev/null +++ b/resources/themes/cura-light/icons/default/DocumentFilled.svg @@ -0,0 +1,3 @@ + + + diff --git a/resources/themes/cura-light/icons/default/ShoppingCart.svg b/resources/themes/cura-light/icons/default/ShoppingCart.svg new file mode 100644 index 0000000000..b3fece3fab --- /dev/null +++ b/resources/themes/cura-light/icons/default/ShoppingCart.svg @@ -0,0 +1,3 @@ + + + From 249a07269e9b58efc0fb0704310815b028d93956 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 30 Nov 2021 19:02:27 +0100 Subject: [PATCH 70/77] Specify spacing between external link buttons Contributes to issue CURA-8585. --- plugins/Marketplace/resources/qml/PackageCard.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index be20b92ddd..9d21551a83 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -544,6 +544,8 @@ Rectangle id: externalButtonRow anchors.horizontalCenter: parent.horizontalCenter + spacing: UM.Theme.getSize("narrow_margin").width + Cura.SecondaryButton { text: packageData.packageType === "plugin" ? catalog.i18nc("@button", "Visit plug-in website") : catalog.i18nc("@button", "Website") From d8e212581b90d4687e6f796fccfda721f1a97958 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 30 Nov 2021 19:11:02 +0100 Subject: [PATCH 71/77] Show placeholder texts when compatibility lists are empty When there are no compatible printers, we show that there is no information. After all, all materials should be compatible with some printer. When there are no compatible support materials, we simply show 'None', because a material could be incompatible with all known support material types. Contributes to issue CURA-8585. --- .../Marketplace/resources/qml/PackageCard.qml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index 9d21551a83..54c1a7efb7 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -447,6 +447,17 @@ Rectangle elide: Text.ElideRight } } + + Label + { + width: parent.width + + visible: packageData.compatiblePrinters.length == 0 + text: "(" + catalog.i18nc("@info", "No compatibility information") + ")" + font: UM.Theme.getFont("medium") + color: UM.Theme.getColor("text") + elide: Text.ElideRight + } } Column @@ -481,6 +492,17 @@ Rectangle elide: Text.ElideRight } } + + Label + { + width: parent.width + + visible: packageData.compatibleSupportMaterials.length == 0 + text: "(" + catalog.i18nc("@info No materials", "None") + ")" + font: UM.Theme.getFont("medium") + color: UM.Theme.getColor("text") + elide: Text.ElideRight + } } Column From bf168388dd49e61797e8fd2528279accd1dab909 Mon Sep 17 00:00:00 2001 From: casper Date: Wed, 1 Dec 2021 10:29:21 +0100 Subject: [PATCH 72/77] Change styling of "Search in the browser" button in the marketplace To comply with the UX design. cura 8563 --- plugins/Marketplace/resources/qml/Marketplace.qml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index 39a7557de6..471c7523cb 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -168,7 +168,10 @@ Window iconSource: UM.Theme.getIcon("LinkExternal") isIconOnRightSide: true - font: UM.Theme.getFont("default") + height: UM.theme.getSize("standard_list_lineheight").height + + textFont: UM.Theme.getFont("default") + textColor: UM.Theme.getColor("text") onClicked: content.item && Qt.openUrlExternally(content.item.searchInBrowserUrl) } From bd9722654cd579532aae45e00924f8346b72e402 Mon Sep 17 00:00:00 2001 From: casper Date: Wed, 1 Dec 2021 11:45:30 +0100 Subject: [PATCH 73/77] Use FontMetrics component to calculate the line height cura 8563 --- plugins/Marketplace/resources/qml/Marketplace.qml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index 471c7523cb..1773066bbd 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -162,15 +162,20 @@ Window } } + FontMetrics + { + id: fontMetrics + font: UM.Theme.getFont("default") + } + Cura.TertiaryButton { text: catalog.i18nc("@info", "Search in the browser") iconSource: UM.Theme.getIcon("LinkExternal") isIconOnRightSide: true - height: UM.theme.getSize("standard_list_lineheight").height - - textFont: UM.Theme.getFont("default") + height: fontMetrics.height + textFont: fontMetrics.font textColor: UM.Theme.getColor("text") onClicked: content.item && Qt.openUrlExternally(content.item.searchInBrowserUrl) From 1a787e5df28ea7c238702adca9f150d7350399cf Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 1 Dec 2021 13:22:50 +0100 Subject: [PATCH 74/77] Solve layout warnings. --- plugins/Marketplace/resources/qml/Marketplace.qml | 2 +- plugins/Marketplace/resources/qml/OnboardBanner.qml | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index 24e73e9f87..84e5b61dcf 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -126,7 +126,7 @@ Window TabBar { id: pageSelectionTabBar - anchors.right: parent.right + Layout.alignment: Qt.AlignRight height: UM.Theme.getSize("button_icon").height spacing: 0 background: Rectangle { color: "transparent" } diff --git a/plugins/Marketplace/resources/qml/OnboardBanner.qml b/plugins/Marketplace/resources/qml/OnboardBanner.qml index f77f8bee97..25e4b53241 100644 --- a/plugins/Marketplace/resources/qml/OnboardBanner.qml +++ b/plugins/Marketplace/resources/qml/OnboardBanner.qml @@ -17,12 +17,8 @@ Rectangle property string readMoreUrl Layout.preferredHeight: childrenRect.height + 2 * UM.Theme.getSize("default_margin").height - anchors - { - margins: UM.Theme.getSize("default_margin").width - left: parent.left - right: parent.right - } + Layout.fillWidth: true + Layout.margins: UM.Theme.getSize("default_margin").width color: UM.Theme.getColor("action_panel_secondary") From b5e06f6c670fca615d4dd2bec37be63bea929582 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 1 Dec 2021 13:48:18 +0100 Subject: [PATCH 75/77] Fix tooltip targetpoint. --- plugins/Marketplace/resources/qml/PackageCard.qml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml index 54c1a7efb7..b8f815bedf 100644 --- a/plugins/Marketplace/resources/qml/PackageCard.qml +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -120,7 +120,6 @@ Rectangle Layout.preferredWidth: UM.Theme.getSize("card_tiny_icon").width Layout.preferredHeight: UM.Theme.getSize("card_tiny_icon").height - enabled: packageData.isCheckedByUltimaker visible: packageData.isCheckedByUltimaker @@ -136,7 +135,7 @@ Rectangle } } visible: parent.hovered - targetPoint: Qt.point(0, Math.round(parent.y + parent.height / 2)) + targetPoint: Qt.point(0, Math.round(parent.y + parent.height / 4)) } Rectangle From c1298c6a5eb1fd93dcbe429e05a1f5a450956ae2 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 1 Dec 2021 13:53:43 +0100 Subject: [PATCH 76/77] Hide search link when not needed. --- plugins/Marketplace/resources/qml/Marketplace.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index 84e5b61dcf..236d6a2a24 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -180,7 +180,7 @@ Window { text: catalog.i18nc("@info", "Search in the browser") iconSource: UM.Theme.getIcon("LinkExternal") - + visible: pageSelectionTabBar.currentItem.hasSearch isIconOnRightSide: true font: UM.Theme.getFont("default") From 518e59303dedfea9b8abac85ab8a4e766a7323ac Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 1 Dec 2021 14:01:41 +0100 Subject: [PATCH 77/77] Fix dashes in links. part of CURA-8565 and/or CURA-8585 --- plugins/Marketplace/PackageModel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Marketplace/PackageModel.py b/plugins/Marketplace/PackageModel.py index 859c6c46f0..9b8c873827 100644 --- a/plugins/Marketplace/PackageModel.py +++ b/plugins/Marketplace/PackageModel.py @@ -84,7 +84,7 @@ class PackageModel(QObject): :return: A block of rich text with formatting embedded. """ # Turn all in-line hyperlinks into actual links. - url_regex = re.compile(r"(((http|https)://)[a-zA-Z0-9@:%._+~#?&/=]{2,256}\.[a-z]{2,12}(/[a-zA-Z0-9@:%.-_+~#?&/=]*)?)") + url_regex = re.compile(r"(((http|https)://)[a-zA-Z0-9@:%.\-_+~#?&/=]{2,256}\.[a-z]{2,12}(/[a-zA-Z0-9@:%.\-_+~#?&/=]*)?)") text = re.sub(url_regex, r'\1', text) # Turn newlines into
so that they get displayed as newlines when rendering as rich text.