Merge branch '4.0' into CURA-6005_cura_drive_plugin

This commit is contained in:
Diego Prado Gesto 2018-12-17 11:25:19 +01:00
commit e62a570210
65 changed files with 818 additions and 735 deletions

View file

@ -13,7 +13,7 @@ import Cura 1.0 as Cura
Cura.MachineAction
{
id: base
property var extrudersModel: Cura.ExtrudersModel{}
property var extrudersModel: CuraApplication.getExtrudersModel()
property int extruderTabsCount: 0
property var activeMachineId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.id : ""

View file

@ -35,6 +35,6 @@ Item
property real maximumWidth: parent.width
property real maximumHeight: parent.height
sourceComponent: Cura.MachineManager.printerOutputDevices.length > 0 ? Cura.MachineManager.printerOutputDevices[0].monitorItem: null
sourceComponent: Cura.MachineManager.printerOutputDevices.length > 0 ? Cura.MachineManager.printerOutputDevices[0].monitorItem : null
}
}

View file

@ -100,7 +100,7 @@ Item
source: UM.Theme.getIcon("load")
width: UM.Theme.getSize("button_icon").width
height: UM.Theme.getSize("button_icon").height
color: UM.Theme.getColor("toolbar_button_text")
color: UM.Theme.getColor("icon")
sourceSize.height: height
}

View file

@ -1,4 +1,4 @@
# Copyright (c) 2017 Ultimaker B.V.
# Copyright (c) 2018 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
import os.path
from UM.Application import Application
@ -15,9 +15,5 @@ class PrepareStage(CuraStage):
Application.getInstance().engineCreatedSignal.connect(self._engineCreated)
def _engineCreated(self):
sidebar_component_path = os.path.join(Resources.getPath(Application.getInstance().ResourceTypes.QmlFiles),
"PrepareSidebar.qml")
menu_component_path = os.path.join(PluginRegistry.getInstance().getPluginPath("PrepareStage"), "PrepareMenu.qml")
self.addDisplayComponent("menu", menu_component_path)
self.addDisplayComponent("sidebar", sidebar_component_path)

View file

