diff options
author | c.lamboo <casperlamboo@gmail.com> | 2022-06-06 23:49:49 +0300 |
---|---|---|
committer | c.lamboo <casperlamboo@gmail.com> | 2022-06-06 23:49:49 +0300 |
commit | 76180eee011c4c51ec88c83913b399ba700fb268 (patch) | |
tree | 4869d481c6a1dce312b751fc34c165571761730a /plugins | |
parent | bee4da63681cb38c25b593456409fe6cf8a50777 (diff) |
Show warning on-close of the install missing packaged dialogCURA-6990
CURA-6990
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/3MFReader/WorkspaceDialog.py | 2 | ||||
-rw-r--r-- | plugins/Marketplace/InstallMissingPackagesDialog.py | 16 | ||||
-rw-r--r-- | plugins/Marketplace/resources/qml/InstallMissingPackagesDialog.qml | 2 |
3 files changed, 16 insertions, 4 deletions
diff --git a/plugins/3MFReader/WorkspaceDialog.py b/plugins/3MFReader/WorkspaceDialog.py index e3cbef607a..419f1fe69c 100644 --- a/plugins/3MFReader/WorkspaceDialog.py +++ b/plugins/3MFReader/WorkspaceDialog.py @@ -292,7 +292,7 @@ class WorkspaceDialog(QObject): @pyqtSlot() def installMissingPackages(self) -> None: - self._install_missing_package_dialog = InstallMissingPackageDialog(self._missing_package_metadata) + self._install_missing_package_dialog = InstallMissingPackageDialog(self._missing_package_metadata, self.showMissingMaterialsWarning) self._install_missing_package_dialog.show() def getResult(self) -> Dict[str, Optional[str]]: diff --git a/plugins/Marketplace/InstallMissingPackagesDialog.py b/plugins/Marketplace/InstallMissingPackagesDialog.py index 3ed46959dd..282dc54492 100644 --- a/plugins/Marketplace/InstallMissingPackagesDialog.py +++ b/plugins/Marketplace/InstallMissingPackagesDialog.py @@ -1,17 +1,22 @@ import os -from PyQt6.QtCore import QObject, pyqtSignal, pyqtProperty -from typing import Optional, List, Dict, cast +from PyQt6.QtCore import QObject, pyqtSignal, pyqtProperty, QUrl +from PyQt6.QtGui import QDesktopServices +from typing import Optional, List, Dict, cast, Callable from cura.CuraApplication import CuraApplication from UM.PluginRegistry import PluginRegistry from cura.CuraPackageManager import CuraPackageManager +from UM.Message import Message +from UM.i18n import i18nCatalog +from UM.FlameProfiler import pyqtSlot from plugins.Marketplace.MissingPackageList import MissingPackageList +i18n_catalog = i18nCatalog("cura") class InstallMissingPackageDialog(QObject): """Dialog used to display packages that need to be installed to load 3mf file materials""" - def __init__(self, packages_metadata: List[Dict[str, str]]) -> None: + def __init__(self, packages_metadata: List[Dict[str, str]], show_missing_materials_warning: Callable[[], None]) -> None: """Initialize :param packages_metadata: List of dictionaries containing information about missing packages. @@ -27,6 +32,7 @@ class InstallMissingPackageDialog(QObject): self._package_metadata: List[Dict[str, str]] = packages_metadata self._package_model: MissingPackageList = MissingPackageList(packages_metadata) + self._show_missing_materials_warning = show_missing_materials_warning def show(self) -> None: plugin_path = self._plugin_registry.getPluginPath("Marketplace") @@ -54,3 +60,7 @@ class InstallMissingPackageDialog(QObject): @pyqtProperty(QObject) def model(self) -> MissingPackageList: return self._package_model + + @pyqtSlot() + def showMissingMaterialsWarning(self) -> None: + self._show_missing_materials_warning() diff --git a/plugins/Marketplace/resources/qml/InstallMissingPackagesDialog.qml b/plugins/Marketplace/resources/qml/InstallMissingPackagesDialog.qml index f08fed4f85..edad18f1a8 100644 --- a/plugins/Marketplace/resources/qml/InstallMissingPackagesDialog.qml +++ b/plugins/Marketplace/resources/qml/InstallMissingPackagesDialog.qml @@ -16,4 +16,6 @@ Marketplace pageContentsSource: "MissingPackages.qml" showSearchHeader: false showOnboadBanner: false + + onClosing: manager.showMissingMaterialsWarning() } |