-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestBench.kv
788 lines (704 loc) · 18.8 KB
/
TestBench.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
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
#:kivy 1.06.0
#import Gauge
#from kivy.uix.screenmanager import FadeTransition
BoxLayout:
orientation: 'vertical'
SomeMenu_ActionBar:
id: ActionBar
ScreenManager:
id: sm
<AutomaticScreen>:
name: 'AutomaticScreen'
FloatLayout:
Button:
id : btn_Auto_LOAD
text : 'LOAD'
size_hint : None, None
size: 75,40
pos_hint: {'top': .5,'right':0.99}
on_release: Popup_Choose_File_Auto.open()
Button:
id : btn_Auto_START_STOP
text : 'START'
size_hint : None, None
size: 75,40
pos_hint: {'top': .65,'right':0.99}
on_release: root.Start_Stop()
disabled : True
Label:
id: lbl_Automatic_Set_Point
text: "Test : No test in progress"
pos:-300,50
TextInput:
id: txtIn_Automatic_SetPoint
hint_text: "Setpoints sent to the bench"
background_color: (.5,.5,.5,1)
size_hint_y:.55
size_hint_x:.4
pos_hint:{'top': .6,'right':0.42}
readonly: True
Label:
text: "Measures in current test:"
pos:52,50
TextInput:
id: txtIn_Automatic_Measures
hint_text: "Measured values in the bench"
background_color: (.5,.5,.5,1)
size_hint_y:.55
size_hint_x:.4
pos_hint:{'top': .6,'right':.86}
readonly: True
BoxLayout:
id:bl_pop_file_auto
p_choose_file_Auto:Popup_Choose_File_Auto.__self__
Popup:
id: Popup_Choose_File_Auto
title: "Choose set-up file"
size_hint:(.6, .8)
on_parent:
if self.parent == bl_pop_file_auto: self.parent.remove_widget(self)
BoxLayout:
orientation: "vertical"
size_hint:(1,1)
FileChooserIconView:
id:filechooser_setup_auto
path : "./"
filters: ['*.csv']
GridLayout:
rows : 1
cols : 2
spacing : (15,0)
size:(150,50)
size_hint:None,None
pos_hint:{'center_x':0.8, 'center_y':0.5}
Button:
text: 'Load'
size: 75, 50
size_hint: None, None
on_release: root.LoadSetUpFile(filechooser_setup_auto.selection);Popup_Choose_File_Auto.dismiss()
Button:
text: 'Cancel'
size: 75, 50
size_hint: None, None
on_release: Popup_Choose_File_Auto.dismiss()
<ManualScreen>:
name: 'ManualScreen'
FloatLayout:
Button:
text : 'Load'
size_hint : None, None
size: 50,40
pos : 400,390
on_release: Manual_Popup_Choose_File.open()
Label:
id : lbl_man_Type
text : 'Type '
size_hint : None, None
size: 300,20
pos : 460,385
text_size: self.size
halign: 'left'
valign: 'middle'
Label:
id : lbl_man_Name
text : 'Name: '
size_hint : None, None
size: 300,20
pos : 460,405
text_size: self.size
halign: 'left'
valign: 'middle'
GridLayout:
cols : 4
rows : 4
col_default_width : 60
col_force_default : True
spacing : (30,10)
pos : (400,-55)
Label:
id:manual_max_U
text : "Max : "
size_hint_y:None
height:30
Label:
id:manual_max_I
text : "Max : "
size_hint_y:None
height:30
Label:
id:manual_max_S
text : "Max : "
size_hint_y:None
height:30
Label:
id:manual_max_C
text : "Max : "
size_hint_y:None
height:30
Slider:
id : slider_man_U
orientation:'vertical'
size_hint_y:None
height:200
background_vertical:"Datas/degrade.png"
background_width:5
max : 0
Slider:
id : slider_man_I
orientation:'vertical'
size_hint_y:None
height:200
background_vertical:"Datas/degrade.png"
background_width:5
max : 0
Slider:
id : slider_man_S
orientation:'vertical'
size_hint_y:None
height:200
background_vertical:"Datas/degrade.png"
background_width:5
max : 0
Slider:
id : slider_man_C
orientation:'vertical'
size_hint_y:None
height:200
background_vertical:"Datas/degrade.png"
background_width:5
max : 0
TextInput:
id: txtIn_Manual_U
input_filter:'float'
hint_text: "[V]"
size_hint_y:None
height:30
text : str(round(slider_man_U.value,2))
TextInput:
id: txtIn_Manual_I
input_filter:'float'
hint_text: "[A]"
size_hint_y:None
height:30
text : str(round(slider_man_I.value,2))
TextInput:
id: txtIn_Manual_S
input_filter:'float'
hint_text: "[tr/min]"
size_hint_y:None
height:30
text : str(round(slider_man_S.value,2))
TextInput:
id: txtIn_Manual_C
input_filter:'float'
hint_text: "[Nm]"
size_hint_y:None
height:30
text : str(round(slider_man_C.value,2))
Button:
id:Manual_TC_Set_Umotor
background_normal: "Datas/manual_button_up.png"
background_down: "Datas/manual_button_down.ico"
size_hint: None,None
size: 50, 50
border: (0, 0, 0, 0) # Don't stretch the outer two pixels on each edge when resizing.
on_release:root.btn_Set_Manual_Release('Manual_TC_Set_Umotor')
Button:
id:Manual_TC_Set_Imotor
background_normal: "Datas/manual_button_up.png"
background_down: "Datas/manual_button_down.png"
size_hint: None,None
size: 50, 50
border: (0, 0, 0, 0) # Don't stretch the outer two pixels on each edge when resizing.
on_release:root.btn_Set_Manual_Release('Manual_TC_Set_Imotor')
Button:
id:Manual_TC_Set_Smotor
background_normal: "Datas/manual_button_up.png"
background_down: "Datas/manual_button_down.png"
size_hint: None,None
size: 50, 50
border: (0, 0, 0, 0) # Don't stretch the outer two pixels on each edge when resizing.
on_release:root.btn_Set_Manual_Release('Manual_TC_Set_Speed')
Button:
id:Manual_TC_Set_Cmotor
background_normal: "Datas/manual_button_up.png"
background_down: "Datas/manual_button_down.png"
size_hint: None,None
size: 50, 50
border: (0, 0, 0, 0) # Don't stretch the outer two pixels on each edge when resizing.
on_release:root.btn_Set_Manual_Release('Manual_TC_Set_Couple')
BoxLayout:
id:bl3
p_man_choose_file:Manual_Popup_Choose_File.__self__
Popup:
id: Manual_Popup_Choose_File
title: "Choose motor file"
size_hint:(.6, .8)
on_parent:
if self.parent == bl3: self.parent.remove_widget(self)
BoxLayout:
orientation: "vertical"
size_hint:(1,1)
FileChooserIconView:
id:filechooser1
path : "./"
filters: ['*.csv']
GridLayout:
rows : 1
cols : 2
spacing : (15,0)
size:(150,50)
size_hint:None,None
pos_hint:{'center_x':0.8, 'center_y':0.5}
Button:
text: 'Load'
size: 75, 50
size_hint: None, None
on_release: root.LoadFile(filechooser1.selection);Manual_Popup_Choose_File.dismiss()
Button:
text: 'Cancel'
size: 75, 50
size_hint: None, None
on_release: Manual_Popup_Choose_File.dismiss()
<HomeScreen>:
name: 'HomeScreen'
GridLayout:
rows : 1
cols : 3
pos_hint:{'center_x':0.65, 'center_y':0.3}
spacing : (30,30)
Button:
on_release: app.changeScreen(1)#app.root.ids.sm.current = 'ManualScreen'
background_normal: "Datas/sliders_file.png"
background_down: "Datas/sliders_file.png"
size_hint: None,None
size: 180, 180
size_hint: None, None
Button:
on_release: app.changeScreen(2)
background_normal: "Datas/auto_file.png"
background_down: "Datas/auto_file.png"
size_hint: None,None
size: 180, 180
Button:
on_release: app.changeScreen(3)
background_normal: "Datas/settings_file.png"
background_down: "Datas/settings_file.png"
size_hint: None,None
size: 180, 180
<SettingsScreen>:
name: 'SettingsScreen'
GridLayout:
rows : 1
cols : 3
pos_hint:{'center_x':0.7, 'center_y':0.25}
spacing : (50,50)
Button:
on_release: Popup_Add_Motor.open()
background_normal: "Datas/add_file.png"
background_down: "Datas/add_file.png"
size_hint: None,None
size: 128, 128
size_hint: None, None
Button:
on_release: Popup_Edit_Motor.open()
background_normal: "Datas/edit_file.png"
background_down: "Datas/edit_file.png"
size_hint: None,None
size: 128, 128
Button:
on_release: Popup_Add_Script.open()
background_normal: "Datas/scripting_img.png"
background_down: "Datas/scripting_img.png"
size_hint: None,None
size: 128, 128
BoxLayout:
id: bl
p_add_mot : Popup_Add_Motor.__self__
Popup:
id: Popup_Add_Motor
title: "Add Motor"
size_hint:(.55, .8)
on_parent:
if self.parent == bl: self.parent.remove_widget(self)
BoxLayout:
current_value:'DC'
GridLayout:
rows : 10
cols : 3
col_default_width : 130
col_force_default : True
row_default_height : 30
row_force_default : True
spacing : (10,20)
pos : (50,50)
ToggleButton :
text:'AC'
group:'Type_motor'
on_release: if(self.state == 'normal'):self.state='down';current_value = self.text
ToggleButton :
text:'DC'
group:'Type_motor'
state : 'down'
on_release: if(self.state == 'normal'):self.state='down';current_value = self.text
ToggleButton :
text:'SBS'
group:'Type_motor'
on_release: if(self.state == 'normal'):self.state='down';current_value = self.text
Label :
text: 'Name of Motor'
TextInput:
id: AddMotor_Name
hint_text: "Name of motor file"
Label :
Label :
text: 'Max current:'
TextInput:
id: AddMotor_MaxI
input_filter:'float'
hint_text: "[A] - Number only"
Label :
Label :
text: 'Max voltage:'
TextInput:
id: AddMotor_MaxU
input_filter:'float'
hint_text: "[V] - Number only"
Label :
Label :
text: 'Max Power:'
TextInput:
id: AddMotor_MaxP
input_filter:'float'
hint_text: "[W] - Number only"
Label :
Label :
text: 'Max speed:'
TextInput:
id: AddMotor_MaxSpeed
input_filter:'float'
hint_text: "[tr/min] - optionnal"
Label :
Button:
text: 'Validate'
size: 75, 50
size_hint: None, None
pos : (100,75)
on_release: root.AddMotor(self.parent.current_value, AddMotor_Name.text,AddMotor_MaxI.text, AddMotor_MaxU.text,AddMotor_MaxP.text,AddMotor_MaxSpeed.text,"add");Popup_Add_Motor.dismiss()
BoxLayout:
id: bl_pop_add_script
p_add_script : Popup_Add_Script.__self__
Popup:
id: Popup_Add_Script
title: "Add Automatic Script"
size_hint:(.55, .8)
on_parent:
if self.parent == bl_pop_add_script: self.parent.remove_widget(self)
BoxLayout:
current_value_auto_cfg:'U_MIN_TO_U_MAX'
GridLayout:
id:gridlayout_cfg_File_scripts
rows : 2
cols : 3
col_default_width : 130
col_force_default : True
row_default_height : 30
row_force_default : True
spacing : (10,20)
ToggleButton :
text:'Umin->Umax'
group:'Type_Caract'
state : 'down'
on_release: if(self.state == 'normal'):self.state='down'
on_release: self.parent.parent.current_value_auto_cfg = 'U_MIN_TO_U_MAX'
on_release: root.updateAddScriptComponents('U_MIN_TO_U_MAX')
ToggleButton :
text:'cr=f(v) u=cst'
group:'Type_Caract'
on_release: if(self.state == 'normal'):self.state='down'
on_release: self.parent.parent.current_value_auto_cfg = 'C_FCT_SP_U_CST'
on_release: root.updateAddScriptComponents('C_FCT_SP_U_CST')
Button:
text:"MotorFile..."
on_release:Automatic_Popup_Choose_File_cfg.open()
ToggleButton :
text:'u=f(v) cr=cst'
group:'Type_Caract'
on_release: if(self.state == 'normal'):self.state='down'
on_release: self.parent.parent.current_value_auto_cfg = 'U_FCT_SP_C_CST'
on_release: root.updateAddScriptComponents('U_FCT_SP_C_CST')
ToggleButton :
text:'v=f(u) c=cst'
group:'Type_Caract'
on_release: if(self.state == 'normal'):self.state='down'
on_release: self.parent.parent.current_value_auto_cfg = 'SP_FCT_U_C_CST'
on_release: root.updateAddScriptComponents('SP_FCT_U_C_CST')
TextInput:
id: txtInput_NameFileScript
hint_text: "FileName"
FloatLayout:
size_hint : None,None
size:self.parent.size
GridLayout:
rows : 1
cols : 6
col_default_width : 60
col_force_default : True
row_default_height : 30
row_force_default : True
pos_hint: {'top': .72,'right':1}
Label:
id:lbl_AddScript_P1
text : 'Umin'
TextInput:
id: txtInput_AddScript_P1
input_filter:'float'
hint_text: "[A] - Number only"
Label:
id:lbl_AddScript_P2
text : 'Umax'
TextInput:
id: txtInput_AddScript_P2
input_filter:'float'
hint_text: "[A] - Number only"
Label:
id:lbl_AddScript_CST
text : ''
TextInput:
id: txtInput_AddScript_CST
input_filter:'float'
hint_text: "[A] - Number only"
TextInput:
id: txtInput_Script_preparation_File
hint_text: "Values in the script file"
background_color: (.5,.5,.5,1)
size_hint_x : .7
size_hint_y : .5
pos_hint: {'top': .5,'right':self.size_hint_x}
readonly: True
multiline: True
Button:
id:btnAdd_ScriptCfg
text: 'Add'
size: 75, 50
size_hint: None, None
pos_hint: {'top': .55,'right':1}
disabled : True
on_release : root.AddScenarioToScript(self.parent.parent.current_value_auto_cfg,txtInput_AddScript_P1.text,txtInput_AddScript_P2.text,txtInput_AddScript_CST.text)
Button:
text: 'Remove'
size: 75, 50
size_hint: None, None
pos_hint: {'top': .35,'right':1}
on_release : root.RemoveScenarioToScript()
Button:
text: 'Validate'
size: 75, 50
size_hint: None, None
pos_hint: {'top': .15,'right':1}
on_release: root.AddScript()
BoxLayout:
id:bl_auto_pop_mot_file_cfg
p_auto_choose_file:Automatic_Popup_Choose_File_cfg.__self__
Popup:
id: Automatic_Popup_Choose_File_cfg
title: "Choose motor file"
size_hint:(.6, .8)
on_parent:
if self.parent == bl_auto_pop_mot_file_cfg: self.parent.remove_widget(self)
BoxLayout:
orientation: "vertical"
size_hint:(1,1)
FileChooserIconView:
id:filechooser_auto_motor_cfg
path : "./"
filters: ['*.csv']
GridLayout:
rows : 1
cols : 2
spacing : (15,0)
size:(150,50)
size_hint:None,None
pos_hint:{'center_x':0.8, 'center_y':0.5}
Button:
text: 'Load'
size: 75, 50
size_hint: None, None
on_release: root.LoadFileMotorToAutoCfg(filechooser_auto_motor_cfg.selection);Automatic_Popup_Choose_File_cfg.dismiss()
Button:
text: 'Cancel'
size: 75, 50
size_hint: None, None
on_release: Automatic_Popup_Choose_File_cfg.dismiss()
BoxLayout:
id: bl2
p_edit_motor:Popup_Edit_Motor.__self__
Popup:
id: Popup_Edit_Motor
title: "Edit Motor"
size_hint:(.6, .8)
on_parent:
if self.parent == bl2: self.parent.remove_widget(self)
FloatLayout:
current_value:'DC'
GridLayout:
id:GL1
rows : 10
cols : 2
col_default_width : 130
col_force_default : True
row_default_height : 30
row_force_default : True
spacing : (10,15)
hint_pos : (None,0)
pos : self.parent.pos
Button:
text:"Choose File"
on_release:Popup_Choose_File.open()
Label:
id : file_choosen_input
markup: True
multiline : False
hint_text : "File Path"
size_hint: (None, None)
height : 50
width : 350
text_size: 300,50
width: (300)
halign: 'left'
valign: 'middle'
Label :
text: 'Name of Motor'
TextInput:
id:EditMotor_Name
hint_text: "Name of motor file"
Label :
text: 'Max current:'
TextInput:
id: EditMotor_MaxI
input_filter:'float'
hint_text: "[A] - Number only"
Label :
text: 'Max voltage:'
TextInput:
id: EditMotor_MaxU
input_filter:'float'
hint_text: "[V] - Number only"
Label :
text: 'Max Power:'
TextInput:
id: EditMotor_MaxP
input_filter:'float'
hint_text: "[W] - Number only"
Label :
text: 'Max speed:'
TextInput:
id: EditMotor_MaxSpeed
input_filter:'float'
hint_text: "[tr/min] - optionnal"
GridLayout:
rows : 2
cols : 1
spacing : (0,15)
size_hint:None,None
size:(100,115)
hint_pos_x : None
pos : (100,100)
hint_pos : (None,0)
pos_hint:{'center_x':0.85, 'center_y':0.2}
Button:
text: 'Cancel'
size: 100, 50
size_hint: None, None
#pos : (100,75)
size_hint:None,None
on_release: Popup_Edit_Motor.dismiss()
Button:
text: 'Save changes'
size: 100, 50
size_hint: None, None
#pos : (100,75)
size_hint:None,None
on_release: on_release: root.AddMotor(self.parent.parent.current_value, EditMotor_Name.text,EditMotor_MaxI.text, EditMotor_MaxU.text,EditMotor_MaxP.text,EditMotor_MaxSpeed.text,"edit"); Popup_Edit_Motor.dismiss()
BoxLayout:
id:bl3
p_choose_file:Popup_Choose_File.__self__
Popup:
id: Popup_Choose_File
title: "Choose motor file"
size_hint:(.6, .8)
on_parent:
if self.parent == bl3: self.parent.remove_widget(self)
BoxLayout:
orientation: "vertical"
size_hint:(1,1)
FileChooserIconView:
id:filechooser1
path : "./"
filters: ['*.csv']
GridLayout:
rows : 1
cols : 2
spacing : (15,0)
size:(150,50)
size_hint:None,None
hint_pos : (None,0)
pos_hint:{'center_x':0.8, 'center_y':0.5}
Button:
text: 'Load'
size: 75, 50
size_hint: None, None
on_release: root.LoadFileToModify(filechooser1.selection);Popup_Choose_File.dismiss()
Button:
text: 'Cancel'
size: 75, 50
size_hint: None, None
on_release: Popup_Choose_File.dismiss()
<SomeMenu_ActionBar@ActionBar>:
ActionView:
id: ActionView
ActionPrevious:
#title: app.title if app.title is not None else 'Action Previous'
title: app.title
on_release: app.actionPrevious_Released()
ActionButton:
text: "Emergency"
background_normal: ''
background_color: 1, .3, .4, .85
ActionGroup:
id: App_ActionGroup
mode: 'spinner'
text: 'Screens'
ActionButton:
text: 'Manual Mode'
on_release: app.changeScreen(1)#app.root.ids.sm.current = 'ManualScreen'
ActionButton:
text: 'Automatic Mode'
on_release: app.changeScreen(2)
ActionButton:
text: 'Settings'
on_release: app.changeScreen(3)
ActionGroup:
id: App_ActionGroup
mode: 'spinner'
text: 'App'
ActionButton:
text: 'Settings'
on_press: app.open_settings()
ActionButton:
text: 'Quit'
on_press: app.quit()
ActionGroup:
id: File_ActionGroup
mode: 'spinner'
text: 'File'
ActionButton:
text: 'Open'
ActionButton:
text: 'Save'
<HiddenIcon_ActionPrevious@ActionPrevious>:
with_previous: False
app_icon: ''
app_icon_width: 0
app_icon_height: 0
size_hint_x: None