Filter already installed packages from the install listviews

Contributes to: CURA-8587
This commit is contained in:
Jelle Spijker 2021-12-01 17:35:56 +01:00
parent 09bc28d840
commit 02e2e0a1c6
No known key found for this signature in database
GPG key ID: 6662DC033BE6B99A
4 changed files with 6 additions and 6 deletions

View file

@ -31,6 +31,7 @@ class RemotePackageList(PackageList):
self._request_url = self._initialRequestUrl()
self.isLoadingChanged.connect(self._onLoadingChanged)
self.isLoadingChanged.emit()
self._locally_installed = { p["package_id"] for p in self._manager.locally_installed_packages }
def __del__(self) -> None:
"""
@ -128,6 +129,8 @@ class RemotePackageList(PackageList):
return
for package_data in response_data["data"]:
if package_data["package_id"] in self._locally_installed:
continue # We should only show packages which are not already installed
try:
package = PackageModel(package_data, parent = self)
self.appendItem({"package": package}) # Add it to this list model.