Enable force override print job in local network, fix override button not enabled on older firmwares

This commit is contained in:
ChrisTerBeke 2019-08-15 20:16:55 +02:00
parent de3f82610a
commit 9e6e9a4beb
No known key found for this signature in database
GPG key ID: A49F1AB9D7E0C263
3 changed files with 25 additions and 1 deletions

View file

@ -494,6 +494,25 @@ Item
implicitWidth: 96 * screenScaleFactor // TODO: Theme! implicitWidth: 96 * screenScaleFactor // TODO: Theme!
visible: printer && printer.activePrintJob && printer.activePrintJob.configurationChanges.length > 0 && !printerStatus.visible visible: printer && printer.activePrintJob && printer.activePrintJob.configurationChanges.length > 0 && !printerStatus.visible
onClicked: base.enabled ? overrideConfirmationDialog.open() : {} onClicked: base.enabled ? overrideConfirmationDialog.open() : {}
enabled: OutputDevice.supportsPrintJobActions
}
// For cloud printing, add this mouse area over the disabled details button to indicate that it's not available
MouseArea
{
id: detailsButtonDisabledButtonArea
anchors.fill: detailsButton
hoverEnabled: detailsButton.visible && !detailsButton.enabled
onEntered: overrideButtonDisabledInfo.open()
onExited: overrideButtonDisabledInfo.close()
enabled: !detailsButton.enabled
}
MonitorInfoBlurb
{
id: overrideButtonDisabledInfo
text: catalog.i18nc("@info", "Please update your printer's firmware to manage the queue remotely.")
target: detailsButton
} }
} }

View file

@ -63,6 +63,11 @@ class ClusterApiClient:
url = "{}/print_jobs/{}/action/move".format(self.CLUSTER_API_PREFIX, print_job_uuid) url = "{}/print_jobs/{}/action/move".format(self.CLUSTER_API_PREFIX, print_job_uuid)
self._manager.post(self._createEmptyRequest(url), json.dumps({"to_position": 0, "list": "queued"}).encode()) self._manager.post(self._createEmptyRequest(url), json.dumps({"to_position": 0, "list": "queued"}).encode())
## Override print job configuration and force it to be printed.
def forcePrintJob(self, print_job_uuid: str) -> None:
url = "{}/print_jobs/{}".format(self.CLUSTER_API_PREFIX, print_job_uuid)
self._manager.put(self._createEmptyRequest(url), json.dumps({"force": True}).encode())
## Delete a print job from the queue. ## Delete a print job from the queue.
def deletePrintJob(self, print_job_uuid: str) -> None: def deletePrintJob(self, print_job_uuid: str) -> None:
url = "{}/print_jobs/{}".format(self.CLUSTER_API_PREFIX, print_job_uuid) url = "{}/print_jobs/{}".format(self.CLUSTER_API_PREFIX, print_job_uuid)

View file

@ -86,7 +86,7 @@ class LocalClusterOutputDevice(UltimakerNetworkedPrinterOutputDevice):
@pyqtSlot(str, name="forceSendJob") @pyqtSlot(str, name="forceSendJob")
def forceSendJob(self, print_job_uuid: str) -> None: def forceSendJob(self, print_job_uuid: str) -> None:
pass # TODO self._getApiClient().forcePrintJob(print_job_uuid)
## Set the remote print job state. ## Set the remote print job state.
# \param print_job_uuid: The UUID of the print job to set the state for. # \param print_job_uuid: The UUID of the print job to set the state for.