-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstructor_assistant_app.py
2299 lines (2008 loc) · 121 KB
/
instructor_assistant_app.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
"""PADI Scuba Diving Instructors are required to complete the 'Record_and_Referral_Form' for every student
after the PADI Open Water Course. This 'Instructor Assistant' aims to make that process fast and easy.
Author: Brendan Andresen <[email protected]>
Created: May 6th, 2023
"""
__version__ = "1.0.0"
import datetime
import os
import tkinter
import json
import hashlib
import secrets
import customtkinter
import pandas
import configparser
import webbrowser
from tkcalendar import DateEntry
from fillpdf import fillpdfs
from tkinter import Toplevel, Menu, messagebox, filedialog
from dataclasses import dataclass
# Datetime
today = datetime.datetime.today()
# Constants
path = os.getcwd()
UI_SETUP_LABELS = f"{path}\\config\\ui_setup_labels.json"
with open(UI_SETUP_LABELS, "r") as file:
data = json.load(file)
CONFINED_WATER_LABELS = data["cw_water_list"]
KNOWLEDGE_DEVELOPMENT_LABELS = data["kd_string_list"]
OPEN_WATER_LABELS = data["ow_string_list"]
STUDENT_AND_REFERRAL_FORM = f"{path}\\assets\\Record_and_Referral_Form.pdf"
STANDARD_FONT = ("roboto", "10")
TITLE_HEADER_FONT = ("roboto", "14")
INSTRUCTOR_DATA = f"{path}\\config\\instructor_data.json"
DIVE_TEMPLATE_DATA = f"{path}\\config\\dive_template_data.json"
# Student Information Global Dictionary
student_dict_global = {}
@dataclass
class Student:
first_name: str
last_name: str
date_of_birth: str
sex: str
phone: str
email: str
street_address: str
city: str
province: str
postal: str
country: str
class StudentGroup:
def __init__(self):
self.student_list = []
# --------------------------- THEME --------------------------------- #
class Theme:
def __init__(self, style: str, style_dict: dict):
self.set_text_color = style_dict[style]["set_text_color"]
self.reset_main_text_color = style_dict[style]["reset_main_text_color"]
self.listbox_color = style_dict[style]["listbox_color"]
self.text_color = style_dict[style]["text_color"]
self.background_color = style_dict[style]["background_color"]
self.frame_color = style_dict[style]["frame_color"]
self.main_button_color = style_dict[style]["main_button_color"]
self.main_button_color_hover = style_dict[style]["main_button_color_hover"]
self.main_button_text_color = style_dict[style]["main_button_text_color"]
self.switch_on_color = style_dict[style]["switch_on_color"]
self.switch_off_color = style_dict[style]["switch_off_color"]
self.switch_button_color = style_dict[style]["switch_button_color"]
self.switch_hover_color = style_dict[style]["switch_hover_color"]
self.master_switch_on_color = style_dict[style]["master_switch_on_color"]
self.master_switch_off_color = style_dict[style]["master_switch_off_color"]
self.master_switch_button_color = style_dict[style]["master_switch_button_color"]
self.master_switch_hover_color = style_dict[style]["master_switch_hover_color"]
def or_elearning_select():
"""Toggle Checkboxes for Knowledge Development"""
if main_ui.kd_switch_list[0].get() == 1:
[switches.deselect() for switches in main_ui.kd_switch_list if main_ui.kd_switch_list.index(switches) < 5]
[kr_check.deselect() for kr_check in main_ui.kr_checkbox_list if main_ui.kr_checkbox_list.index(kr_check) < 5]
[vid_check.deselect() for vid_check in main_ui.kd_video_checkbox_list if
main_ui.kd_video_checkbox_list.index(vid_check) < 5]
main_ui.kd_switch_list[5].select()
main_ui.kd_video_checkbox_list[5].select()
main_ui.kr_checkbox_list[5].select()
main_ui.select_elearning_button.configure(text="Manual & Classroom")
else:
[switches.select() for switches in main_ui.kd_switch_list if main_ui.kd_switch_list.index(switches) < 5]
[kr_check.select() for kr_check in main_ui.kr_checkbox_list if main_ui.kr_checkbox_list.index(kr_check) < 5]
[vid_check.select() for vid_check in main_ui.kd_video_checkbox_list if
main_ui.kd_video_checkbox_list.index(vid_check) < 5]
main_ui.kd_switch_list[5].deselect()
main_ui.kd_video_checkbox_list[5].deselect()
main_ui.kr_checkbox_list[5].deselect()
main_ui.select_elearning_button.configure(text="Elearning")
def new_template(ui):
"""New UI Window for user to make a new custom Dive Template. Often Instructors complete skills in a
consistent sequence. Applying a dive template allows instructors to autofill sections based on information
from other sections"""
new_template_window = Toplevel(ui)
new_template_window.config(pady=50, padx=50)
new_template_window.geometry("1400x975+200+0")
new_template_window.iconbitmap("assets/logo.ico")
new_template_window.grid_columnconfigure(0, weight=1)
new_template_window.grid_columnconfigure(1, weight=1)
new_template_window.grid_rowconfigure(0, weight=1)
new_template_window.grid_rowconfigure(1, weight=1)
# --- Title Template
template_title_frame = customtkinter.CTkFrame(new_template_window, fg_color=theme.frame_color)
template_title_frame.grid(row=0, column=0, padx=10, pady=10, stick="nsew")
template_name_entry = customtkinter.CTkEntry(template_title_frame, width=200, height=30,
text_color=theme.text_color,
fg_color=theme.listbox_color,
border_color=theme.main_button_color)
template_name_entry.grid(column=1, row=0, pady=20, sticky="w")
template_name_label = tkinter.Label(template_title_frame, text="Template Name:", font=TITLE_HEADER_FONT,
background=theme.frame_color)
template_name_label.grid(column=0, row=0, pady=20, padx=(20, 10))
# ----------------------- CONFINED WATER FRAME TEMPLATE WINDOW -------------------- #
template_confined_frame = customtkinter.CTkFrame(new_template_window, fg_color=theme.frame_color)
template_confined_frame.grid(row=1, column=0, ipadx=10, ipady=10, padx=10, pady=10, sticky="nsew")
confined_water_string_template_list = [
"Confined Water 1 (Code: 0)",
"Confined Water 2 (Code: 1)",
"Confined Water 3 (Code: 2)",
"Confined Water 4 (Code: 3)",
"Confined Water 5 (Code: 4)",
"200M Swim (Code: 5)",
"10min Float (Code: 6)",
"Equipment Prep (Code: 7)",
"Disconnect LP Hose (Code: 8)",
"Loose Cylinder Band (Code: 9)",
"Weight System Remove & Replace (Code: 10)",
"Emergency Weight Drop (Code: 11)",
"Skin Diver (Code: 12)",
"Drysuit Orientation (Code: 13)",
"All Confined Water Skills (Code: 14)",
]
for i in range(15):
string = tkinter.Label(template_confined_frame, text=confined_water_string_template_list[i],
font=STANDARD_FONT, background=theme.frame_color)
string.grid(row=i + 1, column=0, sticky="e", padx=(20, 5))
confined_water_string_template_list.append(string)
confined_water_section_set_rule = tkinter.Label(template_confined_frame, text="Confined Water",
font=TITLE_HEADER_FONT,
background=theme.frame_color)
confined_water_section_set_rule.grid(row=0, column=0, sticky="w", padx=(20, 0), pady=(10, 0))
def switch_press(switch_index):
"""changes entry placeholder text"""
if cw_switch_list[switch_index].get() == 0:
cw_entry_list[switch_index].configure(placeholder_text="--")
else:
cw_entry_list[switch_index].configure(placeholder_text=switch_index)
def reset():
if cw_switch_list[0].get() == 1:
for cw in range(15):
cw_entry_list[cw].configure(placeholder_text="--")
cw_switch_list[cw].deselect()
else:
for cw in range(15):
cw_entry_list[cw].configure(placeholder_text=cw)
cw_switch_list[cw].select()
cw_reset_switch = customtkinter.CTkSwitch(template_confined_frame, text="", command=reset,
fg_color=theme.master_switch_off_color,
progress_color=theme.master_switch_on_color,
button_color=theme.master_switch_button_color,
button_hover_color=theme.master_switch_hover_color,
width=65)
cw_reset_switch.select()
cw_reset_switch.grid(row=0, column=2, pady=(20, 5), padx=(0))
# create row of switches
cw_switch_list = []
for i in range(15):
switch = customtkinter.CTkSwitch(template_confined_frame, text="",
command=lambda p=i: switch_press(p),
fg_color=theme.switch_off_color,
progress_color=theme.switch_on_color,
button_color=theme.switch_button_color,
button_hover_color=theme.switch_hover_color,
width=65
)
switch.grid(row=i + 1, column=2, padx=10)
switch.select()
cw_switch_list.append(switch)
# create row of entries
cw_entry_list = []
for n in range(15):
cw_entry = customtkinter.CTkEntry(template_confined_frame, width=40,
placeholder_text_color=theme.text_color, placeholder_text=n, height=25,
text_color=theme.text_color,
fg_color=theme.listbox_color,
border_color=theme.main_button_color,
)
cw_entry.grid(row=n + 1, column=1, pady=2)
cw_entry_list.append(cw_entry)
# --------------------------- KNOWLEDGE DEVELOPMENT TEMPLATE WINDOW ----------------- #
template_knowledge_frame = customtkinter.CTkFrame(new_template_window, fg_color=theme.frame_color)
template_knowledge_frame.grid(row=0, column=1, ipadx=10, ipady=10, padx=10, pady=10, sticky="nsew")
knowledge_development_title = tkinter.Label(template_knowledge_frame, text="Knowledge Development",
font=TITLE_HEADER_FONT, background=theme.frame_color)
knowledge_development_title.grid(row=0, column=0, padx=20, pady=(20, 0))
pass_exam_set_rule = tkinter.Label(template_knowledge_frame, text="Quiz/Exam", font=STANDARD_FONT,
background=theme.frame_color)
pass_exam_set_rule.grid(row=0, column=3, columnspan=1, pady=(20, 0), padx=(0, 20))
knowledge_string_template_list = [
"Section 1 (Code: 15)",
"Section 2 (Code: 16)",
"Section 3 (Code: 17)",
"Section 4 (Code: 18)",
"Section 5 (Code: 19)",
"OR Elearning (Code: 20)",
"All Knowledge Development (Code: 21)",
]
kd_switch_list = []
def switch_press_kd(switch_index):
"""changes entry placeholder text"""
if kd_switch_list[switch_index].get() == 0:
kd_entry_list[switch_index].configure(placeholder_text="--")
else:
kd_entry_list[switch_index].configure(placeholder_text=switch_index + 15)
def reset_kd():
if kd_switch_list[0].get() == 1:
for kd in range(7):
kd_entry_list[kd].configure(placeholder_text="--")
kd_switch_list[kd].deselect()
else:
for kd in range(7):
kd_entry_list[kd].configure(placeholder_text=kd + 15)
kd_switch_list[kd].select()
kd_reset_switch = customtkinter.CTkSwitch(template_knowledge_frame, text="", command=reset_kd,
fg_color=theme.master_switch_off_color,
progress_color=theme.master_switch_on_color,
button_color=theme.master_switch_button_color,
button_hover_color=theme.master_switch_hover_color,
width=65)
kd_reset_switch.select()
kd_reset_switch.grid(row=0, column=2, pady=(15, 0), padx=(7, 0))
for n in range(7):
kd_string = tkinter.Label(template_knowledge_frame, text=knowledge_string_template_list[n],
font=STANDARD_FONT, background=theme.frame_color)
kd_string.grid(row=n + 1, column=0, padx=(33, 5), sticky="e")
for i in range(7):
switch = customtkinter.CTkSwitch(template_knowledge_frame, text="",
command=lambda p=i: switch_press_kd(p),
fg_color=theme.switch_off_color,
progress_color=theme.switch_on_color,
button_color=theme.switch_button_color,
button_hover_color=theme.switch_hover_color,
width=65
)
switch.grid(row=i + 1, column=2, padx=(10, 0))
switch.select()
kd_switch_list.append(switch)
# create row of entries
kd_entry_list = []
for n in range(7):
kd_entry = customtkinter.CTkEntry(template_knowledge_frame, placeholder_text=(n + 15),
width=40,
placeholder_text_color=theme.text_color,
height=25,
text_color=theme.text_color,
fg_color=theme.listbox_color,
border_color=theme.main_button_color)
kd_entry.grid(row=n + 1, column=1, pady=2)
kd_entry_list.append(kd_entry)
kd_exam_entry_list = []
for n in range(6):
kd_entry_exam = customtkinter.CTkEntry(template_knowledge_frame, placeholder_text=(""), width=60, height=25,
text_color=theme.text_color,
fg_color=theme.listbox_color,
border_color=theme.main_button_color)
kd_entry_exam.grid(row=n + 1, column=3, columnspan=1, padx=(0, 20))
kd_exam_entry_list.append(kd_entry_exam)
# ----------------------------- OPEN WATER -------------------------- #
template_open_water = customtkinter.CTkFrame(new_template_window, fg_color=theme.frame_color)
template_open_water.grid(row=1, column=1, ipadx=10, ipady=10, padx=10, pady=10, sticky="nsew")
# --- Open Water Dives Labels - Set Rule Window
ow_dives_label_set_rule = tkinter.Label(template_open_water, text="Open Water Dives", font=TITLE_HEADER_FONT,
background=theme.frame_color)
ow_dives_label_set_rule.grid(row=0, column=0, pady=(10, 0), padx=(0, 10))
ow_string_list_template = [
"Open Water 1 (Code: 22)",
"Open Water 2 (Code: 23)",
"Open Water 3 (Code: 24)",
"Open Water 4 (Code: 25)",
"Cramp Removal",
"Snorkel/Regulator Exchange",
"Inflatable Signal Tube",
"Emergency Weight Drop",
"Surface Swim with Compass",
"Tired Diver Tow",
"Remove/Replace Scuba",
"Remove/Replace Weight",
"CESA",
"UW Compass Navigation",
"All Open Water Dive Flex Skills (Code: 26)",
"All Certification Requirements (Code: 27)",
]
def switch_press_ow(switch_index):
"""changes entry placeholder text"""
if ow_switch_list[switch_index].get() == 0:
ow_entry_list[switch_index].configure(placeholder_text="--")
else:
if 3 < switch_index < 14:
ow_entry_list[switch_index].configure(placeholder_text="")
elif switch_index >= 14:
ow_entry_list[switch_index].configure(placeholder_text=switch_index + 12)
else:
ow_entry_list[switch_index].configure(placeholder_text=switch_index + 22)
def reset_ow():
if ow_switch_list[0].get() == 1:
for ow in range(16):
ow_entry_list[ow].configure(placeholder_text="--")
ow_switch_list[ow].deselect()
else:
switch_index_ow = 22
for ow in range(16):
if 3 < ow < 14:
ow_switch_list[ow].select()
ow_entry_list[ow].configure(placeholder_text="")
else:
try:
ow_entry_list[ow].configure(placeholder_text=switch_index_ow)
ow_switch_list[ow].select()
switch_index_ow += 1
except AttributeError:
pass
ow_reset_switch = customtkinter.CTkSwitch(template_open_water, text="", command=reset_ow,
fg_color=theme.master_switch_off_color,
progress_color=theme.master_switch_on_color,
button_color=theme.master_switch_button_color,
button_hover_color=theme.master_switch_hover_color,
width=65)
ow_reset_switch.select()
ow_reset_switch.grid(row=0, column=2, )
for n in range(16):
ow_string = tkinter.Label(template_open_water, text=ow_string_list_template[n],
font=STANDARD_FONT, background=theme.frame_color)
ow_string.grid(row=n + 1, column=0, padx=(20, 5), sticky="e")
ow_switch_list = []
for i in range(16):
switch = customtkinter.CTkSwitch(template_open_water, text="",
command=lambda p=i: switch_press_ow(p),
fg_color=theme.switch_off_color,
progress_color=theme.switch_on_color,
button_color=theme.switch_button_color,
button_hover_color=theme.switch_hover_color,
width=65
)
switch.grid(row=i + 1, column=2, padx=10)
switch.select()
ow_switch_list.append(switch)
# create row of entries
ow_entry_list = []
index_ow = 22
for n in range(16):
if 3 < n < 14:
ow_entry = customtkinter.CTkEntry(template_open_water, placeholder_text="", width=40,
placeholder_text_color=theme.text_color,
height=25,
text_color=theme.text_color,
fg_color=theme.listbox_color,
border_color=theme.main_button_color)
ow_entry.grid(row=n + 1, column=1, pady=2)
else:
ow_entry = customtkinter.CTkEntry(template_open_water, placeholder_text=(index_ow), width=40,
placeholder_text_color=theme.text_color,
height=25,
text_color=theme.text_color,
fg_color=theme.listbox_color,
border_color=theme.main_button_color)
ow_entry.grid(row=n + 1, column=1, pady=2)
index_ow += 1
ow_entry_list.append(ow_entry)
# --- Set Course Options Labels and Entries
def elearning():
if kd_switch_list[0].get() == 1:
for n in range(5):
kd_entry_list[n].configure(placeholder_text="--")
kd_switch_list[n].deselect()
kd_switch_list[5].select()
elearning_manual_button.configure(text="Manual & Classroom")
kd_entry_list[5].configure(placeholder_text=20)
else:
for n in range(5):
kd_entry_list[n].configure(placeholder_text=n + 15)
kd_switch_list[n].select()
kd_switch_list[5].deselect()
kd_entry_list[5].configure(placeholder_text="--")
elearning_manual_button.configure(text="Elearning")
course_option_frame = customtkinter.CTkFrame(new_template_window, fg_color=theme.frame_color)
course_option_frame.grid(row=0, column=2, padx=10, pady=10, sticky="nsew")
course_option_label_set_rule = tkinter.Label(course_option_frame, text="Course Option:", font=TITLE_HEADER_FONT,
background=theme.frame_color)
course_option_label_set_rule.grid(row=0, column=0, padx=20, pady=20, sticky="nsew")
rdp_table_switch_set_rule = customtkinter.CTkSwitch(course_option_frame, text="RDP Table",
fg_color=theme.switch_off_color,
progress_color=theme.switch_on_color,
button_color=theme.switch_button_color,
button_hover_color=theme.switch_hover_color,
text_color=theme.text_color,
width=65
)
rdp_table_switch_set_rule.grid(row=2, column=0, pady=4, padx=(2, 0))
erdpml_switch_set_rule = customtkinter.CTkSwitch(course_option_frame, text="eRDPml",
fg_color=theme.switch_off_color,
progress_color=theme.switch_on_color,
button_color=theme.switch_button_color,
button_hover_color=theme.switch_hover_color,
text_color=theme.text_color,
width=65
)
erdpml_switch_set_rule.grid(row=4, column=0, pady=4, padx=(0, 10))
computer_switch_set_rule = customtkinter.CTkSwitch(course_option_frame, text="Computer",
fg_color=theme.switch_off_color,
progress_color=theme.switch_on_color,
button_color=theme.switch_button_color,
button_hover_color=theme.switch_hover_color,
text_color=theme.text_color,
width=65
)
computer_switch_set_rule.grid(row=5, column=0, pady=4)
elearning_manual_button = customtkinter.CTkButton(course_option_frame, text="Elearning",
fg_color=theme.main_button_color,
text_color=theme.main_button_text_color,
hover_color=theme.main_button_color_hover,
command=elearning
)
elearning_manual_button.grid(row=6, column=0, pady=20)
# --------------------------- RIGHT BUTTON FRAME TEMPLATE WINDOW
template_right_frame = customtkinter.CTkFrame(new_template_window, fg_color=theme.frame_color)
template_right_frame.grid(row=1, column=2, sticky="nsew", padx=10, pady=10)
def delete_template(nuked_rule):
with open(DIVE_TEMPLATE_DATA, "r") as data:
temp = json.load(data)
del temp[nuked_rule]
with open(DIVE_TEMPLATE_DATA, "w") as data:
json.dump(temp, data, indent=4)
date_rule_box_set_rule.configure(values=temp)
date_rule_box_set_rule.set("")
main_ui.date_rule_box.set("")
main_ui.date_rule_box.configure(values=temp)
delete_label = tkinter.Label(template_right_frame, text="Delete Template", font=STANDARD_FONT,
background=theme.frame_color)
delete_label.grid(row=0, column=0, pady=(20, 5))
try:
with open(DIVE_TEMPLATE_DATA, "r") as data:
templates = json.load(data)
except FileNotFoundError:
templates = {}
delete_values = []
for temps in templates.keys():
delete_values.append(temps)
date_rule_box_set_rule = customtkinter.CTkOptionMenu(template_right_frame, values=delete_values,
fg_color=theme.background_color,
text_color=theme.text_color,
button_color=theme.main_button_color,
button_hover_color=theme.main_button_color_hover,
dropdown_fg_color=theme.background_color,
dropdown_text_color=theme.text_color,
dropdown_hover_color=theme.frame_color
)
date_rule_box_set_rule.grid(row=1, column=0, padx=(15, 0), pady=(0, 20))
delete_rule_button = customtkinter.CTkButton(template_right_frame, text="Delete Template:",
fg_color=theme.main_button_color,
text_color=theme.main_button_text_color,
hover_color=theme.main_button_color_hover,
command=lambda: delete_template(date_rule_box_set_rule.get())
)
delete_rule_button.grid(column=0, row=2, pady=10, padx=(15, 0))
def save_template():
template_name = template_name_entry.get()
ow_cal_entries = ow_entry_list[:4] + ow_entry_list[14:16]
all_cal_entries = cw_entry_list + kd_entry_list + ow_cal_entries
all_switches = cw_switch_list + kd_switch_list + ow_switch_list
new_data = {
template_name_entry.get(): {
"calendar_entries": [],
"switches": [],
"knowledge_quiz": [],
"dive_flex": [],
"course_option": [],
}
}
cal_index = 0
for cal in all_cal_entries:
if cal.get() == "":
# .get() returns an empty string if placeholder is left
new_data[template_name]["calendar_entries"].append(cal.cget("placeholder_text"))
cal_index += 1
elif cal.get() == "--":
new_data[template_name]["calendar_entries"].append(cal_index)
cal_index += 1
else:
calendar_code = int(cal.get())
new_data[template_name]["calendar_entries"].append(calendar_code)
cal_index += 1
for switch in all_switches:
new_data[template_name]["switches"].append(switch.get())
for quiz in kd_exam_entry_list:
new_data[template_name]["knowledge_quiz"].append(quiz.get())
for dive_flex in ow_entry_list[4:14]:
if dive_flex.get() == "":
# .get() returns an empty string if placeholder is left
new_data[template_name]["dive_flex"].append(dive_flex.cget("placeholder_text"))
elif dive_flex.get() == "--":
pass
else:
calendar_flex_code = (dive_flex.get())
new_data[template_name]["dive_flex"].append(calendar_flex_code)
new_data[template_name]["course_option"].append(rdp_table_switch_set_rule.get())
new_data[template_name]["course_option"].append(erdpml_switch_set_rule.get())
new_data[template_name]["course_option"].append(computer_switch_set_rule.get())
try:
with open(DIVE_TEMPLATE_DATA, "r") as data_file:
data = json.load(data_file)
except FileNotFoundError:
with open(DIVE_TEMPLATE_DATA, "w") as data_file:
json.dump(new_data, data_file, indent=4)
else:
data.update(new_data)
new_key_list = []
for templates in data.keys():
new_key_list.append(templates)
main_ui.date_rule_box.configure(values=new_key_list)
with open(DIVE_TEMPLATE_DATA, "w") as data_file:
json.dump(data, data_file, indent=4)
new_template_window.destroy()
set_rule_button = customtkinter.CTkButton(template_right_frame, text="Save Template",
fg_color=theme.main_button_color, text_color=theme.main_button_text_color,
hover_color=theme.main_button_color_hover,
command=save_template)
set_rule_button.grid(column=0, row=3, padx=(15, 0), pady=(350, 0))
def execute_template():
"""Function to set Dates and Dives in main Window to users specs.'"""
with open(DIVE_TEMPLATE_DATA, "r") as datafile: # --- Open Dictionary with Users Date/Dive Specs
date_dict = json.load(datafile)
template_name = main_ui.date_rule_box.get()
all_cal_entries_list = main_ui.cw_cal_list + main_ui.kd_cal_list + main_ui.ow_cal_list
all_switch_list = main_ui.cw_switch_list + main_ui.kd_switch_list + main_ui.ow_switch_list
index_cal = 0
for i in date_dict[template_name]["calendar_entries"]:
if i == "--":
pass
index_cal += 1
else:
# i = int(i)
all_cal_entries_list[index_cal].set_date(all_cal_entries_list[i].get_date())
index_cal += 1
index_switch = 0
for i in date_dict[template_name]["switches"]: # CW
if i == 0:
all_switch_list[index_switch].deselect()
index_switch += 1
kr_index = 0
for switches in main_ui.kd_switch_list:
if switches.get() == 0:
main_ui.kr_checkbox_list[kr_index].deselect()
main_ui.kd_video_checkbox_list[kr_index].deselect()
kr_index += 1
index_kw = 0
for i in date_dict[template_name]["knowledge_quiz"]:
main_ui.kd_exam_entry_list[index_kw].configure(placeholder_text=i)
index_kw += 1
index_dive_flex = 0
for i in date_dict[template_name]["dive_flex"]:
if i == "--":
index_dive_flex += 1
else:
main_ui.ow_flex_dive_list[index_dive_flex].configure(placeholder_text=i)
index_dive_flex += 1
if date_dict[template_name]["course_option"][0] == 1:
main_ui.rdp_check.select()
if date_dict[template_name]["course_option"][1] == 1:
main_ui.erdpml_check.select()
if date_dict[template_name]["course_option"][2] == 1:
main_ui.computer_check.select()
def set_instructor(ui):
"""Password Verification UI window for users to input their Instructor Password."""
with open(INSTRUCTOR_DATA, "r") as data_file:
instructor_list = json.load(data_file)
set_inst = main_ui.list_box.get()
inst = main_ui.list_box.get()
pass_window = Toplevel(ui)
pass_window.geometry("500x250")
pass_window.title("Instructor Password")
pass_window.iconbitmap("assets/logo.ico")
pass_window.config(pady=50, padx=50, background=theme.background_color)
pass_window.grid_columnconfigure(0, weight=1)
pass_frame = customtkinter.CTkFrame(pass_window, fg_color=theme.frame_color)
pass_frame.grid(row=1, column=0, sticky="nsew")
pass_frame.grid_columnconfigure(0, weight=1)
pass_label = tkinter.Label(pass_window, text="Verify Instructor Password", font=TITLE_HEADER_FONT,
background=theme.background_color)
pass_label.grid(column=0, row=0, sticky="w")
pass_entry = customtkinter.CTkEntry(pass_frame, show="*",
text_color=theme.text_color,
fg_color=theme.listbox_color,
border_color=theme.main_button_color)
pass_entry.grid(column=0, row=0, pady=10, padx=10, sticky="ew")
salt = (instructor_list[inst]["Password"]["Salt"])
hashed_pass = (instructor_list[inst]["Password"]["Hash"])
def show():
if password_switch.get() == 0:
pass_entry.configure(show="")
else:
pass_entry.configure(show="*")
password_switch = customtkinter.CTkSwitch(pass_frame, text="Show password", command=show,
fg_color=theme.switch_off_color,
progress_color=theme.switch_on_color,
button_hover_color=theme.switch_hover_color,
button_color=theme.switch_button_color)
password_switch.select()
password_switch.grid(row=0, column=1, sticky="ew", padx=(5, 20))
def password_verify():
"""Verify if password is correct. If correct updates 'fields' dictionary if checkbox is selected."""
hash_object = hashlib.sha256(salt.encode() + pass_entry.get().encode())
hashed_password_entry = hash_object.hexdigest()
if hashed_password_entry == hashed_pass:
pass_window.destroy()
if len(fields["PADI Instructor"]) == 0: # --- check if first Instructor Info field is emtpy
fields["PADI Instructor"] = instructor_list[set_inst]["PADI Instructor"]
fields["PADI No"] = instructor_list[set_inst]["PADI Number"]
fields["Dive CenterResort No"] = instructor_list[set_inst]["Dive Center"]
fields["Date"] = today.day
fields["undefined_9"] = today.month
fields["undefined_10"] = today.year
fields["undefined_12"] = instructor_list[set_inst]["Phone"]
fields["Email_2"] = instructor_list[set_inst]["Email"]
if fields["PADI Instructor"] == instructor_list[set_inst]["PADI Instructor"]:
pass
else: # --- If first Instructor field has info, update the second Instructor field
fields["PADI Instructor_2"] = instructor_list[set_inst]["PADI Instructor"]
fields["PADI No_2"] = instructor_list[set_inst]["PADI Number"]
fields["Dive CenterResort No_2"] = instructor_list[set_inst]["Dive Center"]
fields["Date_2"] = today.day
fields["undefined_15"] = today.month
fields["undefined_16"] = today.year
fields["undefined_18"] = instructor_list[set_inst]["Phone"]
fields["Email_3"] = instructor_list[set_inst]["Email"]
# --- Check if corresponding checkbox is True. If so update Instructor Initials and PADI Number
if main_ui.cw_switch_list[0].get() == 1:
main_ui.cw_set_instructor_list[0].config(text=inst, fg=theme.set_text_color)
fields["Initials 1"] = instructor_list[set_inst]["Initials"]
fields["undefined_29"] = instructor_list[set_inst]["PADI Number"]
if main_ui.cw_switch_list[1].get() == 1:
main_ui.cw_set_instructor_list[1].config(text=inst, fg=theme.set_text_color)
fields["Initials 2"] = instructor_list[set_inst]["Initials"]
fields["undefined_35"] = instructor_list[set_inst]["PADI Number"]
if main_ui.cw_switch_list[2].get() == 1:
main_ui.cw_set_instructor_list[2].config(text=inst, fg=theme.set_text_color)
fields["Initials 3"] = instructor_list[set_inst]["Initials"]
fields["undefined_41"] = instructor_list[set_inst]["PADI Number"]
if main_ui.cw_switch_list[3].get() == 1:
main_ui.cw_set_instructor_list[3].config(text=inst, fg=theme.set_text_color)
fields["Initials 4"] = instructor_list[set_inst]["Initials"]
fields["undefined_47"] = instructor_list[set_inst]["PADI Number"]
if main_ui.cw_switch_list[4].get() == 1:
main_ui.cw_set_instructor_list[4].config(text=inst, fg=theme.set_text_color)
fields["DSD with all CW Dive 1 skills Open Water Diver CW Dive 1"] = instructor_list[set_inst][
"Initials"]
fields["undefined_55"] = instructor_list[set_inst]["PADI Number"]
if main_ui.cw_switch_list[5].get() == 1:
main_ui.cw_set_instructor_list[5].config(text=inst, fg=theme.set_text_color)
fields["200 metreyard Swim OR 300 metreyard MaskSnorkelFin Swim"] = instructor_list[set_inst][
"Initials"]
fields["undefined_68"] = instructor_list[set_inst]["PADI Number"]
if main_ui.cw_switch_list[6].get() == 1:
main_ui.cw_set_instructor_list[6].config(text=inst, fg=theme.set_text_color)
fields["undefined_73"] = instructor_list[set_inst]["Initials"]
fields["undefined_74"] = instructor_list[set_inst]["PADI Number"]
if main_ui.cw_switch_list[7].get() == 1:
main_ui.cw_set_instructor_list[7].config(text=inst, fg=theme.set_text_color)
fields["undefined_77"] = instructor_list[set_inst]["Initials"]
fields["undefined_78"] = instructor_list[set_inst]["PADI Number"]
if main_ui.cw_switch_list[8].get() == 1:
main_ui.cw_set_instructor_list[8].config(text=inst, fg=theme.set_text_color)
fields["undefined_93"] = instructor_list[set_inst]["Initials"]
fields["undefined_94"] = instructor_list[set_inst]["PADI Number"]
if main_ui.cw_switch_list[9].get() == 1:
main_ui.cw_set_instructor_list[9].config(text=inst, fg=theme.set_text_color)
fields["undefined_98"] = instructor_list[set_inst]["Initials"]
fields["undefined_99"] = instructor_list[set_inst]["PADI Number"]
if main_ui.cw_switch_list[10].get() == 1:
main_ui.cw_set_instructor_list[10].config(text=inst, fg=theme.set_text_color)
fields["undefined_104"] = instructor_list[set_inst]["Initials"]
fields["undefined_101"] = instructor_list[set_inst]["PADI Number"]
if main_ui.cw_switch_list[11].get() == 1:
main_ui.cw_set_instructor_list[11].config(text=inst, fg=theme.set_text_color)
fields["undefined_105"] = instructor_list[set_inst]["Initials"]
fields["undefined_106"] = instructor_list[set_inst]["PADI Number"]
if main_ui.cw_switch_list[12].get() == 1:
main_ui.cw_set_instructor_list[12].config(text=inst, fg=theme.set_text_color)
fields["undefined_119"] = instructor_list[set_inst]["Initials"]
fields["undefined_120"] = instructor_list[set_inst]["PADI Number"]
if main_ui.cw_switch_list[13].get() == 1:
main_ui.cw_set_instructor_list[13].config(text=inst, fg=theme.set_text_color)
fields["undefined_124"] = instructor_list[set_inst]["Initials"]
fields["undefined_125"] = instructor_list[set_inst]["PADI Number"]
if main_ui.cw_switch_list[14].get() == 1:
main_ui.cw_set_instructor_list[14].config(text=inst, fg=theme.set_text_color)
fields["PADI"] = instructor_list[set_inst]["PADI Number"]
if main_ui.kd_switch_list[0].get() == 1:
main_ui.kd_set_instructor_list[0].config(text=inst, fg=theme.set_text_color)
fields["undefined_33"] = instructor_list[set_inst]["Initials"]
fields["undefined_34"] = instructor_list[set_inst]["PADI Number"]
if main_ui.kd_switch_list[1].get() == 1:
main_ui.kd_set_instructor_list[1].config(text=inst, fg=theme.set_text_color)
fields["undefined_39"] = instructor_list[set_inst]["Initials"]
fields["undefined_40"] = instructor_list[set_inst]["PADI Number"]
if main_ui.kd_switch_list[2].get() == 1:
main_ui.kd_set_instructor_list[2].config(text=inst, fg=theme.set_text_color)
fields["undefined_45"] = instructor_list[set_inst]["Initials"]
fields["undefined_46"] = instructor_list[set_inst]["PADI Number"]
if main_ui.kd_switch_list[3].get() == 1:
main_ui.kd_set_instructor_list[3].config(text=inst, fg=theme.set_text_color)
fields["undefined_51"] = instructor_list[set_inst]["Initials"]
fields["undefined_52"] = instructor_list[set_inst]["PADI Number"]
if main_ui.kd_switch_list[4].get() == 1:
main_ui.kd_set_instructor_list[4].config(text=inst, fg=theme.set_text_color)
fields["undefined_59"] = instructor_list[set_inst]["Initials"]
fields["undefined_60"] = instructor_list[set_inst]["PADI Number"]
if main_ui.kd_switch_list[5].get() == 1:
main_ui.kd_set_instructor_list[5].config(text=inst, fg=theme.set_text_color)
fields["undefined_64"] = instructor_list[set_inst]["Initials"]
fields["undefined_65"] = instructor_list[set_inst]["PADI Number"]
if main_ui.kd_switch_list[6].get() == 1:
main_ui.kd_set_instructor_list[6].config(text=inst, fg=theme.set_text_color)
fields["undefined_69"] = instructor_list[set_inst]["PADI Number"]
if main_ui.ow_switch_list[0].get() == 1:
main_ui.ow_set_instructor_list[0].config(text=inst, fg=theme.set_text_color)
fields["Initials 1_2"] = instructor_list[set_inst]["Initials"]
fields["undefined_86"] = instructor_list[set_inst]["PADI Number"]
if main_ui.ow_switch_list[1].get() == 1:
main_ui.ow_set_instructor_list[1].config(text=inst, fg=theme.set_text_color)
fields["Initials 2_2"] = instructor_list[set_inst]["Initials"]
fields["undefined_81"] = instructor_list[set_inst]["PADI Number"]
if main_ui.ow_switch_list[2].get() == 1:
main_ui.ow_set_instructor_list[2].config(text=inst, fg=theme.set_text_color)
fields["Initials 1_3"] = instructor_list[set_inst]["Initials"]
fields["undefined_89"] = instructor_list[set_inst]["PADI Number"]
if main_ui.ow_switch_list[3].get() == 1:
main_ui.ow_set_instructor_list[3].config(text=inst, fg=theme.set_text_color)
fields["Initials 2_3"] = instructor_list[set_inst]["Initials"]
fields["undefined_90"] = instructor_list[set_inst]["PADI Number"]
if main_ui.ow_switch_list[4].get() == 1:
main_ui.ow_set_instructor_list[4].config(text=inst, fg=theme.set_text_color)
fields["Instructor Initials 1"] = instructor_list[set_inst]["Initials"]
fields["undefined_109"] = instructor_list[set_inst]["PADI Number"]
if main_ui.ow_switch_list[5].get() == 1:
main_ui.ow_set_instructor_list[5].config(text=inst, fg=theme.set_text_color)
fields["Instructor Initials 2"] = instructor_list[set_inst]["Initials"]
fields["undefined_110"] = instructor_list[set_inst]["PADI Number"]
if main_ui.ow_switch_list[6].get() == 1:
main_ui.ow_set_instructor_list[6].config(text=inst, fg=theme.set_text_color)
fields["Instructor Initials 3"] = instructor_list[set_inst]["Initials"]
fields["undefined_111"] = instructor_list[set_inst]["PADI Number"]
if main_ui.ow_switch_list[7].get() == 1:
main_ui.ow_set_instructor_list[7].config(text=inst, fg=theme.set_text_color)
fields["Instructor Initials 4"] = instructor_list[set_inst]["Initials"]
fields["undefined_112"] = instructor_list[set_inst]["PADI Number"]
if main_ui.ow_switch_list[8].get() == 1:
main_ui.ow_set_instructor_list[8].config(text=inst, fg=theme.set_text_color)
fields["Instructor Initials 5"] = instructor_list[set_inst]["Initials"]
fields["undefined_113"] = instructor_list[set_inst]["PADI Number"]
if main_ui.ow_switch_list[9].get() == 1:
main_ui.ow_set_instructor_list[9].config(text=inst, fg=theme.set_text_color)
fields["Instructor Initials 6"] = instructor_list[set_inst]["Initials"]
fields["undefined_114"] = instructor_list[set_inst]["PADI Number"]
if main_ui.ow_switch_list[10].get() == 1:
main_ui.ow_set_instructor_list[10].config(text=inst, fg=theme.set_text_color)
fields["Instructor Initials 7"] = instructor_list[set_inst]["Initials"]
fields["undefined_115"] = instructor_list[set_inst]["PADI Number"]
if main_ui.ow_switch_list[11].get() == 1:
main_ui.ow_set_instructor_list[11].config(text=inst, fg=theme.set_text_color)
fields["Instructor Initials 8"] = instructor_list[set_inst]["Initials"]
fields["undefined_116"] = instructor_list[set_inst]["PADI Number"]
if main_ui.ow_switch_list[12].get() == 1:
main_ui.ow_set_instructor_list[12].config(text=inst, fg=theme.set_text_color)
fields["Instructor Initials 9"] = instructor_list[set_inst]["Initials"]
fields["undefined_117"] = instructor_list[set_inst]["PADI Number"]
if main_ui.ow_switch_list[13].get() == 1:
main_ui.ow_set_instructor_list[13].config(text=inst, fg=theme.set_text_color)
fields["Instructor Initials 10"] = instructor_list[set_inst]["Initials"]
fields["undefined_121"] = instructor_list[set_inst]["PADI Number"]
if main_ui.ow_switch_list[14].get() == 1:
main_ui.ow_set_instructor_list[14].config(text=inst, fg=theme.set_text_color)
fields["undefined_126"] = instructor_list[set_inst]["PADI Number"]
if main_ui.ow_switch_list[15].get() == 1:
main_ui.ow_set_instructor_list[15].config(text=inst, fg=theme.set_text_color)
fields["undefined_137"] = instructor_list[set_inst]["PADI Number"]
else: # --- User Enters Wrong Password
pass_window.destroy()
messagebox.showinfo("invalid password", "Wrong Password")
# --- Password Submit Button
pass_button = customtkinter.CTkButton(pass_frame, text="Submit", command=password_verify,
fg_color=theme.main_button_color, text_color=theme.main_button_text_color,
hover_color=theme.main_button_color_hover
)
pass_button.grid(column=1, row=1, pady=10, padx=10)
def set_date():
"""Add dates to 'field' dictionary and change 'Set Dive' Label to Calendar DateEntry"""
# --- Confined Water Dives
if main_ui.cw_switch_list[0].get() == 1:
con_water_one_date = main_ui.cw_cal_list[0].get_date()
main_ui.cw_set_date_list[0].config(text=con_water_one_date, fg=theme.set_text_color)
fields["CW 1"] = con_water_one_date.day
fields["undefined_27"] = con_water_one_date.month
fields["undefined_28"] = con_water_one_date.year
if main_ui.cw_switch_list[1].get() == 1:
con_water_two_date = main_ui.cw_cal_list[1].get_date()
main_ui.cw_set_date_list[1].config(text=con_water_two_date, fg=theme.set_text_color)
fields["CW 2"] = con_water_two_date.day
fields["undefined_21"] = con_water_two_date.month
fields["undefined_22"] = con_water_two_date.year
if main_ui.cw_switch_list[2].get() == 1:
con_water_three_date = main_ui.cw_cal_list[2].get_date()
main_ui.cw_set_date_list[2].config(text=con_water_three_date, fg=theme.set_text_color)
fields["CW 3"] = con_water_three_date.day
fields["undefined_23"] = con_water_three_date.month
fields["undefined_24"] = con_water_three_date.year
if main_ui.cw_switch_list[3].get() == 1:
con_water_four_date = main_ui.cw_cal_list[3].get_date()
main_ui.cw_set_date_list[3].config(text=con_water_four_date, fg=theme.set_text_color)
fields["CW 4"] = con_water_four_date.day
fields["undefined_25"] = con_water_four_date.month
fields["undefined_26"] = con_water_four_date.year
if main_ui.cw_switch_list[4].get() == 1:
con_water_five_date = main_ui.cw_cal_list[4].get_date()
main_ui.cw_set_date_list[4].config(text=con_water_five_date, fg=theme.set_text_color)
fields["CW 5"] = con_water_five_date.day
fields["undefined_53"] = con_water_five_date.month
fields["undefined_54"] = con_water_five_date.year
if main_ui.cw_switch_list[5].get() == 1: # Swim
swim_date = main_ui.cw_cal_list[5].get_date()
main_ui.cw_set_date_list[5].config(text=swim_date, fg=theme.set_text_color)
fields["10 Minute Survival Float"] = swim_date.day
fields["undefined_66"] = swim_date.month
fields["undefined_67"] = swim_date.year
if main_ui.cw_switch_list[6].get() == 1: # Float
float_date = main_ui.cw_cal_list[6].get_date()
main_ui.cw_set_date_list[6].config(text=float_date, fg=theme.set_text_color)
fields["undefined_75"] = float_date.day
fields["undefined_76"] = float_date.month
fields["undefined_72"] = float_date.year
if main_ui.cw_switch_list[7].get() == 1:
equip_date = main_ui.cw_cal_list[7].get_date()
main_ui.cw_set_date_list[7].config(text=equip_date, fg=theme.set_text_color)
fields["Equipment Preparation and Care"] = equip_date.day
fields["undefined_91"] = equip_date.month
fields["undefined_92"] = equip_date.year
if main_ui.cw_switch_list[8].get() == 1:
disconnect_date = main_ui.cw_cal_list[8].get_date()
main_ui.cw_set_date_list[8].config(text=disconnect_date, fg=theme.set_text_color)
fields["Disconnect Low Pressure Inflator Hose"] = disconnect_date.day
fields["undefined_95"] = disconnect_date.month
fields["undefined_96"] = disconnect_date.year
if main_ui.cw_switch_list[9].get() == 1:
loose_date = main_ui.cw_cal_list[9].get_date()
main_ui.cw_set_date_list[9].config(text=loose_date, fg=theme.set_text_color)
fields["Loose Cylinder Band"] = loose_date.day
fields["undefined_100"] = loose_date.month
fields["undefined_97"] = loose_date.year
if main_ui.cw_switch_list[10].get() == 1:
weight_date = main_ui.cw_cal_list[10].get_date()
main_ui.cw_set_date_list[10].config(text=weight_date, fg=theme.set_text_color)
fields["Weight System Removal and Replacement surface"] = weight_date.day
fields["undefined_102"] = weight_date.month
fields["undefined_103"] = weight_date.year
if main_ui.cw_switch_list[11].get() == 1:
weight_drop_date = main_ui.cw_cal_list[11].get_date()
main_ui.cw_set_date_list[11].config(text=weight_drop_date, fg=theme.set_text_color)
fields["Emergency Weight Drop or in OW"] = weight_drop_date.day
fields["undefined_107"] = weight_drop_date.month