Added a 'Marketplace' icon in the header of the Toolbox

CURA-7071
This commit is contained in:
Dimitriovski 2020-01-16 16:30:11 +01:00
parent ab6effb712
commit 51ec8a539f
No known key found for this signature in database
GPG key ID: 4E62757E2B0D304D
3 changed files with 46 additions and 18 deletions

View file

@ -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. # Cura is released under the terms of the LGPLv3 or higher.
# --------- # ---------
@ -56,3 +56,5 @@ try:
except ImportError: except ImportError:
CuraAppDisplayName = DEFAULT_CURA_DISPLAY_NAME CuraAppDisplayName = DEFAULT_CURA_DISPLAY_NAME
WEB_MARKETPLACE_URL = "https://marketplace.ultimaker.com/app/cura/materials"

View file

@ -51,7 +51,6 @@ Item
toolbox.viewPage = "overview" toolbox.viewPage = "overview"
} }
} }
}
ToolboxTabButton ToolboxTabButton
{ {
@ -59,24 +58,18 @@ Item
text: catalog.i18nc("@title:tab", "Installed") text: catalog.i18nc("@title:tab", "Installed")
active: toolbox.viewCategory == "installed" active: toolbox.viewCategory == "installed"
enabled: !toolbox.isDownloading enabled: !toolbox.isDownloading
anchors
{
right: parent.right
rightMargin: UM.Theme.getSize("default_margin").width
}
onClicked: toolbox.viewCategory = "installed" onClicked: toolbox.viewCategory = "installed"
width: UM.Theme.getSize("toolbox_header_tab").width + marketplaceNotificationIcon.width - UM.Theme.getSize("default_margin").width width: UM.Theme.getSize("toolbox_header_tab").width + marketplaceNotificationIcon.width - UM.Theme.getSize("default_margin").width
} }
}
Cura.NotificationIcon Cura.NotificationIcon
{ {
id: marketplaceNotificationIcon id: marketplaceNotificationIcon
visible: CuraApplication.getPackageManager().packagesWithUpdate.length > 0 visible: CuraApplication.getPackageManager().packagesWithUpdate.length > 0
anchors.right: bar.right
anchors.right: installedTabButton.right
anchors.verticalCenter: installedTabButton.verticalCenter
labelText: labelText:
{ {
const itemCount = CuraApplication.getPackageManager().packagesWithUpdate.length 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 ToolboxShadow
{ {
anchors.top: bar.bottom anchors.top: bar.bottom

View file

@ -765,6 +765,10 @@ class Toolbox(QObject, Extension):
def materialsGenericModel(self) -> PackagesModel: def materialsGenericModel(self) -> PackagesModel:
return self._materials_generic_model return self._materials_generic_model
@pyqtProperty(str, constant=True)
def getWebMarketplaceUrl(self) -> str:
return ApplicationMetadata.WEB_MARKETPLACE_URL
# Filter Models: # Filter Models:
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
@pyqtSlot(str, str, str) @pyqtSlot(str, str, str)