forked from FNAL-HCAL-Ph1Upgrade/gui-step1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
User-Interface.py
1386 lines (1175 loc) · 57.8 KB
/
User-Interface.py
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
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# User-Interface.py
#
# This is the main Graphical User Interface for for Teststand 1.
# A server runs on a RaspberryPi, which connects to the Fanout.
# The Fanout connects to the ngCCM Emulator.
# QIE cards can be inserted into any QIE card backplane slot.
#
# Developed with the help of many people
# For Baylor University, Summer 2016 (HE) and Summer 2018 (HB).
from Tkinter import *
from datetime import datetime
from initialClass import initialTests
from cardInfoClass import cardInformation
from functools import partial
from Tools import Tools
from checksumClass import Checksum
import temp
import json
import client
import subprocess
import argparse
#toggles between lists and three-state buttons for Pass/Fail switches
listbuttons=0
#initalizes the global hotkey lockout variable. Setting this to '2' will disable hotkeys
lockout=0
class makeGui(Tools):
def __init__(self, parent, color_themes, color_theme="bright"):
#color_themes = ["bright", "dark", "sunrise", "nightfall"]
#color_theme = "nightfall"
# color themes
self.color_themes = color_themes
self.color_theme = color_theme
# Default color_theme is "bright"
if self.color_theme not in self.color_themes:
self.color_theme = "bright"
# set color theme
self.setColorTheme()
# full base path for database
self.databasePath = "/home/django/testing_database_hb"
# Create a webBus instance
#self.myBus = client.webBus("192.168.1.41",0)
self.myBus = client.webBus("pi7",0)
# Create a permanent I2C address of QCard (slot 1)
self.address = 0x19
# Permanent I2C address of Igloo FPGA
self.iglooAddress = 0x09
# Specify "top" or "bottom" Igloo FPGA
self.igloo = "top"
# Standard help message for I2C_ERROR
self.I2C_ERROR_HELP = "Please confirm that the card is in the selected slot.\nPlease confirm that the power source is on."
# Create an instance of initialTests
self.initialTest = initialTests()
# Create an instance of cardInformation
self.cardInfo = cardInformation()
# Read info from left side?
self.readFromList = True
# Make an empty list that will eventually contain all of
# the active card slots
self.outSlotNumbers = []
# Name the parent. This is mostly for bookkeeping purposes
# and doesn't really get used too much... as in not at all!
self.myParent = parent
# Make a placeholder for the shortened unique ID
self.uniqueIDPass = ""
self.nameChoiceVar = StringVar()
self.gpioChoiceVar = StringVar()
self.infoCommentVar = StringVar()
self.barcodeEntry = StringVar()
self.uniqueIDEntry = StringVar()
self.tempEntry = StringVar()
self.firmwareVerEntry = StringVar()
self.firmwareVerMinEntry = StringVar()
self.firmwareVerOtherEntry = StringVar()
self.iglooToggleEntry = StringVar()
self.iglooMajVerEntryT = StringVar()
self.iglooMajVerEntryB = StringVar()
self.iglooMinVerEntryT = StringVar()
self.iglooMinVerEntryB = StringVar()
self.overwriteVar = IntVar()
self.check = 0
# Place an all-encompassing frame in the parent window. All of the following
# frames will be placed here (topMost_frame) and not in the parent window.
self.topMost_frame = Frame(parent)
self.topMost_frame.pack()
self.topMost_frame.configure(bg=self.backc)
#----- constants for controlling layout
button_width = 6
button_padx = "2m"
button_pady = "1m"
frame_padx = "3m"
frame_pady = "2m"
frame_ipadx = "3m"
frame_ipady = "1m"
#---------- end layout constants ------
# Creates hotkey bindings for Pass/Fail buttons
if (not listbuttons) and (lockout is not 2):
hotkeys = ['1','2','3','4','5','q','w','e','r','t','a','s','d','f','g','z','x','c','v']
for i in range(len(hotkeys)):
parent.bind(hotkeys[i], partial(self.togglepstate,i))
def lockon (self,event=None):
global lockout
lockout=1
def lockoff (self,event=None):
global lockout
lockout=0
##########################################
### ###
### BEGIN MAKING SUB-FRAMES ###
### ###
##########################################
# Make and pack a sub-frame within topMost_frame that will contain
# all of the controls for non-hardware related test information
# (i.e. name of tester)
self.info_frame = Frame(
self.topMost_frame,
borderwidth=5, relief=RIDGE,
height=50,
background=self.topc,
)
self.info_frame.pack(
side=TOP,
ipadx=frame_ipadx,
ipady=frame_ipady,
padx=frame_padx,
pady=frame_pady
)
# Make a top half-frame
self.topHalf_frame = Frame(self.topMost_frame)
self.topHalf_frame.configure(bg=self.backc)
self.topHalf_frame.pack(side=TOP)
# Make a frame for containing an experiment diagram
self.experiment_frame = Frame(
self.topHalf_frame,
borderwidth=5, relief=RIDGE,
height=580, width=300,
background=self.rightc
)
self.experiment_frame.pack_propagate=(False)
self.experiment_frame.pack(
side=RIGHT,
ipadx=frame_ipadx,
ipady=frame_ipady,
padx=frame_padx,
pady=frame_pady
)
# Make a label for the entire right frame
self.experi_rightFrame = Frame(
self.topHalf_frame,
borderwidth=5, relief=RIDGE,
height=580, width=300,
background=self.midc
)
self.experi_rightFrame.pack_propagatte=(False)
self.experi_rightFrame.pack(
side=LEFT,
ipadx=frame_ipadx,
ipady=frame_ipady,
padx=frame_padx,
pady=frame_pady
)
if not (listbuttons):
hotkeys = ['1','2','3','4','5','q','w','e','r','t','a','s','d','f','g','z','x','c','v']
for i in range(len(hotkeys)):
parent.bind(hotkeys[i], partial(self.togglepstate,i))
##########################################
### ###
### BEGIN MAKING WIDGETS ###
### ###
##########################################
######################################
##### #####
##### Widgets in info frame #####
##### #####
######################################
# Make and pack a text label for name selector
self.info_Label = Label(self.info_frame, text="Testing Information/Parameters")
self.info_Label.configure(
padx=button_padx,
pady=button_pady,
background=self.topc,
foreground=self.fontc
)
self.info_Label.pack(side=TOP)
# Make a sub-sub-frame within the frame to hold another label and a dropdown box
self.info_subTop_frame = Frame(self.info_frame,background=self.topc)
self.info_subTop_frame.pack(
side=TOP,
ipadx=frame_ipadx,
ipady=frame_ipady,
padx=frame_padx,
pady=frame_pady
)
# Make a sub-sub-frame within the frame to hold comment box
self.info_subBot_frame = Frame(self.info_frame,background=self.topc)
self.info_subBot_frame.pack(
side=TOP,
ipadx=frame_ipadx,
ipady=frame_ipady,
padx=frame_padx,
pady=frame_pady
)
# Make a label for the name drop-down:
self.info_nameLabel = Label(self.info_subTop_frame, text="Tester Name: ")
self.info_nameLabel.configure(
padx=button_padx,
pady=button_pady,
background=self.topc,
foreground=self.fontc
)
self.info_nameLabel.pack(side=LEFT)
# Make and pack a listbox to pick which QIE card to talk to:
self.info_nameBox = OptionMenu(self.info_subTop_frame, self.nameChoiceVar, "Nesta Lenhert", "Chris Madrid", "Bryan Caraway", "Brooks McMaster", "Caleb Smith")
self.info_nameBox.pack(side=LEFT)
self.info_nameBox.configure(bg=self.topc,fg=self.fontc,activebackground=self.dimc,activeforeground=self.fontc)
self.info_nameBox["menu"].config(bg=self.topc,fg=self.fontc,activebackground=self.dimc,activeforeground=self.fontc)
self.nameChoiceVar.set("Choose Name") # initializes the OptionMenu
# Make a label for the name drop-down:
self.info_commentLabel = Label(self.info_subBot_frame, text="User Testing Comments: ")
self.info_commentLabel.configure(
padx=button_padx,
pady=button_pady,
background=self.topc,
foreground=self.fontc
)
self.info_commentLabel.pack(side=LEFT)
# Make a entrybox for testing comments
self.info_commentBox = Entry(
self.info_subBot_frame,
textvariable=self.infoCommentVar
)
self.info_commentBox.pack(side=LEFT)
self.info_commentBox.configure(bg=self.topc,fg=self.fontc)
self.info_commentBox.bind("<FocusIn>",lockon)
self.info_commentBox.bind("<FocusOut>",lockoff)
######################################
##### #####
##### Experiment Setup Frames #####
##### #####
######################################
self.testLabelList = ["BPL-GND","1.2-GND","1.5-GND","2.5-GND",
"3.3-GND","5.0-GND","1.2-1.5","1.2-2.5","1.5-2.5",
"1.2-3.3","1.5-3.3","2.5-3.3","1.2-5.0", "1.5-5.0",
"2.5-5.0", "3.3-5.0", "SuplCur", "Vis", "Program"]
# Make a label for the entire left frame
self.experi_subFrame_lbl = Label(self.experiment_frame,text="QIE Card Setup & Parameters")
self.experi_subFrame_lbl.configure(
padx=button_padx,
pady=button_pady,
background=self.rightc,
foreground=self.fontc
)
self.experi_subFrame_lbl.pack(side=TOP)
# Make top 2_7 subframe
self.experi_subTop2_7_frame = Frame(self.experiment_frame, bg=self.rightc)
self.experi_subTop2_7_frame.pack(
side=TOP,
ipadx=frame_ipadx, padx=frame_padx,
ipady=frame_ipady, pady=frame_pady,
)
# Make top 2_8 subframe
self.experi_subTop2_8_frame = Frame(self.experiment_frame, bg=self.rightc)
self.experi_subTop2_8_frame.pack(
side=TOP,
ipadx=frame_ipadx, padx=frame_padx,
ipady=frame_ipady, pady=frame_pady,
)
# Make top 2_6 subframe
self.experi_subTop2_6_frame = Frame(self.experiment_frame, bg=self.rightc)
self.experi_subTop2_6_frame.pack(
side=TOP,
ipadx=frame_ipadx, padx=frame_padx,
ipady=frame_ipady, pady=frame_pady,
)
# Make top 2 subframe
self.experi_subTop2_frame = Frame(self.experiment_frame,background=self.rightc)
self.experi_subTop2_frame.pack(
side=TOP,
ipadx=frame_ipadx,
ipady=frame_ipady,
padx=frame_padx,
pady=frame_pady
)
# Make top 2_0 subframe
self.experi_subTop2_0_frame = Frame(self.experiment_frame,background=self.rightc)
self.experi_subTop2_0_frame.pack(
side=TOP,
ipadx=frame_ipadx,
ipady=frame_ipady,
padx=frame_padx,
pady=frame_pady
)
# Make top 2_1 subframe
self.experi_subTop2_1_frame = Frame(self.experiment_frame,background=self.rightc)
self.experi_subTop2_1_frame.pack(
side=TOP,
ipadx=frame_ipadx,
ipady=frame_ipady,
padx=frame_padx,
pady=frame_pady
)
# Make top 2_2 subframe
self.experi_subTop2_2_frame = Frame(self.experiment_frame,background=self.rightc)
self.experi_subTop2_2_frame.pack(
side=TOP,
ipadx=frame_ipadx,
ipady=frame_ipady,
padx=frame_padx,
pady=frame_pady
)
# Make top 2_3 subframe
self.experi_subTop2_3_frame = Frame(self.experiment_frame,background=self.rightc)
self.experi_subTop2_3_frame.pack(
side=TOP,
ipadx=frame_ipadx,
ipady=frame_ipady,
padx=frame_padx,
pady=frame_pady
)
# Make top 2_4 subframe
self.experi_subTop2_4_frame = Frame(self.experiment_frame,background=self.rightc)
self.experi_subTop2_4_frame.pack(
side=TOP,
ipadx=frame_ipadx,
ipady=frame_ipady,
padx=frame_padx,
pady=frame_pady
)
# Make top 2_4_5 subframe
self.experi_subTop2_4_5_frame = Frame(self.experiment_frame,background=self.rightc)
self.experi_subTop2_4_5_frame.pack(
side=TOP,
ipadx=frame_ipadx,
ipady=frame_ipady,
padx=frame_padx,
pady=frame_pady
)
# Make top 2_4_6 subframe
self.experi_subTop_2_4_6_frame = Frame(self.experiment_frame, background=self.rightc)
self.experi_subTop_2_4_6_frame.pack(
side=TOP,
ipadx=frame_ipadx,
ipady=frame_ipady,
padx=frame_padx,
pady=frame_pady
)
# Make top 2_5 subframe
self.experi_subTop2_5_frame = Frame(self.experiment_frame,background=self.rightc)
self.experi_subTop2_5_frame.pack(
side=TOP,
ipadx=frame_ipadx,
ipady=frame_ipady,
padx=frame_padx,
pady=frame_pady
)
###################################
### ###
### Subframes on right side ###
### ###
###################################
# Make a buffer frame
self.experi_subTopBuffer_frame = Frame(self.experi_rightFrame,bg=self.midc)
self.experi_subTopBuffer_frame.pack(
side=TOP,
ipady=frame_ipady,
ipadx=frame_ipadx,
padx=frame_padx,
pady=frame_pady
)
# Make an "inspections and tests" label
self.experi_inspections_label = Label(self.experi_subTopBuffer_frame,
text="Inspections and Tests",fg=self.fontc)
self.experi_inspections_label.configure(bg=self.midc)
self.experi_inspections_label.pack()
# Make a subframe for the barcode box
self.experi_barcode_frame = Frame(self.experi_rightFrame, bg=self.midc)
self.experi_barcode_frame.pack(
side=TOP,
ipady=frame_ipady,
ipadx=frame_ipadx,
padx=frame_padx,
pady=frame_pady
)
# Make a label for the Barcode entry
self.experi_barcode_lbl = Label(self.experi_barcode_frame, text="Barcode: ")
self.experi_barcode_lbl.configure(
background=self.midc,
padx=button_padx,
pady=button_pady,
foreground=self.fontc
)
self.experi_barcode_lbl.pack(side=LEFT)
# Make an entry box for the barcode
# Make a entrybox for testing comments
self.experi_barcode_entry = Entry(
self.experi_barcode_frame,
textvariable=self.barcodeEntry
)
self.experi_barcode_entry.pack(side=RIGHT)
self.experi_barcode_entry.configure(bg=self.midc,fg=self.fontc,width=7)
self.experi_barcode_entry.bind("<FocusIn>",lockon)
self.experi_barcode_entry.bind("<FocusOut>",lockoff)
# Make another buffer frame
self.experi_subTopBuffer2_frame = Frame(self.experi_rightFrame,bg=self.midc)
self.experi_subTopBuffer2_frame.pack(
side=TOP,
ipady=frame_ipady,
ipadx=frame_ipadx,
padx=frame_padx,
pady=frame_pady
)
# Make top 3 subframe
self.experi_subTop3_frame = Frame(self.experi_rightFrame,background=self.midc)
self.experi_subTop3_frame.pack(
side=TOP,
ipadx=frame_ipadx,
ipady=frame_ipady,
padx=frame_padx,
)
# Make top 3 subframe for text
self.experi_subTop3_fText = Frame(self.experi_rightFrame,background=self.midc)
self.experi_subTop3_fText.pack(
side=TOP,
ipadx=frame_ipadx,
ipady=frame_ipady,
padx=frame_padx,
)
# Make top 4 subframe
self.experi_subTop4_frame = Frame(self.experi_rightFrame,background=self.midc)
self.experi_subTop4_frame.pack(
side=TOP,
ipadx=frame_ipadx,
padx=frame_padx,
)
# Make top 4 subframe for text
self.experi_subTop4_fText = Frame(self.experi_rightFrame,background=self.midc)
self.experi_subTop4_fText.pack(
side=TOP,
ipadx=frame_ipadx,
padx=frame_padx,
)
# Make top 5 subframe
self.experi_subTop5_frame = Frame(self.experi_rightFrame,background=self.midc)
self.experi_subTop5_frame.pack(
side=TOP,
ipadx=frame_ipadx,
padx=frame_padx,
)
# Make top 5 subframe for text
self.experi_subTop5_fText = Frame(self.experi_rightFrame,background=self.midc)
self.experi_subTop5_fText.pack(
side=TOP,
ipadx=frame_ipadx,
padx=frame_padx,
)
# Make top 6 subframe
self.experi_subTop6_frame = Frame(self.experi_rightFrame,background=self.midc)
self.experi_subTop6_frame.pack(
side=TOP,
ipadx=frame_ipadx,
padx=frame_padx,
)
# Make top 6 subframe for text
self.experi_subTop6_fText = Frame(self.experi_rightFrame,background=self.midc)
self.experi_subTop6_fText.pack(
side=TOP,
ipadx=frame_ipadx,
padx=frame_padx,
)
# Make top 7 subframe
self.experi_subTop7_frame = Frame(self.experi_rightFrame,background=self.midc)
self.experi_subTop7_frame.pack(
side=TOP,
ipadx=frame_ipadx,
ipady=frame_ipady,
pady=frame_pady,
padx=frame_padx,
)
# Create variables for each manual check (16 placeholders for now)
self.testPassList = [StringVar() for i in range(0,19)]
self.testPassState = ("Pass","Fail")
#################################
### ###
### Info for Card ###
### ###
#################################
# Make a label for the uniqueID entry
self.experi_uniqueID_lbl = Label(self.experi_subTop2_frame, text="Unique ID: ")
self.experi_uniqueID_lbl.configure(
background=self.rightc,
foreground=self.fontc,
padx=button_padx,
pady=button_pady,
)
self.experi_uniqueID_lbl.pack(side=LEFT)
# Make an entry box for the UniqueID
# Make a entrybox for testing comments
self.experi_uniqueID_entry = Entry(
self.experi_subTop2_frame,
textvariable=self.uniqueIDEntry,
state="readonly",
readonlybackground=self.rightc,
foreground=self.fontc
)
self.experi_uniqueID_entry.pack(side=RIGHT)
# Make a label for the temperature entry
self.experi_temperature_lbl = Label(self.experi_subTop2_0_frame, text="Temperature: ")
self.experi_temperature_lbl.configure(
background=self.rightc,
foreground=self.fontc,
padx=button_padx,
pady=button_pady,
)
self.experi_temperature_lbl.pack(side=LEFT)
# Make an entry box for the temperature
# Make a entrybox for testing comments
self.experi_temperature_entry = Entry(
self.experi_subTop2_0_frame,
textvariable=self.tempEntry,
state="readonly",
readonlybackground=self.rightc,
foreground=self.fontc
)
self.experi_temperature_entry.configure(bg=self.rightc,fg=self.fontc)
self.experi_temperature_entry.pack(side=RIGHT)
# Make a label for the main firmware ver entry
self.experi_firmwareVer_lbl = Label(self.experi_subTop2_1_frame, text="Bridge Ver (Major): ")
self.experi_firmwareVer_lbl.configure(
background=self.rightc,
foreground=self.fontc,
padx=button_padx,
pady=button_pady,
)
self.experi_firmwareVer_lbl.pack(side=LEFT)
# Make an entry box for the main firmware ver
# Make a entrybox for testing comments
self.experi_firmwareVer_entry = Entry(
self.experi_subTop2_1_frame,
textvariable=self.firmwareVerEntry,
state="readonly",
readonlybackground=self.rightc,
foreground=self.fontc
)
self.experi_firmwareVer_entry.pack(side=RIGHT)
# Make a label for the minor firmware ver entry
self.experi_firmwareVerMin_lbl = Label(self.experi_subTop2_2_frame, text="Bridge Ver (Minor): ")
self.experi_firmwareVerMin_lbl.configure(
background=self.rightc,
foreground=self.fontc,
padx=button_padx,
pady=button_pady,
)
self.experi_firmwareVerMin_lbl.pack(side=LEFT)
# Make an entry box for the minor firmware
# Make a entrybox for testing comments
self.experi_firmwareVerMin_entry = Entry(
self.experi_subTop2_2_frame,
textvariable=self.firmwareVerMinEntry,
state="readonly",
readonlybackground=self.rightc,
foreground=self.fontc
)
self.experi_firmwareVerMin_entry.pack(side=RIGHT)
# Make a label for the other firmware entry
self.experi_firmwareVerOther_lbl = Label(self.experi_subTop2_3_frame, text="Bridge Ver (Other): ")
self.experi_firmwareVerOther_lbl.configure(
background=self.rightc,
foreground=self.fontc,
padx=button_padx,
pady=button_pady,
)
self.experi_firmwareVerOther_lbl.pack(side=LEFT)
# Make an entry box for the other firmware
# Make a entrybox for testing comments
self.experi_firmwareVerOther_entry = Entry(
self.experi_subTop2_3_frame,
textvariable=self.firmwareVerOtherEntry,
state="readonly",
readonlybackground=self.rightc,
foreground=self.fontc
)
self.experi_firmwareVerOther_entry.pack(side=RIGHT)
# Make a label for the major top igloo firmware entry
self.experi_iglooMajVerT_lbl = Label(self.experi_subTop2_4_frame, text="Top Igloo Ver (Major): ")
self.experi_iglooMajVerT_lbl.configure(
background=self.rightc,
foreground=self.fontc,
padx=button_padx,
pady=button_pady,
)
self.experi_iglooMajVerT_lbl.pack(side=LEFT)
# Make an entry box for the major top firmware
self.experi_iglooMajVerT_entry = Entry(
self.experi_subTop2_4_frame,
textvariable=self.iglooMajVerEntryT,
state="readonly",
readonlybackground=self.rightc,
foreground=self.fontc,
width=4
)
self.experi_iglooMajVerT_entry.pack(side=LEFT)
# Make an entry box for the minor top# firmware
self.experi_iglooMinVerT_entry = Entry(
self.experi_subTop2_4_frame,
textvariable=self.iglooMinVerEntryT,
state="readonly",
readonlybackground=self.rightc,
foreground=self.fontc,
width=4
)
self.experi_iglooMinVerT_entry.pack(side=RIGHT)
# Make a label for the minor top igloo firmware entry
self.experi_iglooMinVerT_lbl = Label(self.experi_subTop2_4_frame, text="(Minor): ")
self.experi_iglooMinVerT_lbl.configure(
background=self.rightc,
foreground=self.fontc,
padx=button_padx,
pady=button_pady,
)
self.experi_iglooMinVerT_lbl.pack(side=RIGHT)
# Make a label for the major bottom igloo firmware entry
self.experi_iglooMajVerB_lbl = Label(self.experi_subTop2_4_5_frame, text="Bottom Igloo Ver (Major): ")
self.experi_iglooMajVerB_lbl.configure(
background=self.rightc,
foreground=self.fontc,
padx=button_padx,
pady=button_pady,
)
self.experi_iglooMajVerB_lbl.pack(side=LEFT)
# Make an entry box for the major bottom# firmware
self.experi_iglooMajVerB_entry = Entry(
self.experi_subTop2_4_5_frame,
textvariable=self.iglooMajVerEntryB,
state="readonly",
readonlybackground=self.rightc,
foreground=self.fontc,
width=4
)
self.experi_iglooMajVerB_entry.pack(side=LEFT)
# Make an entry box for the minor bottom firmware
self.experi_iglooMinVerB_entry = Entry(
self.experi_subTop2_4_5_frame,
textvariable=self.iglooMinVerEntryB,
state="readonly",
readonlybackground=self.rightc,
foreground=self.fontc,
width=4
)
self.experi_iglooMinVerB_entry.pack(side=RIGHT)
# Make a label for the minor bottom igloo firmware entry
self.experi_iglooMinVerB_lbl = Label(self.experi_subTop2_4_5_frame, text="(Minor): ")
self.experi_iglooMinVerB_lbl.configure(
background=self.rightc,
foreground=self.fontc,
padx=button_padx,
pady=button_pady,
)
self.experi_iglooMinVerB_lbl.pack(side=RIGHT)
# Make a label for the igloo toggle check
self.iglooToggle_label = Label(self.experi_subTop_2_4_6_frame, text="Igloo Toggle Test: ")
self.iglooToggle_label.configure(bg=self.rightc,fg=self.fontc,padx=button_padx,pady=button_pady)
self.iglooToggle_label.pack(side=LEFT)
# Make an entry box for the minor firmware
self.iglooToggle_entry = Entry(
self.experi_subTop_2_4_6_frame,
textvariable=self.iglooToggleEntry,
state="readonly",
readonlybackground=self.rightc,
foreground=self.fontc
)
self.iglooToggle_entry.pack(side=RIGHT)
# Make a button to read the unique ID & firmware LEFT SIDE
self.experi_uniqueID_left_get = Button(self.experi_subTop2_5_frame, text ="Get Unique ID & Firmware Ver. from Left", command=self.getUniqueIDPress_left)
self.experi_uniqueID_left_get.configure(bg=self.buttonsc[0],fg=self.fontc,activebackground=self.dimbuttonsc[0],activeforeground=self.fontc)
self.experi_uniqueID_left_get.pack(side=TOP)
# Make a button to read the unique ID & firmware RIGHT SIDE
self.experi_uniqueID_right_get = Button(self.experi_subTop2_5_frame, text ="Get Unique ID & Firmware Ver. from Right", command=self.getUniqueIDPress_right)
self.experi_uniqueID_right_get.configure(bg=self.buttonsc[1],fg=self.fontc,activebackground=self.dimbuttonsc[1],activeforeground=self.fontc)
self.experi_uniqueID_right_get.pack(side=TOP)
# Make a button to submit the unique ID & firmware
self.experi_uniqueID_give = Button(self.experi_subTop2_5_frame, text ="Upload Unique ID & Firmware Ver.", command=self.infoSubmitButtonPress)
self.experi_uniqueID_give.configure(bg=self.buttonsc[2],fg=self.fontc,activebackground=self.dimbuttonsc[2],activeforeground=self.fontc)
self.experi_uniqueID_give.pack(side=TOP)
# Make a line of hypens
self.experi_hyphenLine = Label(self.experi_subTop2_6_frame, text="----------------------------------")
self.experi_hyphenLine.configure(bg=self.rightc,fg=self.fontc,padx=button_padx,pady=button_pady)
self.experi_hyphenLine.pack()
# Make a label for the GPIO selection
self.gpioSelect_label = Label(self.experi_subTop2_7_frame, text="Select GPIO Option: ")
self.gpioSelect_label.configure(bg=self.rightc,fg=self.fontc,padx=button_padx,pady=button_pady)
self.gpioSelect_label.pack(side=LEFT)
# Make a option menu for GPIO selection
self.gpioSelect_box = OptionMenu(self.experi_subTop2_7_frame, self.gpioChoiceVar,
"J2 and J21","J3 and J20","J4 and J19","J5 and J18",
"J7 and J26","J8 and J25","J9 and J24","J10 and J23")
self.gpioSelect_box.configure(bg=self.rightc,fg=self.fontc,activebackground=self.dimc,activeforeground=self.fontc)
self.gpioSelect_box.pack(side=LEFT)
self.gpioSelect_box["menu"].config(bg=self.topc,fg=self.fontc,activebackground=self.dimc,activeforeground=self.fontc)
self.gpioChoiceVar.set("J2 and J21")
# Make a button to submit GPIO option
self.gpioSelect_bttn = Button(self.experi_subTop2_8_frame, command=self.gpioBttnPress,
text="Submit GPIO Choice")
self.gpioSelect_bttn.configure(bg=self.buttonsc[0],fg=self.fontc,activebackground=self.dimbuttonsc[0],activeforeground=self.fontc)
self.gpioSelect_bttn.pack()
################################
### ###
### Visual Tests ###
### ###
################################
self.testDescDict = {"BPL-GND" : "Bkpln to GND", "1.2-GND" : "1.2V to GND", "1.5-GND" : "1.5V to GND",
"2.5-GND" : "2.5V to GND", "3.3-GND" : "3.3V to GND", "5.0-GND" : "5.0V to GND",
"1.2-1.5" : "1.2V to 1.5V", "1.2-2.5" : "1.2V to 2.5V", "1.5-2.5" : "1.5V to 2.5V", "1.2-3.3" : "1.2V to 3.3V",
"1.5-3.3" : "1.5V to 3.3V", "2.5-3.3" : "2.5V to 3.3V", "1.2-5.0" : "1.2V to 5.0V", "1.5-5.0" : "1.5V to 5.0V",
"2.5-5.0" : "2.5V to 5.0V", "3.3-5.0" : "3.3V to 5.0V",
"SuplCur" : "Supply Current", "Vis" : "Visual Inspec.", "Program" : "Programming OK"}
# self.testPassList = [StringVar() for i in range(0,19)]
# self.testLabelList = ["Res_1","Res_2","Res_3","Res_4",
# "Res_5","Res_6","Res_7","Res_8",
# "Res_9","Res_10","Res_11", "Res_12",
# "Res_13", "Res_14", "Res_15", "SuplCur", "Vis", "Program",
# "Res_16"]
self.testPassInfo = []
for i in range(0,5):
if (listbuttons):
self.testPassInfo.append(OptionMenu(self.experi_subTop3_frame,self.testPassList[i],"Fail","Pass","N/A",command=self.infoValChange))
self.testPassInfo[i]["menu"].config(bg=self.topc,fg=self.fontc,activebackground=self.dimc,activeforeground=self.fontc)
self.testPassList[i].set("N/A")
else:
self.testPassInfo.append(Button(self.experi_subTop3_frame,text="N/A",command=partial(self.togglepstate,i)))
self.testPassInfo[i].configure(width=11,bg=self.buttonsc[3],fg=self.fontc,activebackground=self.dimbuttonsc[3],activeforeground=self.fontc)
self.testPassInfo[i].pack(side=LEFT)
self.testPassLabel=Label(self.experi_subTop3_fText, text=self.testDescDict[self.testLabelList[i]]+"\n",bg=self.midc,fg=self.fontc)
self.testPassLabel.configure(width=15)
self.testPassLabel.pack(side=LEFT)
for i in range(5,10):
if (listbuttons):
self.testPassInfo.append(OptionMenu(self.experi_subTop4_frame,self.testPassList[i],"Fail","Pass","N/A",command=self.infoValChange))
self.testPassInfo[i]["menu"].config(bg=self.topc,fg=self.fontc,activebackground=self.dimc,activeforeground=self.fontc)
self.testPassList[i].set("N/A")
else:
self.testPassInfo.append(Button(self.experi_subTop4_frame,text="N/A",command=partial(self.togglepstate,i)))
self.testPassInfo[i].configure(width=11, bg=self.buttonsc[3],fg=self.fontc,activebackground=self.dimbuttonsc[3],activeforeground=self.fontc)
self.testPassInfo[i].pack(side=LEFT)
self.testPassLabel=Label(self.experi_subTop4_fText, text=self.testDescDict[self.testLabelList[i]]+"\n", bg=self.midc,fg=self.fontc)
self.testPassLabel.configure(width=15)
self.testPassLabel.pack(side=LEFT)
for i in range(10,15):
if (listbuttons):
self.testPassInfo.append(OptionMenu(self.experi_subTop5_frame,self.testPassList[i],"Fail","Pass","N/A",command=self.infoValChange))
self.testPassInfo[i]["menu"].config(bg=self.topc,fg=self.fontc,activebackground=self.dimc,activeforeground=self.fontc)
self.testPassList[i].set("N/A")
else:
self.testPassInfo.append(Button(self.experi_subTop5_frame,text="N/A",command=partial(self.togglepstate,i)))
self.testPassInfo[i].configure(width=11,bg=self.buttonsc[3],fg=self.fontc,activebackground=self.dimbuttonsc[3],activeforeground=self.fontc)
self.testPassInfo[i].pack(side=LEFT)
self.testPassLabel=Label(self.experi_subTop5_fText, text=self.testDescDict[self.testLabelList[i]]+"\n", bg=self.midc,fg=self.fontc)
self.testPassLabel.configure(width=15)
self.testPassLabel.pack(side=LEFT)
for i in range(15,19):
if (listbuttons):
self.testPassInfo.append(OptionMenu(self.experi_subTop6_frame,self.testPassList[i],"Fail","Pass","N/A",command=self.infoValChange))
self.testPassInfo[i]["menu"].config(bg=self.topc,fg=self.fontc,activebackground=self.dimc,activeforeground=self.fontc)
self.testPassList[i].set("N/A")
else:
self.testPassInfo.append(Button(self.experi_subTop6_frame,text="N/A",command=partial(self.togglepstate,i)))
self.testPassInfo[i].configure(width=15,bg=self.buttonsc[3],fg=self.fontc,activebackground=self.dimbuttonsc[3],activeforeground=self.fontc)
self.testPassInfo[i].pack(side=LEFT)
self.testPassLabel=Label(self.experi_subTop6_fText, text=self.testDescDict[self.testLabelList[i]]+"\n", bg=self.midc,fg=self.fontc)
self.testPassLabel.configure(width=20)
self.testPassLabel.pack(side=LEFT)
# Make a checkbox to overwrite/not overwrite pre-existing data
self.overwriteBox = Checkbutton(self.experi_subTop7_frame, text="Overwrite existing QIE Card data (if applicable)?", variable=self.overwriteVar)
self.overwriteBox.configure(bg=self.buttonsc[1],fg=self.fontc,activebackground=self.dimbuttonsc[1],activeforeground=self.fontc,selectcolor=self.checkc)
self.overwriteBox.pack(side=TOP,
padx = button_padx,
pady = button_pady,
ipady = button_pady*2,
ipadx = button_padx*2)
# Make a button to submit tests and information
self.passAllTestsBttn = Button(self.experi_subTop7_frame, text="Pass All Tests", command=self.throwPassAllBox)
self.passAllTestsBttn.configure(bg=self.buttonsc[4], fg=self.fontc, width=40, activebackground=self.dimbuttonsc[4], activeforeground=self.fontc)
self.passAllTestsBttn.pack(side=TOP)
# Make a button to submit tests and information
self.initSubmitBttn = Button(self.experi_subTop7_frame, text="Submit Inspections & Tests", command=self.initSubmitBttnPress)
self.initSubmitBttn.configure(bg=self.buttonsc[5], fg=self.fontc, width=40, activebackground=self.dimbuttonsc[5], activeforeground=self.fontc)
self.initSubmitBttn.pack(side=TOP)
# Make a button to clear all results
self.clearDataBttn = Button(self.experi_subTop7_frame, text="Clear Inspections, Tests, & Info", command=self.clearDataBttnPress)
self.clearDataBttn.configure(bg=self.buttonsc[6], fg=self.fontc, width=40, activebackground=self.dimbuttonsc[6], activeforeground=self.fontc)
self.clearDataBttn.pack(side=TOP)
#################################
### ###
### BEGIN MEMBER FUNCTIONS ###
### ###
#################################
# This function is needed to make the json dumps print properly
def jdefault(self,o):
return o.__dict__
##########################################################################################
# Controls the three-state button behavior (when enabled) for Pass/Fail buttons
def togglepstate(self,i,event=None):
if ((event is not None) and lockout):
return
for o in range(1):#len(self.testPassInfo)):
if(self.testPassList[i].get() == "Pass"):
self.testPassInfo[i].configure(text="Fail",bg=self.buttonsc[2],fg=self.fontc,activebackground=self.dimbuttonsc[2],activeforeground=self.fontc)
self.testPassList[i].set("Fail")
elif(self.testPassList[i].get() == "Fail"):
self.testPassList[i].set("N/A")
self.testPassInfo[i].configure(text="N/A",bg=self.buttonsc[3],fg=self.fontc,activebackground=self.dimbuttonsc[3],activeforeground=self.fontc)
else:
self.testPassList[i].set("Pass")
self.testPassInfo[i].configure(text="Pass",bg=self.buttonsc[8],fg=self.fontc,activebackground=self.dimbuttonsc[8],activeforeground=self.fontc)
#########################################################################################
# Dumps the results of the tests & inspections to a json file
def initSubmitBttnPress(self):
if (self.nameChoiceVar.get() == "Choose Name"):
self.throwErrorBox()
return None
self.initialTest.User = self.nameChoiceVar.get()
self.initialTest.TestComment = self.infoCommentVar.get()
self.initialTest.Barcode = self.barcodeEntry.get()
self.initialTest.DateRun = str(datetime.now())
if self.overwriteVar.get() == 1: self.initialTest.Overwrite = True
if self.overwriteVar.get() == 0: self.initialTest.Overwrite = False
for i in range(len(self.testPassList)):
if self.testPassList[i].get() == "Pass":
self.initialTest.testResults[self.testLabelList[i]] = True
elif self.testPassList[i].get() == "Fail":
self.initialTest.testResults[self.testLabelList[i]] = False
else:
self.initialTest.testResults[self.testLabelList[i]] = "na"
self.initSubmitBttn.configure(state=DISABLED)
fileString = self.barcodeEntry.get()+"_step1_raw.json"
with open(self.databasePath+'/uploader/temp_json/'+fileString,'w') as jsonFile:
# with open(fileString,'w') as jsonFile: # Uncomment this line for debugging
json.dump(self.initialTest, jsonFile, default = self.jdefault)
subprocess.call(self.databasePath+"/uploader/step12.sh", shell=True)
print "Preliminary step recorded. Thank you!"
##########################################################################################
def throwErrorBox(self):
self.top = Toplevel()
self.top.title("Name Choice Error")
self.top.config(height=50, width=360)
self.top.pack_propagate(False)
self.msg = Label(self.top, text="Please select a name before continuing.",fg=self.fontc)
self.msg.pack()
self.button = Button(self.top, text="Sorry...", command=self.top.destroy)
self.button.configure(bg=self.buttonsc[7],fg=self.fontc,activebackground=self.dimbuttonsc[7],activeforeground=self.fontc)
self.button.pack()
##########################################################################################
def throwPassAllBox(self):
self.passBox = Toplevel()
self.passBox.title("Are you sure?")
self.passBox.config(height=85, width=360)
self.passBox.pack_propagate(False)
self.passMsg = Label(self.passBox, text="Are you sure you want to pass all tests?")