diff options
author | Jelle Spijker <spijker.jelle@gmail.com> | 2021-12-15 18:38:54 +0300 |
---|---|---|
committer | Jelle Spijker <spijker.jelle@gmail.com> | 2021-12-15 18:38:54 +0300 |
commit | 9e1e98bdbd053d70d50f796c4204498f59dd0c1c (patch) | |
tree | 0b549f12c29554b3f0c96e34d292730c9f3541e1 /cura | |
parent | c66e17dd9e52987ff75b708557e9037f4d9d66f2 (diff) |
Revert "Show install button after package has been uninstalled"
This reverts commit c66e17dd9e52987ff75b708557e9037f4d9d66f2.
Diffstat (limited to 'cura')
-rw-r--r-- | cura/CuraPackageManager.py | 32 |
1 files changed, 10 insertions, 22 deletions
diff --git a/cura/CuraPackageManager.py b/cura/CuraPackageManager.py index 2a016bdf6e..313653c8a0 100644 --- a/cura/CuraPackageManager.py +++ b/cura/CuraPackageManager.py @@ -19,23 +19,11 @@ if TYPE_CHECKING: class CuraPackageManager(PackageManager): def __init__(self, application: "QtApplication", parent: Optional["QObject"] = None) -> None: super().__init__(application, parent) - self._local_packages: Optional[Dict[str, Dict[str, Any]]] = None - self._local_packages_installed: Optional[Dict[str, Dict[str, Any]]] = None - self._local_packages_to_remove: Optional[Dict[str, Dict[str, Any]]] = None - self._local_packages_to_install: Optional[Dict[str, Dict[str, Any]]] = None - self.installedPackagesChanged.connect(self._updateLocalPackages) def _updateLocalPackages(self) -> None: - self._local_packages_installed = dict([(package_info["package_id"], dict(package_info)) for package in self.getAllInstalledPackagesInfo().values() for package_info in package]) - self._local_packages_to_remove = dict([(package["package_info"]["package_id"], dict(package["package_info"])) for package in self.getPackagesToRemove().values()]) - self._local_packages_to_install = dict([(package["package_info"]["package_id"], dict(package["package_info"])) for package in self.getPackagesToInstall().values()]) - - self._local_packages = {} - self._local_packages.update(self._local_packages_installed) - self._local_packages.update(self._local_packages_to_remove) - self._local_packages.update(self._local_packages_to_install) + self._local_packages = self.getAllLocalPackages() @property def local_packages(self) -> List[Dict[str, Any]]: @@ -55,15 +43,6 @@ class CuraPackageManager(PackageManager): # It's guaranteed to be a list now. return set(self._local_packages.keys()) - @property - def installed_packages_ids(self) -> Set[str]: - """locally installed packages, lazy execution""" - if self._local_packages is None: - self._updateLocalPackages() - # _updateLocalPackages always results in a list of packages, not None. - # It's guaranteed to be a list now. - return set(self._local_packages_installed.keys()) - def initialize(self) -> None: self._installation_dirs_dict["materials"] = Resources.getStoragePath(CuraApplication.ResourceTypes.MaterialInstanceContainer) self._installation_dirs_dict["qualities"] = Resources.getStoragePath(CuraApplication.ResourceTypes.QualityInstanceContainer) @@ -93,3 +72,12 @@ class CuraPackageManager(PackageManager): machine_with_qualities.append((global_stack, str(extruder_nr), container_id)) return machine_with_materials, machine_with_qualities + + def getAllLocalPackages(self) -> Dict[str, Dict[str, Any]]: + """ returns an unordered list of all the package_info installed, to be installed or to be returned""" + + packages = dict([(package_info["package_id"], dict(package_info)) for package in self.getAllInstalledPackagesInfo().values() for package_info in package]) + packages.update([(package["package_info"]["package_id"], dict(package["package_info"])) for package in self.getPackagesToRemove().values()]) + packages.update([(package["package_info"]["package_id"], dict(package["package_info"])) for package in self.getPackagesToInstall().values()]) + + return packages |