Fixed qml warnings (reading from undefined properties)

CL-893 && CL-894
This commit is contained in:
Jaime van Kessel 2018-08-21 10:14:12 +02:00
parent 1fa3b60f94
commit 03a7833180
3 changed files with 46 additions and 9 deletions

View file

@ -183,6 +183,7 @@ class Toolbox(QObject, Extension):
"materials_available": QUrl("{base_url}/packages?package_type=material".format(base_url=self._api_url)), "materials_available": QUrl("{base_url}/packages?package_type=material".format(base_url=self._api_url)),
"materials_generic": QUrl("{base_url}/packages?package_type=material&tags=generic".format(base_url=self._api_url)) "materials_generic": QUrl("{base_url}/packages?package_type=material&tags=generic".format(base_url=self._api_url))
} }
print("*******", self._request_urls )
# Get the API root for the packages API depending on Cura version settings. # Get the API root for the packages API depending on Cura version settings.
def _getCloudAPIRoot(self) -> str: def _getCloudAPIRoot(self) -> str:

View file

@ -203,29 +203,50 @@ Component
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.margins: UM.Theme.getSize("default_margin").width anchors.margins: UM.Theme.getSize("default_margin").width
height: childrenRect.height height: childrenRect.height + UM.Theme.getSize("default_margin").height
Label Label
{ {
id: printJobName id: printJobName
text: modelData.activePrintJob.name text: modelData.activePrintJob != null ? modelData.activePrintJob.name : ""
font: UM.Theme.getFont("default_bold") font: UM.Theme.getFont("default_bold")
} }
Label Label
{ {
id: ownerName id: ownerName
anchors.top: printJobName.bottom anchors.top: printJobName.bottom
text: modelData.activePrintJob.owner text: modelData.activePrintJob != null ? modelData.activePrintJob.owner : ""
} }
Image Image
{ {
source: modelData.activePrintJob.preview_image_url id: printJobPreview
source: modelData.activePrintJob != null ? modelData.activePrintJob.preview_image_url : ""
anchors.top: ownerName.bottom anchors.top: ownerName.bottom
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: totalTimeLabel.top //anchors.bottom: totalTimeLabel.top
width: height width: parent.width / 3
height: width
} }
Rectangle
{
id: showCameraIcon
width: 30 * screenScaleFactor
height: width
radius: width
anchors.left: parent.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width
anchors.bottom: printJobPreview.bottom
color: UM.Theme.getColor("setting_control_border_highlight")
Image
{
width: parent.width
height: width
anchors.right: parent.right
anchors.rightMargin: parent.rightMargin
source: "camera-icon.svg"
}
}
} }
} }
} }

View file

@ -30,14 +30,22 @@ Item
{ {
anchors.centerIn: parent anchors.centerIn: parent
font: UM.Theme.getFont("default_bold") font: UM.Theme.getFont("default_bold")
text: printCoreConfiguration.position + 1 text: printCoreConfiguration != undefined ? printCoreConfiguration.position + 1 : ""
} }
} }
Label Label
{ {
id: materialLabel id: materialLabel
text: printCoreConfiguration.activeMaterial != null ? printCoreConfiguration.activeMaterial.name : ":(" text:
{
if(printCoreConfiguration != undefined && printCoreConfiguration.activeMaterial != undefined)
{
return printCoreConfiguration.activeMaterial.name
}
return ""
}
elide: Text.ElideRight elide: Text.ElideRight
width: parent.width width: parent.width
font: UM.Theme.getFont("default_bold") font: UM.Theme.getFont("default_bold")
@ -48,7 +56,14 @@ Item
Label Label
{ {
id: printCoreLabel id: printCoreLabel
text: printCoreConfiguration.hotendID text:
{
if(printCoreConfiguration != undefined && printCoreConfiguration.hotendID != undefined)
{
return printCoreConfiguration.hotendID
}
return ""
}
anchors.top: materialLabel.bottom anchors.top: materialLabel.bottom
elide: Text.ElideRight elide: Text.ElideRight
width: parent.width width: parent.width