diff options
author | casper <c.lamboo@ultimaker.com> | 2021-12-03 19:19:18 +0300 |
---|---|---|
committer | casper <c.lamboo@ultimaker.com> | 2021-12-03 19:19:18 +0300 |
commit | 4c570c87e9388d9d7b01c6bf70da448aa73a6d2c (patch) | |
tree | 22c95fb66eb08023b120628fc3563df10915135e | |
parent | 743ac67cdb27559d779703510d97839552d11a79 (diff) |
Make sure recently installed packages only appear once in package list
Some packages might be added to both `getPackagesToInstall` and
`getAllInstalledPackagesInfo`
cura 8587
-rw-r--r-- | cura/CuraPackageManager.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/cura/CuraPackageManager.py b/cura/CuraPackageManager.py index e6123c1947..6c62442758 100644 --- a/cura/CuraPackageManager.py +++ b/cura/CuraPackageManager.py @@ -68,16 +68,24 @@ class CuraPackageManager(PackageManager): def iterateAllLocalPackages(self) -> Generator[Dict[str, Any], None, None]: """ A generator which returns an unordered list of all the PackageModels""" + handled_packages = set() for packages in self.getAllInstalledPackagesInfo().values(): for package_info in packages: - yield package_info + if not handled_packages.__contains__(package_info["package_id"]): + handled_packages.add(package_info["package_id"]) + yield package_info # Get all to be removed package_info's. These packages are still used in the current session so the user might # still want to interact with these. for package_data in self.getPackagesToRemove().values(): - yield package_data["package_info"] + for package_data in self.getPackagesToRemove().values(): + if not handled_packages.__contains__(package_data["package_info"]["package_id"]): + handled_packages.add(package_data["package_info"]["package_id"]) + yield package_data["package_info"] # Get all to be installed package_info's. Since the user might want to interact with these for package_data in self.getPackagesToInstall().values(): - yield package_data["package_info"] + if not handled_packages.__contains__(package_data["package_info"]["package_id"]): + handled_packages.add(package_data["package_info"]["package_id"]) + yield package_data["package_info"]
\ No newline at end of file |