Cleaned-up printe job info block

Contributes to CL-897, CL-1051
This commit is contained in:
Ian Paschal 2018-09-27 13:40:46 +02:00
parent 50e07ae2a7
commit 302f9a95b3
8 changed files with 811 additions and 166 deletions

View file

@ -1,93 +1,119 @@
import QtQuick 2.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import UM 1.2 as UM
Item
{
Item {
id: extruderInfo
property var printCoreConfiguration
width: Math.round(parent.width / 2)
height: childrenRect.height
property var printCoreConfiguration: null;
Item
{
width: Math.round(parent.width / 2);
height: childrenRect.height;
// Extruder circle
Item {
id: extruderCircle
width: 30
height: 30
anchors.verticalCenter: printAndMaterialLabel.verticalCenter
opacity:
{
if(printCoreConfiguration == null || printCoreConfiguration.activeMaterial == null || printCoreConfiguration.hotendID == null)
{
return 0.5
width: UM.Theme.getSize("monitor_tab_extruder_circle").width;
height: UM.Theme.getSize("monitor_tab_extruder_circle").height;
anchors.verticalCenter: parent.verticalCenter;
// Loading skeleton
Rectangle {
visible: !extruderInfo.printCoreConfiguration;
anchors.fill: parent;
radius: Math.round(width / 2);
color: UM.Theme.getColor("viewport_background");
}
// Actual content
Rectangle {
visible: extruderInfo.printCoreConfiguration;
anchors.fill: parent;
radius: Math.round(width / 2);
border.width: UM.Theme.getSize("monitor_tab_thick_lining").width;
border.color: UM.Theme.getColor("monitor_tab_lining_active");
opacity: {
if (printCoreConfiguration == null || printCoreConfiguration.activeMaterial == null || printCoreConfiguration.hotendID == null) {
return 0.5;
}
return 1;
}
return 1
}
Rectangle
{
anchors.fill: parent
radius: Math.round(width / 2)
border.width: 2
border.color: "black"
}
Label
{
anchors.centerIn: parent
font: UM.Theme.getFont("default_bold")
text: printCoreConfiguration.position + 1
Label {
anchors.centerIn: parent;
font: UM.Theme.getFont("default_bold");
text: printCoreConfiguration.position + 1;
}
}
}
Item
{
id: printAndMaterialLabel
anchors
{
right: parent.right
left: extruderCircle.right
margins: UM.Theme.getSize("default_margin").width
}
height: childrenRect.height
// Print core and material labels
Item {
id: materialLabel
Label
{
id: materialLabel
text:
{
if(printCoreConfiguration != undefined && printCoreConfiguration.activeMaterial != undefined)
{
return printCoreConfiguration.activeMaterial.name
}
return ""
}
font: UM.Theme.getFont("default")
elide: Text.ElideRight
width: parent.width
anchors {
left: extruderCircle.right;
leftMargin: UM.Theme.getSize("default_margin").width;
top: parent.top;
right: parent.right;
}
height: UM.Theme.getSize("monitor_tab_text_line").height;
// Loading skeleton
Rectangle {
visible: !extruderInfo.printCoreConfiguration;
anchors.fill: parent;
color: UM.Theme.getColor("viewport_background");
}
Label
{
id: printCoreLabel
text:
{
if(printCoreConfiguration != undefined && printCoreConfiguration.hotendID != undefined)
{
return printCoreConfiguration.hotendID
// Actual content
Label {
visible: extruderInfo.printCoreConfiguration;
anchors.fill: parent;
text: {
if (printCoreConfiguration != undefined && printCoreConfiguration.activeMaterial != undefined) {
return printCoreConfiguration.activeMaterial.name;
}
return ""
return "";
}
anchors.top: materialLabel.bottom
elide: Text.ElideRight
width: parent.width
opacity: 0.6
font: UM.Theme.getFont("default")
font: UM.Theme.getFont("default");
elide: Text.ElideRight;
}
}
Item {
id: printCoreLabel;
anchors {
right: parent.right;
left: extruderCircle.right;
leftMargin: UM.Theme.getSize("default_margin").width;
bottom: parent.bottom;
}
height: UM.Theme.getSize("monitor_tab_text_line").height;
// Loading skeleton
Rectangle {
visible: !extruderInfo.printCoreConfiguration;
width: parent.width / 3;
height: parent.height;
color: UM.Theme.getColor("viewport_background");
}
// Actual content
Label {
visible: extruderInfo.printCoreConfiguration;
text: {
if (printCoreConfiguration != undefined && printCoreConfiguration.hotendID != undefined) {
return printCoreConfiguration.hotendID;
}
return "";
}
elide: Text.ElideRight;
opacity: 0.6;
font: UM.Theme.getFont("default");
}
}
}