Move cloud flow message to correct folder

This commit is contained in:
ChrisTerBeke 2019-08-09 10:09:54 +02:00
parent 11ef53905b
commit 669e64afdb
2 changed files with 1 additions and 1 deletions

View file

@ -0,0 +1,41 @@
# Copyright (c) 2019 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
import os
from PyQt5.QtCore import QUrl
from PyQt5.QtGui import QDesktopServices
from UM import i18nCatalog
from UM.Message import Message
from cura.CuraApplication import CuraApplication
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"
)
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=image_path,
image_caption=I18N_CATALOG.i18nc("@info:status Ultimaker Cloud should not be translated.",
"Connect to Ultimaker Cloud"),
)
self._address = address
self.addAction("", I18N_CATALOG.i18nc("@action", "Get started"), "", "")
self.actionTriggered.connect(self._onCloudFlowStarted)
def _onCloudFlowStarted(self, messageId: str, actionId: str) -> None:
QDesktopServices.openUrl(QUrl("http://{}/cloud_connect".format(self._address)))
self.hide()