Merge pull request #7873 from Ultimaker/CURA-7438_Show_cloud_connection_not_available_printer_removed_from_account

CURA-7438 Handle the case when a cloud printer is removed from the account
This commit is contained in:
Nino van Hooff 2020-06-10 11:46:10 +02:00 committed by GitHub
commit feeeb972f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 137 additions and 30 deletions

View file

@ -35,14 +35,21 @@ Cura.ExpandablePopup
}
}
readonly property string connectionStatusMessage: {
function getConnectionStatusMessage() {
if (connectionStatus == "printer_cloud_not_available")
{
if(Cura.API.connectionStatus.isInternetReachable)
{
if (Cura.API.account.isLoggedIn)
{
return catalog.i18nc("@status", "The cloud printer is offline. Please check if the printer is turned on and connected to the internet.")
if (Cura.MachineManager.activeMachineIsLinkedToCurrentAccount)
{
return catalog.i18nc("@status", "The cloud printer is offline. Please check if the printer is turned on and connected to the internet.")
}
else
{
return catalog.i18nc("@status", "This printer is not linked to your account. Please visit the Ultimaker Digital Factory to establish a connection.")
}
}
else
{
@ -139,12 +146,13 @@ Cura.ExpandablePopup
{
id: connectionStatusTooltipHoverArea
anchors.fill: parent
hoverEnabled: connectionStatusMessage !== ""
hoverEnabled: getConnectionStatusMessage() !== ""
acceptedButtons: Qt.NoButton // react to hover only, don't steal clicks
onEntered:
{
machineSelector.mouseArea.entered() // we want both this and the outer area to be entered
tooltip.tooltipText = getConnectionStatusMessage()
tooltip.show()
}
onExited: { tooltip.hide() }
@ -155,7 +163,7 @@ Cura.ExpandablePopup
id: tooltip
width: 250 * screenScaleFactor
tooltipText: connectionStatusMessage
tooltipText: getConnectionStatusMessage()
arrowSize: UM.Theme.getSize("button_tooltip_arrow").width
x: connectionStatusImage.x - UM.Theme.getSize("narrow_margin").width
y: connectionStatusImage.y + connectionStatusImage.height + UM.Theme.getSize("narrow_margin").height