@ -163,7 +163,7 @@ Cura.ExpandableComponent
Repeater
{
model: Cura.ExtrudersModel{}
model: CuraApplication.getExtrudersModel()
CheckBox
{

View file

@ -12,7 +12,6 @@ from UM.Math.Color import Color
from UM.View.GL.OpenGL import OpenGL
from cura.Settings.ExtruderManager import ExtruderManager
from cura.Settings.ExtrudersModel import ExtrudersModel
import math
@ -29,13 +28,16 @@ class SolidView(View):
self._non_printing_shader = None
self._support_mesh_shader = None
self._extruders_model = ExtrudersModel()
self._extruders_model = None
self._theme = None
def beginRendering(self):
scene = self.getController().getScene()
renderer = self.getRenderer()
if not self._extruders_model:
self._extruders_model = Application.getInstance().getExtrudersModel()
if not self._theme:
self._theme = Application.getInstance().getTheme()

View file

@ -0,0 +1,104 @@
import QtQuick 2.7
import QtQuick.Controls 2.1
import UM 1.0 as UM
import Cura 1.1 as Cura
Item
{
id: ratingWidget
property real rating: 0
property int indexHovered: -1
property string packageId: ""
property int userRating: 0
property bool canRate: false
signal rated(int rating)
width: contentRow.width
height: contentRow.height
MouseArea
{
id: mouseArea
anchors.fill: parent
hoverEnabled: ratingWidget.canRate
acceptedButtons: Qt.NoButton
onExited:
{
if(ratingWidget.canRate)
{
ratingWidget.indexHovered = -1
}
}
Row
{
id: contentRow
height: childrenRect.height
Repeater
{
model: 5 // We need to get 5 stars
Button
{
id: control
hoverEnabled: true
onHoveredChanged:
{
if(hovered && ratingWidget.canRate)
{
indexHovered = index
}
}
ToolTip.visible: control.hovered && !ratingWidget.canRate
ToolTip.text: !Cura.API.account.isLoggedIn ? catalog.i18nc("@label", "You need to login first before you can rate"): catalog.i18nc("@label", "You need to install the package before you can rate")
property bool isStarFilled:
{
// If the entire widget is hovered, override the actual rating.
if(ratingWidget.indexHovered >= 0)
{
return indexHovered >= index
}
if(ratingWidget.userRating > 0)
{
return userRating >= index +1
}
return rating >= index + 1
}
contentItem: Item {}
height: UM.Theme.getSize("rating_star").height
width: UM.Theme.getSize("rating_star").width
background: UM.RecolorImage
{
source: UM.Theme.getIcon(control.isStarFilled ? "star_filled" : "star_empty")
// Unfilled stars should always have the default color. Only filled stars should change on hover
color:
{
if(!ratingWidget.canRate)
{
return UM.Theme.getColor("rating_star")
}
if((ratingWidget.indexHovered >= 0 || ratingWidget.userRating > 0) && isStarFilled)
{
return UM.Theme.getColor("primary")
}
return UM.Theme.getColor("rating_star")
}
}
onClicked:
{
if(ratingWidget.canRate)
{
rated(index + 1) // Notify anyone who cares about this.
}
}
}
}
}
}
}

View file

@ -0,0 +1,34 @@
import QtQuick 2.3
import QtQuick.Controls 1.4
import UM 1.1 as UM
import Cura 1.1 as Cura
Row
{
id: rating
height: UM.Theme.getSize("rating_star").height
visible: model.average_rating > 0 //Has a rating at all.
spacing: UM.Theme.getSize("thick_lining").width
width: starIcon.width + spacing + numRatingsLabel.width
UM.RecolorImage
{
id: starIcon
source: UM.Theme.getIcon("star_filled")
color: model.user_rating == 0 ? UM.Theme.getColor("rating_star") : UM.Theme.getColor("primary")
height: UM.Theme.getSize("rating_star").height
width: UM.Theme.getSize("rating_star").width
}
Label
{
id: numRatingsLabel
text: model.average_rating != undefined ? model.average_rating.toFixed(1) + " (" + model.num_ratings + " " + catalog.i18nc("@label", "ratings") + ")": ""
verticalAlignment: Text.AlignVCenter
height: starIcon.height
width: contentWidth
anchors.verticalCenter: starIcon.verticalCenter
color: starIcon.color
font: UM.Theme.getFont("small")
renderType: Text.NativeRendering
}
}

View file

@ -6,6 +6,8 @@ import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import UM 1.1 as UM
import Cura 1.1 as Cura
Item
{
id: page
@ -24,7 +26,7 @@ Item
right: parent.right
rightMargin: UM.Theme.getSize("wide_margin").width
}
height: UM.Theme.getSize("toolbox_detail_header").height
height: childrenRect.height + 3 * UM.Theme.getSize("default_margin").width
Rectangle
{
id: thumbnail
@ -37,7 +39,7 @@ Item
leftMargin: UM.Theme.getSize("wide_margin").width
topMargin: UM.Theme.getSize("wide_margin").height
}
color: "white" //Always a white background for image (regardless of theme).
color: UM.Theme.getColor("main_background")
Image
{
anchors.fill: parent
@ -55,19 +57,23 @@ Item
top: thumbnail.top
left: thumbnail.right
leftMargin: UM.Theme.getSize("default_margin").width
right: parent.right
rightMargin: UM.Theme.getSize("wide_margin").width
bottomMargin: UM.Theme.getSize("default_margin").height
}
text: details === null ? "" : (details.name || "")
font: UM.Theme.getFont("large")
color: UM.Theme.getColor("text")
wrapMode: Text.WordWrap
width: parent.width
height: UM.Theme.getSize("toolbox_property_label").height
width: contentWidth
height: contentHeight
renderType: Text.NativeRendering
}
SmallRatingWidget
{
anchors.left: title.right
anchors.leftMargin: UM.Theme.getSize("default_margin").width
anchors.verticalCenter: title.verticalCenter
property var model: details
}
Column
{
id: properties
@ -81,6 +87,13 @@ Item
width: childrenRect.width
height: childrenRect.height
Label
{
text: catalog.i18nc("@label", "Rating") + ":"
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text_medium")
renderType: Text.NativeRendering
}
Label
{
text: catalog.i18nc("@label", "Version") + ":"
font: UM.Theme.getFont("default")
@ -121,6 +134,48 @@ Item
}
spacing: Math.floor(UM.Theme.getSize("narrow_margin").height)
height: childrenRect.height
RatingWidget
{
id: rating
visible: details.type == "plugin"
packageId: details.id != undefined ? details.id: ""
userRating: details.user_rating != undefined ? details.user_rating: 0
canRate: toolbox.isInstalled(details.id) && Cura.API.account.isLoggedIn
onRated:
{
toolbox.ratePackage(details.id, rating)
// HACK: This is a far from optimal solution, but without major refactoring, this is the best we can
// do. Since a rework of this is scheduled, it shouldn't live that long...
var index = toolbox.pluginsAvailableModel.find("id", details.id)
if(index != -1)
{
if(details.user_rating == 0) // User never rated before.
{
toolbox.pluginsAvailableModel.setProperty(index, "num_ratings", details.num_ratings + 1)
}
toolbox.pluginsAvailableModel.setProperty(index, "user_rating", rating)
// Hack; This is because the current selection is an outdated copy, so we need to re-copy it.
base.selection = toolbox.pluginsAvailableModel.getItem(index)
return
}
index = toolbox.pluginsShowcaseModel.find("id", details.id)
if(index != -1)
{
if(details.user_rating == 0) // User never rated before.
{
toolbox.pluginsShowcaseModel.setProperty(index, "user_rating", rating)
}
toolbox.pluginsShowcaseModel.setProperty(index, "num_ratings", details.num_ratings + 1)
// Hack; This is because the current selection is an outdated copy, so we need to re-copy it.
base.selection = toolbox.pluginsShowcaseModel.getItem(index)
}
}
}
Label
{
text: details === null ? "" : (details.version || catalog.i18nc("@label", "Unknown"))
@ -170,13 +225,6 @@ Item
renderType: Text.NativeRendering
}
}
Rectangle
{
color: UM.Theme.getColor("lining")
width: parent.width
height: UM.Theme.getSize("default_lining").height
anchors.bottom: parent.bottom
}
}
ToolboxDetailList
{

View file

@ -6,6 +6,7 @@ import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.3
import UM 1.1 as UM
import Cura 1.1 as Cura
Item
{
@ -14,94 +15,13 @@ Item
property int installedPackages: (toolbox.viewCategory == "material" && model.type === undefined) ? toolbox.getNumberOfInstalledPackagesByAuthor(model.id) : (toolbox.isInstalled(model.id) ? 1 : 0)
height: childrenRect.height
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
Rectangle
{
id: highlight
anchors.fill: parent
opacity: 0.0
color: UM.Theme.getColor("primary")
}
Row
{
width: parent.width
height: childrenRect.height
spacing: Math.floor(UM.Theme.getSize("narrow_margin").width)
Rectangle
{
id: thumbnail
width: UM.Theme.getSize("toolbox_thumbnail_small").width
height: UM.Theme.getSize("toolbox_thumbnail_small").height
color: "white"
border.width: UM.Theme.getSize("default_lining").width
border.color: UM.Theme.getColor("lining")
Image
{
anchors.centerIn: parent
width: UM.Theme.getSize("toolbox_thumbnail_small").width - UM.Theme.getSize("wide_margin").width
height: UM.Theme.getSize("toolbox_thumbnail_small").height - UM.Theme.getSize("wide_margin").width
fillMode: Image.PreserveAspectFit
source: model.icon_url || "../images/logobot.svg"
mipmap: true
}
UM.RecolorImage
{
width: (parent.width * 0.4) | 0
height: (parent.height * 0.4) | 0
anchors
{
bottom: parent.bottom
right: parent.right
}
sourceSize.height: height
visible: installedPackages != 0
color: (installedPackages == packageCount) ? UM.Theme.getColor("primary") : UM.Theme.getColor("border")
source: "../images/installed_check.svg"
}
}
Column
{
width: parent.width - thumbnail.width - parent.spacing
spacing: Math.floor(UM.Theme.getSize("narrow_margin").width)
anchors.top: parent.top
anchors.topMargin: UM.Theme.getSize("default_margin").height
Label
{
id: name
text: model.name
width: parent.width
wrapMode: Text.WordWrap
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("default_bold")
renderType: Text.NativeRendering
}
Label
{
id: info
text: model.description
maximumLineCount: 2
elide: Text.ElideRight
width: parent.width
wrapMode: Text.WordWrap
color: UM.Theme.getColor("text_medium")
font: UM.Theme.getFont("default")
renderType: Text.NativeRendering
}
}
}
MouseArea
{
anchors.fill: parent
hoverEnabled: true
onEntered:
{
thumbnail.border.color = UM.Theme.getColor("primary")
highlight.opacity = 0.1
}
onExited:
{
thumbnail.border.color = UM.Theme.getColor("lining")
highlight.opacity = 0.0
}
onEntered: thumbnail.border.color = UM.Theme.getColor("primary")
onExited: thumbnail.border.color = UM.Theme.getColor("lining")
onClicked:
{
base.selection = model
@ -131,4 +51,83 @@ Item
}
}
}
Rectangle
{
id: thumbnail
width: UM.Theme.getSize("toolbox_thumbnail_small").width
height: UM.Theme.getSize("toolbox_thumbnail_small").height
color: UM.Theme.getColor("main_background")
border.width: UM.Theme.getSize("default_lining").width
border.color: UM.Theme.getColor("lining")
Image
{
anchors.centerIn: parent
width: UM.Theme.getSize("toolbox_thumbnail_small").width - UM.Theme.getSize("wide_margin").width
height: UM.Theme.getSize("toolbox_thumbnail_small").height - UM.Theme.getSize("wide_margin").width
fillMode: Image.PreserveAspectFit
source: model.icon_url || "../images/logobot.svg"
mipmap: true
}
UM.RecolorImage
{
width: (parent.width * 0.4) | 0
height: (parent.height * 0.4) | 0
anchors
{
bottom: parent.bottom
right: parent.right
}
sourceSize.height: height
visible: installedPackages != 0
color: (installedPackages == packageCount) ? UM.Theme.getColor("primary") : UM.Theme.getColor("border")
source: "../images/installed_check.svg"
}
}
Item
{
anchors
{
left: thumbnail.right
leftMargin: Math.floor(UM.Theme.getSize("narrow_margin").width)
right: parent.right
top: parent.top
bottom: parent.bottom
}
Label
{
id: name
text: model.name
width: parent.width
elide: Text.ElideRight
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("default_bold")
}
Label
{
id: info
text: model.description
elide: Text.ElideRight
width: parent.width
wrapMode: Text.WordWrap
color: UM.Theme.getColor("text_medium")
font: UM.Theme.getFont("default")
anchors.top: name.bottom
anchors.bottom: rating.top
verticalAlignment: Text.AlignVCenter
maximumLineCount: 2
}
SmallRatingWidget
{
id: rating
anchors
{
bottom: parent.bottom
left: parent.left
right: parent.right
}
}
}
}

