diff options
author | Ghostkeeper <rubend@tutanota.com> | 2022-06-08 11:17:39 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2022-06-08 11:19:51 +0300 |
commit | 0f12b012cfa5bfd1f6b30828421e891289e029c3 (patch) | |
tree | e17b29a8ae56f3f47ee9109905a32988cddee1dc /plugins/Marketplace | |
parent | de8a58f0d7e2ca5cc9e4b7966d6a7d6201118b0b (diff) |
Create InstallMissingPackageDialog with newly-exposed function from Marketplace
This adds a new function to the API of the Marketplace plug-in.
It's not pretty, but it's going to be how it is for a while.
Done to fix a critical build issue. The 'import plugins' thing works from source but not on the build.
Diffstat (limited to 'plugins/Marketplace')
-rw-r--r-- | plugins/Marketplace/Marketplace.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/plugins/Marketplace/Marketplace.py b/plugins/Marketplace/Marketplace.py index e856245c3d..06fed6ec0b 100644 --- a/plugins/Marketplace/Marketplace.py +++ b/plugins/Marketplace/Marketplace.py @@ -3,15 +3,15 @@ import os.path from PyQt6.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject -from typing import Optional, cast +from typing import Callable, cast, Dict, List, Optional from cura.CuraApplication import CuraApplication # Creating QML objects and managing packages. - from UM.Extension import Extension # We are implementing the main object of an extension here. from UM.PluginRegistry import PluginRegistry # To find out where we are stored (the proper way). -from .RemotePackageList import RemotePackageList # To register this type with QML. +from .InstallMissingPackagesDialog import InstallMissingPackageDialog # To allow creating this dialogue from outside of the plug-in. from .LocalPackageList import LocalPackageList # To register this type with QML. +from .RemotePackageList import RemotePackageList # To register this type with QML. class Marketplace(Extension, QObject): @@ -118,3 +118,15 @@ class Marketplace(Extension, QObject): @pyqtProperty(bool, notify=showRestartNotificationChanged) def showRestartNotification(self) -> bool: return self._restart_needed + + def showInstallMissingPackageDialog(self, packages_metadata: List[Dict[str, str]], ignore_warning_callback: Callable[[], None]) -> None: + """ + Show a dialog that prompts the user to install certain packages. + + The dialog is worded for packages that are missing and required for a certain operation. + :param packages_metadata: The metadata of the packages that are missing. + :param ignore_warning_callback: A callback that gets executed when the user ignores the pop-up, to show them a + warning. + """ + dialog = InstallMissingPackageDialog(packages_metadata, ignore_warning_callback) + dialog.show() |