Added delete button to cluster queue

CL-894
This commit is contained in:
Jaime van Kessel 2018-08-17 10:49:44 +02:00
parent db1d90ed9b
commit eb7d42a7f8
3 changed files with 18 additions and 2 deletions

View file

@ -204,7 +204,7 @@ class NetworkedPrinterOutputDevice(PrinterOutputDevice):
self._validateManager() self._validateManager()
request = self._createEmptyRequest(target) request = self._createEmptyRequest(target)
self._last_request_time = time() self._last_request_time = time()
reply = self._manager.delete(request) reply = self._manager.deleteResource(request)
self._registerOnFinishedCallback(reply, on_finished) self._registerOnFinishedCallback(reply, on_finished)
def get(self, target: str, on_finished: Optional[Callable[[QNetworkReply], None]]) -> None: def get(self, target: str, on_finished: Optional[Callable[[QNetworkReply], None]]) -> None:

View file

@ -374,6 +374,12 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
data = "{\"to_position\": 0}" data = "{\"to_position\": 0}"
self.put("print_jobs/{uuid}/move_to_position".format(uuid = print_job_uuid), data, on_finished=None) self.put("print_jobs/{uuid}/move_to_position".format(uuid = print_job_uuid), data, on_finished=None)
@pyqtSlot(str)
def deleteJobFromQueue(self, print_job_uuid: str) -> None:
# This function is part of the output device (and not of the printjob output model) as this type of operation
# is a modification of the cluster queue and not of the actual job.
self.delete("print_jobs/{uuid}".format(uuid = print_job_uuid), on_finished=None)
def _printJobStateChanged(self) -> None: def _printJobStateChanged(self) -> None:
username = self._getUserName() username = self._getUserName()

View file

@ -135,7 +135,7 @@ Item
//y: configurationSelector.height - UM.Theme.getSize("default_lining").height //y: configurationSelector.height - UM.Theme.getSize("default_lining").height
//x: configurationSelector.width - width //x: configurationSelector.width - width
width: 200 width: 200
height: childrenRect.height height: contentItem.height + 2 * padding
visible: false visible: false
padding: UM.Theme.getSize("default_lining").width padding: UM.Theme.getSize("default_lining").width
transformOrigin: Popup.Top transformOrigin: Popup.Top
@ -145,17 +145,27 @@ Item
height: childrenRect.height height: childrenRect.height
Button Button
{ {
id: sendToTopButton
text: "Send to top" text: "Send to top"
onClicked: OutputDevice.sendJobToTop(printJob.key) onClicked: OutputDevice.sendJobToTop(printJob.key)
width: parent.width width: parent.width
enabled: OutputDevice.printJobs[0].key != printJob.key enabled: OutputDevice.printJobs[0].key != printJob.key
} }
Button
{
id: deleteButton
text: "Delete"
onClicked: OutputDevice.deleteJobFromQueue(printJob.key)
width: parent.width
anchors.top: sendToTopButton.bottom
}
} }
background: Rectangle background: Rectangle
{ {
color: UM.Theme.getColor("setting_control") color: UM.Theme.getColor("setting_control")
border.color: UM.Theme.getColor("setting_control_border") border.color: UM.Theme.getColor("setting_control_border")
height: popup.height
} }
exit: Transition exit: Transition