View file

@ -13,91 +13,78 @@ Rectangle
property int installedPackages: toolbox.viewCategory == "material" ? toolbox.getNumberOfInstalledPackagesByAuthor(model.id) : (toolbox.isInstalled(model.id) ? 1 : 0)
id: tileBase
width: UM.Theme.getSize("toolbox_thumbnail_large").width + (2 * UM.Theme.getSize("default_lining").width)
height: thumbnail.height + packageNameBackground.height + (2 * UM.Theme.getSize("default_lining").width)
height: thumbnail.height + packageName.height + rating.height + UM.Theme.getSize("default_margin").width
border.width: UM.Theme.getSize("default_lining").width
border.color: UM.Theme.getColor("lining")
color: "transparent"
Rectangle
color: UM.Theme.getColor("main_background")
Image
{
id: thumbnail
color: "white"
width: UM.Theme.getSize("toolbox_thumbnail_large").width
height: UM.Theme.getSize("toolbox_thumbnail_large").height
height: UM.Theme.getSize("toolbox_thumbnail_large").height - 4 * UM.Theme.getSize("default_margin").height
width: UM.Theme.getSize("toolbox_thumbnail_large").height - 4 * UM.Theme.getSize("default_margin").height
fillMode: Image.PreserveAspectFit
source: model.icon_url || "../images/logobot.svg"
mipmap: true
anchors
{
top: parent.top
topMargin: UM.Theme.getSize("default_margin").height
horizontalCenter: parent.horizontalCenter
topMargin: UM.Theme.getSize("default_lining").width
}
Image
}
Label
{
id: packageName
text: model.name
anchors
{
anchors.centerIn: parent
width: UM.Theme.getSize("toolbox_thumbnail_large").width - 2 * UM.Theme.getSize("default_margin").width
height: UM.Theme.getSize("toolbox_thumbnail_large").height - 2 * UM.Theme.getSize("default_margin").height
fillMode: Image.PreserveAspectFit
source: model.icon_url || "../images/logobot.svg"
mipmap: true
horizontalCenter: parent.horizontalCenter
top: thumbnail.bottom
}
UM.RecolorImage
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
renderType: Text.NativeRendering
height: UM.Theme.getSize("toolbox_heading_label").height
width: parent.width - UM.Theme.getSize("default_margin").width
wrapMode: Text.WordWrap
font: UM.Theme.getFont("medium_bold")
}
UM.RecolorImage
{
width: (parent.width * 0.20) | 0
height: width
anchors
{
width: (parent.width * 0.3) | 0
height: (parent.height * 0.3) | 0
anchors
{
bottom: parent.bottom
right: parent.right
bottomMargin: UM.Theme.getSize("default_lining").width
}
visible: installedPackages != 0
color: (installedPackages == packageCount) ? UM.Theme.getColor("primary") : UM.Theme.getColor("border")
source: "../images/installed_check.svg"
bottom: bottomBorder.top
right: parent.right
}
visible: installedPackages != 0
color: (installedPackages == packageCount) ? UM.Theme.getColor("primary") : UM.Theme.getColor("border")
source: "../images/installed_check.svg"
}
SmallRatingWidget
{
id: rating
anchors.bottom: parent.bottom
anchors.bottomMargin: UM.Theme.getSize("narrow_margin").height
anchors.horizontalCenter: parent.horizontalCenter
}
Rectangle
{
id: packageNameBackground
id: bottomBorder
color: UM.Theme.getColor("primary")
anchors
{
top: thumbnail.bottom
horizontalCenter: parent.horizontalCenter
}
height: UM.Theme.getSize("toolbox_heading_label").height
anchors.bottom: parent.bottom
width: parent.width
Label
{
id: packageName
text: model.name
anchors
{
horizontalCenter: parent.horizontalCenter
}
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
height: UM.Theme.getSize("toolbox_heading_label").height
width: parent.width
wrapMode: Text.WordWrap
color: UM.Theme.getColor("button_text")
font: UM.Theme.getFont("medium_bold")
renderType: Text.NativeRendering
}
height: UM.Theme.getSize("toolbox_header_highlight").height
}
MouseArea
{
anchors.fill: parent
hoverEnabled: true
onEntered:
{
packageName.color = UM.Theme.getColor("button_text_hover")
packageNameBackground.color = UM.Theme.getColor("primary_hover")
tileBase.border.color = UM.Theme.getColor("primary_hover")
}
onExited:
{
packageName.color = UM.Theme.getColor("button_text")
packageNameBackground.color = UM.Theme.getColor("primary")
tileBase.border.color = UM.Theme.getColor("lining")
}
onEntered: tileBase.border.color = UM.Theme.getColor("primary")
onExited: tileBase.border.color = UM.Theme.getColor("lining")
onClicked:
{
base.selection = model

View file

@ -41,6 +41,9 @@ class PackagesModel(ListModel):
self.addRoleName(Qt.UserRole + 20, "links")
self.addRoleName(Qt.UserRole + 21, "website")
self.addRoleName(Qt.UserRole + 22, "login_required")
self.addRoleName(Qt.UserRole + 23, "average_rating")
self.addRoleName(Qt.UserRole + 24, "num_ratings")
self.addRoleName(Qt.UserRole + 25, "user_rating")
# List of filters for queries. The result is the union of the each list of results.
self._filter = {} # type: Dict[str, str]
@ -101,7 +104,10 @@ class PackagesModel(ListModel):
"tags": package["tags"] if "tags" in package else [],
"links": links_dict,
"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": float(package.get("rating", {}).get("average", 0)),
"num_ratings": package.get("rating", {}).get("count", 0),
"user_rating": package.get("rating", {}).get("user_rating", 0)
})
# Filter on all the key-word arguments.

