diff options
author | c.lamboo <casperlamboo@gmail.com> | 2022-06-02 18:33:56 +0300 |
---|---|---|
committer | c.lamboo <casperlamboo@gmail.com> | 2022-06-02 18:33:56 +0300 |
commit | 8fe53163b3263e58d85dd860b37bce7e746dac29 (patch) | |
tree | 5158f65a8a99e4448356ac90f2a43f46eb295060 /plugins/3MFReader | |
parent | a506b6d9adc5dae13409067ea2bffe6684df6d45 (diff) |
Add Action button and learn more link to warning message
CURA-6990
Diffstat (limited to 'plugins/3MFReader')
-rw-r--r-- | plugins/3MFReader/WorkspaceDialog.py | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/plugins/3MFReader/WorkspaceDialog.py b/plugins/3MFReader/WorkspaceDialog.py index 55261480a0..30a2a39465 100644 --- a/plugins/3MFReader/WorkspaceDialog.py +++ b/plugins/3MFReader/WorkspaceDialog.py @@ -2,7 +2,9 @@ # Cura is released under the terms of the LGPLv3 or higher. from typing import List, Optional, Dict, cast -from PyQt6.QtCore import pyqtSignal, QObject, pyqtProperty, QCoreApplication +from PyQt6.QtCore import pyqtSignal, QObject, pyqtProperty, QCoreApplication, QUrl +from PyQt6.QtGui import QDesktopServices + from UM.FlameProfiler import pyqtSlot from UM.PluginRegistry import PluginRegistry from UM.Application import Application @@ -387,8 +389,33 @@ class WorkspaceDialog(QObject): title=i18n_catalog.i18nc("@info:title", "Material profiles not installed"), message_type=Message.MessageType.WARNING ) + result_message.addAction( + "learn_more", + name=i18n_catalog.i18nc("@action:button", "Learn more"), + icon="", + description="Learn more about project materials.", + button_align=Message.ActionButtonAlignment.ALIGN_LEFT, + button_style=Message.ActionButtonStyle.LINK + ) + result_message.addAction( + "install_materials", + name=i18n_catalog.i18nc("@action:button", "Install Materials"), + icon="", + description="Install missing materials from project file.", + button_align=Message.ActionButtonAlignment.ALIGN_RIGHT, + button_style=Message.ActionButtonStyle.DEFAULT + ) + result_message.actionTriggered.connect(self._onMessageActionTriggered) result_message.show() + def _onMessageActionTriggered(self, message: Message, sync_message_action: str): + if sync_message_action == "install_materials": + self.installMissingPackages() + message.hide() + elif sync_message_action == "learn_more": + QDesktopServices.openUrl(QUrl("https://support.ultimaker.com/hc/en-us/articles/360011968360-Using-the-Ultimaker-Marketplace")) + + def __show(self) -> None: if self._view is None: self._createViewFromQML() |