-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdatalogger.kv
257 lines (229 loc) · 7.07 KB
/
datalogger.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
# UI definition
# Copyright 2021, Holger Fleischmann, Bavaria/Germany
# Apache License 2.0
#:import MeasurementsGroup measurementsview
#:import GraphsScreen graphsview
#:import ServiceScreen serviceview
<DataLoggerWidget>:
padding: [6, 6, 6, 6]
orientation: 'vertical'
status_text: ''
time_text: ' '
date_text: ' '
# header bar:
BoxLayout:
orientation: 'horizontal'
height: time_label.height + date_label.height
size_hint_y: None
Button:
canvas:
Rectangle:
source: 'images/temperature-measure.png'
pos: self.x + (self.width - 35) / 2, self.y + (self.height - 35) / 2
size: 35, 35
background_color: [0.6, 0.6, 1, 1] if screen_manager.index == 0 else [0.5, 0.5, 1, 0]
width: self.height
size_hint_x: None
on_press:
screen_manager.index = 0
Button:
canvas:
Rectangle:
source: 'images/graphs.png'
pos: self.x + (self.width - 35) / 2, self.y + (self.height - 35) / 2
size: 35, 35
background_color: [0.6, 0.6, 1, 1] if screen_manager.index == 1 else [0.5, 0.5, 1, 0]
width: self.height
size_hint_x: None
on_press:
screen_manager.index = 1
Button:
canvas:
Rectangle:
source: 'images/service.png'
pos: self.x + (self.width - 35) / 2, self.y + (self.height - 35) / 2
size: 35, 35
background_color: [0.6, 0.6, 1, 1] if screen_manager.index == 2 else [0.5, 0.5, 1, 0]
width: self.height
size_hint_x: None
on_press:
screen_manager.index = 2
# status text:
Label:
id: status_label
text: root.status_text
halign: 'left'
valign: 'center'
font_size: '20sp'
text_size: self.size
# time and date in the top right corner:
BoxLayout:
orientation: 'vertical'
size_hint_x: None
Label:
id: time_label
text: root.time_text
halign: 'center'
valign: 'top'
font_size: '24sp'
size: self.texture_size
Label:
id: date_label
font_size: '16sp'
text: root.date_text
halign: 'center'
valign: 'top'
color: [1, 1, 1, 0.85]
size: self.texture_size
Carousel:
id: screen_manager
direction: 'right'
anim_type: 'in_out_circ'
MeasurementsScreen:
id: measurements_screen
name: 'measurements'
GraphsScreen:
id: graphs_screen
name: 'graphs'
ServiceScreen:
id: service_screen
name: 'graphs'
<MeasurementsScreen>:
BoxLayout:
id: columns
orientation: 'horizontal'
<MeasurementsGroup>:
orientation: 'vertical'
Label:
id: header_text
text: root.header_text
font_size: '20sp'
padding_y: 6
#bold: True
size: self.texture_size
size_hint_y: None
canvas.before:
Color:
rgba: (.5, 0.5, .5, .5)
Rectangle:
pos: (self.x + 1, self.y + 2)
size: (self.width - 2, self.height - 4)
ScrollView:
GridLayout:
id: measurements_view
cols: 1
size_hint_y: None
height: self.minimum_height
<Label@MeasurementItem>:
font_size: '20sp'
<MeasurementItem>:
signal_color: (0.0, 0.9, 0.1, 1.0)
orientation: 'horizontal'
height: 30
size_hint_y: None
canvas.before:
Color:
rgba: (.0, 0.9, .1, .3) if self.selected else (0, 0, 0, 1)
Rectangle:
pos: self.pos
size: self.size
Label:
width: 24
height: 30
size_hint_x: None
size_hint_y: None
canvas.before:
Color:
rgba: root.signal_color
Rectangle:
pos: (self.x + 6, self.y + 8)
size: (16, 16)
Label:
text: root.label
markup: True
font_size: '15sp'
color: [1, 1, 1, 0.85]
text_size: self.size
halign: 'left'
valign: 'center'
size_hint_x: None
width: 126
padding_x: 3
Label:
# canvas.before:
# Color:
# rgba: (.9, 0.9, .1, .3)
# Rectangle:
# pos: self.pos
# size: self.size
text: root.value
bold: True
color: (1, 1, 1, .2) if root.stale else (1, 1, 1, 1)
font_size: '16sp' if root.small else self.font_size
text_size: self.size
halign: 'right'
valign: 'center'
size_hint_x: None
width: 65
padding_x: 3
Label:
text: root.unit
color: [1, 1, 1, 0.85]
text_size: self.size
font_size: '16sp' if root.small else self.font_size
halign: 'left'
valign: 'center'
width : 65
size_hint_x: None
padding_x: 3
<GraphsCanvas>:
<GraphsScreen>:
BoxLayout:
padding: [5, 0, 15, 0]
GraphsCanvas:
id: graphs_canvas
padding: 5
x_grid_label: False
x_grid: True
y_grid_label: True
y_grid: True
<ServiceScreen>:
BoxLayout:
orientation: 'vertical'
width: 300
size_hint_x: None
height: 200
size_hint_y: None
Button:
text: 'Neustart'
on_release:
root.reboot_action()
Button:
text: 'Herunterfahren'
on_release:
root.shutdown_action()
Button:
text: 'Aktualisieren'
on_release:
root.update_action()
<OkCancelPopup>:
message: 'missing text'
BoxLayout:
orientation: 'vertical'
AnchorLayout:
Label:
text: root.message
AnchorLayout:
anchor_x: 'right'
anchor_y: 'bottom'
size_hint_y: None
BoxLayout:
orientation: 'horizontal'
Button:
text: 'OK'
on_release:
root.ok_action()
Button:
text: 'Abbrechen'
on_release:
root.cancel_action()