mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-06 21:44:01 -06:00
Add generic material packages to materials page
Contributes to CURA-5510
This commit is contained in:
parent
e3a193d6a6
commit
0bde1487e7
5 changed files with 47 additions and 11 deletions
|
@ -9,6 +9,9 @@ import UM 1.1 as UM
|
|||
|
||||
Column
|
||||
{
|
||||
property var heading: ""
|
||||
property var model
|
||||
id: gridArea
|
||||
height: childrenRect.height + 2 * padding
|
||||
width: parent.width
|
||||
spacing: UM.Theme.getSize("default_margin").height
|
||||
|
@ -16,7 +19,7 @@ Column
|
|||
Label
|
||||
{
|
||||
id: heading
|
||||
text: toolbox.viewCategory == "material" ? catalog.i18nc("@label", "Community contributions") : catalog.i18nc("@label", "Community plugins")
|
||||
text: gridArea.heading
|
||||
width: parent.width
|
||||
color: UM.Theme.getColor("text_medium")
|
||||
font: UM.Theme.getFont("medium")
|
||||
|
@ -24,14 +27,13 @@ Column
|
|||
GridLayout
|
||||
{
|
||||
id: grid
|
||||
property var model: toolbox.viewCategory == "material" ? toolbox.authorsModel : toolbox.packagesModel
|
||||
width: parent.width - 2 * parent.padding
|
||||
columns: 2
|
||||
columnSpacing: UM.Theme.getSize("default_margin").height
|
||||
rowSpacing: UM.Theme.getSize("default_margin").width
|
||||
Repeater
|
||||
{
|
||||
model: grid.model
|
||||
model: gridArea.model
|
||||
delegate: ToolboxDownloadsGridTile
|
||||
{
|
||||
Layout.preferredWidth: (grid.width - (grid.columns - 1) * grid.columnSpacing) / grid.columns
|
||||
|
|
|
@ -104,8 +104,18 @@ Item
|
|||
switch(toolbox.viewCategory)
|
||||
{
|
||||
case "material":
|
||||
toolbox.viewPage = "author"
|
||||
toolbox.filterModelByProp("packages", "author_id", model.id)
|
||||
|
||||
// If model has a type, it must be a package
|
||||
if (model.type)
|
||||
{
|
||||
toolbox.viewPage = "detail"
|
||||
toolbox.filterModelByProp("packages", "id", model.id)
|
||||
}
|
||||
else
|
||||
{
|
||||
toolbox.viewPage = "author"
|
||||
toolbox.filterModelByProp("packages", "author_id", model.id)
|
||||
}
|
||||
break
|
||||
default:
|
||||
toolbox.viewPage = "detail"
|
||||
|
|
|
@ -29,6 +29,17 @@ ScrollView
|
|||
{
|
||||
id: allPlugins
|
||||
width: parent.width
|
||||
heading: toolbox.viewCategory == "material" ? catalog.i18nc("@label", "Community Contributions") : catalog.i18nc("@label", "Community Plugins")
|
||||
model: toolbox.viewCategory == "material" ? toolbox.authorsModel : toolbox.packagesModel
|
||||
}
|
||||
|
||||
ToolboxDownloadsGrid
|
||||
{
|
||||
id: genericMaterials
|
||||
visible: toolbox.viewCategory == "material"
|
||||
width: parent.width
|
||||
heading: catalog.i18nc("@label", "Generic Materials")
|
||||
model: toolbox.materialsGenericModel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue