Merge branch 'master' into fix_toolbox_appearance

This commit is contained in:
fieldOfView 2018-05-02 17:18:43 +02:00
commit 00875f0330
118 changed files with 231 additions and 140 deletions

View file

@ -46,6 +46,11 @@ Window
id: viewLoading
visible: toolbox.viewCategory != "installed" && toolbox.viewPage == "loading"
}
ToolboxErrorPage
{
id: viewErrored
visible: toolbox.viewCategory != "installed" && toolbox.viewPage == "errored"
}
ToolboxDownloadsPage
{
id: viewDownloads

View file

@ -11,10 +11,7 @@ Item
id: tile
property bool installed: toolbox.isInstalled(model.id)
width: detailList.width - UM.Theme.getSize("wide_margin").width
// TODO: Without this line, every instance of this object has 0 height. With
// it, QML spits out tons of bugs claiming a binding loop (not true). Why?
// Because QT is garbage.
height: Math.max( UM.Theme.getSize("toolbox_detail_tile").height, childrenRect.height + UM.Theme.getSize("default_margin").height)
height: Math.max(UM.Theme.getSize("toolbox_detail_tile").height, childrenRect.height + UM.Theme.getSize("default_margin").height)
Item
{
id: normalData
@ -66,7 +63,7 @@ Item
}
else
{
if ( toolbox.isDownloading && toolbox.activePackage == model )
if (toolbox.isDownloading && toolbox.activePackage == model)
{
return catalog.i18nc("@action:button", "Cancel")
}
@ -76,21 +73,7 @@ Item
}
}
}
enabled:
{
if (installed)
{
return true
}
if ( toolbox.isDownloading )
{
return toolbox.activePackage == model ? true : false
}
else
{
return true
}
}
enabled: installed || !(toolbox.isDownloading && toolbox.activePackage != model) //Don't allow installing while another download is running.
opacity: enabled ? 1.0 : 0.5
style: ButtonStyle
{
@ -252,7 +235,8 @@ Item
color: UM.Theme.getColor("lining")
width: tile.width
height: UM.Theme.getSize("default_lining").height
anchors.bottom: tile.bottom
anchors.top: supportedConfigsChart.bottom
anchors.topMargin: UM.Theme.getSize("default_margin").height + UM.Theme.getSize("wide_margin").height //Normal margin for spacing after chart, wide margin between items.
}
Connections
{

View file

@ -0,0 +1,22 @@
// Copyright (c) 2018 Ultimaker B.V.
// Toolbox is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
Rectangle
{
id: page
width: parent.width
height: parent.height
color: "transparent"
Label
{
text: catalog.i18nc("@info", "Could not connect to the Cura Package database. Please check your connection.")
anchors
{
centerIn: parent
}
}
}

View file

@ -314,8 +314,9 @@ class Toolbox(QObject, Extension):
return
def resetDownload(self):
self._download_reply.abort()
self._download_reply.downloadProgress.disconnect(self._onDownloadProgress)
if self._download_reply:
self._download_reply.abort()
self._download_reply.downloadProgress.disconnect(self._onDownloadProgress)
self._download_reply = None
self._download_request = None
self.setDownloadProgress(0)
@ -333,11 +334,13 @@ class Toolbox(QObject, Extension):
if reply.error() == QNetworkReply.TimeoutError:
Logger.log("w", "Got a timeout.")
self.setViewPage("errored")
self.resetDownload()
return
if reply.error() == QNetworkReply.HostNotFoundError:
Logger.log("w", "Unable to reach server.")
self.setViewPage("errored")
self.resetDownload()
return