-
Notifications
You must be signed in to change notification settings - Fork 0
/
gab.kv
453 lines (434 loc) · 13.3 KB
/
gab.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
440
441
442
443
444
445
446
447
448
449
450
451
452
453
#:kivy 1.10
#:set swidth dp(90)
#:set sheight dp(40)
#:set sfont sp(14)
#:set dark (34/255, 34/255, 34/255, 1)
#:set green (34/255, 139/255, 34/255, 1)
#:set white (1, 1, 1, 1)
#:set nan float('nan')
#:import isnan math.isnan
#:import Factory kivy.factory.Factory
#:import Window kivy.core.window
<EWidget@Widget>:
size_hint: (1, 1)
width: root.width
height: root.height
<CLabel@Label>:
width: swidth
height: 3 * sheight // 4
font_size: sfont
size_hint: None, None
pos_hint: {'center_x': 0.5}
halign: 'center'
valign: 'middle'
<CLabelInfo@Label>:
font_size: sfont
size_hint: None, None
pos_hint: {'x': 0}
size_hint_x: 1
halign: 'left'
valign: 'middle'
<CButton@Button>:
width: swidth
height: 3 * sheight // 4
font_size: sfont
size_hint: None, None
pos_hint: {'center_x': 0.5}
<CSTextInput@TextInput>:
width: swidth
height: 3 * sheight // 4
font_size: sfont
size_hint: None, None
pos_hint: {'center_x': 0.5}
halign: 'center'
multiline: False
<CTextInput@CSTextInput>:
data: nan
param: ''
text: '' if isnan(self.data) else '{:g}'.format(self.data)
disabled: False if isnan(self.data) else True
user: False
on_focus: app.main.validate_input(self)
on_text: app.main.help_me(self)
#background_disabled_normal: ''
#disabled_color: green if self.user else white
background_color: green if self.user else white
<PTextInput@CSTextInput>:
data: 1
text: '' if isnan(self.data) else '{:g}'.format(self.data)
on_focus: app.main.validate_popup_input(self)
hint_text: '1'
<CCheckBox@CheckBox>:
height: 3 * sheight // 4
size_hint_y: None
allow_no_selection: False
<GBoxLayout@BoxLayout>:
height: 3 * sheight / 4
size_hint_y: None
pos_hint: {'center_x': 0.5}
<CSpinnerOption@SpinnerOption>:
font_size: sfont
height: 3 * sheight / 4
<CSpinner@Spinner>
size_hint: 1, None
height: 3 * sheight / 4
sync_height: True
font_size: sfont
option_cls: Factory.get("CSpinnerOption")
<IterPopup>:
title: 'Iteration'
id: iter_pop
BoxLayout:
orientation: 'vertical'
GridLayout:
cols: 4
CLabel:
text: 'Dimensions'
size_hint_x: 1
CLabel:
text: 'Range of Elements'
size_hint_x: 1
CLabel:
text: 'Target dim.'
size_hint_x: 1
CLabel:
text: 'Start value'
size_hint_x: 1
GBoxLayout:
orientation: 'horizontal'
CCheckBox:
active: True
group: 'dim'
id: d_check
CLabel:
size_hint_x: 1
text: 'd'
CCheckBox:
group: 'dim'
id: L_check
CLabel:
text: 'L'
size_hint_x: 1
CCheckBox:
group: 'dim'
CLabel:
text: 'T'
size_hint_x: 1
GBoxLayout:
orientation: 'horizontal'
CLabel:
text: 'From'
size_hint_x: 1
CSpinner:
text: '0'
size_hint_x: 1
id: iter_from_input
values: [str(item) for item in range(root.cols)]
CLabel:
text: 'To'
size_hint_x: 1
CSpinner:
text: '0'
size_hint_x: 1
id: iter_to_input
values: [str(item) for item in range(root.cols)]
PTextInput:
size_hint_x: 1
id: iter_target_input
PTextInput:
size_hint_x: 1
id: iter_start_input
CLabel:
text: 'Iterated parametr'
size_hint_x: 1
CSpinner
text: 'f'
size_hint: 1, None
height: 3 * sheight / 4
id: iter_row
values: ['f', 'd', 'H', '\u03B1', 'V', 'L', 'Y', '\u03B2', 'Q', 'T']
CSpinner:
text: '0'
size_hint: 1, None
height: 3 * sheight / 4
id: iter_col
values: [str(item) for item in range(root.cols)]
EWidget:
GBoxLayout:
orientation: 'horizontal'
EWidget
CButton:
text: 'ok'
on_release: iter_pop.dismiss()
on_release: app.main.iterate(d_check.active, L_check.active, iter_from_input.text, iter_to_input.text, iter_target_input.text, iter_start_input.text, iter_row.text, iter_col.text)
<MagPopup>:
title: 'Magnify'
id: mag_pop
BoxLayout:
orientation: 'vertical'
GridLayout:
cols: 3
CLabel:
text: 'Kind of magnification'
size_hint_x: 1
CLabel:
text: 'Between elements'
size_hint_x: 1
CLabel:
text: 'Magnification value'
size_hint_x: 1
GBoxLayout:
orientation: 'horizontal'
size_hint_x: 1
CLabel:
text: 'Aperture'
size_hint_x: 1
CLabel:
text: 'Field'
size_hint_x: 1
GBoxLayout:
orientation: 'horizontal'
size_hint_x: 1
CLabel:
text: 'From'
size_hint_x: 1
CLabel:
text: 'To'
size_hint_x: 1
GBoxLayout:
GBoxLayout:
orientation: 'horizontal'
CCheckBox:
active: True
group: 'mag'
id: v_check
CLabel:
text: 'V'
size_hint_x: 1
CCheckBox:
group: 'mag'
CLabel:
text: 'Q'
size_hint_x: 1
GBoxLayout:
orientation: 'horizontal'
CSpinner:
text: '1'
id: mag_from_input
values: [str(item) for item in range(1, root.cols)]
CSpinner:
text: '1'
id: mag_to_input
values: [str(item) for item in range(1, root.cols)]
PTextInput:
size_hint_x: 1
id: mag_val_input
EWidget:
GBoxLayout:
orientation: 'horizontal'
EWidget
CButton:
text: 'ok'
on_release: mag_pop.dismiss()
on_release: app.main.magnify(v_check.active, mag_from_input.text, mag_to_input.text, mag_val_input.text)
<Col>:
orientation: 'vertical'
size_hint: None, None
width: self.minimum_width
height: self.minimum_height
col_number: 0
f: nan
d: nan
h: nan
alpha: nan
v: nan
l: nan
y1: nan
beta: nan
q: nan
t: nan
phi: nan
par_q: ['f', 'd', 'h', 'alpha', 'v', 'l', 'y1', 'beta', 'q', 't', 'phi']
CLabel:
text: str(root.col_number)
CTextInput:
data: root.f
background_color: dark if root.col_number + 1 == len(app.main.ids.table.data) or root.col_number == 0 else green if self.user else white
param: 'f'
CTextInput:
data: root.d
background_color: dark if root.col_number + 1 == len(app.main.ids.table.data) else green if self.user else white
param: 'd'
CTextInput:
data: root.h
param: 'h'
CTextInput:
data: root.alpha
background_color: dark if root.col_number + 1 == len(app.main.ids.table.data) else green if self.user else green if self.user else white
param: 'alpha'
CTextInput:
data: root.v
background_color: dark if root.col_number + 1 == len(app.main.ids.table.data) or root.col_number == 0 else green if self.user else white
param: 'v'
CTextInput:
data: root.l
background_color: dark if root.col_number + 1 == len(app.main.ids.table.data) or root.col_number == 0 else green if self.user else white
param: 'l'
CTextInput:
data: root.y1
param: 'y1'
CTextInput:
data: root.beta
background_color: dark if root.col_number + 1 == len(app.main.ids.table.data) else green if self.user else white
param: 'beta'
CTextInput:
data: root.q
background_color: dark if root.col_number + 1 == len(app.main.ids.table.data) or root.col_number == 0 else green if self.user else white
param: 'q'
CTextInput:
data: root.t
background_color: dark if root.col_number + 1 == len(app.main.ids.table.data) or root.col_number == 0 else green if self.user else white
param: 't'
CLabel:
#data: root.phi
text: '' if isnan(root.phi) else '{:0.2f}'.format(root.phi)
param: 'phi'
<RV>:
id: table
viewclass: 'Col'
scroll_type: ['bars', 'content']
scroll_wheel_distance: '114dp'
bar_height: '30dp'
SelectableRecycleBoxLayout:
default_size: None, None
default_size_hint: None, None
size_hint: None, None
width: self.minimum_width
height: self.minimum_height
orientation: 'horizontal'
<NosWidget>:
id: nos
BoxLayout:
orientation: 'vertical'
BoxLayout:
orientation: 'horizontal'
height: self.minimum_height
size_hint_y: None
CLabel:
text: 'Number of\nelements:'
CSTextInput:
id: noe_input
input_filter: 'int'
focus: True
on_text_validate: app.nos.validate_input(self)
EWidget
CLabel:
text: 'Info Label'
id: info_label
size_hint_y: None
height: sheight
size_hint_x: 1
pos_hint: {'x': 0.01}
text_size: self.size
halign: 'left'
<MainWidget>:
id:main
BoxLayout:
background_color: 0,0,1,.5
orientation: 'vertical'
BoxLayout:
orientation: 'horizontal'
size_hint_y: None
height: self.minimum_height
CButton:
text: 'New'
on_release: app.sm.current = 'nos'
on_release: lhi_label.data = nan
on_release: vignette_input.data = nan
on_release: app.nos.noe_input.focus = True
CButton:
text: 'Magnify'
on_release: main.mag_pop.open()
CButton:
text: 'Iteration'
on_release: main.iter_pop.open()
CButton:
text: 'Plot'
on_release: main.plot()
CButton:
text: 'Export'
on_release: main.export()
CButton:
text: 'History'
on_release: main.history()
CButton:
text: 'Screenshot'
on_release: main.capture()
CButton:
text: 'Help'
on_release: main.help()
BoxLayout:
orientation: 'horizontal'
pos_hint: {'center_x': 0.5}
size_hint_y: None
height: self.minimum_height
BoxLayout:
orientation: 'vertical'
size_hint: None, None
width: self.minimum_width
height: self.minimum_height
CLabel:
text: 'number'
CLabel:
text: 'f'
CLabel:
text: 'd'
CLabel:
text: 'H'
CLabel:
text: '\u03B1'
CLabel:
text: 'V'
CLabel:
text: 'L'
CLabel:
text: 'Y'
CLabel:
text: '\u03B2'
CLabel:
text: 'Q'
CLabel:
text: 'T'
CLabel:
text: '\u03A6 [sub]a[/sub]'
markup: True
EWidget
RV:
id: table
BoxLayout:
orientation: 'horizontal'
height: sheight
size_hint_y: None
CLabel:
id: lhi_label
data: nan
text: 'LHI: {:g}'.format(float(self.data)) if not isnan(float(self.data)) else 'LHI:'
CLabel:
text: 'vignette'
CTextInput:
id: vignette_input
param: 'vignette'
data: nan
CLabelInfo:
id: magnify_info
text: ''
text_size: self.size
pos_hint: {'x': 0.01}
EWidget
CLabel:
text: 'Info Label'
id: info_label
pos_hint: {'x': 0.01}
text_size: self.size
halign: 'left'
size_hint_x: 1