Merge pull request #4455 from Ultimaker/fix_toolbox_download

Fix toolbox download
This commit is contained in:
Lipu Fei 2018-10-02 10:27:00 +02:00 committed by GitHub
commit 729f9a69ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 8 deletions

View File

@ -15,7 +15,7 @@ Item
{ {
id: sidebar id: sidebar
} }
Rectangle Item
{ {
id: header id: header
anchors anchors

View File

@ -23,6 +23,7 @@ Item
{ {
id: button id: button
text: catalog.i18nc("@action:button", "Back") text: catalog.i18nc("@action:button", "Back")
enabled: !toolbox.isDownloading
UM.RecolorImage UM.RecolorImage
{ {
id: backArrow id: backArrow
@ -39,7 +40,7 @@ Item
width: width width: width
height: height height: height
} }
color: button.hovered ? UM.Theme.getColor("primary") : UM.Theme.getColor("text") color: button.enabled ? (button.hovered ? UM.Theme.getColor("primary") : UM.Theme.getColor("text")) : UM.Theme.getColor("text_inactive")
source: UM.Theme.getIcon("arrow_left") source: UM.Theme.getIcon("arrow_left")
} }
width: UM.Theme.getSize("toolbox_back_button").width width: UM.Theme.getSize("toolbox_back_button").width
@ -59,7 +60,7 @@ Item
{ {
id: labelStyle id: labelStyle
text: control.text text: control.text
color: control.hovered ? UM.Theme.getColor("primary") : UM.Theme.getColor("text") color: control.enabled ? (control.hovered ? UM.Theme.getColor("primary") : UM.Theme.getColor("text")) : UM.Theme.getColor("text_inactive")
font: UM.Theme.getFont("default_bold") font: UM.Theme.getFont("default_bold")
horizontalAlignment: Text.AlignRight horizontalAlignment: Text.AlignRight
width: control.width width: control.width

View File

@ -9,9 +9,8 @@ import UM 1.1 as UM
Item Item
{ {
id: page id: page
property var details: base.selection property var details: base.selection || {}
anchors.fill: parent anchors.fill: parent
width: parent.width
ToolboxBackColumn ToolboxBackColumn
{ {
id: sidebar id: sidebar

View File

@ -25,7 +25,7 @@ Item
{ {
text: catalog.i18nc("@title:tab", "Plugins") text: catalog.i18nc("@title:tab", "Plugins")
active: toolbox.viewCategory == "plugin" && enabled active: toolbox.viewCategory == "plugin" && enabled
enabled: toolbox.viewPage != "loading" && toolbox.viewPage != "errored" enabled: !toolbox.isDownloading && toolbox.viewPage != "loading" && toolbox.viewPage != "errored"
onClicked: onClicked:
{ {
toolbox.filterModelByProp("packages", "type", "plugin") toolbox.filterModelByProp("packages", "type", "plugin")
@ -39,7 +39,7 @@ Item
{ {
text: catalog.i18nc("@title:tab", "Materials") text: catalog.i18nc("@title:tab", "Materials")
active: toolbox.viewCategory == "material" && enabled active: toolbox.viewCategory == "material" && enabled
enabled: toolbox.viewPage != "loading" && toolbox.viewPage != "errored" enabled: !toolbox.isDownloading && toolbox.viewPage != "loading" && toolbox.viewPage != "errored"
onClicked: onClicked:
{ {
toolbox.filterModelByProp("authors", "package_types", "material") toolbox.filterModelByProp("authors", "package_types", "material")
@ -53,6 +53,7 @@ Item
{ {
text: catalog.i18nc("@title:tab", "Installed") text: catalog.i18nc("@title:tab", "Installed")
active: toolbox.viewCategory == "installed" active: toolbox.viewCategory == "installed"
enabled: !toolbox.isDownloading
anchors anchors
{ {
right: parent.right right: parent.right

View File

@ -603,7 +603,7 @@ class Toolbox(QObject, Extension):
@pyqtSlot() @pyqtSlot()
def cancelDownload(self) -> None: def cancelDownload(self) -> None:
Logger.log("i", "Toolbox: User cancelled the download of a plugin.") Logger.log("i", "Toolbox: User cancelled the download of a package.")
self.resetDownload() self.resetDownload()
def resetDownload(self) -> None: def resetDownload(self) -> None:
@ -755,6 +755,7 @@ class Toolbox(QObject, Extension):
self._active_package = package self._active_package = package
self.activePackageChanged.emit() self.activePackageChanged.emit()
## The active package is the package that is currently being downloaded
@pyqtProperty(QObject, fset = setActivePackage, notify = activePackageChanged) @pyqtProperty(QObject, fset = setActivePackage, notify = activePackageChanged)
def activePackage(self) -> Optional[Dict[str, Any]]: def activePackage(self) -> Optional[Dict[str, Any]]:
return self._active_package return self._active_package