From adc80729918470c9f096e759eefcc794a5398365 Mon Sep 17 00:00:00 2001 From: Kostas Karmas Date: Fri, 30 Oct 2020 12:44:59 +0100 Subject: [PATCH 1/2] Hide queue in Monitor page if printer does not support it CURA-7784 --- plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml | 1 + plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py | 6 ++++++ .../src/Models/Http/CloudClusterResponse.py | 6 ++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml b/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml index 47c45f8b11..dc69d89fed 100644 --- a/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml +++ b/plugins/UM3NetworkPrinting/resources/qml/MonitorStage.qml @@ -72,6 +72,7 @@ Component top: printers.bottom topMargin: 48 * screenScaleFactor // TODO: Theme! } + visible: OutputDevice.supportsPrintJobQueue } PrinterVideoStream diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py index 9314e067a2..0c6ed4548a 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py @@ -287,6 +287,12 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice): firmware_version = Version([version_number[0], version_number[1], version_number[2]]) return firmware_version >= self.PRINT_JOB_ACTIONS_MIN_VERSION + @pyqtProperty(bool) + def supportsPrintJobQueue(self) -> bool: + """Gets whether the printer supports a queue""" + + return "queue" in self._cluster.capabilities if self._cluster.capabilities else False + def setJobState(self, print_job_uuid: str, state: str) -> None: """Set the remote print job state.""" diff --git a/plugins/UM3NetworkPrinting/src/Models/Http/CloudClusterResponse.py b/plugins/UM3NetworkPrinting/src/Models/Http/CloudClusterResponse.py index a9107db3c8..1af3d83964 100644 --- a/plugins/UM3NetworkPrinting/src/Models/Http/CloudClusterResponse.py +++ b/plugins/UM3NetworkPrinting/src/Models/Http/CloudClusterResponse.py @@ -1,6 +1,6 @@ # Copyright (c) 2019 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -from typing import Optional +from typing import Optional, List from ..BaseModel import BaseModel @@ -11,7 +11,8 @@ class CloudClusterResponse(BaseModel): def __init__(self, cluster_id: str, host_guid: str, host_name: str, is_online: bool, status: str, host_internal_ip: Optional[str] = None, host_version: Optional[str] = None, - friendly_name: Optional[str] = None, printer_type: str = "ultimaker3", printer_count: int = 1, **kwargs) -> None: + friendly_name: Optional[str] = None, printer_type: str = "ultimaker3", printer_count: int = 1, + capabilities: Optional[List[str]] = None, **kwargs) -> None: """Creates a new cluster response object. :param cluster_id: The secret unique ID, e.g. 'kBEeZWEifXbrXviO8mRYLx45P8k5lHVGs43XKvRniPg='. @@ -36,6 +37,7 @@ class CloudClusterResponse(BaseModel): self.friendly_name = friendly_name self.printer_type = printer_type self.printer_count = printer_count + self.capabilities = capabilities super().__init__(**kwargs) # Validates the model, raising an exception if the model is invalid. From c8e3c4ff1224d4f0775cadb0a00b47b36860b55d Mon Sep 17 00:00:00 2001 From: Kostas Karmas Date: Fri, 30 Oct 2020 12:49:39 +0100 Subject: [PATCH 2/2] Display the queue by default if there are no capabilities If the capabilities list is missing, display the queue anyway, even if it is always empty CURA-7784 --- plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py index 0c6ed4548a..82b8c1da62 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py @@ -291,7 +291,7 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice): def supportsPrintJobQueue(self) -> bool: """Gets whether the printer supports a queue""" - return "queue" in self._cluster.capabilities if self._cluster.capabilities else False + return "queue" in self._cluster.capabilities if self._cluster.capabilities else True def setJobState(self, print_job_uuid: str, state: str) -> None: """Set the remote print job state."""