mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
CURA-5035 More styling & layout
This commit is contained in:
parent
7359554641
commit
d4cc4659d8
11 changed files with 248 additions and 180 deletions
|
@ -17,10 +17,10 @@ Window
|
||||||
property bool dataReady: manager.dataReady
|
property bool dataReady: manager.dataReady
|
||||||
title: catalog.i18nc("@title:tab", "Toolbox");
|
title: catalog.i18nc("@title:tab", "Toolbox");
|
||||||
modality: Qt.ApplicationModal
|
modality: Qt.ApplicationModal
|
||||||
width: 960 * screenScaleFactor
|
width: 720 * screenScaleFactor
|
||||||
height: 640 * screenScaleFactor
|
height: 640 * screenScaleFactor
|
||||||
minimumWidth: 960 * screenScaleFactor
|
minimumWidth: 720 * screenScaleFactor
|
||||||
maximumWidth: 960 * screenScaleFactor
|
maximumWidth: 720 * screenScaleFactor
|
||||||
minimumHeight: 350 * screenScaleFactor
|
minimumHeight: 350 * screenScaleFactor
|
||||||
color: UM.Theme.getColor("sidebar")
|
color: UM.Theme.getColor("sidebar")
|
||||||
Item
|
Item
|
||||||
|
|
|
@ -7,66 +7,15 @@ import QtQuick.Controls 1.4
|
||||||
import QtQuick.Controls.Styles 1.4
|
import QtQuick.Controls.Styles 1.4
|
||||||
import UM 1.1 as UM
|
import UM 1.1 as UM
|
||||||
|
|
||||||
// TODO: Switch to QtQuick.Controls 2.x and remove QtQuick.Controls.Styles
|
|
||||||
|
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
id: base
|
id: base
|
||||||
|
property var details: manager.authorsModel.items[0]
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
Item
|
ToolboxBackColumn
|
||||||
{
|
{
|
||||||
id: sidebar
|
id: sidebar
|
||||||
height: parent.height
|
|
||||||
width: UM.Theme.getSize("base_unit").width * 6
|
|
||||||
anchors
|
|
||||||
{
|
|
||||||
top: parent.top
|
|
||||||
left: parent.left
|
|
||||||
topMargin: UM.Theme.getSize("double_margin").height
|
|
||||||
leftMargin: UM.Theme.getSize("default_margin").width
|
|
||||||
rightMargin: UM.Theme.getSize("default_margin").width
|
|
||||||
}
|
|
||||||
Button
|
|
||||||
{
|
|
||||||
text: "Back"
|
|
||||||
UM.RecolorImage
|
|
||||||
{
|
|
||||||
id: backArrow
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
|
||||||
width: UM.Theme.getSize("standard_arrow").width
|
|
||||||
height: UM.Theme.getSize("standard_arrow").height
|
|
||||||
sourceSize.width: width
|
|
||||||
sourceSize.height: height
|
|
||||||
color: UM.Theme.getColor("text")
|
|
||||||
source: UM.Theme.getIcon("arrow_left")
|
|
||||||
}
|
|
||||||
width: UM.Theme.getSize("base_unit").width * 4
|
|
||||||
height: UM.Theme.getSize("base_unit").height * 2
|
|
||||||
onClicked:
|
|
||||||
{
|
|
||||||
manager.viewPage = "overview"
|
|
||||||
manager.filterPackages("type", manager.viewCategory)
|
|
||||||
}
|
|
||||||
style: ButtonStyle
|
|
||||||
{
|
|
||||||
background: Rectangle
|
|
||||||
{
|
|
||||||
color: "transparent"
|
|
||||||
}
|
|
||||||
label: Label
|
|
||||||
{
|
|
||||||
text: control.text
|
|
||||||
color: UM.Theme.getColor("text")
|
|
||||||
font: UM.Theme.getFont("default_bold")
|
|
||||||
horizontalAlignment: Text.AlignRight
|
|
||||||
width: control.width
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
id: header
|
id: header
|
||||||
|
@ -74,6 +23,7 @@ Item
|
||||||
{
|
{
|
||||||
left: sidebar.right
|
left: sidebar.right
|
||||||
right: parent.right
|
right: parent.right
|
||||||
|
rightMargin: UM.Theme.getSize("double_margin").width
|
||||||
}
|
}
|
||||||
height: UM.Theme.getSize("base_unit").height * 12
|
height: UM.Theme.getSize("base_unit").height * 12
|
||||||
Image
|
Image
|
||||||
|
@ -82,7 +32,7 @@ Item
|
||||||
width: UM.Theme.getSize("toolbox_thumbnail_medium").width
|
width: UM.Theme.getSize("toolbox_thumbnail_medium").width
|
||||||
height: UM.Theme.getSize("toolbox_thumbnail_medium").height
|
height: UM.Theme.getSize("toolbox_thumbnail_medium").height
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
source: manager.detailData["icon_url"] || "../images/logobot.svg"
|
source: details.icon_url || "../images/logobot.svg"
|
||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
top: parent.top
|
top: parent.top
|
||||||
|
@ -91,8 +41,10 @@ Item
|
||||||
topMargin: UM.Theme.getSize("double_margin").height
|
topMargin: UM.Theme.getSize("double_margin").height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Column
|
|
||||||
|
Label
|
||||||
{
|
{
|
||||||
|
id: title
|
||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
top: thumbnail.top
|
top: thumbnail.top
|
||||||
|
@ -100,39 +52,79 @@ Item
|
||||||
leftMargin: UM.Theme.getSize("default_margin").width
|
leftMargin: UM.Theme.getSize("default_margin").width
|
||||||
right: parent.right
|
right: parent.right
|
||||||
rightMargin: UM.Theme.getSize("double_margin").width
|
rightMargin: UM.Theme.getSize("double_margin").width
|
||||||
|
bottomMargin: UM.Theme.getSize("default_margin").height
|
||||||
|
}
|
||||||
|
text: details.name
|
||||||
|
font: UM.Theme.getFont("large")
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
width: parent.width
|
||||||
|
height: UM.Theme.getSize("base_unit") * 2
|
||||||
|
}
|
||||||
|
|
||||||
|
Column
|
||||||
|
{
|
||||||
|
id: properties
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
top: title.bottom
|
||||||
|
left: title.left
|
||||||
|
topMargin: UM.Theme.getSize("default_margin").height
|
||||||
|
}
|
||||||
|
spacing: Math.floor(UM.Theme.getSize("default_margin").height / 2)
|
||||||
|
width: childrenRect.width
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
text: "Version:"
|
||||||
|
font: UM.Theme.getFont("very_small")
|
||||||
|
color: UM.Theme.getColor("text_medium")
|
||||||
|
}
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
text: "Author:"
|
||||||
|
font: UM.Theme.getFont("very_small")
|
||||||
|
color: UM.Theme.getColor("text_medium")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Column
|
||||||
|
{
|
||||||
|
id: values
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
top: title.bottom
|
||||||
|
left: properties.right
|
||||||
|
leftMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
topMargin: UM.Theme.getSize("default_margin").height
|
||||||
}
|
}
|
||||||
spacing: Math.floor(UM.Theme.getSize("default_margin").height/2)
|
spacing: Math.floor(UM.Theme.getSize("default_margin").height/2)
|
||||||
|
width: UM.Theme.getSize("base_unit").width * 12
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: manager.detailData["name"]
|
text: details.name
|
||||||
font: UM.Theme.getFont("large")
|
font: UM.Theme.getFont("very_small")
|
||||||
wrapMode: Text.WordWrap
|
color: UM.Theme.getColor("text")
|
||||||
width: parent.width
|
|
||||||
}
|
}
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: "HELLO THIS IS AN AUTHOR PAGE"
|
text: details.name
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("very_small")
|
||||||
wrapMode: Text.WordWrap
|
color: UM.Theme.getColor("text")
|
||||||
width: parent.width
|
|
||||||
}
|
|
||||||
Label
|
|
||||||
{
|
|
||||||
text: "Author: " + manager.detailData["author"]["name"]
|
|
||||||
font: UM.Theme.getFont("small")
|
|
||||||
wrapMode: Text.WordWrap
|
|
||||||
width: parent.width
|
|
||||||
// TODO: Add mail icon.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
color: UM.Theme.getColor("text_medium")
|
||||||
|
width: parent.width
|
||||||
|
height: UM.Theme.getSize("default_lining").height
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ToolboxDetailList {
|
ToolboxDetailList {
|
||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
right: header.right
|
|
||||||
top: header.bottom
|
top: header.bottom
|
||||||
left: header.left
|
|
||||||
bottom: base.bottom
|
bottom: base.bottom
|
||||||
|
left: header.left
|
||||||
|
right: base.right
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
64
plugins/Toolbox/resources/qml/ToolboxBackColumn.qml
Normal file
64
plugins/Toolbox/resources/qml/ToolboxBackColumn.qml
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
// Copyright (c) 2018 Ultimaker B.V.
|
||||||
|
// PluginBrowser is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
|
import QtQuick 2.2
|
||||||
|
import QtQuick.Dialogs 1.1
|
||||||
|
import QtQuick.Controls 1.4
|
||||||
|
import QtQuick.Controls.Styles 1.4
|
||||||
|
import UM 1.1 as UM
|
||||||
|
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
id: sidebar
|
||||||
|
height: parent.height
|
||||||
|
width: UM.Theme.getSize("base_unit").width * 6
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
|
topMargin: UM.Theme.getSize("double_margin").height
|
||||||
|
leftMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
}
|
||||||
|
Button
|
||||||
|
{
|
||||||
|
id: button
|
||||||
|
text: "Back"
|
||||||
|
UM.RecolorImage
|
||||||
|
{
|
||||||
|
id: backArrow
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
width: UM.Theme.getSize("standard_arrow").width
|
||||||
|
height: UM.Theme.getSize("standard_arrow").height
|
||||||
|
sourceSize.width: width
|
||||||
|
sourceSize.height: height
|
||||||
|
color: button.hovered ? UM.Theme.getColor("primary") : UM.Theme.getColor("text")
|
||||||
|
source: UM.Theme.getIcon("arrow_left")
|
||||||
|
}
|
||||||
|
width: UM.Theme.getSize("base_unit").width * 4
|
||||||
|
height: UM.Theme.getSize("base_unit").height * 2
|
||||||
|
onClicked:
|
||||||
|
{
|
||||||
|
manager.viewPage = "overview"
|
||||||
|
manager.filterPackages("type", manager.viewCategory)
|
||||||
|
}
|
||||||
|
style: ButtonStyle
|
||||||
|
{
|
||||||
|
background: Rectangle
|
||||||
|
{
|
||||||
|
color: "transparent"
|
||||||
|
}
|
||||||
|
label: Label
|
||||||
|
{
|
||||||
|
id: labelStyle
|
||||||
|
text: control.text
|
||||||
|
color: control.hovered ? UM.Theme.getColor("primary") : UM.Theme.getColor("text")
|
||||||
|
font: UM.Theme.getFont("default_bold")
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
width: control.width
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,11 +10,6 @@ import UM 1.1 as UM
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
id: base
|
id: base
|
||||||
anchors
|
|
||||||
{
|
|
||||||
topMargin: UM.Theme.getSize("double_margin").height
|
|
||||||
bottomMargin: UM.Theme.getSize("double_margin").height
|
|
||||||
}
|
|
||||||
ScrollView
|
ScrollView
|
||||||
{
|
{
|
||||||
frameVisible: false
|
frameVisible: false
|
||||||
|
@ -22,8 +17,13 @@ Item
|
||||||
style: UM.Theme.styles.scrollview
|
style: UM.Theme.styles.scrollview
|
||||||
Column
|
Column
|
||||||
{
|
{
|
||||||
anchors.right: base.right
|
anchors
|
||||||
anchors.rightMargin: UM.Theme.getSize("double_margin").width
|
{
|
||||||
|
right: base.right
|
||||||
|
topMargin: UM.Theme.getSize("double_margin").height
|
||||||
|
bottomMargin: UM.Theme.getSize("double_margin").height
|
||||||
|
top: parent.top
|
||||||
|
}
|
||||||
height: childrenRect.height
|
height: childrenRect.height
|
||||||
spacing: UM.Theme.getSize("default_margin").height
|
spacing: UM.Theme.getSize("default_margin").height
|
||||||
Repeater
|
Repeater
|
||||||
|
|
|
@ -7,67 +7,15 @@ import QtQuick.Controls 1.4
|
||||||
import QtQuick.Controls.Styles 1.4
|
import QtQuick.Controls.Styles 1.4
|
||||||
import UM 1.1 as UM
|
import UM 1.1 as UM
|
||||||
|
|
||||||
// TODO: Switch to QtQuick.Controls 2.x and remove QtQuick.Controls.Styles
|
|
||||||
|
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
property var details: manager.packagesModel.items[0]
|
|
||||||
id: base
|
id: base
|
||||||
|
property var details: manager.packagesModel.items[0]
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
Item
|
ToolboxBackColumn
|
||||||
{
|
{
|
||||||
id: sidebar
|
id: sidebar
|
||||||
height: parent.height
|
|
||||||
width: UM.Theme.getSize("base_unit").width * 6
|
|
||||||
anchors
|
|
||||||
{
|
|
||||||
top: parent.top
|
|
||||||
left: parent.left
|
|
||||||
topMargin: UM.Theme.getSize("double_margin").height
|
|
||||||
leftMargin: UM.Theme.getSize("default_margin").width
|
|
||||||
rightMargin: UM.Theme.getSize("default_margin").width
|
|
||||||
}
|
|
||||||
Button
|
|
||||||
{
|
|
||||||
text: "Back"
|
|
||||||
UM.RecolorImage
|
|
||||||
{
|
|
||||||
id: backArrow
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
|
||||||
width: UM.Theme.getSize("standard_arrow").width
|
|
||||||
height: UM.Theme.getSize("standard_arrow").height
|
|
||||||
sourceSize.width: width
|
|
||||||
sourceSize.height: height
|
|
||||||
color: UM.Theme.getColor("text")
|
|
||||||
source: UM.Theme.getIcon("arrow_left")
|
|
||||||
}
|
|
||||||
width: UM.Theme.getSize("base_unit").width * 4
|
|
||||||
height: UM.Theme.getSize("base_unit").height * 2
|
|
||||||
onClicked:
|
|
||||||
{
|
|
||||||
manager.viewPage = "overview"
|
|
||||||
manager.filterPackages("type", manager.viewCategory)
|
|
||||||
}
|
|
||||||
style: ButtonStyle
|
|
||||||
{
|
|
||||||
background: Rectangle
|
|
||||||
{
|
|
||||||
color: "transparent"
|
|
||||||
}
|
|
||||||
label: Label
|
|
||||||
{
|
|
||||||
text: control.text
|
|
||||||
color: UM.Theme.getColor("text")
|
|
||||||
font: UM.Theme.getFont("default_bold")
|
|
||||||
horizontalAlignment: Text.AlignRight
|
|
||||||
width: control.width
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
id: header
|
id: header
|
||||||
|
@ -75,6 +23,7 @@ Item
|
||||||
{
|
{
|
||||||
left: sidebar.right
|
left: sidebar.right
|
||||||
right: parent.right
|
right: parent.right
|
||||||
|
rightMargin: UM.Theme.getSize("double_margin").width
|
||||||
}
|
}
|
||||||
height: UM.Theme.getSize("base_unit").height * 12
|
height: UM.Theme.getSize("base_unit").height * 12
|
||||||
Image
|
Image
|
||||||
|
@ -119,6 +68,7 @@ Item
|
||||||
{
|
{
|
||||||
top: title.bottom
|
top: title.bottom
|
||||||
left: title.left
|
left: title.left
|
||||||
|
topMargin: UM.Theme.getSize("default_margin").height
|
||||||
}
|
}
|
||||||
spacing: Math.floor(UM.Theme.getSize("default_margin").height / 2)
|
spacing: Math.floor(UM.Theme.getSize("default_margin").height / 2)
|
||||||
width: childrenRect.width
|
width: childrenRect.width
|
||||||
|
@ -149,6 +99,7 @@ Item
|
||||||
top: title.bottom
|
top: title.bottom
|
||||||
left: properties.right
|
left: properties.right
|
||||||
leftMargin: UM.Theme.getSize("default_margin").width
|
leftMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
topMargin: UM.Theme.getSize("default_margin").height
|
||||||
}
|
}
|
||||||
spacing: Math.floor(UM.Theme.getSize("default_margin").height/2)
|
spacing: Math.floor(UM.Theme.getSize("default_margin").height/2)
|
||||||
width: UM.Theme.getSize("base_unit").width * 12
|
width: UM.Theme.getSize("base_unit").width * 12
|
||||||
|
@ -160,7 +111,7 @@ Item
|
||||||
}
|
}
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: details.generated_time
|
text: Qt.formatDateTime(details.last_updated, "dd MMM yyyy")
|
||||||
font: UM.Theme.getFont("very_small")
|
font: UM.Theme.getFont("very_small")
|
||||||
color: UM.Theme.getColor("text")
|
color: UM.Theme.getColor("text")
|
||||||
}
|
}
|
||||||
|
@ -171,16 +122,21 @@ Item
|
||||||
color: UM.Theme.getColor("text")
|
color: UM.Theme.getColor("text")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
color: UM.Theme.getColor("text_medium")
|
||||||
|
width: parent.width
|
||||||
|
height: UM.Theme.getSize("default_lining").height
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ToolboxDetailList {
|
ToolboxDetailList {
|
||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
right: header.right
|
|
||||||
top: header.bottom
|
top: header.bottom
|
||||||
|
|
||||||
left: header.left
|
|
||||||
bottom: base.bottom
|
bottom: base.bottom
|
||||||
|
left: header.left
|
||||||
|
right: base.right
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ Rectangle
|
||||||
right: controls.left
|
right: controls.left
|
||||||
rightMargin: UM.Theme.getSize("default_margin").width
|
rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
top: parent.top
|
top: parent.top
|
||||||
topMargin: UM.Theme.getSize("default_margin").height
|
|
||||||
}
|
}
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
|
@ -45,7 +44,6 @@ Rectangle
|
||||||
id: controls
|
id: controls
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
|
||||||
width: childrenRect.width
|
width: childrenRect.width
|
||||||
Button {
|
Button {
|
||||||
id: installButton
|
id: installButton
|
||||||
|
@ -54,7 +52,7 @@ Rectangle
|
||||||
{
|
{
|
||||||
if ( manager.isDownloading )
|
if ( manager.isDownloading )
|
||||||
{
|
{
|
||||||
return pluginList.activePlugin == model ? true : false
|
return manager.activePackage == model ? true : false
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -79,19 +77,20 @@ Rectangle
|
||||||
}
|
}
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
if ( manager.isDownloading && pluginList.activePlugin == model )
|
console.log( "MODEL", model.download_url )
|
||||||
|
if ( manager.isDownloading && manager.activePackage == model )
|
||||||
{
|
{
|
||||||
manager.cancelDownload();
|
manager.cancelDownload();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pluginList.activePlugin = model;
|
// manager.activePackage = model;
|
||||||
if ( model.can_upgrade )
|
if ( model.can_upgrade )
|
||||||
{
|
{
|
||||||
manager.downloadAndInstallPlugin( model.update_url );
|
// manager.downloadAndInstallPlugin( model.update_url );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
manager.downloadAndInstallPlugin( model.file_location );
|
manager.startDownload( model.download_url );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,6 +101,6 @@ Rectangle
|
||||||
color: UM.Theme.getColor("text_medium")
|
color: UM.Theme.getColor("text_medium")
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: UM.Theme.getSize("default_lining").height
|
height: UM.Theme.getSize("default_lining").height
|
||||||
anchors.top: parent.top
|
anchors.bottom: parent.bottom
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ Column
|
||||||
{
|
{
|
||||||
id: grid
|
id: grid
|
||||||
width: parent.width
|
width: parent.width
|
||||||
columns: 3
|
columns: 2
|
||||||
columnSpacing: UM.Theme.getSize("base_unit").width
|
columnSpacing: UM.Theme.getSize("base_unit").width
|
||||||
rowSpacing: UM.Theme.getSize("base_unit").height
|
rowSpacing: UM.Theme.getSize("base_unit").height
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,13 @@ Item
|
||||||
id: base
|
id: base
|
||||||
height: childrenRect.height
|
height: childrenRect.height
|
||||||
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
|
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
id: highlight
|
||||||
|
anchors.fill: parent
|
||||||
|
opacity: 0.0
|
||||||
|
color: UM.Theme.getColor("primary")
|
||||||
|
}
|
||||||
Row
|
Row
|
||||||
{
|
{
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
@ -68,17 +75,31 @@ Item
|
||||||
MouseArea
|
MouseArea
|
||||||
{
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: {
|
hoverEnabled: true
|
||||||
|
onEntered:
|
||||||
|
{
|
||||||
|
thumbnail.border.color = UM.Theme.getColor("primary")
|
||||||
|
highlight.opacity = 0.1
|
||||||
|
}
|
||||||
|
onExited:
|
||||||
|
{
|
||||||
|
thumbnail.border.color = UM.Theme.getColor("text")
|
||||||
|
highlight.opacity = 0.0
|
||||||
|
}
|
||||||
|
onClicked:
|
||||||
|
{
|
||||||
if ( manager.viewCategory == "material" )
|
if ( manager.viewCategory == "material" )
|
||||||
{
|
{
|
||||||
manager.viewSelection = model.name
|
manager.viewSelection = model.name
|
||||||
manager.viewPage = "author"
|
manager.viewPage = "author"
|
||||||
|
manager.filterAuthors("name", model.name)
|
||||||
manager.filterPackages("author_name", model.name)
|
manager.filterPackages("author_name", model.name)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
manager.viewSelection = model.id
|
manager.viewSelection = model.id
|
||||||
manager.viewPage = "detail"
|
manager.viewPage = "detail"
|
||||||
|
manager.filterAuthors("name", model.author_name)
|
||||||
manager.filterPackages("id", model.id)
|
manager.filterPackages("id", model.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,12 +55,14 @@ Item
|
||||||
{
|
{
|
||||||
manager.viewSelection = model.name
|
manager.viewSelection = model.name
|
||||||
manager.viewPage = "author"
|
manager.viewPage = "author"
|
||||||
|
manager.filterAuthors("name", model.name)
|
||||||
manager.filterPackages("author_name", model.name)
|
manager.filterPackages("author_name", model.name)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
manager.viewSelection = model.id
|
manager.viewSelection = model.id
|
||||||
manager.viewPage = "detail"
|
manager.viewPage = "detail"
|
||||||
|
manager.filterAuthors("name", model.author_name)
|
||||||
manager.filterPackages("id", model.id)
|
manager.filterPackages("id", model.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ from PyQt5.QtCore import Qt, pyqtProperty, pyqtSignal
|
||||||
from UM.Qt.ListModel import ListModel
|
from UM.Qt.ListModel import ListModel
|
||||||
|
|
||||||
## Model that holds cura packages. By setting the filter property the instances held by this model can be changed.
|
## Model that holds cura packages. By setting the filter property the instances held by this model can be changed.
|
||||||
class CuraPackageModel(ListModel):
|
class PackagesModel(ListModel):
|
||||||
IdRole = Qt.UserRole + 1
|
IdRole = Qt.UserRole + 1
|
||||||
TypeRole = Qt.UserRole + 2
|
TypeRole = Qt.UserRole + 2
|
||||||
NameRole = Qt.UserRole + 3
|
NameRole = Qt.UserRole + 3
|
||||||
|
@ -19,21 +19,25 @@ class CuraPackageModel(ListModel):
|
||||||
DescriptionRole = Qt.UserRole + 7
|
DescriptionRole = Qt.UserRole + 7
|
||||||
IconURLRole = Qt.UserRole + 8
|
IconURLRole = Qt.UserRole + 8
|
||||||
ImageURLsRole = Qt.UserRole + 9
|
ImageURLsRole = Qt.UserRole + 9
|
||||||
|
DownloadURLRole = Qt.UserRole + 10
|
||||||
|
LastUpdatedRole = Qt.UserRole + 11
|
||||||
|
|
||||||
def __init__(self, parent = None):
|
def __init__(self, parent = None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
||||||
self._packages_metadata = None
|
self._packages_metadata = None
|
||||||
|
|
||||||
self.addRoleName(CuraPackageModel.IdRole, "id")
|
self.addRoleName(PackagesModel.IdRole, "id")
|
||||||
self.addRoleName(CuraPackageModel.TypeRole, "type")
|
self.addRoleName(PackagesModel.TypeRole, "type")
|
||||||
self.addRoleName(CuraPackageModel.NameRole, "name")
|
self.addRoleName(PackagesModel.NameRole, "name")
|
||||||
self.addRoleName(CuraPackageModel.VersionRole, "version")
|
self.addRoleName(PackagesModel.VersionRole, "version")
|
||||||
self.addRoleName(CuraPackageModel.AuthorNameRole, "author_name")
|
self.addRoleName(PackagesModel.AuthorNameRole, "author_name")
|
||||||
self.addRoleName(CuraPackageModel.AuthorEmailRole, "author_email")
|
self.addRoleName(PackagesModel.AuthorEmailRole, "author_email")
|
||||||
self.addRoleName(CuraPackageModel.DescriptionRole, "description")
|
self.addRoleName(PackagesModel.DescriptionRole, "description")
|
||||||
self.addRoleName(CuraPackageModel.IconURLRole, "icon_url")
|
self.addRoleName(PackagesModel.IconURLRole, "icon_url")
|
||||||
self.addRoleName(CuraPackageModel.ImageURLsRole, "image_urls")
|
self.addRoleName(PackagesModel.ImageURLsRole, "image_urls")
|
||||||
|
self.addRoleName(PackagesModel.DownloadURLRole, "download_url")
|
||||||
|
self.addRoleName(PackagesModel.LastUpdatedRole, "last_updated")
|
||||||
|
|
||||||
# List of filters for queries. The result is the union of the each list of results.
|
# List of filters for queries. The result is the union of the each list of results.
|
||||||
self._filter = {} # type: Dict[str,str]
|
self._filter = {} # type: Dict[str,str]
|
||||||
|
@ -55,7 +59,9 @@ class CuraPackageModel(ListModel):
|
||||||
"author_email": package["author"]["email"],
|
"author_email": package["author"]["email"],
|
||||||
"description": package["description"],
|
"description": package["description"],
|
||||||
"icon_url": package["icon_url"] if "icon_url" in package else None,
|
"icon_url": package["icon_url"] if "icon_url" in package else None,
|
||||||
"image_urls": package["image_urls"]
|
"image_urls": package["image_urls"],
|
||||||
|
"download_url": package["download_url"],
|
||||||
|
"last_updated": package["last_updated"]
|
||||||
})
|
})
|
||||||
|
|
||||||
# Filter on all the key-word arguments.
|
# Filter on all the key-word arguments.
|
|
@ -23,7 +23,7 @@ import zipfile
|
||||||
|
|
||||||
from cura.CuraApplication import CuraApplication
|
from cura.CuraApplication import CuraApplication
|
||||||
from .AuthorsModel import AuthorsModel
|
from .AuthorsModel import AuthorsModel
|
||||||
from .CuraPackageModel import CuraPackageModel
|
from .PackagesModel import PackagesModel
|
||||||
|
|
||||||
i18n_catalog = i18nCatalog("cura")
|
i18n_catalog = i18nCatalog("cura")
|
||||||
|
|
||||||
|
@ -32,8 +32,10 @@ class Toolbox(QObject, Extension):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
||||||
|
self._plugin_registry = Application.getInstance().getPluginRegistry()
|
||||||
|
self._packages_version = self._plugin_registry.APIVersion
|
||||||
self._api_version = 1
|
self._api_version = 1
|
||||||
self._api_url = "https://api-staging.ultimaker.com/cura-packages/v%s" % self._api_version
|
self._api_url = "https://api.ultimaker.com/cura-packages/v{api_version}/cura/v{package_version}".format( api_version = self._api_version, package_version = self._packages_version)
|
||||||
|
|
||||||
self._package_list_request = None
|
self._package_list_request = None
|
||||||
self._showcase_request = None
|
self._showcase_request = None
|
||||||
|
@ -42,8 +44,7 @@ class Toolbox(QObject, Extension):
|
||||||
self._download_plugin_reply = None
|
self._download_plugin_reply = None
|
||||||
|
|
||||||
self._network_manager = None
|
self._network_manager = None
|
||||||
self._plugin_registry = Application.getInstance().getPluginRegistry()
|
|
||||||
self._packages_version_number = self._plugin_registry.APIVersion
|
|
||||||
|
|
||||||
self._packages_metadata = [] # Stores the remote information of the packages
|
self._packages_metadata = [] # Stores the remote information of the packages
|
||||||
self._packages_model = None # Model that list the remote available packages
|
self._packages_model = None # Model that list the remote available packages
|
||||||
|
@ -76,11 +77,17 @@ class Toolbox(QObject, Extension):
|
||||||
# if self._view_page == "author":
|
# if self._view_page == "author":
|
||||||
# filter with "author == self._view_selection"
|
# filter with "author == self._view_selection"
|
||||||
|
|
||||||
|
# Active package refers to which package is currently being downloaded,
|
||||||
|
# installed, or otherwise modified.
|
||||||
|
self._active_package = None
|
||||||
|
|
||||||
|
|
||||||
# Nowadays can be 'plugins', 'materials' or 'installed'
|
# Nowadays can be 'plugins', 'materials' or 'installed'
|
||||||
self._current_view = "plugins"
|
self._current_view = "plugins"
|
||||||
self._detail_view = False
|
|
||||||
self._detail_data = {} # Extraneous since can just use the data prop of the model.
|
self._detail_data = {} # Extraneous since can just use the data prop of the model.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
self._restart_required = False
|
self._restart_required = False
|
||||||
|
|
||||||
self._dialog = None
|
self._dialog = None
|
||||||
|
@ -121,6 +128,7 @@ class Toolbox(QObject, Extension):
|
||||||
authorsMetadataChanged = pyqtSignal()
|
authorsMetadataChanged = pyqtSignal()
|
||||||
showcaseMetadataChanged = pyqtSignal()
|
showcaseMetadataChanged = pyqtSignal()
|
||||||
|
|
||||||
|
activePackageChanged = pyqtSignal()
|
||||||
onDownloadProgressChanged = pyqtSignal()
|
onDownloadProgressChanged = pyqtSignal()
|
||||||
onIsDownloadingChanged = pyqtSignal()
|
onIsDownloadingChanged = pyqtSignal()
|
||||||
restartRequiredChanged = pyqtSignal()
|
restartRequiredChanged = pyqtSignal()
|
||||||
|
@ -155,9 +163,7 @@ class Toolbox(QObject, Extension):
|
||||||
self._restart_dialog_message = message
|
self._restart_dialog_message = message
|
||||||
self.showRestartDialog.emit()
|
self.showRestartDialog.emit()
|
||||||
|
|
||||||
@pyqtProperty(bool, notify = onIsDownloadingChanged)
|
|
||||||
def isDownloading(self):
|
|
||||||
return self._is_downloading
|
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def browsePackages(self):
|
def browsePackages(self):
|
||||||
|
@ -171,14 +177,14 @@ class Toolbox(QObject, Extension):
|
||||||
|
|
||||||
def requestPackageList(self):
|
def requestPackageList(self):
|
||||||
Logger.log("i", "Requesting package list")
|
Logger.log("i", "Requesting package list")
|
||||||
url = QUrl("{base_url}/cura/v{version}/packages".format(base_url = self._api_url, version = self._packages_version_number))
|
url = QUrl("{base_url}/packages".format(base_url = self._api_url))
|
||||||
self._package_list_request = QNetworkRequest(url)
|
self._package_list_request = QNetworkRequest(url)
|
||||||
self._package_list_request.setRawHeader(*self._request_header)
|
self._package_list_request.setRawHeader(*self._request_header)
|
||||||
self._network_manager.get(self._package_list_request)
|
self._network_manager.get(self._package_list_request)
|
||||||
|
|
||||||
def requestShowcase(self):
|
def requestShowcase(self):
|
||||||
Logger.log("i", "Requesting showcase list")
|
Logger.log("i", "Requesting showcase list")
|
||||||
url = QUrl("{base_url}/cura/v{version}/showcase".format(base_url = self._api_url, version = self._packages_version_number))
|
url = QUrl("{base_url}/showcase".format(base_url = self._api_url))
|
||||||
self._showcase_request = QNetworkRequest(url)
|
self._showcase_request = QNetworkRequest(url)
|
||||||
self._showcase_request.setRawHeader(*self._request_header)
|
self._showcase_request.setRawHeader(*self._request_header)
|
||||||
self._network_manager.get(self._showcase_request)
|
self._network_manager.get(self._showcase_request)
|
||||||
|
@ -315,6 +321,18 @@ class Toolbox(QObject, Extension):
|
||||||
self.setIsDownloading(True)
|
self.setIsDownloading(True)
|
||||||
self._download_plugin_reply.downloadProgress.connect(self._onDownloadPluginProgress)
|
self._download_plugin_reply.downloadProgress.connect(self._onDownloadPluginProgress)
|
||||||
|
|
||||||
|
# DOWNLOADING BEHAVIOR
|
||||||
|
@pyqtSlot(str)
|
||||||
|
def startDownload(self, url):
|
||||||
|
Logger.log("i", "Attempting to download & install package from %s", url)
|
||||||
|
url = QUrl(url)
|
||||||
|
self._download_plugin_request = QNetworkRequest(url)
|
||||||
|
self._download_plugin_request.setRawHeader(*self._request_header)
|
||||||
|
self._download_plugin_reply = self._network_manager.get(self._download_plugin_request)
|
||||||
|
self.setDownloadProgress(0)
|
||||||
|
self.setIsDownloading(True)
|
||||||
|
self._download_plugin_reply.downloadProgress.connect(self._onDownloadPluginProgress)
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def cancelDownload(self):
|
def cancelDownload(self):
|
||||||
Logger.log("i", "user cancelled the download of a plugin")
|
Logger.log("i", "user cancelled the download of a plugin")
|
||||||
|
@ -445,13 +463,13 @@ class Toolbox(QObject, Extension):
|
||||||
return
|
return
|
||||||
|
|
||||||
if reply.operation() == QNetworkAccessManager.GetOperation:
|
if reply.operation() == QNetworkAccessManager.GetOperation:
|
||||||
if reply_url == "{base_url}/cura/v{version}/packages".format(base_url = self._api_url, version = self._packages_version_number):
|
if reply_url == "{base_url}/packages".format(base_url = self._api_url):
|
||||||
try:
|
try:
|
||||||
json_data = json.loads(bytes(reply.readAll()).decode("utf-8"))
|
json_data = json.loads(bytes(reply.readAll()).decode("utf-8"))
|
||||||
|
print(json_data)
|
||||||
# Create packages model with all packages:
|
# Create packages model with all packages:
|
||||||
if not self._packages_model:
|
if not self._packages_model:
|
||||||
self._packages_model = CuraPackageModel()
|
self._packages_model = PackagesModel()
|
||||||
self._packages_metadata = json_data["data"]
|
self._packages_metadata = json_data["data"]
|
||||||
self._packages_model.setPackagesMetaData(self._packages_metadata)
|
self._packages_model.setPackagesMetaData(self._packages_metadata)
|
||||||
self.packagesMetadataChanged.emit()
|
self.packagesMetadataChanged.emit()
|
||||||
|
@ -472,12 +490,12 @@ class Toolbox(QObject, Extension):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
elif reply_url == "{base_url}/cura/v{version}/showcase".format(base_url = self._api_url, version = self._packages_version_number):
|
elif reply_url == "{base_url}/showcase".format(base_url = self._api_url):
|
||||||
try:
|
try:
|
||||||
json_data = json.loads(bytes(reply.readAll()).decode("utf-8"))
|
json_data = json.loads(bytes(reply.readAll()).decode("utf-8"))
|
||||||
# Create packages model with all packages:
|
# Create packages model with all packages:
|
||||||
if not self._showcase_model:
|
if not self._showcase_model:
|
||||||
self._showcase_model = CuraPackageModel()
|
self._showcase_model = PackagesModel()
|
||||||
self._showcase_metadata = json_data["data"]
|
self._showcase_metadata = json_data["data"]
|
||||||
print(self._showcase_metadata)
|
print(self._showcase_metadata)
|
||||||
self._showcase_model.setPackagesMetaData(self._showcase_metadata)
|
self._showcase_model.setPackagesMetaData(self._showcase_metadata)
|
||||||
|
@ -520,6 +538,18 @@ class Toolbox(QObject, Extension):
|
||||||
|
|
||||||
|
|
||||||
# Getter & Setter for self._view_category
|
# Getter & Setter for self._view_category
|
||||||
|
|
||||||
|
@pyqtProperty(bool, notify = onIsDownloadingChanged)
|
||||||
|
def isDownloading(self):
|
||||||
|
return self._is_downloading
|
||||||
|
|
||||||
|
def setActivePackage(self, package):
|
||||||
|
self._active_package = package
|
||||||
|
self.activePackageChanged.emit()
|
||||||
|
@pyqtProperty(QObject, fset = setActivePackage, notify = activePackageChanged)
|
||||||
|
def activePackage(self):
|
||||||
|
return self._active_package
|
||||||
|
|
||||||
def setViewCategory(self, category = "plugins"):
|
def setViewCategory(self, category = "plugins"):
|
||||||
self._view_category = category
|
self._view_category = category
|
||||||
self.viewChanged.emit()
|
self.viewChanged.emit()
|
||||||
|
@ -527,7 +557,6 @@ class Toolbox(QObject, Extension):
|
||||||
def viewCategory(self):
|
def viewCategory(self):
|
||||||
return self._view_category
|
return self._view_category
|
||||||
|
|
||||||
# Getter & Setter for self._view_page
|
|
||||||
def setViewPage(self, page = "overview"):
|
def setViewPage(self, page = "overview"):
|
||||||
self._view_page = page
|
self._view_page = page
|
||||||
self.viewChanged.emit()
|
self.viewChanged.emit()
|
||||||
|
@ -535,7 +564,6 @@ class Toolbox(QObject, Extension):
|
||||||
def viewPage(self):
|
def viewPage(self):
|
||||||
return self._view_page
|
return self._view_page
|
||||||
|
|
||||||
# Getter & Setter for self._view_selection
|
|
||||||
def setViewSelection(self, selection = ""):
|
def setViewSelection(self, selection = ""):
|
||||||
self._view_selection = selection
|
self._view_selection = selection
|
||||||
self.viewChanged.emit()
|
self.viewChanged.emit()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue