Make send to DF in monitor for abstract printer work (again-ish).

Already moslty implemented, but a new approach of the base feature (abstract cloud printers) made a more? elegant and functioning implementation possible.

(re)implements CURA-9422
This commit is contained in:
Remco Burema 2022-08-31 14:13:47 +02:00
parent 4c55befad7
commit 4ea437ba28
6 changed files with 186 additions and 60 deletions

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.
import time
@ -531,9 +531,9 @@ class MachineManager(QObject):
def printerConnected(self) -> bool:
return bool(self._printer_output_devices)
@pyqtProperty(bool, notify = printerConnectedStatusChanged)
def activeMachineIsAbstract(self) -> bool:
return (self.activeMachine is not None) and parseBool(self.activeMachine.getMetaDataEntry("is_abstract_machine", False))
@pyqtProperty(bool, notify = globalContainerChanged)
def activeMachineIsAbstractCloudPrinter(self) -> bool:
return len(self._printer_output_devices) == 1 and self._printer_output_devices[0].__class__.__name__ == "AbstractCloudOutputDevice"
@pyqtProperty(bool, notify = printerConnectedStatusChanged)
def activeMachineIsGroup(self) -> bool:
@ -559,8 +559,6 @@ class MachineManager(QObject):
@pyqtProperty(bool, notify = printerConnectedStatusChanged)
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
@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.
import QtQuick 2.10
@ -12,7 +12,6 @@ Rectangle
id: viewportOverlay
property bool isConnected: Cura.MachineManager.activeMachineHasNetworkConnection || Cura.MachineManager.activeMachineHasCloudConnection
property bool isAbstractCloudPrinter: Cura.MachineManager.activeMachineIsAbstract
property bool isNetworkConfigurable:
{
if(Cura.MachineManager.activeMachine === null)
@ -97,7 +96,7 @@ Rectangle
{
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.")
font: UM.Theme.getFont("medium")
width: contentWidth
@ -110,62 +109,19 @@ Rectangle
{
horizontalCenter: parent.horizontalCenter
}
visible: !isNetworkConfigured && isNetworkConfigurable && !isAbstractCloudPrinter
visible: !isNetworkConfigured && isNetworkConfigurable
text: catalog.i18nc("@info", "Please connect your printer to the network.")
font: UM.Theme.getFont("medium")
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
{
anchors
{
left: noNetworkLabel.left
}
visible: !isNetworkConfigured && isNetworkConfigurable && !isAbstractCloudPrinter
visible: !isNetworkConfigured && isNetworkConfigurable
width: childrenRect.width
height: childrenRect.height

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.
import QtQuick 2.2
import UM 1.3 as UM
import QtQuick 2.15
import UM 1.5 as UM
import Cura 1.0 as Cura
// This is the root component for the monitor stage.
@ -37,6 +37,7 @@ Component
Item
{
id: printers
visible: !Cura.MachineManager.activeMachineIsAbstractCloudPrinter
anchors
{
top: parent.top
@ -69,14 +70,66 @@ Component
top: printers.bottom
topMargin: 48 * screenScaleFactor // TODO: Theme!
}
visible: OutputDevice.supportsPrintJobQueue && OutputDevice.canReadPrintJobs
visible: OutputDevice.supportsPrintJobQueue && OutputDevice.canReadPrintJobs && !Cura.MachineManager.activeMachineIsAbstractCloudPrinter
}
PrinterVideoStream
{
anchors.fill: parent
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

@ -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

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -1 +0,0 @@
<svg id="Laag_1" data-name="Laag 1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 300 300"><defs><style>.cls-1,.cls-4{fill:#f3f8fe;}.cls-1,.cls-6,.cls-7{stroke:#061884;}.cls-1,.cls-10,.cls-5{stroke-miterlimit:10;}.cls-1,.cls-10,.cls-5,.cls-6,.cls-7{stroke-width:2px;}.cls-2,.cls-6{fill:#fff;}.cls-3{fill:#061884;}.cls-10,.cls-5,.cls-7{fill:none;}.cls-5{stroke:#c5dbfb;}.cls-10,.cls-5,.cls-6,.cls-7{stroke-linecap:round;}.cls-10,.cls-5{stroke-dasharray:4 6;}.cls-6,.cls-7{stroke-linejoin:round;}.cls-8{fill:#c5dbfb;}.cls-9{fill:#061784;}.cls-10{stroke:#061784;}</style></defs><path class="cls-1" d="M34,95.76H264.17a6.1,6.1,0,0,1,6.1,6.1V259a0,0,0,0,1,0,0H27.94a0,0,0,0,1,0,0V101.86A6.1,6.1,0,0,1,34,95.76Z"/><path class="cls-2" d="M39,258.9a1,1,0,0,1-1-1V105a2,2,0,0,1,2-2H260.69a3,3,0,0,1,3,3V257.9a1,1,0,0,1-1,1Z"/><path class="cls-3" d="M260.69,104a2,2,0,0,1,2,2V257.9H39V105a1,1,0,0,1,1-1H260.69m0-2H40a3,3,0,0,0-3,3V257.9a2,2,0,0,0,2,2H262.69a2,2,0,0,0,2-2V106a4,4,0,0,0-4-4Z"/><path class="cls-4" d="M260.69,106V255.9H41V106H260.69m0-2H40a1,1,0,0,0-1,1V257.9H262.69V106a2,2,0,0,0-2-2Z"/><path class="cls-5" d="M181.94,105.9"/><line class="cls-6" x1="1" y1="274.41" x2="297.21" y2="274.41"/><path class="cls-4" d="M21.7,274.41A15.5,15.5,0,0,1,6.22,258.92a1,1,0,0,1,1-1H291a1,1,0,0,1,1,1,15.51,15.51,0,0,1-15.49,15.49Z"/><path class="cls-3" d="M291,258.92a14.49,14.49,0,0,1-14.49,14.49H21.7A14.48,14.48,0,0,1,7.22,258.92H291m0-2H7.22a2,2,0,0,0-2,2A16.5,16.5,0,0,0,21.7,275.41H276.5A16.51,16.51,0,0,0,293,258.92a2,2,0,0,0-2-2Zm0,4Z"/><path class="cls-3" d="M171.6,258.92h-45v.61a4.4,4.4,0,0,0,4.4,4.39h36.21a4.39,4.39,0,0,0,4.39-4.39Z"/><polygon class="cls-1" points="165.96 230.99 106.46 230.99 106.46 171.49 131.96 145.99 191.46 145.99 191.46 205.49 165.96 230.99"/><path class="cls-7" d="M161.71,167.24H149a21.25,21.25,0,0,0,0,42.5h12.75"/><circle class="cls-2" cx="193.96" cy="147.99" r="25"/><path class="cls-3" d="M194,128a20,20,0,1,0,20,20A20,20,0,0,0,194,128Zm16.58,13h-9.38a29.54,29.54,0,0,0-4.94-10.84A18,18,0,0,1,210.54,141ZM200,148a29.07,29.07,0,0,1-.44,5H188.4a28.63,28.63,0,0,1,0-10h11.12A29.07,29.07,0,0,1,200,148Zm-11.13,7h10.26A27.78,27.78,0,0,1,194,165.47,27.78,27.78,0,0,1,188.83,155Zm0-14A27.7,27.7,0,0,1,194,130.51,27.7,27.7,0,0,1,199.09,141Zm2.87-10.84A29.54,29.54,0,0,0,186.76,141h-9.38A18,18,0,0,1,191.7,130.15Zm-15,12.84h9.69a30.69,30.69,0,0,0,0,10h-9.69a17.72,17.72,0,0,1,0-10Zm.7,12h9.38a29.54,29.54,0,0,0,4.94,10.84A18,18,0,0,1,177.38,155Zm18.84,10.84A29.54,29.54,0,0,0,201.16,155h9.38A18,18,0,0,1,196.22,165.83Zm15-12.84h-9.69a30.69,30.69,0,0,0,0-10h9.69a17.72,17.72,0,0,1,0,10Z"/><path class="cls-8" d="M150.16,140a1,1,0,0,1-1-1v-4a1,1,0,0,1,2,0v4A1,1,0,0,1,150.16,140Zm0-10a1,1,0,0,1-1-1v-4a1,1,0,1,1,2,0v4A1,1,0,0,1,150.16,130Zm0-10a1,1,0,0,1-1-1v-4a1,1,0,1,1,2,0v4A1,1,0,0,1,150.16,120Z"/><path class="cls-9" d="M150.16,90a1,1,0,0,1-1-1V85a1,1,0,1,1,2,0v4A1,1,0,0,1,150.16,90Zm0-10a1,1,0,0,1-1-1V75a1,1,0,1,1,2,0v4A1,1,0,0,1,150.16,80Zm0-10a1,1,0,0,1-1-1V65a1,1,0,0,1,2,0v4A1,1,0,0,1,150.16,70Zm0-10a1,1,0,0,1-1-1V55a1,1,0,0,1,2,0v4A1,1,0,0,1,150.16,60Zm0-10a1,1,0,0,1-1-1V45a1,1,0,0,1,2,0v4A1,1,0,0,1,150.16,50Zm0-10a1,1,0,0,1-1-1,1,1,0,0,1,1-1h0a1,1,0,0,1,0,2Z"/><path class="cls-9" d="M215.16,60a1,1,0,0,1-1-1V55a1,1,0,1,1,2,0v4A1,1,0,0,1,215.16,60Zm-6,0h-4a1,1,0,1,1,0-2h4a1,1,0,0,1,0,2Zm-10,0h-4a1,1,0,0,1,0-2h4a1,1,0,0,1,0,2Zm-10,0h-4a1,1,0,0,1,0-2h4a1,1,0,0,1,0,2Zm-10,0h-4a1,1,0,0,1,0-2h4a1,1,0,0,1,0,2Zm-10,0h-4a1,1,0,0,1,0-2h4a1,1,0,0,1,0,2Zm-10,0h-4a1,1,0,0,1,0-2h4a1,1,0,0,1,0,2Zm56-10a1,1,0,0,1-1-1V45a1,1,0,1,1,2,0v4A1,1,0,0,1,215.16,50Z"/><polyline class="cls-10" points="145.16 58.99 85.16 58.99 85.16 38.99"/><path class="cls-3" d="M67.89,0V36h6.34l4-3H93.56l4,3h6.33V0Zm34,34H98.23l-4-3H77.56l-4,3H69.89V2h32Z"/><path class="cls-3" d="M97.89,5h-24V25a3,3,0,0,0,3,3h18a3,3,0,0,0,3-3Zm-9,2v3h-6V7Zm7,19h-20V7h5v5h10V7h5Z"/><path class="cls-3" d="M132.82,0V36h6.34l4-3h15.33l4,3h6.33V0Zm34,34h-3.66l-4-3H142.49l-4,3h-3.67V2h32Z"/><path class="cls-3" d="M162.82,5h-24V25a3,3,0,0,0,3,3h18a3,3,0,0,0,3-3Zm-9,2v3h-6V7Zm7,19h-20V7h5v5h10V7h5Z"/><path class="cls-3" d="M197.75,0V36h6.34l4-3h15.33l4,3h6.33V0Zm34,34h-3.66l-4-3H207.42l-4,3h-3.67V2h32Z"/><path class="cls-3" d="M227.75,5h-24V25a3,3,0,0,0,3,3h18a3,3,0,0,0,3-3Zm-9,2v3h-6V7Zm7,19h-20V7h5v5h10V7h5Z"/></svg>

Before

Width:  |  Height:  |  Size: 4.3 KiB