Merge pull request #8656 from Ultimaker/CURA-7784_Hide_queue_if_printer_doesnt_support_it

Hide queue in Monitor page if printer does not support it
This commit is contained in:
Jelle Spijker 2020-10-31 12:30:59 +01:00 committed by GitHub
commit 8a4bab27cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 2 deletions

View File

@ -72,6 +72,7 @@ Component
top: printers.bottom
topMargin: 48 * screenScaleFactor // TODO: Theme!
}
visible: OutputDevice.supportsPrintJobQueue
}
PrinterVideoStream

View File

@ -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 True
def setJobState(self, print_job_uuid: str, state: str) -> None:
"""Set the remote print job state."""

View File

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