Merge pull request #13175 from Ultimaker/CURA-9422_abstract_cloud_monitor_redux

[CURA-9422] abstract cloud monitor redux
This commit is contained in:
Casper Lamboo 2022-08-31 16:09:40 +02:00 committed by GitHub
commit 62b102cc74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 181 additions and 65 deletions

View File

@ -90,7 +90,6 @@ class GlobalStack(CuraContainerStack):
@pyqtProperty("QVariantList", notify=configuredConnectionTypesChanged) @pyqtProperty("QVariantList", notify=configuredConnectionTypesChanged)
def configuredConnectionTypes(self) -> List[int]: def configuredConnectionTypes(self) -> List[int]:
"""The configured connection types can be used to find out if the global """The configured connection types can be used to find out if the global
stack is configured to be connected with a printer, without having to stack is configured to be connected with a printer, without having to
know all the details as to how this is exactly done (and without know all the details as to how this is exactly done (and without
actually setting the stack to be active). actually setting the stack to be active).

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021 Ultimaker B.V. # Copyright (c) 2022 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.
import time import time
@ -531,9 +531,9 @@ class MachineManager(QObject):
def printerConnected(self) -> bool: def printerConnected(self) -> bool:
return bool(self._printer_output_devices) return bool(self._printer_output_devices)
@pyqtProperty(bool, notify = printerConnectedStatusChanged) @pyqtProperty(bool, notify = globalContainerChanged)
def activeMachineIsAbstract(self) -> bool: def activeMachineIsAbstractCloudPrinter(self) -> bool:
return (self.activeMachine is not None) and parseBool(self.activeMachine.getMetaDataEntry("is_abstract_machine", False)) return len(self._printer_output_devices) == 1 and self._printer_output_devices[0].__class__.__name__ == "AbstractCloudOutputDevice"
@pyqtProperty(bool, notify = printerConnectedStatusChanged) @pyqtProperty(bool, notify = printerConnectedStatusChanged)
def activeMachineIsGroup(self) -> bool: def activeMachineIsGroup(self) -> bool:
@ -559,8 +559,6 @@ class MachineManager(QObject):
@pyqtProperty(bool, notify = printerConnectedStatusChanged) @pyqtProperty(bool, notify = printerConnectedStatusChanged)
def activeMachineHasCloudRegistration(self) -> bool: def activeMachineHasCloudRegistration(self) -> bool:
if self.activeMachineIsAbstract:
return any(m.getMetaDataEntry("is_online", False) for m in self.getMachinesWithDefinition(self.activeMachine.definition.getId(), True))
return self.activeMachine is not None and ConnectionType.CloudConnection in self.activeMachine.configuredConnectionTypes return self.activeMachine is not None and ConnectionType.CloudConnection in self.activeMachine.configuredConnectionTypes
@pyqtProperty(bool, notify = printerConnectedStatusChanged) @pyqtProperty(bool, notify = printerConnectedStatusChanged)

View File

@ -1,4 +1,4 @@
// Copyright (c) 2018 Ultimaker B.V. // Copyright (c) 2022 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.
import QtQuick 2.10 import QtQuick 2.10
@ -12,7 +12,6 @@ Rectangle
id: viewportOverlay id: viewportOverlay
property bool isConnected: Cura.MachineManager.activeMachineHasNetworkConnection || Cura.MachineManager.activeMachineHasCloudConnection property bool isConnected: Cura.MachineManager.activeMachineHasNetworkConnection || Cura.MachineManager.activeMachineHasCloudConnection
property bool isAbstractCloudPrinter: Cura.MachineManager.activeMachineIsAbstract
property bool isNetworkConfigurable: property bool isNetworkConfigurable:
{ {
if(Cura.MachineManager.activeMachine === null) if(Cura.MachineManager.activeMachine === null)
@ -97,7 +96,7 @@ Rectangle
{ {
horizontalCenter: parent.horizontalCenter horizontalCenter: parent.horizontalCenter
} }
visible: isNetworkConfigured && !isConnected && !isAbstractCloudPrinter visible: isNetworkConfigured && !isConnected
text: catalog.i18nc("@info", "Please make sure your printer has a connection:\n- Check if the printer is turned on.\n- Check if the printer is connected to the network.\n- Check if you are signed in to discover cloud-connected printers.") text: catalog.i18nc("@info", "Please make sure your printer has a connection:\n- Check if the printer is turned on.\n- Check if the printer is connected to the network.\n- Check if you are signed in to discover cloud-connected printers.")
font: UM.Theme.getFont("medium") font: UM.Theme.getFont("medium")
width: contentWidth width: contentWidth
@ -110,62 +109,19 @@ Rectangle
{ {
horizontalCenter: parent.horizontalCenter horizontalCenter: parent.horizontalCenter
} }
visible: !isNetworkConfigured && isNetworkConfigurable && !isAbstractCloudPrinter visible: !isNetworkConfigured && isNetworkConfigurable
text: catalog.i18nc("@info", "Please connect your printer to the network.") text: catalog.i18nc("@info", "Please connect your printer to the network.")
font: UM.Theme.getFont("medium") font: UM.Theme.getFont("medium")
width: contentWidth width: contentWidth
} }
Rectangle
{
id: sendToFactoryCard
visible: isAbstractCloudPrinter
color: UM.Theme.getColor("detail_background")
height: childrenRect.height + UM.Theme.getSize("default_margin").height * 2
width: childrenRect.width + UM.Theme.getSize("wide_margin").width * 2
Column
{
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
spacing: UM.Theme.getSize("wide_margin").height
padding: UM.Theme.getSize("default_margin").width
topPadding: 0
Image
{
id: sendToFactoryImage
anchors.horizontalCenter: parent.horizontalCenter
source: UM.Theme.getImage("illustration_connect_printers")
}
UM.Label
{
anchors.horizontalCenter: parent.horizontalCenter
text: catalog.i18nc("@info", "Monitor your printers from everywhere using Ultimaker Digital Factory")
font: UM.Theme.getFont("medium")
width: sendToFactoryImage.width
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
Cura.PrimaryButton
{
id: sendToFactoryButton
anchors.horizontalCenter: parent.horizontalCenter
text: catalog.i18nc("@button", "View printers in Digital Factory")
onClicked: Qt.openUrlExternally("https://digitalfactory.ultimaker.com/app/print-jobs?utm_source=cura&utm_medium=software&utm_campaign=monitor-view-cloud-printer-type")
}
}
}
Item Item
{ {
anchors anchors
{ {
left: noNetworkLabel.left left: noNetworkLabel.left
} }
visible: !isNetworkConfigured && isNetworkConfigurable && !isAbstractCloudPrinter visible: !isNetworkConfigured && isNetworkConfigurable
width: childrenRect.width width: childrenRect.width
height: childrenRect.height height: childrenRect.height

View File

@ -153,7 +153,7 @@ Item
MonitorPrinterPill MonitorPrinterPill
{ {
text: printJob.configuration.printerType text: printJob ? printJob.configuration.printerType : ""
} }
} }
} }
@ -173,7 +173,7 @@ Item
id: printerConfiguration id: printerConfiguration
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
buildplate: catalog.i18nc("@label", "Glass") buildplate: catalog.i18nc("@label", "Glass")
configurations: base.printJob.configuration.extruderConfigurations configurations: base.printJob ? base.printJob.configuration.extruderConfigurations : null
height: Math.round(72 * screenScaleFactor) // TODO: Theme! height: Math.round(72 * screenScaleFactor) // TODO: Theme!
} }

View File

@ -1,8 +1,8 @@
// Copyright (c) 2019 Ultimaker B.V. // Copyright (c) 2022 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.
import QtQuick 2.2 import QtQuick 2.15
import UM 1.3 as UM import UM 1.5 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
// This is the root component for the monitor stage. // This is the root component for the monitor stage.
@ -37,6 +37,7 @@ Component
Item Item
{ {
id: printers id: printers
visible: !Cura.MachineManager.activeMachineIsAbstractCloudPrinter
anchors anchors
{ {
top: parent.top top: parent.top
@ -69,14 +70,66 @@ Component
top: printers.bottom top: printers.bottom
topMargin: 48 * screenScaleFactor // TODO: Theme! topMargin: 48 * screenScaleFactor // TODO: Theme!
} }
visible: OutputDevice.supportsPrintJobQueue && OutputDevice.canReadPrintJobs visible: OutputDevice.supportsPrintJobQueue && OutputDevice.canReadPrintJobs && !Cura.MachineManager.activeMachineIsAbstractCloudPrinter
} }
PrinterVideoStream PrinterVideoStream
{ {
anchors.fill: parent anchors.fill: parent
cameraUrl: OutputDevice.activeCameraUrl cameraUrl: OutputDevice.activeCameraUrl
visible: OutputDevice.activeCameraUrl != "" visible: OutputDevice.activeCameraUrl != "" && !Cura.MachineManager.activeMachineIsAbstractCloudPrinter
}
Rectangle
{
id: sendToFactoryCard
visible: Cura.MachineManager.activeMachineIsAbstractCloudPrinter
color: UM.Theme.getColor("detail_background")
height: childrenRect.height + UM.Theme.getSize("default_margin").height * 2
width: childrenRect.width + UM.Theme.getSize("wide_margin").width * 2
anchors
{
horizontalCenter: parent.horizontalCenter
top: parent.top
topMargin: UM.Theme.getSize("wide_margin").height * screenScaleFactor * 2
}
Column
{
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
spacing: UM.Theme.getSize("wide_margin").height
padding: UM.Theme.getSize("default_margin").width
topPadding: 0
Image
{
id: sendToFactoryImage
anchors.horizontalCenter: parent.horizontalCenter
source: UM.Theme.getImage("cura_connected_printers")
}
UM.Label
{
anchors.horizontalCenter: parent.horizontalCenter
text: catalog.i18nc("@info", "Monitor your printers from everywhere using Ultimaker Digital Factory")
font: UM.Theme.getFont("medium")
width: sendToFactoryImage.width
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
Cura.PrimaryButton
{
id: sendToFactoryButton
anchors.horizontalCenter: parent.horizontalCenter
text: catalog.i18nc("@button", "View printers in Digital Factory")
onClicked: Qt.openUrlExternally("https://digitalfactory.ultimaker.com/app/print-jobs?utm_source=cura&utm_medium=software&utm_campaign=monitor-view-cloud-printer-type")
}
}
} }
} }
} }

