Welcome to mirror list, hosted at ThFree Co, Russian Federation.

PrintJobAwaitingApprovalMessage.py « Messages « src « UM3NetworkPrinting « plugins - github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2e015dd46fa0ec55ae0ad3be8a10f0400c74db59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Copyright (c) 2022 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from PyQt6.QtCore import QUrl
from PyQt6.QtGui import QDesktopServices

from UM import i18nCatalog
from UM.Message import Message


I18N_CATALOG = i18nCatalog("cura")


class PrintJobPendingApprovalMessage(Message):
    """Message shown when waiting for approval on an uploaded print job."""

    def __init__(self) -> None:
        super().__init__(
            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"),
            message_type=Message.MessageType.POSITIVE
        )
        self.addAction("manage_print_jobs", I18N_CATALOG.i18nc("@action", "Manage print jobs"), "", "")

        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._onActionTriggered)

    def _onActionTriggered(self, message: Message, action: str) -> None:
        """ Callback function for the "Manage print jobs" button on the pending approval notification. """
        match action:
            case "manage_print_jobs":
                QDesktopServices.openUrl(QUrl("https://digitalfactory.ultimaker.com/app/jobs/"))
            case "learn_more":
                QDesktopServices.openUrl(QUrl("https://support.ultimaker.com/hc/en-us/articles/5329940078620"))