View file

@ -13,7 +13,6 @@ from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkRepl
from UM.Logger import Logger
from UM.PluginRegistry import PluginRegistry
from UM.Extension import Extension
from UM.Qt.ListModel import ListModel
from UM.i18n import i18nCatalog
from UM.Version import Version
@ -51,17 +50,10 @@ class Toolbox(QObject, Extension):
self._download_progress = 0 # type: float
self._is_downloading = False # type: bool
self._network_manager = None # type: Optional[QNetworkAccessManager]
self._request_header = [
b"User-Agent",
str.encode(
"%s/%s (%s %s)" % (
self._application.getApplicationName(),
self._application.getVersion(),
platform.system(),
platform.machine(),
)
)
]
self._request_headers = [] # type: List[Tuple[bytes, bytes]]
self._updateRequestHeader()
self._request_urls = {} # type: Dict[str, QUrl]
self._to_update = [] # type: List[str] # Package_ids that are waiting to be updated
self._old_plugin_ids = set() # type: Set[str]
@ -116,6 +108,7 @@ class Toolbox(QObject, Extension):
self._restart_dialog_message = "" # type: str
self._application.initializationFinished.connect(self._onAppInitialized)
self._application.getCuraAPI().account.loginStateChanged.connect(self._updateRequestHeader)
# Signals:
# --------------------------------------------------------------------------
@ -135,12 +128,38 @@ class Toolbox(QObject, Extension):
showLicenseDialog = pyqtSignal()
uninstallVariablesChanged = pyqtSignal()
def _updateRequestHeader(self):
self._request_headers = [
(b"User-Agent",
str.encode(
"%s/%s (%s %s)" % (
self._application.getApplicationName(),
self._application.getVersion(),
platform.system(),
platform.machine(),
)
))
]
access_token = self._application.getCuraAPI().account.accessToken
if access_token:
self._request_headers.append((b"Authorization", "Bearer {}".format(access_token).encode()))
def _resetUninstallVariables(self) -> None:
self._package_id_to_uninstall = None # type: Optional[str]
self._package_name_to_uninstall = ""
self._package_used_materials = [] # type: List[Tuple[GlobalStack, str, str]]
self._package_used_qualities = [] # type: List[Tuple[GlobalStack, str, str]]
@pyqtSlot(str, int)
def ratePackage(self, package_id: str, rating: int) -> None:
url = QUrl("{base_url}/packages/{package_id}/ratings".format(base_url=self._api_url, package_id = package_id))
self._rate_request = QNetworkRequest(url)
for header_name, header_value in self._request_headers:
cast(QNetworkRequest, self._rate_request).setRawHeader(header_name, header_value)
data = "{\"data\": {\"cura_version\": \"%s\", \"rating\": %i}}" % (Version(self._application.getVersion()), rating)
self._rate_reply = cast(QNetworkAccessManager, self._network_manager).put(self._rate_request, data.encode())
@pyqtSlot(result = str)
def getLicenseDialogPluginName(self) -> str:
return self._license_dialog_plugin_name
@ -531,7 +550,8 @@ class Toolbox(QObject, Extension):
def _makeRequestByType(self, request_type: str) -> None:
Logger.log("i", "Requesting %s metadata from server.", request_type)
request = QNetworkRequest(self._request_urls[request_type])
request.setRawHeader(*self._request_header)
for header_name, header_value in self._request_headers:
request.setRawHeader(header_name, header_value)
if self._network_manager:
self._network_manager.get(request)
@ -546,7 +566,8 @@ class Toolbox(QObject, Extension):
if hasattr(QNetworkRequest, "RedirectPolicyAttribute"):
# Patch for Qt 5.9+
cast(QNetworkRequest, self._download_request).setAttribute(QNetworkRequest.RedirectPolicyAttribute, True)
cast(QNetworkRequest, self._download_request).setRawHeader(*self._request_header)
for header_name, header_value in self._request_headers:
cast(QNetworkRequest, self._download_request).setRawHeader(header_name, header_value)
self._download_reply = cast(QNetworkAccessManager, self._network_manager).get(self._download_request)
self.setDownloadProgress(0)
self.setIsDownloading(True)
@ -628,7 +649,7 @@ class Toolbox(QObject, Extension):
else:
self.setViewPage("errored")
self.resetDownload()
else:
elif reply.operation() == QNetworkAccessManager.PutOperation:
# Ignore any operation that is not a get operation
pass

