mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-02 00:34:26 +08:00
use differentiate icon for Ultimaker controlled material/plugin
Materials can be certified, while plugins can be verified. Added packageType to the model such that the card knows which icon to use. Contributes to CURA-8562
This commit is contained in:
parent
584411e59e
commit
eb3083c84d
@ -27,9 +27,11 @@ class PackageModel(QObject):
|
|||||||
"""
|
"""
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self._package_id = package_data.get("package_id", "UnknownPackageId")
|
self._package_id = package_data.get("package_id", "UnknownPackageId")
|
||||||
|
self._package_type = package_data.get("package_type", "")
|
||||||
self._icon_url = package_data.get("icon_url", "")
|
self._icon_url = package_data.get("icon_url", "")
|
||||||
self._display_name = package_data.get("display_name", catalog.i18nc("@label:property", "Unknown Package"))
|
self._display_name = package_data.get("display_name", catalog.i18nc("@label:property", "Unknown Package"))
|
||||||
self._is_verified = "verified" in package_data.get("tags", [])
|
tags = package_data.get("tags", [])
|
||||||
|
self._is_checked_by_ultimaker = "verified" in tags and self._package_type == "plugin" or "certified" in tags and self._package_type == "material"
|
||||||
self._package_version = package_data.get("package_version", "") # Display purpose, no need for 'UM.Version'.
|
self._package_version = package_data.get("package_version", "") # Display purpose, no need for 'UM.Version'.
|
||||||
self._package_info_url = package_data.get("website", "") # Not to be confused with 'download_url'.
|
self._package_info_url = package_data.get("website", "") # Not to be confused with 'download_url'.
|
||||||
self._download_count = package_data.get("download_count", 0)
|
self._download_count = package_data.get("download_count", 0)
|
||||||
@ -49,6 +51,10 @@ class PackageModel(QObject):
|
|||||||
def packageId(self) -> str:
|
def packageId(self) -> str:
|
||||||
return self._package_id
|
return self._package_id
|
||||||
|
|
||||||
|
@pyqtProperty(str, constant = True)
|
||||||
|
def packageType(self) -> str:
|
||||||
|
return self._package_type
|
||||||
|
|
||||||
@pyqtProperty(str, constant=True)
|
@pyqtProperty(str, constant=True)
|
||||||
def iconUrl(self):
|
def iconUrl(self):
|
||||||
return self._icon_url
|
return self._icon_url
|
||||||
@ -57,9 +63,9 @@ class PackageModel(QObject):
|
|||||||
def displayName(self) -> str:
|
def displayName(self) -> str:
|
||||||
return self._display_name
|
return self._display_name
|
||||||
|
|
||||||
@pyqtProperty(bool, constant=True)
|
@pyqtProperty(bool, constant = True)
|
||||||
def isVerified(self):
|
def isCheckedByUltimaker(self):
|
||||||
return self._is_verified
|
return self._is_checked_by_ultimaker
|
||||||
|
|
||||||
@pyqtProperty(str, constant=True)
|
@pyqtProperty(str, constant=True)
|
||||||
def packageVersion(self):
|
def packageVersion(self):
|
||||||
|
@ -85,12 +85,12 @@ Rectangle
|
|||||||
Layout.preferredHeight: UM.Theme.getSize("card_tiny_icon").height
|
Layout.preferredHeight: UM.Theme.getSize("card_tiny_icon").height
|
||||||
|
|
||||||
|
|
||||||
enabled: packageData.isVerified
|
enabled: packageData.isCheckedByUltimaker
|
||||||
visible: packageData.isVerified
|
visible: packageData.isCheckedByUltimaker
|
||||||
|
|
||||||
Cura.ToolTip
|
Cura.ToolTip
|
||||||
{
|
{
|
||||||
tooltipText: catalog.i18nc("@info", "Verified")
|
tooltipText: packageData.packageType == "plugin" ? catalog.i18nc("@info", "Verified") : catalog.i18nc("@info", "Ultimaker Certified Materials")
|
||||||
visible: parent.hovered
|
visible: parent.hovered
|
||||||
targetPoint: Qt.point(0, Math.round(parent.y + parent.height / 2))
|
targetPoint: Qt.point(0, Math.round(parent.y + parent.height / 2))
|
||||||
}
|
}
|
||||||
@ -104,7 +104,7 @@ Rectangle
|
|||||||
{
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: UM.Theme.getColor("primary")
|
color: UM.Theme.getColor("primary")
|
||||||
source: UM.Theme.getIcon("CheckCircle")
|
source: packageData.packageType == "plugin" ? UM.Theme.getIcon("CheckCircle") : UM.Theme.getIcon("Certified")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user