From 13644f7e41037e3b787fc3ac1b1547be1b592826 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 28 Jan 2020 11:57:40 +0100 Subject: [PATCH] Load different pages of Marketplace depending on current tab Feels intuitive actually, but if you think about it it's weird that the link should change depending on the tab that's next to it. Contributes to issue CURA-7071. --- .../Toolbox/resources/qml/components/ToolboxHeader.qml | 10 +++++++++- plugins/Toolbox/src/Toolbox.py | 6 +++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/plugins/Toolbox/resources/qml/components/ToolboxHeader.qml b/plugins/Toolbox/resources/qml/components/ToolboxHeader.qml index f751663670..df1a43911e 100644 --- a/plugins/Toolbox/resources/qml/components/ToolboxHeader.qml +++ b/plugins/Toolbox/resources/qml/components/ToolboxHeader.qml @@ -89,7 +89,15 @@ Item rightMargin: UM.Theme.getSize("default_margin").width verticalCenter: parent.verticalCenter } - onClicked: Qt.openUrlExternally(toolbox.getWebMarketplaceUrl) + onClicked: + { + let page = "plugins"; //Online page to go to on the Marketplace subdomain. + if(materialsTabButton.active) + { + page = "materials"; + } + Qt.openUrlExternally(toolbox.getWebMarketplaceUrl(page)); + } UM.RecolorImage { id: cloudMarketplaceButton diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index 7f4bd919dd..c957a0c10c 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -767,12 +767,12 @@ class Toolbox(QObject, Extension): def materialsGenericModel(self) -> PackagesModel: return self._materials_generic_model - @pyqtProperty(str, constant=True) - def getWebMarketplaceUrl(self) -> str: + @pyqtSlot(str, result = str) + def getWebMarketplaceUrl(self, page: str) -> str: root = CuraMarketplaceRoot if root == "": root = DEFAULT_MARKETPLACE_ROOT - return root + "/app/cura/materials" + return root + "/app/cura/" + page # Filter Models: # --------------------------------------------------------------------------