diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml index fd0870d351..b863712481 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrintJobCard.qml @@ -213,6 +213,7 @@ Item } width: 32 * screenScaleFactor // TODO: Theme! height: 32 * screenScaleFactor // TODO: Theme! + enabled: OutputDevice.supportsPrintJobActions onClicked: enabled ? contextMenu.switchPopupState() : {} visible: { @@ -245,7 +246,7 @@ Item MonitorInfoBlurb { id: contextMenuDisabledInfo - text: catalog.i18nc("@info", "These options are not available because you are monitoring a cloud printer.") + text: catalog.i18nc("@info", "Please update your printer's firmware to manage the queue remotely.") target: contextMenuButton } -} \ No newline at end of file +} diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml index 89687ceeb8..1f5a4cfcb2 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorPrinterCard.qml @@ -172,7 +172,7 @@ Item } width: 36 * screenScaleFactor // TODO: Theme! height: 36 * screenScaleFactor // TODO: Theme! - + enabled: OutputDevice.supportsPrintJobActions onClicked: enabled ? contextMenu.switchPopupState() : {} visible: { @@ -205,7 +205,7 @@ Item MonitorInfoBlurb { id: contextMenuDisabledInfo - text: catalog.i18nc("@info", "These options are not available because you are monitoring a cloud printer.") + text: catalog.i18nc("@info", "Please update your printer's firmware to manage the queue remotely.") target: contextMenuButton } @@ -243,7 +243,6 @@ Item } } - // Divider Rectangle { diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml index cd5a5d1a37..369951fa9c 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorQueue.qml @@ -42,7 +42,6 @@ Item } height: 18 * screenScaleFactor // TODO: Theme! width: childrenRect.width - visible: !cloudConnection UM.RecolorImage { @@ -65,7 +64,7 @@ Item color: UM.Theme.getColor("monitor_text_link") font: UM.Theme.getFont("medium") // 14pt, regular linkColor: UM.Theme.getColor("monitor_text_link") - text: catalog.i18nc("@label link to connect manager", "Go to Cura Connect") + text: catalog.i18nc("@label link to connect manager", "Manage in browser") renderType: Text.NativeRendering } } @@ -73,7 +72,7 @@ Item MouseArea { anchors.fill: manageQueueLabel - onClicked: Cura.MachineManager.printerOutputDevices[0].openPrintJobControlPanel() + onClicked: OutputDevice.openPrintJobControlPanel() onEntered: { manageQueueText.font.underline = true @@ -196,8 +195,7 @@ Item color: UM.Theme.getColor("monitor_card_background") border.color: UM.Theme.getColor("monitor_card_border") radius: 2 * screenScaleFactor // TODO: Theme! - - visible: printJobList.model.length == 0 + visible: OutputDevice.printJobs.length == 0 Row { @@ -247,14 +245,14 @@ Item color: UM.Theme.getColor("monitor_text_link") font: UM.Theme.getFont("medium") // 14pt, regular linkColor: UM.Theme.getColor("monitor_text_link") - text: catalog.i18nc("@label link to connect manager", "View print history") + text: catalog.i18nc("@label link to connect manager", "Manage in browser") renderType: Text.NativeRendering } MouseArea { anchors.fill: parent hoverEnabled: true - onClicked: Cura.MachineManager.printerOutputDevices[0].openPrintJobControlPanel() + onClicked: OutputDevice.openPrintJobControlPanel() onEntered: { viewPrintHistoryText.font.underline = true diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py index dcbeeb4626..34f062671f 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py @@ -16,6 +16,7 @@ from UM.Message import Message from UM.PluginRegistry import PluginRegistry from UM.Qt.Duration import Duration, DurationFormat from UM.Scene.SceneNode import SceneNode +from UM.Version import Version from cura.CuraApplication import CuraApplication from cura.PrinterOutput.NetworkedPrinterOutputDevice import AuthState, NetworkedPrinterOutputDevice @@ -49,6 +50,9 @@ class CloudOutputDevice(NetworkedPrinterOutputDevice): # The interval with which the remote clusters are checked CHECK_CLUSTER_INTERVAL = 10.0 # seconds + # The minimum version of firmware that support print job actions over cloud. + PRINT_JOB_ACTIONS_MIN_VERSION = Version("5.3.0") + # Signal triggered when the print jobs in the queue were changed. printJobsChanged = pyqtSignal() @@ -360,6 +364,13 @@ class CloudOutputDevice(NetworkedPrinterOutputDevice): ).show() self.writeFinished.emit() + ## Whether the printer that this output device represents supports print job actions via the cloud. + @pyqtProperty(bool, notify = _clusterPrintersChanged) + def supportsPrintJobActions(self) -> bool: + version_number = self.printers[0].firmwareVersion.split(".") + firmware_version = Version([version_number[0], version_number[1], version_number[2]]) + return firmware_version >= self.PRINT_JOB_ACTIONS_MIN_VERSION + ## Gets the number of printers in the cluster. # We use a minimum of 1 because cloud devices are always a cluster and printer discovery needs it. @pyqtProperty(int, notify = _clusterPrintersChanged) diff --git a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintJobStatus.py b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintJobStatus.py index 79050521af..4a3823ccca 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintJobStatus.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrintJobStatus.py @@ -91,7 +91,6 @@ class CloudClusterPrintJobStatus(BaseCloudModel): def createOutputModel(self, controller: CloudOutputController) -> UM3PrintJobOutputModel: model = UM3PrintJobOutputModel(controller, self.uuid, self.name) self.updateOutputModel(model) - return model ## Creates a new configuration model diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index 3f3cd4cdd6..6fbb115601 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -140,6 +140,11 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): if self._printer_selection_dialog is not None: self._printer_selection_dialog.show() + ## Whether the printer that this output device represents supports print job actions via the local network. + @pyqtProperty(bool, constant=True) + def supportsPrintJobActions(self) -> bool: + return True + @pyqtProperty(int, constant=True) def clusterSize(self) -> int: return self._cluster_size diff --git a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py index be7bb1006a..e49077d66d 100644 --- a/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/src/UM3OutputDevicePlugin.py @@ -27,7 +27,7 @@ from UM.Version import Version from . import ClusterUM3OutputDevice, LegacyUM3OutputDevice from .Cloud.CloudOutputDeviceManager import CloudOutputDeviceManager -from .Cloud.CloudOutputDevice import CloudOutputDevice # typing +from .Cloud.CloudOutputDevice import CloudOutputDevice # typing if TYPE_CHECKING: from PyQt5.QtNetwork import QNetworkReply