|
@@ -6,7 +6,7 @@ import QtQuick.Controls 1.1
|
|
|
import QtQuick.Controls.Styles 1.1
|
|
|
import QtQuick.Layouts 1.1
|
|
|
|
|
|
-import UM 1.1 as UM
|
|
|
+import UM 1.2 as UM
|
|
|
import Cura 1.0 as Cura
|
|
|
|
|
|
Rectangle
|
|
@@ -14,6 +14,7 @@ Rectangle
|
|
|
id: base;
|
|
|
|
|
|
property int currentModeIndex;
|
|
|
+ property bool monitoringPrint: false
|
|
|
|
|
|
// Is there an output device for this printer?
|
|
|
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
|
@@ -21,6 +22,7 @@ Rectangle
|
|
|
color: UM.Theme.getColor("sidebar");
|
|
|
UM.I18nCatalog { id: catalog; name:"cura"}
|
|
|
|
|
|
+
|
|
|
function showTooltip(item, position, text)
|
|
|
{
|
|
|
tooltip.text = text;
|
|
@@ -33,6 +35,22 @@ Rectangle
|
|
|
tooltip.hide();
|
|
|
}
|
|
|
|
|
|
+ function strPadLeft(string, pad, length) {
|
|
|
+ return (new Array(length + 1).join(pad) + string).slice(-length);
|
|
|
+ }
|
|
|
+
|
|
|
+ function getPrettyTime(time)
|
|
|
+ {
|
|
|
+ var hours = Math.floor(time / 3600)
|
|
|
+ time -= hours * 3600
|
|
|
+ var minutes = Math.floor(time / 60);
|
|
|
+ time -= minutes * 60
|
|
|
+ var seconds = Math.floor(time);
|
|
|
+
|
|
|
+ var finalTime = strPadLeft(hours, "0", 2) + ':' + strPadLeft(minutes,'0',2)+ ':' + strPadLeft(seconds,'0',2);
|
|
|
+ return finalTime;
|
|
|
+ }
|
|
|
+
|
|
|
MouseArea
|
|
|
{
|
|
|
anchors.fill: parent
|
|
@@ -44,12 +62,64 @@ Rectangle
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // Mode selection buttons for changing between Setting & Monitor print mode
|
|
|
+ Rectangle
|
|
|
+ {
|
|
|
+ id: sidebarHeaderBar
|
|
|
+ anchors.left: parent.left
|
|
|
+ anchors.right: parent.right
|
|
|
+ height: childrenRect.height
|
|
|
+ color: UM.Theme.getColor("sidebar_header_bar")
|
|
|
+
|
|
|
+ Row
|
|
|
+ {
|
|
|
+ anchors.left: parent.left
|
|
|
+ anchors.leftMargin: UM.Theme.getSize("default_margin").width;
|
|
|
+ anchors.right: parent.right
|
|
|
+ Button
|
|
|
+ {
|
|
|
+ width: (parent.width - UM.Theme.getSize("default_margin").width) / 2
|
|
|
+ height: UM.Theme.getSize("sidebar_header").height
|
|
|
+ onClicked: monitoringPrint = false
|
|
|
+ iconSource: UM.Theme.getIcon("tab_settings");
|
|
|
+ checkable: true
|
|
|
+ checked: true
|
|
|
+ exclusiveGroup: sidebarHeaderBarGroup
|
|
|
+
|
|
|
+ style: UM.Theme.styles.sidebar_header_tab
|
|
|
+ }
|
|
|
+ Button
|
|
|
+ {
|
|
|
+ width: (parent.width - UM.Theme.getSize("default_margin").width) / 2
|
|
|
+ height: UM.Theme.getSize("sidebar_header").height
|
|
|
+ onClicked: monitoringPrint = true
|
|
|
+ iconSource: {
|
|
|
+ if(!printerConnected)
|
|
|
+ {
|
|
|
+ return UM.Theme.getIcon("tab_monitor")
|
|
|
+ } else if(Cura.MachineManager.printerOutputDevices[0].jobState == "paused")
|
|
|
+ {
|
|
|
+ return UM.Theme.getIcon("tab_monitor_paused")
|
|
|
+ } else if (Cura.MachineManager.printerOutputDevices[0].jobState != "error")
|
|
|
+ {
|
|
|
+ return UM.Theme.getIcon("tab_monitor_connected")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ checkable: true
|
|
|
+ exclusiveGroup: sidebarHeaderBarGroup
|
|
|
+
|
|
|
+ style: UM.Theme.styles.sidebar_header_tab
|
|
|
+ }
|
|
|
+ ExclusiveGroup { id: sidebarHeaderBarGroup }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
SidebarHeader {
|
|
|
id: header
|
|
|
width: parent.width
|
|
|
height: totalHeightHeader
|
|
|
|
|
|
- anchors.top: parent.top
|
|
|
+ anchors.top: sidebarHeaderBar.bottom
|
|
|
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
|
|
|
|
|
onShowTooltip: base.showTooltip(item, location, text)
|
|
@@ -85,14 +155,15 @@ Rectangle
|
|
|
|
|
|
Label {
|
|
|
id: settingsModeLabel
|
|
|
- text: catalog.i18nc("@label:listbox","Setup");
|
|
|
+ text: catalog.i18nc("@label:listbox","Print Setup");
|
|
|
anchors.left: parent.left
|
|
|
anchors.leftMargin: UM.Theme.getSize("default_margin").width;
|
|
|
anchors.top: headerSeparator.bottom
|
|
|
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
|
|
width: parent.width/100*45
|
|
|
- font: UM.Theme.getFont("large");
|
|
|
+ font: UM.Theme.getFont("large")
|
|
|
color: UM.Theme.getColor("text")
|
|
|
+ visible: !monitoringPrint
|
|
|
}
|
|
|
|
|
|
Rectangle {
|
|
@@ -103,6 +174,7 @@ Rectangle
|
|
|
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
|
|
anchors.top: headerSeparator.bottom
|
|
|
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
|
|
+ visible: !monitoringPrint
|
|
|
Component{
|
|
|
id: wizardDelegate
|
|
|
Button {
|
|
@@ -152,6 +224,19 @@ Rectangle
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ Label {
|
|
|
+ id: monitorLabel
|
|
|
+ text: catalog.i18nc("@label","Printer Monitor");
|
|
|
+ anchors.left: parent.left
|
|
|
+ anchors.leftMargin: UM.Theme.getSize("default_margin").width;
|
|
|
+ anchors.top: headerSeparator.bottom
|
|
|
+ anchors.topMargin: UM.Theme.getSize("default_margin").height
|
|
|
+ width: parent.width/100*45
|
|
|
+ font: UM.Theme.getFont("large")
|
|
|
+ color: UM.Theme.getColor("text")
|
|
|
+ visible: monitoringPrint
|
|
|
+ }
|
|
|
+
|
|
|
StackView
|
|
|
{
|
|
|
id: sidebarContents
|
|
@@ -161,6 +246,7 @@ Rectangle
|
|
|
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
|
|
anchors.left: base.left
|
|
|
anchors.right: base.right
|
|
|
+ visible: !monitoringPrint
|
|
|
|
|
|
delegate: StackViewDelegate
|
|
|
{
|
|
@@ -191,23 +277,152 @@ Rectangle
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- Rectangle {
|
|
|
+ // Item that shows the print monitor properties
|
|
|
+ Column
|
|
|
+ {
|
|
|
+ id: printMonitor
|
|
|
+
|
|
|
+ anchors.bottom: footerSeparator.top
|
|
|
+ anchors.top: monitorLabel.bottom
|
|
|
+ anchors.topMargin: UM.Theme.getSize("default_margin").height
|
|
|
+ anchors.left: base.left
|
|
|
+ anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
|
|
+ anchors.right: base.right
|
|
|
+ visible: monitoringPrint
|
|
|
+
|
|
|
+ Loader
|
|
|
+ {
|
|
|
+ sourceComponent: monitorSection
|
|
|
+ property string label: catalog.i18nc("@label", "Temperatures")
|
|
|
+ }
|
|
|
+ Repeater
|
|
|
+ {
|
|
|
+ model: machineExtruderCount.properties.value
|
|
|
+ delegate: Loader
|
|
|
+ {
|
|
|
+ sourceComponent: monitorItem
|
|
|
+ property string label: machineExtruderCount.properties.value > 1 ? catalog.i18nc("@label", "Hotend Temperature %1").arg(index + 1) : catalog.i18nc("@label", "Hotend Temperature")
|
|
|
+ property string value: printerConnected ? Math.round(Cura.MachineManager.printerOutputDevices[0].hotendTemperatures[index]) + "°C" : ""
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Repeater
|
|
|
+ {
|
|
|
+ model: machineHeatedBed.properties.value == "True" ? 1 : 0
|
|
|
+ delegate: Loader
|
|
|
+ {
|
|
|
+ sourceComponent: monitorItem
|
|
|
+ property string label: catalog.i18nc("@label", "Bed Temperature")
|
|
|
+ property string value: printerConnected ? Math.round(Cura.MachineManager.printerOutputDevices[0].bedTemperature) + "°C" : ""
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Loader
|
|
|
+ {
|
|
|
+ sourceComponent: monitorSection
|
|
|
+ property string label: catalog.i18nc("@label", "Active print")
|
|
|
+ }
|
|
|
+ Loader
|
|
|
+ {
|
|
|
+ sourceComponent: monitorItem
|
|
|
+ property string label: catalog.i18nc("@label", "Job Name")
|
|
|
+ property string value: printerConnected ? Cura.MachineManager.printerOutputDevices[0].jobName : ""
|
|
|
+ }
|
|
|
+ Loader
|
|
|
+ {
|
|
|
+ sourceComponent: monitorItem
|
|
|
+ property string label: catalog.i18nc("@label", "Printing Time")
|
|
|
+ property string value: printerConnected ? getPrettyTime(Cura.MachineManager.printerOutputDevices[0].timeTotal) : ""
|
|
|
+ }
|
|
|
+ Loader
|
|
|
+ {
|
|
|
+ sourceComponent: monitorItem
|
|
|
+ property string label: catalog.i18nc("@label", "Estimated time left")
|
|
|
+ property string value: printerConnected ? getPrettyTime(Cura.MachineManager.printerOutputDevices[0].timeTotal - Cura.MachineManager.printerOutputDevices[0].timeElapsed) : ""
|
|
|
+ }
|
|
|
+ Loader
|
|
|
+ {
|
|
|
+ sourceComponent: monitorItem
|
|
|
+ property string label: catalog.i18nc("@label", "Current Layer")
|
|
|
+ property string value: printerConnected ? "0" : ""
|
|
|
+ }
|
|
|
+
|
|
|
+ Component
|
|
|
+ {
|
|
|
+ id: monitorItem
|
|
|
+
|
|
|
+ Row
|
|
|
+ {
|
|
|
+ height: UM.Theme.getSize("setting_control").height
|
|
|
+ Label
|
|
|
+ {
|
|
|
+ text: label
|
|
|
+ color: printerConnected ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
|
|
|
+ font: UM.Theme.getFont("default")
|
|
|
+ width: base.width * 0.4
|
|
|
+ elide: Text.ElideRight
|
|
|
+ anchors.verticalCenter: parent.verticalCenter
|
|
|
+ }
|
|
|
+ Label
|
|
|
+ {
|
|
|
+ text: value
|
|
|
+ color: printerConnected ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
|
|
|
+ font: UM.Theme.getFont("default")
|
|
|
+ anchors.verticalCenter: parent.verticalCenter
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Component
|
|
|
+ {
|
|
|
+ id: monitorSection
|
|
|
+
|
|
|
+ Rectangle
|
|
|
+ {
|
|
|
+ color: UM.Theme.getColor("setting_category")
|
|
|
+ width: base.width - 2 * UM.Theme.getSize("default_margin").width
|
|
|
+ height: UM.Theme.getSize("section").height
|
|
|
+
|
|
|
+ Label
|
|
|
+ {
|
|
|
+ anchors.verticalCenter: parent.verticalCenter
|
|
|
+ anchors.left: parent.left
|
|
|
+ anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
|
|
+ text: label
|
|
|
+ font: UM.Theme.getFont("setting_category")
|
|
|
+ color: UM.Theme.getColor("setting_category_text")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Rectangle
|
|
|
+ {
|
|
|
id: footerSeparator
|
|
|
width: parent.width
|
|
|
height: UM.Theme.getSize("sidebar_lining").height
|
|
|
color: UM.Theme.getColor("sidebar_lining")
|
|
|
anchors.bottom: saveButton.top
|
|
|
- anchors.bottomMargin: UM.Theme.getSize("default_margin").height
|
|
|
+ anchors.bottomMargin: UM.Theme.getSize("default_margin").height
|
|
|
}
|
|
|
|
|
|
SaveButton
|
|
|
{
|
|
|
- id: saveButton;
|
|
|
+ id: saveButton
|
|
|
+ implicitWidth: base.width
|
|
|
+ implicitHeight: totalHeight
|
|
|
+ anchors.bottom: parent.bottom
|
|
|
+ visible: !monitoringPrint
|
|
|
+ }
|
|
|
+
|
|
|
+ MonitorButton
|
|
|
+ {
|
|
|
+ id: monitorButton
|
|
|
implicitWidth: base.width
|
|
|
implicitHeight: totalHeight
|
|
|
anchors.bottom: parent.bottom
|
|
|
+ visible: monitoringPrint
|
|
|
}
|
|
|
|
|
|
+
|
|
|
SidebarTooltip
|
|
|
{
|
|
|
id: tooltip;
|
|
@@ -242,4 +457,24 @@ Rectangle
|
|
|
modesListModel.append({ text: catalog.i18nc("@title:tab", "Advanced"), item: sidebarAdvanced })
|
|
|
sidebarContents.push({ "item": modesListModel.get(base.currentModeIndex).item, "immediate": true });
|
|
|
}
|
|
|
-}
|
|
|
+
|
|
|
+ UM.SettingPropertyProvider
|
|
|
+ {
|
|
|
+ id: machineExtruderCount
|
|
|
+
|
|
|
+ containerStackId: Cura.MachineManager.activeMachineId
|
|
|
+ key: "machine_extruder_count"
|
|
|
+ watchedProperties: [ "value" ]
|
|
|
+ storeIndex: 0
|
|
|
+ }
|
|
|
+
|
|
|
+ UM.SettingPropertyProvider
|
|
|
+ {
|
|
|
+ id: machineHeatedBed
|
|
|
+
|
|
|
+ containerStackId: Cura.MachineManager.activeMachineId
|
|
|
+ key: "machine_heated_bed"
|
|
|
+ watchedProperties: [ "value" ]
|
|
|
+ storeIndex: 0
|
|
|
+ }
|
|
|
+}
|