-
Notifications
You must be signed in to change notification settings - Fork 2
/
houston.kv
440 lines (383 loc) · 11.8 KB
/
houston.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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
#:kivy 1.0.9
<Top>:
uart_tab: uart_tab
sched_tab: sched_tab
resp_tab: resp_tab
dash_tab: dash_tab
orientation: 'vertical'
AnchorLayout:
anchor_x: 'left'
anchor_y: 'top'
size_hint: 1, 0.01
# size_y: 60
Image:
source: 'logo.png'
size_hint: None, None
size: 300, 68
AnchorLayout:
anchor_x: 'right'
anchor_y: 'top'
size_hint: 1, 0.01
Button:
text:'settings'
font_size: 30
on_release: app.open_settings()
size_hint: None, None
size: 200, 68
color: 0.3, 0.3, 0.3, 1
background_color: 0,0,0,1
BoxLayout: #space below the logo tab
orientation: 'horizontal'
size_hint: 1, 0.99
TabbedPanel:
size_hint: 1, .95
pos_hint: {'center_x': .5, 'center_y': .475}
do_default_tab: False
UARTTab:
id: uart_tab
SCHEDTab:
id: sched_tab
RESPTab:
id: resp_tab
DASHTab:
id: dash_tab
<UARTTab>: # the main UART tab
text: 'Telem'
uart_entry: uart_entry
rv: rv
BoxLayout:
id: bl1
size_hint_y: 1
size_hint_x: 1
orientation: 'vertical'
BoxLayout: # layout for main area
id: main_area
size_hint_y: 0.9
size_hint_x: 1
orientation: 'vertical'
BoxLayout: # top bar
size_hint_x: 1
size_hint_y: 0.05
Label:
text: root.port_label
color: root.port_label_color
Label:
id: my_custom_label
text: 'Other Status Thing'
BoxLayout: # main data list
size_hint_x: 1
size_hint_y: 0.85
RecycleView:
id: rv
scroll_type: ['bars', 'content']
scroll_wheel_distance: dp(114)
bar_width: dp(10)
viewclass: 'UARTRow'
RecycleBoxLayout:
default_size: None, dp(30) # dp(30) is height
default_size_hint: 1, None
size_hint_y: None
height: self.minimum_height
orientation: 'vertical'
spacing: dp(2)
BoxLayout: # layout for command entry
size_hint_y: 0.05
size_hint_x: 1
TextInput:
id: uart_entry
text: ""
size_hint: .8, 1
spacing: .2, .2
# height: dp(30)
multiline: False
on_text_validate: root.on_enter(*args) # can either call root. or app. - in this case, root is MainTab class
Button:
text: 'Send'
size_hint_y: 1
size_hint_x: 0.2
on_press: root.send_button_press()
<SCHEDTab>: # the command queue tab
text: 'Schedule'
sched_rv: sched_rv
cmd_entry: cmd_entry
cmd_epoch_entry: cmd_epoch_entry
cmd_expected_entry: cmd_expected_entry
cmd_timeout_entry: cmd_timeout_entry
cmd_rel: cmd_rel
BoxLayout: # panels must have only one direct child
orientation:'vertical'
GridLayout: # container for the column labels
cols: 4
rows: 1
size_hint_y: None
height: 50
Label:
text: 'Command'
Label:
text: 'Epoch'
Label:
text: 'Expected Response'
Label:
text: 'Timeout'
GridLayout: # for buttons
cols: 4
rows: 2
size_hint_y: None
height: dp(90)
padding: dp(8)
spacing: dp(16)
TextInput:
id: cmd_entry
size_hint_x: 1
hint_text: 'Command'
padding: dp(10), dp(5), 0, 0
TextInput:
id: cmd_epoch_entry
size_hint_x: 1
hint_text: 'Timeout'
padding: dp(10), dp(5), 0, 0
TextInput:
id: cmd_expected_entry
size_hint_x: 1
hint_text: 'Expected Response'
padding: dp(10), dp(5), 0, 0
TextInput:
id: cmd_timeout_entry
size_hint_x: 1
hint_text: 'Timeout'
padding: dp(10), dp(5), 0, 0
Button:
text: 'Add to Schedule'
on_press: root.add_to_sched()
Button:
text: 'Clear Schedule'
on_press: root.clear_sched()
BoxLayout:
orientation:'horizontal'
Label:
text: 'Relative'
text_align: 'right'
CheckBox:
color: 0.5, 0.9, 0.66, 1
active: 'True'
id: cmd_rel
RecycleView:
id: sched_rv
scroll_type: ['bars', 'content']
scroll_wheel_distance: dp(114)
bar_width: dp(10)
viewclass: 'Cmdrow'
size_hint_y: 0.8
RecycleGridLayout:
default_size: None, dp(30)
default_size_hint: 1, None
size_hint_y: None
height: self.minimum_height
orientation: 'vertical'
spacing: dp(2)
cols: 1
BoxLayout: # load, save, schedule buttons
orientation: 'horizontal'
size_hint_y: 0.1
BoxLayout:
spacing: dp(16)
size_hint_y: None
height: 50
Button:
text: 'Load'
on_release: root.show_load()
Button:
text: 'Save'
on_release: root.show_save()
Button:
text: 'Uplink Schedule'
on_release: root.uplink_schedule()
<RESPTab>: # tab for responses
text: 'Response'
resp_rv: resp_rv
BoxLayout:
orientation:'vertical'
GridLayout: # container for the column labels
cols: 4
rows: 1
size_hint_y: None
height: 50
Label:
text: 'ID'
size_hint_x: 0.1
Label:
text: 'Command'
size_hint_x: 0.3
Label:
text: 'Expected Response'
size_hint_x: 0.3
Label:
text: 'Status'
size_hint_x: 0.3
RecycleView:
id: resp_rv
scroll_type: ['bars', 'content']
scroll_wheel_distance: dp(114)
bar_width: dp(10)
viewclass: 'Resprow'
size_hint_y: 0.8
RecycleBoxLayout:
default_size: None, dp(30)
default_size_hint: 1, None
size_hint_y: None
height: self.minimum_height
orientation: 'vertical'
spacing: dp(2)
# cols: 1 # required if this is recycleGridLayout
<DashItem>:
canvas.before:
Color:
rgba: 0.14, 0.14, 0.14, 1
size_hint_y: 0.2
size_hint_x: 0.2
<DASHTab>: # tab for responses
text: 'Dashboard'
BoxLayout:
orientation:'vertical'
GridLayout: # container for the column labels
cols: 4
rows: 4
size_hint_y: None
height: 50
<UARTRow@BoxLayout>: # row class for the UART telemetry
canvas.before:
Color:
rgba: 0.14, 0.14, 0.14, 1
Rectangle:
size: self.size
pos: self.pos
value: '' # this is the key of the dict item that will be used
BoxLayout:
size_hint_x: 1
orientation: 'horizontal'
Label:
text: root.value
text_size: root.width, None
padding: 20, 10
halign: 'left'
color: 0.92, 0.9, 0.66, 1
<Cmdrow@BoxLayout>: # the row class for the command system - pulls out several different items and displays nicely
canvas.before:
Color:
rgba: 0.14, 0.14, 0.14, 1
Rectangle:
size: self.size
pos: self.pos
# these allow us to pop data in from py - these are rv.data dict keys
cmdid: 0
cmd: ''
timeout: 0
expect: ''
epoch: 0
rel: True
BoxLayout:
size_hint_x: 1
orientation: 'horizontal'
Label:
size_hint_x: 0.05
text: str(root.cmdid)
color: 0.3, 0.3, 0.3, 1
Label:
size_hint_x: 0.2
text: root.cmd
color: 0.0, 0.9, 0.66, 1
Label:
size_hint_x: 0.2
text: str(root.epoch)
#text: root.epoch #str('+'+str(epoch)) if (root.rel == 'True') else str('| '+str(epoch)+ ' |')
color: 0.0, 0.9, 0.66, 1
Label:
size_hint_x: 0.22
text: root.expect
color: 0.0, 0.9, 0.66, 1
Label:
size_hint_x: 0.2
text: str(root.timeout)
color: 0.0, 0.9, 0.66, 1
Button:
text: 'X'
size_hint_x: 0.05
on_press: app.rm_button_press(root.cmdid)
color: 0.14, 0.14, 0.14, 1
<Resprow@BoxLayout>:
# these allow us to pop data in from py - these are rv.data dict keys
cmdid: 0
cmd: ''
timeout: 0
expect: ''
epoch: 0
rel: True
state: ''
colours: {'pending':(0,0,1,0.5), 'ack':(0,1,0,0.5),'':(0,0,0,0.5), 'new':(1,1,0.5,0.5), 'errored':(1,0.1,0.1,0.5)}
canvas.before:
Color:
rgba: self.colours[self.state] #self.r,1, 1, 1 #self.colours[self.state]
Rectangle:
size: self.size
pos: self.pos
BoxLayout:
size_hint_x: 1
orientation: 'horizontal'
Label:
size_hint_x: 0.1
text: str(root.cmdid)
color: 1,1,1,1
Label:
size_hint_x: 0.3
text: root.cmd
color: 1,1,1,1
Label:
size_hint_x: 0.3
text: root.expect
color: 1,1,1,1
Label:
size_hint_x: 0.3
text: 'acknowledged' if (root.state == 'ack') else (str(root.state))
color: 1,1,1,1
# Stuff from elsewhere
<LoadDialog>:
BoxLayout:
size: root.size
pos: root.pos
orientation: "vertical"
FileChooserIconView:
id: filechooser
path: './schedules'
BoxLayout:
size_hint_y: None
height: 30
Button:
text: "Cancel"
on_release: root.cancel()
Button:
text: "Load"
on_release: root.load(filechooser.path, filechooser.selection)
<SaveDialog>:
text_input: text_input
BoxLayout:
size: root.size
pos: root.pos
orientation: "vertical"
FileChooserIconView:
id: filechooser
on_selection: text_input.text = self.selection and self.selection[0] or ''
path: './schedules'
TextInput:
id: text_input
size_hint_y: None
height: 50
multiline: False
BoxLayout:
size_hint_y: None
height: 30
Button:
text: "Cancel"
on_release: root.cancel()
Button:
text: "Save"
on_release: root.save(filechooser.path, text_input.text)