Update the copy of the connect to cloud message

CURA-8601
This commit is contained in:
Jaime van Kessel 2021-10-01 11:38:13 +02:00
parent d296531ffa
commit d4c4b11927
2 changed files with 14 additions and 20 deletions

View file

@ -15,27 +15,22 @@ I18N_CATALOG = i18nCatalog("cura")
class CloudFlowMessage(Message): class CloudFlowMessage(Message):
def __init__(self, address: str) -> None: def __init__(self, printer_name: str) -> None:
image_path = os.path.join(
CuraApplication.getInstance().getPluginRegistry().getPluginPath("UM3NetworkPrinting") or "",
"resources", "svg", "cloud-flow-start.svg"
)
super().__init__( super().__init__(
text=I18N_CATALOG.i18nc("@info:status", text=I18N_CATALOG.i18nc("@info:status",
"Send and monitor print jobs from anywhere using your Ultimaker account."), f"Your printer <b>{printer_name}</b> could be connected via cloud.\n Manage your print queue and monitor your prints from anywhere connecting your printer to Digital Factory"),
lifetime=0, title=I18N_CATALOG.i18nc("@info:title", "Are you ready for cloud printing?")
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"),
) )
self._address = address self._printer_name = printer_name
self.addAction("", I18N_CATALOG.i18nc("@action", "Get started"), "", "") 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) self.actionTriggered.connect(self._onCloudFlowStarted)
def _onCloudFlowStarted(self, messageId: str, actionId: str) -> None: def _onCloudFlowStarted(self, message_id: str, action_id: str) -> None:
QDesktopServices.openUrl(QUrl("http://{}/cloud_connect".format(self._address))) if action_id == "get_started":
self.hide() 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"))

View file

@ -52,7 +52,6 @@ class LocalClusterOutputDeviceManager:
def start(self) -> None: def start(self) -> None:
"""Start the network discovery.""" """Start the network discovery."""
self._zero_conf_client.start() self._zero_conf_client.start()
for address in self._getStoredManualAddresses(): for address in self._getStoredManualAddresses():
self.addManualDevice(address) self.addManualDevice(address)
@ -292,4 +291,4 @@ class LocalClusterOutputDeviceManager:
if not CuraApplication.getInstance().getCuraAPI().account.isLoggedIn: if not CuraApplication.getInstance().getCuraAPI().account.isLoggedIn:
# Do not show the message if the user is not signed in. # Do not show the message if the user is not signed in.
return return
CloudFlowMessage(device.ipAddress).show() CloudFlowMessage(device.name).show()