From 7bbc91b7a5830aa9420b00e27290f832dc60849f Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 27 Oct 2021 16:11:02 +0200 Subject: [PATCH 1/4] Clear contents of net marketplace if window is closed CURA-8556 --- plugins/Marketplace/resources/qml/Marketplace.qml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index 2b17d3ebf3..04c26b6936 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -18,6 +18,18 @@ Window width: minimumWidth height: minimumHeight + onVisibleChanged: + { + // Set and unset the content. No need to keep things in memory if it's not visible. + if(visible) + { + content.source = "plugins.qml" + } + else + { + content.source = "" + } + } title: "Marketplace" //Seen by Ultimaker as a brand name, so this doesn't get translated. modality: Qt.NonModal @@ -61,9 +73,9 @@ Window Loader //Page contents. { + id: content anchors.fill: parent anchors.margins: UM.Theme.getSize("default_margin").width - source: "Plugins.qml" } } From e3d90f16a195a236ef06f0c324cee06865f45886 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 27 Oct 2021 17:42:00 +0200 Subject: [PATCH 2/4] Close new marketplace window when signing out or in Because otherwise you can either see plugins you might not have the rights to, or not see plugins you do have the rights to. part of CURA-8556 --- .../Marketplace/resources/qml/Marketplace.qml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/plugins/Marketplace/resources/qml/Marketplace.qml b/plugins/Marketplace/resources/qml/Marketplace.qml index 04c26b6936..2213b3d456 100644 --- a/plugins/Marketplace/resources/qml/Marketplace.qml +++ b/plugins/Marketplace/resources/qml/Marketplace.qml @@ -7,6 +7,7 @@ import QtQuick.Layouts 1.15 import QtQuick.Window 2.2 import UM 1.2 as UM +import Cura 1.6 as Cura Window { @@ -18,18 +19,18 @@ Window width: minimumWidth height: minimumHeight - onVisibleChanged: + // Set and unset the content. No need to keep things in memory if it's not visible. + onVisibleChanged: content.source = visible ? "Plugins.qml" : "" + + Connections { - // Set and unset the content. No need to keep things in memory if it's not visible. - if(visible) + target: Cura.API.account + function onLoginStateChanged() { - content.source = "plugins.qml" - } - else - { - content.source = "" + close(); } } + title: "Marketplace" //Seen by Ultimaker as a brand name, so this doesn't get translated. modality: Qt.NonModal From 31dcf21a3ea8206ddbaf850584862e972ac08faf Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Thu, 28 Oct 2021 14:31:18 +0200 Subject: [PATCH 3/4] Disable horizontal scrollbar The layout of the plugin/material cards should take care of the text and rendering. The dimensions of these cards therefor should not require a horizontal scrollbar --- plugins/Marketplace/resources/qml/Plugins.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/Marketplace/resources/qml/Plugins.qml b/plugins/Marketplace/resources/qml/Plugins.qml index dca1b8762b..0fbe8b7734 100644 --- a/plugins/Marketplace/resources/qml/Plugins.qml +++ b/plugins/Marketplace/resources/qml/Plugins.qml @@ -9,6 +9,7 @@ import UM 1.4 as UM ScrollView { clip: true + ScrollBar.horizontal.policy: ScrollBar.AlwaysOff ListView { @@ -170,4 +171,4 @@ ScrollView } } } -} \ No newline at end of file +} From cdf05a56065321d9fc15767490d846680f3dc63f Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Thu, 28 Oct 2021 16:07:21 +0200 Subject: [PATCH 4/4] Only show plugin and material packages It was showing all packages available in the marketplace. This included `cloud` DF integrations. It will now filter on packages and plugins. Contributes to CURA-8556 --- plugins/Marketplace/PackageList.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/Marketplace/PackageList.py b/plugins/Marketplace/PackageList.py index 257b71f6a0..b93cec1183 100644 --- a/plugins/Marketplace/PackageList.py +++ b/plugins/Marketplace/PackageList.py @@ -33,6 +33,7 @@ class PackageList(ListModel): PackageRole = Qt.UserRole + 1 ITEMS_PER_PAGE = 20 # Pagination of number of elements to download at once. + INCLUDED_PACKAGE_TYPE = ("material", "plugin") # Only show these kind of packages def __init__(self, parent: "QObject" = None) -> None: super().__init__(parent) @@ -121,8 +122,9 @@ class PackageList(ListModel): return for package_data in response_data["data"]: - package = PackageModel(package_data, parent = self) - self.appendItem({"package": package}) # Add it to this list model. + if package_data["package_type"] in self.INCLUDED_PACKAGE_TYPE: + package = PackageModel(package_data, parent = self) + self.appendItem({"package": package}) # Add it to this list model. self._request_url = response_data["links"].get("next", "") # Use empty string to signify that there is no next page. self.hasMoreChanged.emit()