From 812b728636cc6e8437c56b4f4b6cb3da6439b2df Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Thu, 2 Jun 2022 15:36:53 +0200 Subject: [PATCH] Show warning when opening file without installing missing materials CURA-6990 --- plugins/3MFReader/WorkspaceDialog.py | 11 +++++++++++ plugins/3MFReader/WorkspaceDialog.qml | 5 ++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/plugins/3MFReader/WorkspaceDialog.py b/plugins/3MFReader/WorkspaceDialog.py index 56bc9e2fcc..55261480a0 100644 --- a/plugins/3MFReader/WorkspaceDialog.py +++ b/plugins/3MFReader/WorkspaceDialog.py @@ -11,6 +11,7 @@ from UM.Settings.ContainerRegistry import ContainerRegistry from cura.Settings.GlobalStack import GlobalStack from plugins.Marketplace.InstallMissingPackagesDialog import InstallMissingPackageDialog from .UpdatableMachinesModel import UpdatableMachinesModel +from UM.Message import Message import os import threading @@ -378,6 +379,16 @@ class WorkspaceDialog(QObject): time.sleep(1 / 50) QCoreApplication.processEvents() # Ensure that the GUI does not freeze. + @pyqtSlot() + def showMissingMaterialsWarning(self) -> None: + result_message = Message( + i18n_catalog.i18nc("@info:status", "The material used in this project relies on some material definitions not available in Cura, this might produce undesirable print results. We highly recommend installing the full material package from the Marketplace."), + lifetime=0, + title=i18n_catalog.i18nc("@info:title", "Material profiles not installed"), + message_type=Message.MessageType.WARNING + ) + result_message.show() + def __show(self) -> None: if self._view is None: self._createViewFromQML() diff --git a/plugins/3MFReader/WorkspaceDialog.qml b/plugins/3MFReader/WorkspaceDialog.qml index f6048f8324..de0f5c8acd 100644 --- a/plugins/3MFReader/WorkspaceDialog.qml +++ b/plugins/3MFReader/WorkspaceDialog.qml @@ -463,7 +463,10 @@ UM.Dialog { visible: buttonWarning text: catalog.i18nc("@action:button", "Open project anyway") - onClicked: reject() + onClicked: { + manager.showMissingMaterialsWarning(); + accept(); + } }, Cura.PrimaryButton {