View File

@ -118,11 +118,11 @@ Loader {
top: buttonText.top top: buttonText.top
bottom: buttonText.bottom bottom: buttonText.bottom
} }
visible: model.isAbstractMachine visible: model.isAbstractMachine ? model.isAbstractMachine : false
UM.Label UM.Label
{ {
text: model.machineCount text: model.machineCount ? model.machineCount : ""
anchors.centerIn: parent anchors.centerIn: parent
font: UM.Theme.getFont("default_bold") font: UM.Theme.getFont("default_bold")
} }

View File

@ -223,7 +223,6 @@ Cura.ExpandablePopup
id: buttonRow id: buttonRow
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right

View File

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 298 271">
<defs>
<style>
.cls-1, .cls-2, .cls-3, .cls-4, .cls-5, .cls-6, .cls-7, .cls-8, .cls-9, .cls-10 {
stroke: #f3f3f3;
}
.cls-1, .cls-2, .cls-3, .cls-4, .cls-5, .cls-6, .cls-8, .cls-11, .cls-9, .cls-10 {
stroke-miterlimit: 10;
}
.cls-1, .cls-12, .cls-4, .cls-10 {
fill: #555557;
}
.cls-1, .cls-9 {
stroke-width: 1.8px;
}
.cls-2 {
stroke-dasharray: 0 0 4 4;
}
.cls-2, .cls-3, .cls-4, .cls-5, .cls-6, .cls-7, .cls-8, .cls-11, .cls-10 {
stroke-width: 2px;
}
.cls-2, .cls-3, .cls-5, .cls-6, .cls-7, .cls-8, .cls-11, .cls-9 {
fill: none;
}
.cls-13 {
fill: #f3f3f3;
}
.cls-14 {
fill: #1f1f20;
}
.cls-3 {
stroke-dasharray: 0 0 4 4;
}
.cls-5 {
stroke-dasharray: 0 0 3.9 3.9;
}
.cls-6 {
stroke-dasharray: 0 0 3.81 3.81;
}
.cls-7 {
stroke-linecap: round;
stroke-linejoin: round;
}
.cls-11 {
stroke: #061884;
}
.cls-10 {
stroke-dasharray: 0 4;
}
</style>
</defs>
<g id="a">
<line class="cls-11" x1="150" y1="98" x2="150" y2="100"/>
<g>
<line class="cls-8" x1="150" y1="46" x2="150" y2="48"/>
<line class="cls-6" x1="150" y1="51.81" x2="150" y2="88.04"/>
<line class="cls-8" x1="150" y1="89.95" x2="150" y2="91.95"/>
</g>
<g>
<line class="cls-8" x1="227" y1="46" x2="227" y2="48"/>
<line class="cls-3" x1="227" y1="52" x2="227" y2="66"/>
<line class="cls-8" x1="227" y1="68" x2="227" y2="70"/>
</g>
<g>
<line class="cls-8" x1="73" y1="46" x2="73" y2="48"/>
<line class="cls-2" x1="73" y1="52" x2="73" y2="66.01"/>
<line class="cls-8" x1="73" y1="68.02" x2="73" y2="70.02"/>
</g>
<line class="cls-10" x1="74" y1="69" x2="72" y2="69"/>
<g>
<line class="cls-8" x1="228.01" y1="69" x2="226.01" y2="69"/>
<line class="cls-5" x1="222.11" y1="69" x2="75.95" y2="69"/>
<line class="cls-8" x1="74" y1="69" x2="72" y2="69"/>
</g>
<path class="cls-13" d="M91,0V36h-6.33l-4-3h-15.33l-4,3h-6.33V0h36Zm-2,2H57V34h3.67l4-3h16.67l4,3h3.67V2Zm-4,23c0,1.66-1.34,3-3,3h-18c-1.66,0-3-1.34-3-3V5h24V25Zm-15-18v3h6v-3h-6Zm13,0h-5v5h-10V7h-5V26h20V7Z"/>
<path class="cls-13" d="M168,0V36h-6.33l-4-3h-15.33l-4,3h-6.33V0h36Zm-2,2h-32V34h3.67l4-3h16.67l4,3h3.67V2Zm-4,23c0,1.66-1.34,3-3,3h-18c-1.66,0-3-1.34-3-3V5h24V25Zm-15-18v3h6v-3h-6Zm13,0h-5v5h-10V7h-5V26h20V7Z"/>
<path class="cls-13" d="M245,0V36h-6.33l-4-3h-15.33l-4,3h-6.33V0h36Zm-2,2h-32V34h3.67l4-3h16.67l4,3h3.67V2Zm-4,23c0,1.66-1.34,3-3,3h-18c-1.66,0-3-1.34-3-3V5h24V25Zm-15-18v3h6v-3h-6Zm13,0h-5v5h-10V7h-5V26h20V7Z"/>
<path class="cls-4" d="M28,97.1V254h242V97.1h0c0-3.37-2.73-6.1-6.1-6.1H34.1c-3.37,0-6.1,2.73-6.1,6.1Z"/>
<path class="cls-14" d="M261,255c.55,0,1-.45,1-1V102c0-1.66-1.34-3-3-3H38c-1.1,0-2,.9-2,2V254c0,.55,.45,1,1,1h224Z"/>
<path class="cls-13" d="M259,100H38c-.55,0-1,.45-1,1V254h224V102c0-1.1-.9-2-2-2m4,2V254c0,1.1-.9,2-2,2H37c-1.1,0-2-.9-2-2V101c0-1.66,1.34-3,3-3h221c2.21,0,4,1.79,4,4Z"/>
<path class="cls-12" d="M259,102H39V252h220V102m2,0V254H37V101c0-.55,.45-1,1-1h221c1.1,0,2,.9,2,2Z"/>
<line class="cls-7" x1="297" y1="270" x2="1" y2="270"/>
<path class="cls-12" d="M276.89,270c8.28,0,14.99-6.72,15-15,0-.55-.45-1-1-1H7.11c-.55,0-1,.45-1,1,0,8.28,6.72,14.99,15,15h255.77Z"/>
<path class="cls-13" d="M290.89,255H7.11c0,7.73,6.27,14,14,14h255.77c7.73,0,14-6.27,14-14m2,0c-.01,8.83-7.17,15.99-16,16H21.11c-8.83-.01-15.99-7.17-16-16,0-1.1,.9-2,2-2H290.89c1.1,0,2,.9,2,2Zm-2,2h0Z"/>
<path class="cls-13" d="M172,254.61c0,2.43-1.97,4.39-4.39,4.39h-36.21c-2.43,0-4.39-1.97-4.39-4.39v-.61h45v.61Z"/>
<polygon class="cls-8" points="191.31 191.39 191.31 131.89 131.81 131.89 106.31 157.39 106.31 216.89 165.81 216.89 191.31 191.39"/>
<path class="cls-8" d="M161.56,195.64h-12.75c-11.74,0-21.25-9.51-21.25-21.25s9.51-21.25,21.25-21.25h12.75"/>
<path class="cls-14" d="M209.37,134.96c0-9.8-7.91-17.77-17.71-17.84-9.85-.07-17.9,7.85-17.97,17.71-.07,9.85,7.85,17.9,17.71,17.97,9.89,.03,17.93-7.96,17.97-17.84Z"/>
<path class="cls-14" d="M191.39,118.62c-9.06-.04-16.44,7.28-16.47,16.34,0,8.97,7.24,16.27,16.21,16.34,9.02,.07,16.4-7.18,16.47-16.21,.07-9.02-7.18-16.4-16.21-16.47m19.47,16.34c0,10.63-8.58,19.27-19.21,19.34-10.68,.07-19.4-8.53-19.47-19.21-.07-10.68,8.53-19.4,19.21-19.47,10.71-.02,19.42,8.63,19.47,19.34Z"/>
<ellipse class="cls-9" cx="191.39" cy="134.96" rx="16.47" ry="16.34"/>
<path class="cls-9" d="M191.39,118.62c-2.84,2.76-4.62,6.68-5.55,11.18-.69,3.41-.69,6.91,0,10.32,.93,4.5,2.71,8.42,5.55,11.18"/>
<path class="cls-9" d="M191.39,151.3c2.84-3.16,4.76-7.02,5.58-11.18,.65-3.41,.65-6.91,0-10.32-.82-4.16-2.75-8.02-5.58-11.18"/>
<line class="cls-1" x1="207" y1="140.12" x2="175.79" y2="140.12"/>
<line class="cls-1" x1="207" y1="129.8" x2="175.79" y2="129.8"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB