-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathextruder.kv
300 lines (261 loc) · 9.7 KB
/
extruder.kv
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
#: import ExtruderWidget extruder_widget
#: import DialGauge dial-gauge
#: import GraphView graph-view
<NumericInput>
use_bubble: False
use_handles: False
font_size: '18sp'
<HotendSpinnerOptions@SpinnerOption>
background_color: .4, .4, .4, 1
on_release: app.main_window.ids.extruder.selected_temp('hotend', self.text.split()[0])
<BedSpinnerOptions@SpinnerOption>
background_color: .4, .4, .4, 1
on_release: app.main_window.ids.extruder.selected_temp('bed', self.text.split()[0])
<ExtruderWidget>:
orientation: 'vertical'
canvas.before:
Color:
rgba: 0.4, 0.4, 0.4, 1
Rectangle:
pos: self.pos
size: self.size
id: extruder
hotend_dg: hotend_dg
bed_dg: bed_dg
hotend_switch: hotend_switch
bed_switch: bed_switch
on_curtool: root._on_curtool()
BoxLayout:
orientation: 'vertical'
BoxLayout:
orientation: 'horizontal'
size_hint_y: None
height: dp(30)
Label:
text: 'Length:'
NumericInput:
id: extrude_length
multiline: False
input_type: 'number'
input_filter: 'float'
text: app.config.get('Extruder', 'length')
on_text_validate: root.update_length()
Label:
text: ' mm, Speed: '
NumericInput:
id: extrude_speed
multiline: False
input_type: 'number'
input_filter: 'float'
text: app.config.get('Extruder', 'speed')
on_text_validate: root.update_speed()
Label:
text: ' mm/min'
BoxLayout:
orientation: 'horizontal'
size_hint_y: None
height: dp(50)
padding: [4, 4, 4, 4]
spacing: 20
Button:
size_hint_y: None
height: dp(40)
text: 'Extrude'
disabled: not app.is_connected
on_press: root.extrude()
Button:
size_hint_y: None
height: dp(40)
text: 'Reverse'
disabled: not app.is_connected
on_press: root.reverse()
ScreenManager:
id: temps_screen
size_hint_y: None
height: sp(120)
#loop: True
Screen:
name: 'dial'
BoxLayout:
orientation: 'horizontal'
BoxLayout:
orientation: 'vertical'
DialGauge:
pos_hint: {'center_x': 0.5}
id: hotend_dg
dial_diameter: 180
# gauge properties
scale_max: 260
scale_min: 20
value: self.scale_min
# example for half temperature gauge
semi_circle: True
scale_increment: 20
angle_start: 90
angle_stop: 270
tic_frequency: 1
tic_radius: self.dial_diameter/2.0
needle_length: self.dial_diameter/2 - self.tic_length -4 # ends just where tics start less a few pixels
needle_width: 5
hub_radius: 10
dial_color: 1,1,0,1
hub_color: 1,0,0
needle_color: 1,0,0
show_value: True
value_offset_pos: 0, self.dial_diameter/4 # offset from center of dial
value_color: [0,1,0,1]
# setup three annulars of different colors
annulars: [{'color': [0,1,0,1], 'start': 20.0, 'stop': 60.0}, {'color': [1, 165.0/255, 0, 1], 'start': 60.0, 'stop': 80.0}, {'color': [1, 0, 0, 1], 'start': 80.0, 'stop': 260.0}]
annular_thickness: 6
setpoint_value: float('nan')
setpoint_color: 0,0,0,1
setpoint_length: self.dial_diameter/2
setpoint_thickness: 1
Label:
text: 'Hotend'
size_hint_y: None
size: self.texture_size
BoxLayout:
orientation: 'vertical'
DialGauge:
pos_hint: {'center_x': 0.5}
id: bed_dg
dial_diameter: 180
# gauge properties
scale_max: 120
scale_min: 20
value: self.scale_min
# example for half temperature gauge
scale_increment: 10
semi_circle: True
angle_start: 90
angle_stop: 270
tic_frequency: 1
tic_radius: self.dial_diameter/2.0
needle_length: self.dial_diameter/2 - self.tic_length -4 # ends just where tics start less a few pixels
needle_width: 5
hub_radius: 10
dial_color: 1,1,0,1
hub_color: 1,0,0
needle_color: 1,0,0
show_value: True
value_offset_pos: 0, self.dial_diameter/4 # offset from center of dial
value_color: [0,1,0,1]
# setup two annulars of different colors
annulars: [{'color': [0,1,0,1], 'start': 20.0, 'stop': 60.0}, {'color': [1, 0, 0, 1], 'start': 60.0, 'stop': 120.0}]
annular_thickness: 6
setpoint_value: float('nan')
setpoint_color: 0,0,0,1
setpoint_length: self.dial_diameter/2
setpoint_thickness: 1
Label:
text: 'Bed'
size_hint_y: None
size: self.texture_size
Screen:
name: 'graph'
on_enter: graph_view.reset()
GraphView:
id: graph_view
GridLayout:
cols: 3
padding: 5, 5
spacing: 5
Label:
size_hint_x: None
width: self.texture_size[0]
text: 'Hotend:'
Switch:
id: hotend_switch
disabled: not app.is_connected
on_active: root.switch_active(self, 'hotend', self.active, set_hotend_temp.text.split()[0])
BoxLayout:
orientation: 'horizontal'
Button:
text: '+'
size_hint_x: None
width: dp(40)
on_press: root.adjust_temp('hotend', '5')
Spinner:
id: set_hotend_temp
text: 'select temp' if not root.last_hotend_temp else str(root.last_hotend_temp)
values: app.config.get('Extruder', 'hotend_presets').split(',')
option_cls: Factory.HotendSpinnerOptions
Button:
text: '-'
size_hint_x: None
width: dp(40)
on_press: root.adjust_temp('hotend', '-5')
Label:
size_hint_x: None
width: self.texture_size[0]
text: '°C'
Label:
size_hint_x: None
width: self.texture_size[0]
text: 'Bed:'
Switch:
id: bed_switch
disabled: not app.is_connected
on_active: root.switch_active(self, 'bed', self.active, set_bed_temp.text.split()[0])
BoxLayout:
orientation: 'horizontal'
Button:
text: '+'
size_hint_x: None
width: dp(40)
on_press: root.adjust_temp('bed', '5')
Spinner:
id: set_bed_temp
text: 'select temp' if not root.last_bed_temp else str(root.last_bed_temp)
values: app.config.get('Extruder', 'bed_presets').split(',')
option_cls: Factory.BedSpinnerOptions
Button:
text: '-'
size_hint_x: None
width: dp(40)
on_press: root.adjust_temp('bed', '-5')
Label:
size_hint_x: None
width: self.texture_size[0]
text: '°C'
BoxLayout:
orientation: 'horizontal'
size_hint_y: None
height: 40
ToggleButton:
id: tool_t0
group: 'tool_group'
on_press: root.set_tool(0)
size_hint_y: None
size: dp(40), dp(40)
text: 'T0'
state: 'down'
disabled: not app.is_connected
allow_no_selection: False
ToggleButton:
id: tool_t1
group: 'tool_group'
on_press: root.set_tool(1)
size_hint_y: None
size: dp(40), dp(40)
text: 'T1'
disabled: not root.has_T1 or not app.is_connected
allow_no_selection: False
# uses up rest of space bit like a spring in other layouts
#Widget:
# Label:
# canvas.before:
# PushMatrix
# Rotate:
# angle: 90
# origin: self.center
# canvas.after:
# PopMatrix
# size_hint: None, None
# pos: 0, 0
# #size: 10, 20
# halign: 'left'
# valign: 'top'
# text_size: self.size
# text: 'Extruder'