View file

@ -97,6 +97,7 @@ Item
return ""
}
visible: printJob
width: 120 * screenScaleFactor // TODO: Theme!
// FIXED-LINE-HEIGHT:
height: 18 * screenScaleFactor // TODO: Theme!

View file

@ -12,7 +12,19 @@ import UM 1.2 as UM
Item
{
// The printer name
property alias text: printerNameLabel.text;
property var text: ""
property var tagText: {
switch(text) {
case "Ultimaker 3":
return "UM 3"
case "Ultimaker 3 Extended":
return "UM 3 EXT"
case "Ultimaker S5":
return "UM S5"
default:
return text
}
}
implicitHeight: 18 * screenScaleFactor // TODO: Theme!
implicitWidth: printerNameLabel.contentWidth + 12 // TODO: Theme!
@ -28,7 +40,7 @@ Item
id: printerNameLabel
anchors.centerIn: parent
color: "#535369" // TODO: Theme!
text: ""
text: tagText
font.pointSize: 10
}
}

View file

@ -34,16 +34,20 @@ Component
name: "cura"
}
LinearGradient {
LinearGradient
{
anchors.fill: parent
gradient: Gradient {
GradientStop {
gradient: Gradient
{
GradientStop
{
position: 0.0
color: "#f6f6f6"
color: "#f6f6f6" // TODO: Theme!
}
GradientStop {
GradientStop
{
position: 1.0
color: "#ffffff"
color: "#ffffff" // TODO: Theme!
}
}
}
@ -81,7 +85,8 @@ Component
id: queue
width: Math.min(834 * screenScaleFactor, maximumWidth)
anchors {
anchors
{
bottom: parent.bottom
horizontalCenter: parent.horizontalCenter
top: printers.bottom
@ -210,7 +215,8 @@ Component
ScrollView
{
id: queuedPrintJobs
anchors {
anchors
{
bottom: parent.bottom
horizontalCenter: parent.horizontalCenter
top: printJobQueueHeadings.bottom
@ -239,7 +245,8 @@ Component
}
}
PrinterVideoStream {
PrinterVideoStream
{
anchors.fill: parent
cameraUrl: OutputDevice.activeCameraUrl
visible: OutputDevice.activeCameraUrl != ""

View file

@ -83,9 +83,7 @@ Item {
Column {
Repeater {
model: Cura.ExtrudersModel {
simpleNames: true;
}
model: CuraApplication.getExtrudersModel()
Label {
text: model.name;