mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-13 09:47:50 -06:00
Move message triggering into CloudOutputDevice so that the campaign link can include the cluster_id.
CURA-9221
This commit is contained in:
parent
119fb32681
commit
9c599870e3
3 changed files with 8 additions and 5 deletions
|
@ -16,7 +16,6 @@ from cura.CuraApplication import CuraApplication
|
||||||
from cura.UltimakerCloud import UltimakerCloudConstants
|
from cura.UltimakerCloud import UltimakerCloudConstants
|
||||||
from cura.UltimakerCloud.UltimakerCloudScope import UltimakerCloudScope
|
from cura.UltimakerCloud.UltimakerCloudScope import UltimakerCloudScope
|
||||||
from .ToolPathUploader import ToolPathUploader
|
from .ToolPathUploader import ToolPathUploader
|
||||||
from ..Messages.PrintJobAwaitingApprovalMessage import PrintJobPendingApprovalMessage
|
|
||||||
from ..Models.BaseModel import BaseModel
|
from ..Models.BaseModel import BaseModel
|
||||||
from ..Models.Http.CloudClusterResponse import CloudClusterResponse
|
from ..Models.Http.CloudClusterResponse import CloudClusterResponse
|
||||||
from ..Models.Http.CloudClusterStatus import CloudClusterStatus
|
from ..Models.Http.CloudClusterStatus import CloudClusterStatus
|
||||||
|
@ -202,7 +201,6 @@ class CloudApiClient:
|
||||||
if "data" in response:
|
if "data" in response:
|
||||||
data = response["data"]
|
data = response["data"]
|
||||||
if "status" in data and data["status"] == "wait_approval":
|
if "status" in data and data["status"] == "wait_approval":
|
||||||
PrintJobPendingApprovalMessage().show()
|
|
||||||
on_finished_empty = cast(Callable[[List], Any], on_finished)
|
on_finished_empty = cast(Callable[[List], Any], on_finished)
|
||||||
on_finished_empty([])
|
on_finished_empty([])
|
||||||
elif isinstance(data, list):
|
elif isinstance(data, list):
|
||||||
|
|
|
@ -21,6 +21,7 @@ from cura.PrinterOutput.PrinterOutputDevice import ConnectionType
|
||||||
|
|
||||||
from .CloudApiClient import CloudApiClient
|
from .CloudApiClient import CloudApiClient
|
||||||
from ..ExportFileJob import ExportFileJob
|
from ..ExportFileJob import ExportFileJob
|
||||||
|
from ..Messages.PrintJobAwaitingApprovalMessage import PrintJobPendingApprovalMessage
|
||||||
from ..UltimakerNetworkedPrinterOutputDevice import UltimakerNetworkedPrinterOutputDevice
|
from ..UltimakerNetworkedPrinterOutputDevice import UltimakerNetworkedPrinterOutputDevice
|
||||||
from ..Messages.PrintJobUploadBlockedMessage import PrintJobUploadBlockedMessage
|
from ..Messages.PrintJobUploadBlockedMessage import PrintJobUploadBlockedMessage
|
||||||
from ..Messages.PrintJobUploadErrorMessage import PrintJobUploadErrorMessage
|
from ..Messages.PrintJobUploadErrorMessage import PrintJobUploadErrorMessage
|
||||||
|
@ -271,6 +272,8 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice):
|
||||||
message.pyQtActionTriggered.connect(lambda message, action: (QDesktopServices.openUrl(QUrl(df_url)), message.hide()))
|
message.pyQtActionTriggered.connect(lambda message, action: (QDesktopServices.openUrl(QUrl(df_url)), message.hide()))
|
||||||
|
|
||||||
message.show()
|
message.show()
|
||||||
|
else:
|
||||||
|
PrintJobPendingApprovalMessage(self._cluster.cluster_id).show()
|
||||||
|
|
||||||
self.writeFinished.emit()
|
self.writeFinished.emit()
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ I18N_CATALOG = i18nCatalog("cura")
|
||||||
class PrintJobPendingApprovalMessage(Message):
|
class PrintJobPendingApprovalMessage(Message):
|
||||||
"""Message shown when waiting for approval on an uploaded print job."""
|
"""Message shown when waiting for approval on an uploaded print job."""
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self, cluster_id: str) -> None:
|
||||||
super().__init__(
|
super().__init__(
|
||||||
text = I18N_CATALOG.i18nc("@info:status", "You will receive a confirmation via email when the print job is approved"),
|
text = I18N_CATALOG.i18nc("@info:status", "You will receive a confirmation via email when the print job is approved"),
|
||||||
title=I18N_CATALOG.i18nc("@info:title", "The print job was successfully submitted"),
|
title=I18N_CATALOG.i18nc("@info:title", "The print job was successfully submitted"),
|
||||||
|
@ -27,10 +27,12 @@ class PrintJobPendingApprovalMessage(Message):
|
||||||
|
|
||||||
self.actionTriggered.connect(self._onActionTriggered)
|
self.actionTriggered.connect(self._onActionTriggered)
|
||||||
|
|
||||||
|
self.cluster_id = cluster_id
|
||||||
|
|
||||||
def _onActionTriggered(self, message: Message, action: str) -> None:
|
def _onActionTriggered(self, message: Message, action: str) -> None:
|
||||||
""" Callback function for the "Manage print jobs" button on the pending approval notification. """
|
""" Callback function for the "Manage print jobs" button on the pending approval notification. """
|
||||||
match action:
|
match action:
|
||||||
case "manage_print_jobs":
|
case "manage_print_jobs":
|
||||||
QDesktopServices.openUrl(QUrl("https://digitalfactory.ultimaker.com/app/jobs/"))
|
QDesktopServices.openUrl(QUrl(f"https://digitalfactory.ultimaker.com/app/jobs/{self._cluster.cluster_id}?utm_source=cura&utm_medium=software&utm_campaign=message-printjob-sent"))
|
||||||
case "learn_more":
|
case "learn_more":
|
||||||
QDesktopServices.openUrl(QUrl("https://support.ultimaker.com/hc/en-us/articles/5329940078620"))
|
QDesktopServices.openUrl(QUrl("https://support.ultimaker.com/hc/en-us/articles/5329940078620?utm_source=cura&utm_medium=software&utm_campaign=message-printjob-sent"))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue