mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-12 09:17:50 -06:00
Show context menu on printers with firmware 5.3 or later
This commit is contained in:
parent
6cbe89f832
commit
93351ec9b9
7 changed files with 27 additions and 14 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue