diff --git a/plugins/UM3NetworkPrinting/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/ClusterUM3OutputDevice.py index 3a9bf20789..c4e78403b1 100644 --- a/plugins/UM3NetworkPrinting/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/ClusterUM3OutputDevice.py @@ -366,6 +366,13 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): datetime_completed = datetime.fromtimestamp(current_time + time_remaining) return (datetime_completed.strftime("%a %b ") + "{day}".format(day=datetime_completed.day)).upper() + @pyqtSlot(str) + def sendJobToTop(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. + data = "{\"to_position\": 0}" + self.put("print_jobs/{uuid}/move_to_position".format(uuid = print_job_uuid), data, on_finished=None) + def _printJobStateChanged(self) -> None: username = self._getUserName() diff --git a/plugins/UM3NetworkPrinting/PrintJobInfoBlock.qml b/plugins/UM3NetworkPrinting/PrintJobInfoBlock.qml index 7ae65dfb9b..086740416d 100644 --- a/plugins/UM3NetworkPrinting/PrintJobInfoBlock.qml +++ b/plugins/UM3NetworkPrinting/PrintJobInfoBlock.qml @@ -1,7 +1,8 @@ import QtQuick 2.2 -import QtQuick.Controls 1.4 +import QtQuick.Controls 2.0 import QtQuick.Controls.Styles 1.4 + import UM 1.3 as UM @@ -83,16 +84,73 @@ Item text: "Waiting for: first available" } + + function switchPopupState() + { + popup.visible ? popup.close() : popup.open() + } Button { + id: contextButton text: "..." anchors { right: parent.right top: parent.top } + onClicked: parent.switchPopupState() } + + Popup + { + // TODO Change once updating to Qt5.10 - The 'opened' property is in 5.10 but the behavior is now implemented with the visible property + id: popup + clip: true + closePolicy: Popup.CloseOnPressOutsideParent + x: parent.width - width + y: contextButton.height + //y: configurationSelector.height - UM.Theme.getSize("default_lining").height + //x: configurationSelector.width - width + width: 200 + height: childrenRect.height + visible: false + padding: UM.Theme.getSize("default_lining").width + transformOrigin: Popup.Top + contentItem: Item + { + width: panelWidth - 2 * popup.padding + height: cildrenRect.height + Button + { + text: "Send to top" + onClicked: OutputDevice.sendJobToTop(printJob.key) + width: parent.width + } + } + + background: Rectangle + { + color: UM.Theme.getColor("setting_control") + border.color: UM.Theme.getColor("setting_control_border") + } + + exit: Transition + { + // This applies a default NumberAnimation to any changes a state change makes to x or y properties + NumberAnimation { property: "visible"; duration: 75; } + } + enter: Transition + { + // This applies a default NumberAnimation to any changes a state change makes to x or y properties + NumberAnimation { property: "visible"; duration: 75; } + } + + onClosed: visible = false + onOpened: visible = true + } + + // PrintCore && Material config Row {