mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-12 09:17:50 -06:00
Merge pull request #6988 from Ultimaker/CURA-7071
CURA-7071/Added option to redirect to Web MP from Cura MP
This commit is contained in:
commit
35903e7dd3
7 changed files with 95 additions and 28 deletions
|
@ -23,6 +23,7 @@ set(CURA_BUILDTYPE "" CACHE STRING "Build type of Cura, eg. 'PPA'")
|
||||||
set(CURA_CLOUD_API_ROOT "" CACHE STRING "Alternative Cura cloud API root")
|
set(CURA_CLOUD_API_ROOT "" CACHE STRING "Alternative Cura cloud API root")
|
||||||
set(CURA_CLOUD_API_VERSION "" CACHE STRING "Alternative Cura cloud API version")
|
set(CURA_CLOUD_API_VERSION "" CACHE STRING "Alternative Cura cloud API version")
|
||||||
set(CURA_CLOUD_ACCOUNT_API_ROOT "" CACHE STRING "Alternative Cura cloud account API version")
|
set(CURA_CLOUD_ACCOUNT_API_ROOT "" CACHE STRING "Alternative Cura cloud account API version")
|
||||||
|
set(CURA_MARKETPLACE_ROOT "" CACHE STRING "Alternative Marketplace location")
|
||||||
|
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/cura.desktop.in ${CMAKE_BINARY_DIR}/cura.desktop @ONLY)
|
configure_file(${CMAKE_SOURCE_DIR}/cura.desktop.in ${CMAKE_BINARY_DIR}/cura.desktop @ONLY)
|
||||||
|
|
||||||
|
|
|
@ -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.
|
||||||
|
|
||||||
# ---------
|
# ---------
|
||||||
|
|
|
@ -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.
|
||||||
|
|
||||||
CuraAppName = "@CURA_APP_NAME@"
|
CuraAppName = "@CURA_APP_NAME@"
|
||||||
|
@ -9,3 +9,4 @@ CuraDebugMode = True if "@_cura_debugmode@" == "ON" else False
|
||||||
CuraCloudAPIRoot = "@CURA_CLOUD_API_ROOT@"
|
CuraCloudAPIRoot = "@CURA_CLOUD_API_ROOT@"
|
||||||
CuraCloudAPIVersion = "@CURA_CLOUD_API_VERSION@"
|
CuraCloudAPIVersion = "@CURA_CLOUD_API_VERSION@"
|
||||||
CuraCloudAccountAPIRoot = "@CURA_CLOUD_ACCOUNT_API_ROOT@"
|
CuraCloudAccountAPIRoot = "@CURA_CLOUD_ACCOUNT_API_ROOT@"
|
||||||
|
CuraMarketplaceRoot = "@CURA_MARKETPLACE_ROOT@"
|
3
plugins/Toolbox/resources/images/shop.svg
Normal file
3
plugins/Toolbox/resources/images/shop.svg
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24">
|
||||||
|
<path d="M19,3H5A2.9,2.9,0,0,0,2,6V9a3.9,3.9,0,0,0,2,3.4V22H20V12.4A3.9,3.9,0,0,0,22,9V6A2.9,2.9,0,0,0,19,3ZM10,5h4V9a2,2,0,0,1-4,0ZM4,9V5H8V9A2,2,0,0,1,4,9ZM18,20H14V15H10v5H6V13a3.7,3.7,0,0,0,3-1.4A3.7,3.7,0,0,0,12,13a3.7,3.7,0,0,0,3-1.4A3.7,3.7,0,0,0,18,13ZM20,9a2,2,0,0,1-4,0V5h4Z" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 364 B |
|
@ -14,18 +14,45 @@ Rectangle
|
||||||
Column
|
Column
|
||||||
{
|
{
|
||||||
height: childrenRect.height + 2 * padding
|
height: childrenRect.height + 2 * padding
|
||||||
spacing: UM.Theme.getSize("default_margin").width
|
spacing: UM.Theme.getSize("default_margin").height
|
||||||
width: parent.width
|
width: parent.width
|
||||||
padding: UM.Theme.getSize("wide_margin").height
|
padding: UM.Theme.getSize("wide_margin").height
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
width: parent.width - parent.padding * 2
|
||||||
|
height: childrenRect.height
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
id: heading
|
id: heading
|
||||||
text: catalog.i18nc("@label", "Featured")
|
text: catalog.i18nc("@label", "Featured")
|
||||||
width: parent.width
|
width: contentWidth
|
||||||
|
height: contentHeight
|
||||||
color: UM.Theme.getColor("text_medium")
|
color: UM.Theme.getColor("text_medium")
|
||||||
font: UM.Theme.getFont("large")
|
font: UM.Theme.getFont("large")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
}
|
}
|
||||||
|
UM.TooltipArea
|
||||||
|
{
|
||||||
|
width: childrenRect.width
|
||||||
|
height: childrenRect.height
|
||||||
|
anchors.right: parent.right
|
||||||
|
text: catalog.i18nc("@info:tooltip", "Go to Web Marketplace")
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
text: "<a href='%2'>".arg(toolbox.getWebMarketplaceUrl("materials")) + catalog.i18nc("@label", "Search materials") + "</a>"
|
||||||
|
width: contentWidth
|
||||||
|
height: contentHeight
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
font: UM.Theme.getFont("default")
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
|
||||||
|
linkColor: UM.Theme.getColor("text_link")
|
||||||
|
onLinkActivated: Qt.openUrlExternally(link)
|
||||||
|
|
||||||
|
visible: toolbox.viewCategory === "material"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Grid
|
Grid
|
||||||
{
|
{
|
||||||
height: childrenRect.height
|
height: childrenRect.height
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2018 Ultimaker B.V.
|
// Copyright (c) 2020 Ultimaker B.V.
|
||||||
// Toolbox is released under the terms of the LGPLv3 or higher.
|
// Toolbox is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import QtQuick 2.10
|
import QtQuick 2.10
|
||||||
|
@ -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,33 @@ Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
UM.TooltipArea
|
||||||
|
{
|
||||||
|
id: webMarketplaceButtonTooltipArea
|
||||||
|
width: childrenRect.width
|
||||||
|
height: parent.height
|
||||||
|
text: catalog.i18nc("@info:tooltip", "Go to Web Marketplace")
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
right: parent.right
|
||||||
|
rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
onClicked: Qt.openUrlExternally(toolbox.getWebMarketplaceUrl("plugins"))
|
||||||
|
UM.RecolorImage
|
||||||
|
{
|
||||||
|
id: cloudMarketplaceButton
|
||||||
|
source: "../../images/shop.svg"
|
||||||
|
color: UM.Theme.getColor(webMarketplaceButtonTooltipArea.containsMouse ? "primary" : "text")
|
||||||
|
height: parent.height / 2
|
||||||
|
width: height
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
sourceSize.width: width
|
||||||
|
sourceSize.height: height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ToolboxShadow
|
ToolboxShadow
|
||||||
{
|
{
|
||||||
anchors.top: bar.bottom
|
anchors.top: bar.bottom
|
||||||
|
|
|
@ -16,6 +16,7 @@ from UM.i18n import i18nCatalog
|
||||||
from UM.Version import Version
|
from UM.Version import Version
|
||||||
|
|
||||||
from cura import ApplicationMetadata
|
from cura import ApplicationMetadata
|
||||||
|
|
||||||
from cura.CuraApplication import CuraApplication
|
from cura.CuraApplication import CuraApplication
|
||||||
from cura.Machines.ContainerTree import ContainerTree
|
from cura.Machines.ContainerTree import ContainerTree
|
||||||
|
|
||||||
|
@ -31,6 +32,13 @@ if TYPE_CHECKING:
|
||||||
|
|
||||||
i18n_catalog = i18nCatalog("cura")
|
i18n_catalog = i18nCatalog("cura")
|
||||||
|
|
||||||
|
DEFAULT_MARKETPLACE_ROOT = "https://marketplace.ultimaker.com" # type: str
|
||||||
|
|
||||||
|
try:
|
||||||
|
from cura.CuraVersion import CuraMarketplaceRoot
|
||||||
|
except ImportError:
|
||||||
|
CuraMarketplaceRoot = DEFAULT_MARKETPLACE_ROOT
|
||||||
|
|
||||||
# todo Remove license and download dialog, use SyncOrchestrator instead
|
# todo Remove license and download dialog, use SyncOrchestrator instead
|
||||||
|
|
||||||
## Provides a marketplace for users to download plugins an materials
|
## Provides a marketplace for users to download plugins an materials
|
||||||
|
@ -766,6 +774,13 @@ class Toolbox(QObject, Extension):
|
||||||
def materialsGenericModel(self) -> PackagesModel:
|
def materialsGenericModel(self) -> PackagesModel:
|
||||||
return self._materials_generic_model
|
return self._materials_generic_model
|
||||||
|
|
||||||
|
@pyqtSlot(str, result = str)
|
||||||
|
def getWebMarketplaceUrl(self, page: str) -> str:
|
||||||
|
root = CuraMarketplaceRoot
|
||||||
|
if root == "":
|
||||||
|
root = DEFAULT_MARKETPLACE_ROOT
|
||||||
|
return root + "/app/cura/" + page
|
||||||
|
|
||||||
# Filter Models:
|
# Filter Models:
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
@pyqtSlot(str, str, str)
|
@pyqtSlot(str, str, str)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue