-
Notifications
You must be signed in to change notification settings - Fork 0
/
RadioScan.kv
432 lines (364 loc) · 10.2 KB
/
RadioScan.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
Root:
BottomBar: # ------------------> bottom navigation bar with 3 elements, particularly screens
id:bottom_bar
panel_color: 0,0,0,0.5
selected_color_background: "blue"
text_color_active: "green"
#--------- 1st screen content-----------------------------------------------
MDBottomNavigationItem:
name: 'screen 1'
text: 'Activity'
text_color: "yellow"
icon: 'radiation.png'
on_tab_press:
root.ids.activity.on_enter()
on_leave:
root.ids.activity.on_leave()
Real_time_activity:
id: activity
#--------- 2nd screen content-----------------------------------------------
MDBottomNavigationItem:
name: 'screen 2'
text: 'Bar chart'
text_color: "yellow"
icon: 'bar-chart.png'
on_tab_press:
root.ids.bar.start_bar_plotting()
on_leave:
root.ids.bar.bar_plot_stop()
Bar:
id: bar
#--------- 3d screen content-----------------------------------------------
MDBottomNavigationItem:
name: 'screen 3'
text: 'Stat. data'
text_color: "yellow"
icon: 'statistics.png'
Data_base:
# -----------> top bar with title of app
MDTopAppBar:
md_bg_color: "green"
#title: "Radiation activity"
pos_hint: {"x": 0, "y": 0.9}
MDFloatLayout:
pos_hint: {"center_x": 0.5, "center_y": 0.5}
MDLabel:
text: "RadioScan"
halign: "center"
valign: "top"
theme_text_color: "Custom"
text_color: "white"
font_size: 34
pos_hint: {"x": 0, "y": 0.5}
#--------------------> 1st screen.
# Actually represents momental radiation activity. We can observe relevant temperature,
# detected radioactive particles pr sec, momental detected partical activity converted to amount pr hour,
# ------------------- 1 st screen settings
<Real_time_activity>:
name: 'screen 1'
degr: 0
angl: 0
rad_level: "jmghmg "
MDFloatLayout:
size_hint: 1, 0.6
pos_hint: {"x": 0, "y": 0.25}
canvas.before:
Color:
rgba: 0.1,0.25, 0.3, 1
Ellipse:
size: 400, 400
pos: self.width/2-200, self.height/2 - 150
angle_start: 235
angle_end: 360+125
Color:
rgba: 0, 1, 0, 1
Ellipse:
size: 400, 400
pos: self.width/2-200, self.height/2 - 150
angle_start: 235
angle_end: 235 + root.degr
Color:
rgba: 1,1,1,1
Ellipse:
size: 350, 350
pos: self.width/2-175, self.height/2 - 125
angle_start: 235
angle_end: 360+125
Color:
rgba: 1,1,1,1
Ellipse:
size: 350, 350
pos: self.width/2-175, self.height/2 - 125
Color:
rgba: 187/225, 221/225, 248/255, 1
Ellipse:
size: 400, 400
pos: self.width/2-200, self.height/2 - 150
angle_start: 125
angle_end: 235
MDFloatLayout:
Image:
id: arrow
source: "arrow3.png"
pos: 309, 127
size_hint: None, None
size: 150+150*0.2, 200+200*0.2
#opacity: 0.5
canvas.before:
PushMatrix
Rotate:
angle: 125 - root.degr #
origin: 399, 209
axis: 0,0,1
canvas.after:
PopMatrix
MDFloatLayout:
MDLabel:
id: rad_level
halign: "center"
pos_hint: {"center_x": 0.5, "center_y": 0.3}
font_size: 48
MDFloatLayout:
Image:
pos_hint: {"center_x": 0.036, "center_y": 0.75}
source: "thermometer.png"
size_hint: 0.075,0.075
MDLabel:
pos_hint: {"center_x": 0.12, "center_y": 0.75}
halign: "center"
id: temp_text
text: "temperature "
font_size: 24
Image:
pos_hint: {"center_x": 0.036, "center_y": 0.6}
source: "radiation2.png"
size_hint: 0.05, 0.05
MDGridLayout:
id: grid_dose
size_hint: 0.3, 0.15
pos_hint: {"center_x": 0.17, "center_y": 0.6}
cols: 2
rows: 1
#adaptive_width: True
MDLabel:
#pos_hint: {"center_x": 0.13, "center_y": 0.6}
halign: "center"
id: radiation_dose
font_size: 24
#size_hint_x: None
#size: self.texture_size
MDLabel:
id: units
pos_hint: {"x": 0, "y": 0.6}
halign: "left"
text: " 1/h"
font_size: 18
MDLabel:
pos_hint: {"center_x": 0.09, "center_y": 0.05}
halign: "center"
id: timer
text: "timer"
font_name: 'TickingTimebombBB'
#Image:
# id: start_pic
# source: "start.png"
# pos_hint: {"x": 0.85, "y": -0.025}
# size_hint: 0.15,0.15
Image:
id: atom_pic
pos_hint: {"x": 0.9, "y": 0.75}
source: "atom.png"
size_hint: 0.12,0.12
# ------------------- 2nd screen settings
# -------------------- radiation activity displayed in plot shape. Average radiation activity converted from momental one
# to pr 1 hour on Y axes. Time in sec on X axes
<Bar>:
name: 'screen 3'
chart_box: chart_box
MDBoxLayout:
#orientation: "vertical"
id: chart_box
size_hint: 1, 1
pos_hint: {"center_x": 0.5, "center_y": 0.35}
# ------------------- 3d screen settings
#-------------------- this screen lets to get data from database and display radiation activity, temperature throughout
# chosen period of time.
#
<Data_base>:
name: 'screen 3'
MDBoxLayout:
size_hint: 1, 1
pos_hint: {"center_x": 0.5, "center_y": 0.38}
orientation: "vertical"
MDBoxLayout:
canvas.before:
Color:
rgba: 1, 1, 1, 1
Rectangle:
size: self.size
pos: self.pos
size_hint: 1, 0.85
orientation: "horizontal"
MDBoxLayout:
id: main_box
size_hint: 0.78, 1
pos_hint: {"center_x": 0.5, "center_y": 0.48}
canvas.before:
Color:
rgba: 1, 1, 1, 1
Rectangle:
size: self.size
pos: self.pos
MDLabel:
id: main_text
text: "data is loading"
pos_hint: {"center_x": 0.5, "center_y": 0.5}
halign: "center"
MDBoxLayout:
orientation: "vertical"
size_hint: 0.22, 1
canvas.before:
Color:
rgba: 1, 1, 1, 1
Rectangle:
size: self.size
pos: self.pos
MDGridLayout:
cols: 1
spacing: 10,10
padding: 10,10,10,10
MDRectangleFlatButton:
size_hint: .5, 1
text: "Choose time"
text_color: "black"
theme_text_color: "Custom"
line_color: "red"
on_press: root.show_time_picker()
MDRectangleFlatButton:
size_hint: .5, 1
text: "Choose date"
text_color: "black"
theme_text_color: "Custom"
line_color: "red"
on_press: root.call_dialog()
MDRectangleFlatButton:
size_hint: .5, 1
text: "Load rad/temp data"
text_color: "black"
theme_text_color: "Custom"
line_color: "red"
on_press: root.load_data()
MDRectangleFlatButton:
size_hint: .5, 1
text: "Reset"
theme_text_color: "Custom"
text_color: "black"
line_color: "red"
on_press: root.reset()
MDRectangleFlatButton:
size_hint: .5, 1
text: "---"
theme_text_color: "Custom"
text_color: "black"
line_color: "red"
on_press: root.reset()
MDFloatLayout:
canvas.before:
Color:
rgba: 1, 1, 1, 1
Rectangle:
size: self.size
pos: self.pos
id: red_box
MDLabel:
pos_hint: {"x": 0.05, "y": 0.35}
#id: time
text: "time: "
font_size: "24"
MDLabel:
pos_hint: {"x": 0.05, "y": 0.2}
id: time
text: " ---"
#font_size: "24"
MDLabel:
pos_hint: {"x": 0.05, "y": 0}
#id: dates
text: "date:"
font_size: "24"
MDLabel:
pos_hint: {"x": 0.05, "y": -0.2}
id: dates
text: "---"
#font_size: "24"
MDBoxLayout:
size_hint: 1, 0.10
canvas.before:
Color:
rgba: 0/255, 148/255, 250/255, 1
Rectangle:
size: self.size
pos: self.pos
#----------> timepicker settings, popup windows which allow to set time in hours and specific days
<Time_picker>:
start_hr: start_hr
pos_hint: {"x":0, "y":0.55}
orientation: "vertical"
padding: "10dp"
size_hint_y: None
height: "110dp"
MDFloatLayout:
pos_hint: {"x": 0, "y": .20}
MDLabel:
text: "Set period"
pos_hint: {"x": 0, "y": -0.1}
halign: "center"
valign: "top"
font_size: "24"
MDGridLayout:
pos_hint: {"center_x":0.4, "center_y":0.5}
size_hint: 1, 0.75
cols: 4
rows: 2
MDFloatLayout:
MDLabel:
id: start_lbl
text: " start: "
pos_hint: {"center_x": 0.4, "center_y": 0.5}
valign: 'bottom'
halign: 'right'
font_size: "20"
HourTextField:
#size_hint: 1, 0.9
id: start_hr
hint_text: "Hour"
mode: "rectangle"
input_filter: 'int'
Widget:
size_hint_x: 0.1
MinuteTextField:
#size_hint: 1, 0.9
id: start_min
hint_text: "Min"
mode: "rectangle"
input_filter: 'int'
MDFloatLayout:
MDLabel:
id: lbl
text: "end: "
pos_hint: {"center_x": 0.4, "center_y": 0.5}
font_size: "20"
halign: 'right'
HourTextField:
#size_hint: 1, 0.9
id: end_hr
hint_text: "Hour"
mode: "rectangle"
input_filter: 'int'
Widget:
size_hint_x: 0.1
MinuteTextField:
#size_hint: 1, 0.9
id: end_min
hint_text: "Min"
mode: "rectangle"
input_filter: 'int'