From 51ec8a539fa22390b9bea607e610e1ed1d5105c3 Mon Sep 17 00:00:00 2001 From: Dimitriovski Date: Thu, 16 Jan 2020 16:30:11 +0100 Subject: [PATCH] Added a 'Marketplace' icon in the header of the Toolbox CURA-7071 --- cura/ApplicationMetadata.py | 4 +- .../qml/components/ToolboxHeader.qml | 56 +++++++++++++------ plugins/Toolbox/src/Toolbox.py | 4 ++ 3 files changed, 46 insertions(+), 18 deletions(-) diff --git a/cura/ApplicationMetadata.py b/cura/ApplicationMetadata.py index 8da64beead..449cc6848a 100644 --- a/cura/ApplicationMetadata.py +++ b/cura/ApplicationMetadata.py @@ -1,4 +1,4 @@ -# Copyright (c) 2018 Ultimaker B.V. +# Copyright (c) 2020 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. # --------- @@ -56,3 +56,5 @@ try: except ImportError: CuraAppDisplayName = DEFAULT_CURA_DISPLAY_NAME + +WEB_MARKETPLACE_URL = "https://marketplace.ultimaker.com/app/cura/materials" \ No newline at end of file diff --git a/plugins/Toolbox/resources/qml/components/ToolboxHeader.qml b/plugins/Toolbox/resources/qml/components/ToolboxHeader.qml index 491567eb5f..de64eefff1 100644 --- a/plugins/Toolbox/resources/qml/components/ToolboxHeader.qml +++ b/plugins/Toolbox/resources/qml/components/ToolboxHeader.qml @@ -51,32 +51,25 @@ Item toolbox.viewPage = "overview" } } - } - ToolboxTabButton - { - id: installedTabButton - text: catalog.i18nc("@title:tab", "Installed") - active: toolbox.viewCategory == "installed" - enabled: !toolbox.isDownloading - anchors + ToolboxTabButton { - right: parent.right - rightMargin: UM.Theme.getSize("default_margin").width + id: installedTabButton + text: catalog.i18nc("@title:tab", "Installed") + active: toolbox.viewCategory == "installed" + enabled: !toolbox.isDownloading + onClicked: toolbox.viewCategory = "installed" + width: UM.Theme.getSize("toolbox_header_tab").width + marketplaceNotificationIcon.width - UM.Theme.getSize("default_margin").width } - onClicked: toolbox.viewCategory = "installed" - width: UM.Theme.getSize("toolbox_header_tab").width + marketplaceNotificationIcon.width - UM.Theme.getSize("default_margin").width + + } Cura.NotificationIcon { id: marketplaceNotificationIcon - visible: CuraApplication.getPackageManager().packagesWithUpdate.length > 0 - - anchors.right: installedTabButton.right - anchors.verticalCenter: installedTabButton.verticalCenter - + anchors.right: bar.right labelText: { const itemCount = CuraApplication.getPackageManager().packagesWithUpdate.length @@ -84,6 +77,35 @@ Item } } + + UM.TooltipArea + { + width: childrenRect.width; + height: childrenRect.height; + text: catalog.i18nc("@info:tooltip", "Go to Web Marketplace") + anchors + { + right: parent.right + rightMargin: UM.Theme.getSize("default_margin").width + verticalCenter: parent.verticalCenter + } + Image + { + id: cloudMarketplaceButton + source: "../../images/marketplace.png" + height: 45 + width: height + //width: UM.Theme.getSize("toolbox_header_tab").width + mipmap: true + fillMode: Image.PreserveAspectFit + MouseArea + { + anchors.fill: parent + onClicked: Qt.openUrlExternally(toolbox.getWebMarketplaceUrl) + } + } + } + ToolboxShadow { anchors.top: bar.bottom diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index b1928b4e84..c7ea5bf7cc 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -765,6 +765,10 @@ class Toolbox(QObject, Extension): def materialsGenericModel(self) -> PackagesModel: return self._materials_generic_model + @pyqtProperty(str, constant=True) + def getWebMarketplaceUrl(self) -> str: + return ApplicationMetadata.WEB_MARKETPLACE_URL + # Filter Models: # -------------------------------------------------------------------------- @pyqtSlot(str, str, str)