-
Notifications
You must be signed in to change notification settings - Fork 2
/
ControlPanel.qml
180 lines (165 loc) · 4.42 KB
/
ControlPanel.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.3
ColumnLayout {
id: mainLayout
property var file: ""
Layout.fillWidth: true
RowLayout {
id: connectionMenu
ComboBox {
id: devText
editable: true
model: atcore.serialPorts
Layout.fillWidth: true
}
ComboBox{
id: devSpeed
editable: false
model: atcore.portSpeeds
currentIndex: 7
}
}
Button {
text: "Connect"
onClicked: {
atcore.initSerial(devText.text, devSpeed.currentText.valueOf())
}
Layout.fillWidth: true
}
RowLayout {
id: printMenu
Button {
text: "Load file..."
Layout.fillWidth: true
onClicked: {
fileDialog.visible = true
}
}
FileDialog {
id: fileDialog
title: "Please choose a file"
selectExisting: true
selectFolder: false
selectMultiple: false
nameFilters: [ "GCode file (*.gcode)"]
folder: shortcuts.home
onAccepted: {
// https://stackoverflow.com/questions/24927850/get-the-path-from-a-qml-url
var path = fileDialog.fileUrl.toString();
// remove prefixed "file:///"
path = path.replace(/^(file:\/{3})/,"");
// unescape html codes like '%23' for '#'
var cleanPath = "/" + decodeURIComponent(path);
file = cleanPath
}
}
Button {
text: "Print"
onClicked: {
if(!file) {
return
}
atcore.print(file)
}
}
}
ColumnLayout {
id: controlMenu
width: parent.width
RowLayout {
Button {
text: "Stop"
onClicked: atcore.stop()
}
Button {
text: "Emergency"
onClicked: atcore.emergencyStop()
}
Button {
Layout.fillWidth: true
text: "Motors Off"
}
}
RowLayout {
id: positionLayout
Button {
text: "Relative Mode"
onClicked: {
text = text == "Relative Mode" ? "Absolute" : "Relative"
text = text + " Mode"
}
}
SpinBox {
Layout.fillWidth: true
editable: true
value: 50
textFromValue: function(value) {return value + " mm"}
}
Button {
Layout.fillWidth: true
text: "Set"
onClicked: atcore.setExtruderTemp(hendTemp.currentText.valueOf(), 0)
}
}
RowLayout {
id: tempLayout
Label {
text: "Heat:"
color: "gray"
}
Button {
Layout.fillWidth: true
text: "Off"
}
ComboBox {
id: hendTemp
editable: true
validator: IntValidator {
bottom: 0
top: 300
}
model: [185, 235]
}
Button {
Layout.fillWidth: true
text: "Set"
}
}
RowLayout {
Label {
text: "Bed :"
color: "gray"
}
Button {
Layout.fillWidth: true
text: "Off"
}
ComboBox {
id: bedTemp
editable: true
validator: IntValidator {
bottom: 0
top: 300
}
model: [50, 80]
}
Button {
Layout.fillWidth: true
text: "Set"
onClicked: atcore.setBedTemp(bedTemp.currentText.valueOf())
}
}
ColumnLayout {
id: rowPie
height: width
anchors.right: controlMenu.right
anchors.left: controlMenu.left
Pie {
id: pie
visible: true
}
}
}
}