From d4c4b11927f5457509a9c13ae078a025d74d9cca Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 1 Oct 2021 11:38:13 +0200 Subject: [PATCH 1/5] Update the copy of the connect to cloud message CURA-8601 --- .../src/Messages/CloudFlowMessage.py | 31 ++++++++----------- .../LocalClusterOutputDeviceManager.py | 3 +- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/Messages/CloudFlowMessage.py b/plugins/UM3NetworkPrinting/src/Messages/CloudFlowMessage.py index c453537d81..58c4dacf03 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/CloudFlowMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/CloudFlowMessage.py @@ -15,27 +15,22 @@ I18N_CATALOG = i18nCatalog("cura") class CloudFlowMessage(Message): - def __init__(self, address: str) -> None: - - image_path = os.path.join( - CuraApplication.getInstance().getPluginRegistry().getPluginPath("UM3NetworkPrinting") or "", - "resources", "svg", "cloud-flow-start.svg" - ) + def __init__(self, printer_name: str) -> None: super().__init__( text=I18N_CATALOG.i18nc("@info:status", - "Send and monitor print jobs from anywhere using your Ultimaker account."), - lifetime=0, - dismissable=True, - option_state=False, - image_source=QUrl.fromLocalFile(image_path), - image_caption=I18N_CATALOG.i18nc("@info:status Ultimaker Cloud should not be translated.", - "Connect to Ultimaker Digital Factory"), + f"Your printer {printer_name} could be connected via cloud.\n Manage your print queue and monitor your prints from anywhere connecting your printer to Digital Factory"), + title=I18N_CATALOG.i18nc("@info:title", "Are you ready for cloud printing?") ) - self._address = address - self.addAction("", I18N_CATALOG.i18nc("@action", "Get started"), "", "") + self._printer_name = printer_name + self.addAction("get_started", I18N_CATALOG.i18nc("@action", "Get started"), "", "") + self.addAction("learn_more", I18N_CATALOG.i18nc("@action", "Learn more"), "", "", button_style=Message.ActionButtonStyle.LINK, button_align=Message.ActionButtonAlignment.ALIGN_LEFT) + self.actionTriggered.connect(self._onCloudFlowStarted) - def _onCloudFlowStarted(self, messageId: str, actionId: str) -> None: - QDesktopServices.openUrl(QUrl("http://{}/cloud_connect".format(self._address))) - self.hide() + def _onCloudFlowStarted(self, message_id: str, action_id: str) -> None: + if action_id == "get_started": + QDesktopServices.openUrl(QUrl("https://digitalfactory.ultimaker.com/app/printers?add_printer=true&utm_source=cura&utm_medium=software&utm_campaign=message-networkprinter-added")) + self.hide() + else: + QDesktopServices.openUrl(QUrl("https://support.ultimaker.com/hc/en-us/articles/360012019239?utm_source=cura&utm_medium=software&utm_campaign=add-cloud-printer")) diff --git a/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py b/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py index e79709d3dc..0cd5304cf9 100644 --- a/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py +++ b/plugins/UM3NetworkPrinting/src/Network/LocalClusterOutputDeviceManager.py @@ -52,7 +52,6 @@ class LocalClusterOutputDeviceManager: def start(self) -> None: """Start the network discovery.""" - self._zero_conf_client.start() for address in self._getStoredManualAddresses(): self.addManualDevice(address) @@ -292,4 +291,4 @@ class LocalClusterOutputDeviceManager: if not CuraApplication.getInstance().getCuraAPI().account.isLoggedIn: # Do not show the message if the user is not signed in. return - CloudFlowMessage(device.ipAddress).show() + CloudFlowMessage(device.name).show() From 6bc9aaa4bf2d8b5ad69c64c0cf081da527788ef7 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 1 Oct 2021 11:54:27 +0200 Subject: [PATCH 2/5] Add message type to cloud CURA-8601 --- plugins/UM3NetworkPrinting/src/Messages/CloudFlowMessage.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/src/Messages/CloudFlowMessage.py b/plugins/UM3NetworkPrinting/src/Messages/CloudFlowMessage.py index 58c4dacf03..692b52a0ba 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/CloudFlowMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/CloudFlowMessage.py @@ -20,7 +20,8 @@ class CloudFlowMessage(Message): super().__init__( text=I18N_CATALOG.i18nc("@info:status", f"Your printer {printer_name} could be connected via cloud.\n Manage your print queue and monitor your prints from anywhere connecting your printer to Digital Factory"), - title=I18N_CATALOG.i18nc("@info:title", "Are you ready for cloud printing?") + title=I18N_CATALOG.i18nc("@info:title", "Are you ready for cloud printing?"), + message_type=Message.MessageType.CLOUD ) self._printer_name = printer_name self.addAction("get_started", I18N_CATALOG.i18nc("@action", "Get started"), "", "") From dc7a45eacfeb5e5cb22a72143ef78f2fb3e1087f Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 1 Oct 2021 16:51:39 +0200 Subject: [PATCH 3/5] Remove cloud-flow-start icon It wasn't used anymore CURA-8601 --- .../resources/svg/cloud-flow-start.svg | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 plugins/UM3NetworkPrinting/resources/svg/cloud-flow-start.svg diff --git a/plugins/UM3NetworkPrinting/resources/svg/cloud-flow-start.svg b/plugins/UM3NetworkPrinting/resources/svg/cloud-flow-start.svg deleted file mode 100644 index 746dc269fd..0000000000 --- a/plugins/UM3NetworkPrinting/resources/svg/cloud-flow-start.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - Cloud_connection-icon - Created with Sketch. - - - - - - - - \ No newline at end of file From 527de2b6ef4ac47855d54ecea295d4d5b8d3fb35 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 5 Oct 2021 10:20:52 +0200 Subject: [PATCH 4/5] Use image instead of custom message type CURA-8601 --- .../resources/svg/CloudPlatform.svg | 353 ++++++++++++++++++ .../src/Messages/CloudFlowMessage.py | 7 +- resources/themes/cura-light/theme.json | 2 +- 3 files changed, 359 insertions(+), 3 deletions(-) create mode 100644 plugins/UM3NetworkPrinting/resources/svg/CloudPlatform.svg diff --git a/plugins/UM3NetworkPrinting/resources/svg/CloudPlatform.svg b/plugins/UM3NetworkPrinting/resources/svg/CloudPlatform.svg new file mode 100644 index 0000000000..5da9f17bbf --- /dev/null +++ b/plugins/UM3NetworkPrinting/resources/svg/CloudPlatform.svg @@ -0,0 +1,353 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/UM3NetworkPrinting/src/Messages/CloudFlowMessage.py b/plugins/UM3NetworkPrinting/src/Messages/CloudFlowMessage.py index 692b52a0ba..3ef5a6bf43 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/CloudFlowMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/CloudFlowMessage.py @@ -16,12 +16,15 @@ I18N_CATALOG = i18nCatalog("cura") class CloudFlowMessage(Message): def __init__(self, printer_name: str) -> None: - + image_path = os.path.join( + CuraApplication.getInstance().getPluginRegistry().getPluginPath("UM3NetworkPrinting") or "", + "resources", "svg", "CloudPlatform.svg" + ) super().__init__( text=I18N_CATALOG.i18nc("@info:status", f"Your printer {printer_name} could be connected via cloud.\n Manage your print queue and monitor your prints from anywhere connecting your printer to Digital Factory"), title=I18N_CATALOG.i18nc("@info:title", "Are you ready for cloud printing?"), - message_type=Message.MessageType.CLOUD + image_source=QUrl.fromLocalFile(image_path) ) self._printer_name = printer_name self.addAction("get_started", I18N_CATALOG.i18nc("@action", "Get started"), "", "") diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index daa12b3390..78676da926 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -626,7 +626,7 @@ "message_close": [1, 1], "message_radius": [0.25, 0.25], "message_action_button": [0, 2.5], - "message_image": [15.0, 5.0], + "message_image": [15.0, 10.0], "message_type_icon": [2, 2], "infill_button_margin": [0.5, 0.5], From 501b4c4fde1d28520c03f249ee86487c5fed43b7 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Tue, 5 Oct 2021 13:54:13 +0200 Subject: [PATCH 5/5] Spaces around assignment operator According to UM codestyle Contributes to CURA-8601 --- .../UM3NetworkPrinting/src/Messages/CloudFlowMessage.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/UM3NetworkPrinting/src/Messages/CloudFlowMessage.py b/plugins/UM3NetworkPrinting/src/Messages/CloudFlowMessage.py index 3ef5a6bf43..34687339a9 100644 --- a/plugins/UM3NetworkPrinting/src/Messages/CloudFlowMessage.py +++ b/plugins/UM3NetworkPrinting/src/Messages/CloudFlowMessage.py @@ -21,14 +21,14 @@ class CloudFlowMessage(Message): "resources", "svg", "CloudPlatform.svg" ) super().__init__( - text=I18N_CATALOG.i18nc("@info:status", + text = I18N_CATALOG.i18nc("@info:status", f"Your printer {printer_name} could be connected via cloud.\n Manage your print queue and monitor your prints from anywhere connecting your printer to Digital Factory"), - title=I18N_CATALOG.i18nc("@info:title", "Are you ready for cloud printing?"), - image_source=QUrl.fromLocalFile(image_path) + title = I18N_CATALOG.i18nc("@info:title", "Are you ready for cloud printing?"), + image_source = QUrl.fromLocalFile(image_path) ) self._printer_name = printer_name self.addAction("get_started", I18N_CATALOG.i18nc("@action", "Get started"), "", "") - self.addAction("learn_more", I18N_CATALOG.i18nc("@action", "Learn more"), "", "", button_style=Message.ActionButtonStyle.LINK, button_align=Message.ActionButtonAlignment.ALIGN_LEFT) + self.addAction("learn_more", I18N_CATALOG.i18nc("@action", "Learn more"), "", "", button_style = Message.ActionButtonStyle.LINK, button_align = Message.ActionButtonAlignment.ALIGN_LEFT) self.actionTriggered.connect(self._onCloudFlowStarted)