mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 04:26:05 +08:00
Add the digital factory button
CURA-7418
This commit is contained in:
parent
200e3d6ee7
commit
a7e7ddf4b5
@ -261,6 +261,10 @@ class CuraApplication(QtApplication):
|
|||||||
def ultimakerCloudAccountRootUrl(self) -> str:
|
def ultimakerCloudAccountRootUrl(self) -> str:
|
||||||
return UltimakerCloudAuthentication.CuraCloudAccountAPIRoot
|
return UltimakerCloudAuthentication.CuraCloudAccountAPIRoot
|
||||||
|
|
||||||
|
@pyqtProperty(str, constant=True)
|
||||||
|
def ultimakerDigitalFactoryUrl(self) -> str:
|
||||||
|
return UltimakerCloudAuthentication.CuraDigitalFactoryURL
|
||||||
|
|
||||||
def addCommandLineOptions(self):
|
def addCommandLineOptions(self):
|
||||||
"""Adds command line options to the command line parser.
|
"""Adds command line options to the command line parser.
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
DEFAULT_CLOUD_API_ROOT = "https://api.ultimaker.com" # type: str
|
DEFAULT_CLOUD_API_ROOT = "https://api.ultimaker.com" # type: str
|
||||||
DEFAULT_CLOUD_API_VERSION = "1" # type: str
|
DEFAULT_CLOUD_API_VERSION = "1" # type: str
|
||||||
DEFAULT_CLOUD_ACCOUNT_API_ROOT = "https://account.ultimaker.com" # type: str
|
DEFAULT_CLOUD_ACCOUNT_API_ROOT = "https://account.ultimaker.com" # type: str
|
||||||
|
DEFAULT_DIGITAL_FACTORY_URL = "https://digitalfactory.ultimaker.com" # type: str
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from cura.CuraVersion import CuraCloudAPIRoot # type: ignore
|
from cura.CuraVersion import CuraCloudAPIRoot # type: ignore
|
||||||
@ -28,3 +29,10 @@ try:
|
|||||||
CuraCloudAccountAPIRoot = DEFAULT_CLOUD_ACCOUNT_API_ROOT
|
CuraCloudAccountAPIRoot = DEFAULT_CLOUD_ACCOUNT_API_ROOT
|
||||||
except ImportError:
|
except ImportError:
|
||||||
CuraCloudAccountAPIRoot = DEFAULT_CLOUD_ACCOUNT_API_ROOT
|
CuraCloudAccountAPIRoot = DEFAULT_CLOUD_ACCOUNT_API_ROOT
|
||||||
|
|
||||||
|
try:
|
||||||
|
from cura.CuraVersion import CuraDigitalFactoryURL
|
||||||
|
if CuraDigitalFactoryURL == "":
|
||||||
|
CuraDigitalFactoryURL = DEFAULT_DIGITAL_FACTORY_URL
|
||||||
|
except ImportError:
|
||||||
|
CuraDigitalFactoryURL = DEFAULT_DIGITAL_FACTORY_URL
|
@ -91,6 +91,8 @@ Row // Sync state icon + message
|
|||||||
color: UM.Theme.getColor("text")
|
color: UM.Theme.getColor("text")
|
||||||
font: UM.Theme.getFont("medium")
|
font: UM.Theme.getFont("medium")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
|
height: contentHeight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
visible: !Cura.API.account.manualSyncEnabled
|
visible: !Cura.API.account.manualSyncEnabled
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,6 +103,8 @@ Row // Sync state icon + message
|
|||||||
color: UM.Theme.getColor("secondary_button_text")
|
color: UM.Theme.getColor("secondary_button_text")
|
||||||
font: UM.Theme.getFont("medium")
|
font: UM.Theme.getFont("medium")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
height: contentHeight
|
||||||
visible: Cura.API.account.manualSyncEnabled
|
visible: Cura.API.account.manualSyncEnabled
|
||||||
|
|
||||||
MouseArea
|
MouseArea
|
||||||
|
@ -9,62 +9,88 @@ import Cura 1.1 as Cura
|
|||||||
|
|
||||||
Column
|
Column
|
||||||
{
|
{
|
||||||
spacing: UM.Theme.getSize("default_margin").height
|
spacing: UM.Theme.getSize("narrow_margin").height
|
||||||
|
|
||||||
Label
|
Item
|
||||||
{
|
{
|
||||||
id: title
|
width: childrenRect.width
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
height: childrenRect.height
|
||||||
horizontalAlignment: Text.AlignHCenter
|
AvatarImage
|
||||||
renderType: Text.NativeRendering
|
{
|
||||||
text: catalog.i18nc("@label The argument is a username.", "Hi %1").arg(profile.username)
|
id: avatar
|
||||||
font: UM.Theme.getFont("large_bold")
|
|
||||||
color: UM.Theme.getColor("text")
|
width: UM.Theme.getSize("main_window_header").height
|
||||||
|
height: UM.Theme.getSize("main_window_header").height
|
||||||
|
|
||||||
|
source: profile["profile_image_url"] ? profile["profile_image_url"] : ""
|
||||||
|
outlineColor: "transparent"
|
||||||
|
}
|
||||||
|
Column
|
||||||
|
{
|
||||||
|
anchors.left: avatar.right
|
||||||
|
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
spacing: UM.Theme.getSize("narrow_margin").height
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
id: username
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
text: profile.username
|
||||||
|
font: UM.Theme.getFont("large_bold")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
|
}
|
||||||
|
|
||||||
|
SyncState
|
||||||
|
{
|
||||||
|
id: syncRow
|
||||||
|
}
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
id: lastSyncLabel
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
text: catalog.i18nc("@label The argument is a timestamp", "Last update: %1").arg(Cura.API.account.lastSyncDateTime)
|
||||||
|
font: UM.Theme.getFont("default")
|
||||||
|
color: UM.Theme.getColor("text_medium")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SyncState
|
Rectangle
|
||||||
{
|
{
|
||||||
id: syncRow
|
width: parent.width
|
||||||
|
color: UM.Theme.getColor("lining")
|
||||||
|
height: UM.Theme.getSize("default_lining").height
|
||||||
}
|
}
|
||||||
|
Cura.TertiaryButton
|
||||||
Label
|
|
||||||
{
|
{
|
||||||
id: lastSyncLabel
|
id: cloudButton
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
renderType: Text.NativeRendering
|
|
||||||
text: catalog.i18nc("@label The argument is a timestamp", "Last update: %1").arg(Cura.API.account.lastSyncDateTime)
|
|
||||||
font: UM.Theme.getFont("default")
|
|
||||||
color: UM.Theme.getColor("text_medium")
|
|
||||||
}
|
|
||||||
|
|
||||||
Cura.SecondaryButton
|
|
||||||
{
|
|
||||||
id: accountButton
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
width: UM.Theme.getSize("account_button").width
|
width: UM.Theme.getSize("account_button").width
|
||||||
height: UM.Theme.getSize("account_button").height
|
height: UM.Theme.getSize("account_button").height
|
||||||
text: catalog.i18nc("@button", "Ultimaker account")
|
text: catalog.i18nc("@button", "Ultimaker Digital Factory")
|
||||||
|
onClicked: Qt.openUrlExternally(CuraApplication.ultimakerDigitalFactoryUrl)
|
||||||
|
fixedWidthMode: false
|
||||||
|
}
|
||||||
|
|
||||||
|
Cura.TertiaryButton
|
||||||
|
{
|
||||||
|
id: accountButton
|
||||||
|
width: UM.Theme.getSize("account_button").width
|
||||||
|
height: UM.Theme.getSize("account_button").height
|
||||||
|
text: catalog.i18nc("@button", "Ultimaker Account")
|
||||||
onClicked: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl)
|
onClicked: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl)
|
||||||
fixedWidthMode: false
|
fixedWidthMode: false
|
||||||
}
|
}
|
||||||
|
|
||||||
Label
|
Rectangle
|
||||||
|
{
|
||||||
|
width: parent.width
|
||||||
|
color: UM.Theme.getColor("lining")
|
||||||
|
height: UM.Theme.getSize("default_lining").height
|
||||||
|
}
|
||||||
|
|
||||||
|
Cura.TertiaryButton
|
||||||
{
|
{
|
||||||
id: signOutButton
|
id: signOutButton
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
onClicked: Cura.API.account.logout()
|
||||||
text: catalog.i18nc("@button", "Sign out")
|
text: catalog.i18nc("@button", "Sign Out")
|
||||||
color: UM.Theme.getColor("secondary_button_text")
|
|
||||||
font: UM.Theme.getFont("medium")
|
|
||||||
renderType: Text.NativeRendering
|
|
||||||
|
|
||||||
MouseArea
|
|
||||||
{
|
|
||||||
anchors.fill: parent
|
|
||||||
onClicked: Cura.API.account.logout()
|
|
||||||
hoverEnabled: true
|
|
||||||
onEntered: signOutButton.font.underline = true
|
|
||||||
onExited: signOutButton.font.underline = false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user