mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-07 05:53:59 -06:00
Filter already installed packages from the install listviews
Contributes to: CURA-8587
This commit is contained in:
parent
09bc28d840
commit
02e2e0a1c6
4 changed files with 6 additions and 6 deletions
|
@ -13,8 +13,6 @@ from UM.i18n import i18nCatalog
|
|||
from UM.TaskManagement.HttpRequestManager import HttpRequestManager
|
||||
from UM.Logger import Logger
|
||||
|
||||
from cura.CuraApplication import CuraApplication
|
||||
|
||||
from .PackageList import PackageList
|
||||
from .PackageModel import PackageModel
|
||||
from . import Marketplace
|
||||
|
@ -38,7 +36,6 @@ class LocalPackageList(PackageList):
|
|||
|
||||
def __init__(self, parent: Optional["QObject"] = None) -> None:
|
||||
super().__init__(parent)
|
||||
self._manager = CuraApplication.getInstance().getPackageManager()
|
||||
self._has_footer = False
|
||||
|
||||
@pyqtSlot()
|
||||
|
|
|
@ -26,6 +26,7 @@ class PackageList(ListModel):
|
|||
|
||||
def __init__(self, parent: Optional["QObject"] = None) -> None:
|
||||
super().__init__(parent)
|
||||
self._manager = CuraApplication.getInstance().getPackageManager()
|
||||
self._error_message = ""
|
||||
self.addRoleName(self.PackageRole, "package")
|
||||
self._is_loading = False
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue