From b4a8cb1b82cb87c8315d6ca91539a9339c180677 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 8 Jul 2021 17:01:03 +0200 Subject: [PATCH 1/5] Add monitor print button for cloud print The button redirects the user to the cloud page CURA-8018 --- .../UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py index 1884efec46..9a996444a6 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py @@ -256,7 +256,16 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice): """ self._uploaded_print_job = self._pre_upload_print_job self._progress.hide() - PrintJobUploadSuccessMessage().show() + message = PrintJobUploadSuccessMessage() + message.addAction("monitor print", + name=I18N_CATALOG.i18nc("@action:button", "Monitor Print"), + icon="", + description="Remove the plugin", + button_align=message.ActionButtonAlignment.ALIGN_RIGHT) + df_url = "https://digitalfactory.ultimaker.com/app/jobs/%s?utm_source=cura&utm_medium=software&utm_campaign=monitor-button" % self._cluster.cluster_id + message.pyQtActionTriggered.connect(lambda message, action: (QDesktopServices.openUrl(QUrl(df_url)), message.hide())) + + message.show() self.writeFinished.emit() def _onPrintUploadSpecificError(self, reply: "QNetworkReply", _: "QNetworkReply.NetworkError"): From 2b5747f3eefb673734b366250a6dc671acc25760 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 12 Jul 2021 17:13:32 +0200 Subject: [PATCH 2/5] Update plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py Co-authored-by: Ghostkeeper --- plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py index 9a996444a6..3ca150ec87 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py @@ -260,7 +260,7 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice): message.addAction("monitor print", name=I18N_CATALOG.i18nc("@action:button", "Monitor Print"), icon="", - description="Remove the plugin", + description=I18N_CATALOG.i18nc("@action:tooltip", "Track the print in Ultimaker Digital Factory"), button_align=message.ActionButtonAlignment.ALIGN_RIGHT) df_url = "https://digitalfactory.ultimaker.com/app/jobs/%s?utm_source=cura&utm_medium=software&utm_campaign=monitor-button" % self._cluster.cluster_id message.pyQtActionTriggered.connect(lambda message, action: (QDesktopServices.openUrl(QUrl(df_url)), message.hide())) From e8fc88e6b02f465faaa59c7475d0bf59215e804b Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 13 Jul 2021 09:45:00 +0200 Subject: [PATCH 3/5] Use f-string formatting instead of % CURA-8018 Co-authored-by: Konstantinos Karmas --- plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py index 3ca150ec87..86927a43d4 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py @@ -262,7 +262,7 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice): icon="", description=I18N_CATALOG.i18nc("@action:tooltip", "Track the print in Ultimaker Digital Factory"), button_align=message.ActionButtonAlignment.ALIGN_RIGHT) - df_url = "https://digitalfactory.ultimaker.com/app/jobs/%s?utm_source=cura&utm_medium=software&utm_campaign=monitor-button" % self._cluster.cluster_id + df_url = f"https://digitalfactory.ultimaker.com/app/jobs/{self._cluster.cluster_id}?utm_source=cura&utm_medium=software&utm_campaign=monitor-button" message.pyQtActionTriggered.connect(lambda message, action: (QDesktopServices.openUrl(QUrl(df_url)), message.hide())) message.show() From e31ec31f344d82f5ca8471f4d618c3276a49ef26 Mon Sep 17 00:00:00 2001 From: Konstantinos Karmas Date: Tue, 13 Jul 2021 09:59:05 +0200 Subject: [PATCH 4/5] Make the lifetime of the "print job sent" message 30s Previously it was 5s and the message would disappear before the user had a chance to press the "Monitor print" button. CURA-8018 --- .../src/Messages/PrintJobUploadSuccessMessage.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadSuccessMessage.py b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadSuccessMessage.py index aa64f338dd..aa3d72ccd8 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadSuccessMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/PrintJobUploadSuccessMessage.py @@ -13,6 +13,5 @@ class PrintJobUploadSuccessMessage(Message): def __init__(self) -> None: super().__init__( text = I18N_CATALOG.i18nc("@info:status", "Print job was successfully sent to the printer."), - title = I18N_CATALOG.i18nc("@info:title", "Data Sent"), - lifetime = 5 + title = I18N_CATALOG.i18nc("@info:title", "Data Sent") ) From 329973adfbea675edd851548b7a6952bcbc42a73 Mon Sep 17 00:00:00 2001 From: Konstantinos Karmas Date: Tue, 13 Jul 2021 10:00:27 +0200 Subject: [PATCH 5/5] Capitalize only the first word in the message action CURA-8018 --- plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py index 86927a43d4..9eaa133ef5 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py @@ -258,7 +258,7 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice): self._progress.hide() message = PrintJobUploadSuccessMessage() message.addAction("monitor print", - name=I18N_CATALOG.i18nc("@action:button", "Monitor Print"), + name=I18N_CATALOG.i18nc("@action:button", "Monitor print"), icon="", description=I18N_CATALOG.i18nc("@action:tooltip", "Track the print in Ultimaker Digital Factory"), button_align=message.ActionButtonAlignment.ALIGN_RIGHT)