mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 02:35:53 +08:00
Add properties of whether the queue can be manipulated
Not all printers can do that. Contributes to issue CURA-9220.
This commit is contained in:
parent
483911dc4a
commit
b4c4371929
@ -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.
|
||||
|
||||
from time import time
|
||||
@ -96,6 +96,8 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice):
|
||||
|
||||
# Trigger the printersChanged signal when the private signal is triggered.
|
||||
self.printersChanged.connect(self._cloudClusterPrintersChanged)
|
||||
# Trigger the permissionsChanged signal when the account's permissions change.
|
||||
self._account.permissionsChanged.connect(self.permissionsChanged)
|
||||
|
||||
# Keep server string of the last generated time to avoid updating models more than once for the same response
|
||||
self._received_printers = None # type: Optional[List[ClusterPrinterStatus]]
|
||||
@ -340,6 +342,30 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice):
|
||||
def openPrinterControlPanel(self) -> None:
|
||||
QDesktopServices.openUrl(QUrl(self.clusterCloudUrl + "?utm_source=cura&utm_medium=software&utm_campaign=monitor-manage-printer"))
|
||||
|
||||
permissionsChanged = pyqtSignal()
|
||||
|
||||
@pyqtProperty(bool, notify = permissionsChanged)
|
||||
def canReadPrintJobs(self) -> bool:
|
||||
"""
|
||||
Whether this user can read the list of print jobs and their properties.
|
||||
"""
|
||||
return "digital-factory.print-job.read" in self._account.permissions
|
||||
|
||||
@pyqtProperty(bool, notify = permissionsChanged)
|
||||
def canWriteOthersPrintJobs(self) -> bool:
|
||||
"""
|
||||
Whether this user can change things about print jobs made by other
|
||||
people.
|
||||
"""
|
||||
return "digital-factory.print-job.write" in self._account.permissions
|
||||
|
||||
@pyqtProperty(bool, notify = permissionsChanged)
|
||||
def canWriteOwnPrintJobs(self) -> bool:
|
||||
"""
|
||||
Whether this user can change things about print jobs made by themself.
|
||||
"""
|
||||
return "digital-factory.print-job.write.own" in self._account.permissions
|
||||
|
||||
@property
|
||||
def clusterData(self) -> CloudClusterResponse:
|
||||
"""Gets the cluster response from which this device was created."""
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2019 Ultimaker B.V.
|
||||
# Copyright (c) 2022 Ultimaker B.V.
|
||||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
import os
|
||||
from typing import Optional, Dict, List, Callable, Any
|
||||
@ -103,6 +103,28 @@ class LocalClusterOutputDevice(UltimakerNetworkedPrinterOutputDevice):
|
||||
"""
|
||||
return True # This API always supports print job queueing.
|
||||
|
||||
@pyqtProperty(bool, constant = True)
|
||||
def canReadPrintJobs(self) -> bool:
|
||||
"""
|
||||
Whether this user can read the list of print jobs and their properties.
|
||||
"""
|
||||
return False # On LAN, the user can always read it.
|
||||
|
||||
@pyqtProperty(bool, constant = True)
|
||||
def canWriteOthersPrintJobs(self) -> bool:
|
||||
"""
|
||||
Whether this user can change things about print jobs made by other
|
||||
people.
|
||||
"""
|
||||
return True # On LAN, the user can always change this.
|
||||
|
||||
@pyqtProperty(bool, constant = True)
|
||||
def canWriteOwnPrintJobs(self) -> bool:
|
||||
"""
|
||||
Whether this user can change things about print jobs made by themself.
|
||||
"""
|
||||
return True # On LAN, the user can always change this.
|
||||
|
||||
def setJobState(self, print_job_uuid: str, action: str) -> None:
|
||||
"""Set the remote print job state.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user