Don't show download count for bundled plug-ins

I considered rewriting the section title property to be QML-only and translate it from the QML, but this is a bit simpler in the end, even though there is data duplication now.

Contributes to issue CURA-8565.
This commit is contained in:
Ghostkeeper 2021-11-30 14:42:12 +01:00 committed by Jelle Spijker
parent ecc3760e8e
commit 8162bdcfa8
No known key found for this signature in database
GPG key ID: 6662DC033BE6B99A

View file

@ -17,10 +17,11 @@ class PackageModel(QObject):
QML. The model can also be constructed directly from a response received by the API.
"""
def __init__(self, package_data: Dict[str, Any], section_title: Optional[str] = None, parent: Optional[QObject] = None) -> None:
def __init__(self, package_data: Dict[str, Any], installation_status: str, section_title: Optional[str] = None, parent: Optional[QObject] = None) -> None:
"""
Constructs a new model for a single package.
:param package_data: The data received from the Marketplace API about the package to create.
:param installation_status: Whether the package is `not_installed`, `installed` or `bundled`.
:param section_title: If the packages are to be categorized per section provide the section_title
:param parent: The parent QML object that controls the lifetime of this model (normally a PackageList).
"""
@ -48,6 +49,7 @@ class PackageModel(QObject):
if not self._icon_url or self._icon_url == "":
self._icon_url = author_data.get("icon_url", "")
self._installation_status = installation_status
self._section_title = section_title
# Note that there's a lot more info in the package_data than just these specified here.
@ -95,6 +97,10 @@ class PackageModel(QObject):
def authorInfoUrl(self):
return self._author_info_url
@pyqtProperty(str, constant = True)
def installationStatus(self) -> str:
return self._installation_status
@pyqtProperty(str, constant = True)
def sectionTitle(self) -> Optional[str]:
return self._section_title