mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-29 23:34:32 +08:00
Removed the rating from the download grid
It felt a bit weird to already have it in the grid layout CURA-6013
This commit is contained in:
parent
50099ab753
commit
e92bd01fb2
@ -16,6 +16,42 @@ Item
|
|||||||
height: UM.Theme.getSize("toolbox_thumbnail_small").height
|
height: UM.Theme.getSize("toolbox_thumbnail_small").height
|
||||||
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
|
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
|
||||||
|
|
||||||
|
MouseArea
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
onEntered: thumbnail.border.color = UM.Theme.getColor("primary")
|
||||||
|
onExited: thumbnail.border.color = UM.Theme.getColor("lining")
|
||||||
|
onClicked:
|
||||||
|
{
|
||||||
|
base.selection = model
|
||||||
|
switch(toolbox.viewCategory)
|
||||||
|
{
|
||||||
|
case "material":
|
||||||
|
|
||||||
|
// If model has a type, it must be a package
|
||||||
|
if (model.type !== undefined)
|
||||||
|
{
|
||||||
|
toolbox.viewPage = "detail"
|
||||||
|
toolbox.filterModelByProp("packages", "id", model.id)
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
toolbox.viewPage = "author"
|
||||||
|
toolbox.setFilters("packages", {
|
||||||
|
"author_id": model.id,
|
||||||
|
"type": "material"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
toolbox.viewPage = "detail"
|
||||||
|
toolbox.filterModelByProp("packages", "id", model.id)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
id: thumbnail
|
id: thumbnail
|
||||||
@ -33,8 +69,6 @@ Item
|
|||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
source: model.icon_url || "../images/logobot.svg"
|
source: model.icon_url || "../images/logobot.svg"
|
||||||
mipmap: true
|
mipmap: true
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
UM.RecolorImage
|
UM.RecolorImage
|
||||||
{
|
{
|
||||||
@ -50,42 +84,6 @@ Item
|
|||||||
color: (installedPackages == packageCount) ? UM.Theme.getColor("primary") : UM.Theme.getColor("border")
|
color: (installedPackages == packageCount) ? UM.Theme.getColor("primary") : UM.Theme.getColor("border")
|
||||||
source: "../images/installed_check.svg"
|
source: "../images/installed_check.svg"
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea
|
|
||||||
{
|
|
||||||
anchors.fill: thumbnail
|
|
||||||
hoverEnabled: true
|
|
||||||
onEntered: thumbnail.border.color = UM.Theme.getColor("primary")
|
|
||||||
onExited: thumbnail.border.color = UM.Theme.getColor("lining")
|
|
||||||
onClicked:
|
|
||||||
{
|
|
||||||
base.selection = model
|
|
||||||
switch(toolbox.viewCategory)
|
|
||||||
{
|
|
||||||
case "material":
|
|
||||||
|
|
||||||
// If model has a type, it must be a package
|
|
||||||
if (model.type !== undefined)
|
|
||||||
{
|
|
||||||
toolbox.viewPage = "detail"
|
|
||||||
toolbox.filterModelByProp("packages", "id", model.id)
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
toolbox.viewPage = "author"
|
|
||||||
toolbox.setFilters("packages", {
|
|
||||||
"author_id": model.id,
|
|
||||||
"type": "material"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
break
|
|
||||||
default:
|
|
||||||
toolbox.viewPage = "detail"
|
|
||||||
toolbox.filterModelByProp("packages", "id", model.id)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
@ -119,17 +117,39 @@ Item
|
|||||||
anchors.top: name.bottom
|
anchors.top: name.bottom
|
||||||
anchors.bottom: rating.top
|
anchors.bottom: rating.top
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
maximumLineCount: 2
|
||||||
}
|
}
|
||||||
RatingWidget
|
Row
|
||||||
{
|
{
|
||||||
id: rating
|
id: rating
|
||||||
visible: model.type == "plugin"
|
height: UM.Theme.getSize("rating_star").height
|
||||||
packageId: model.id
|
visible: model.average_rating > 0 //Has a rating at all.
|
||||||
rating: model.average_rating != undefined ? model.average_rating : 0
|
spacing: UM.Theme.getSize("thick_lining").width
|
||||||
numRatings: model.num_ratings != undefined ? model.num_ratings : 0
|
anchors
|
||||||
userRating: model.user_rating
|
{
|
||||||
enabled: installedPackages != 0 && Cura.API.account.isLoggedIn
|
bottom: parent.bottom
|
||||||
anchors.bottom: parent.bottom
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
|
||||||
|
UM.RecolorImage
|
||||||
|
{
|
||||||
|
id: starIcon
|
||||||
|
source: UM.Theme.getIcon("star_filled")
|
||||||
|
color: "#5a5a5a"
|
||||||
|
height: UM.Theme.getSize("rating_star").height
|
||||||
|
width: UM.Theme.getSize("rating_star").width
|
||||||
|
}
|
||||||
|
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
text: model.average_rating.toFixed(1) + " (" + model.num_ratings + " " + catalog.i18nc("@label", "ratings") + ")"
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
height: starIcon.height
|
||||||
|
anchors.verticalCenter: starIcon.verticalCenter
|
||||||
|
color: starIcon.color
|
||||||
|
font: UM.Theme.getFont("small")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ class PackagesModel(ListModel):
|
|||||||
"links": links_dict,
|
"links": links_dict,
|
||||||
"website": package["website"] if "website" in package else None,
|
"website": package["website"] if "website" in package else None,
|
||||||
"login_required": "login-required" in package.get("tags", []),
|
"login_required": "login-required" in package.get("tags", []),
|
||||||
"average_rating": package.get("rating", {}).get("average", 0),
|
"average_rating": float(package.get("rating", {}).get("average", 0)),
|
||||||
"num_ratings": package.get("rating", {}).get("count", 0),
|
"num_ratings": package.get("rating", {}).get("count", 0),
|
||||||
"user_rating": package.get("rating", {}).get("user", 0)
|
"user_rating": package.get("rating", {}).get("user", 0)
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user