-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgui_help.py
1041 lines (890 loc) · 43.9 KB
/
gui_help.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
import PySimpleGUI as sg
from quote import *
def empty_response(response, empty_field):
if response == "":
sg.theme("dark grey 14")
layout = [[sg.Text("Enter missing value for ", empty_field, ":")],
[sg.InputText(enable_events=True, key="event")]]
window = sg.Window("Quote Calculator", layout)
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED:
break
if event == "Next":
response = values[event]
window.close()
return response
class GuiHelp:
# Theme color
def __init__(self):
self.create_theme()
self.customization = None
self.exit = False
@staticmethod
def create_theme():
sg.theme("dark grey 14")
# Creates first window (liner setup)
def create_first_window(self, quote):
# Set the layout for main info page
layout = [[sg.Text("Choose the type of tank:")],
[sg.InputCombo(("Circular", "Rectangular", "Flat Sheet"), size=(40, 1), enable_events=True,
key="tank_type")],
[sg.Text(size=(40, 2))],
[sg.Text("Enter price per square foot:")],
[sg.Text("$"), sg.InputText(enable_events=True, key="square_foot_cost", size=(10, 1))],
[sg.Text(size=(40, 2))],
[sg.Text("Enter weight per square foot:")],
[sg.InputText(enable_events=True, key="square_foot_weight", size=(8, 1)), sg.Text("lbs.")],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 1)), sg.Button("Next", size=(6, 1))]]
# Create setup window
setup_window = sg.Window("Quote Calculator", layout)
# Event reader
exit_a = self.first_window_event_reader(setup_window, quote)
# Close window
setup_window.close()
# Return true if closed, false otherwise
return exit_a
# First window event reader
def first_window_event_reader(self, setup_window, quote):
while True:
event, values = setup_window.read()
if event == sg.WINDOW_CLOSED:
self.exit = True
return True
if event == "Next":
tank = values["tank_type"].lower()
sq_price = float(values["square_foot_cost"])
sq_weight = float(values["square_foot_weight"])
quote.lining_system.liner = Liner(tank, sq_price, sq_weight)
return False
# Creates second window (liner customizations)
def create_second_window(self, quote):
# Circular configuration
if isinstance(quote.lining_system.liner.info, CLiner):
exit_b = self.create_circular_configuration_window(quote)
elif isinstance(quote.lining_system.liner.info, RLiner):
exit_b = self.create_rectangular_configuration_window(quote)
elif isinstance(quote.lining_system.liner.info, FLiner):
exit_b = self.create_flat_sheet_configuration_window(quote)
else:
exit_b = False
return exit_b
# Creates circular configuration window
def create_circular_configuration_window(self, quote):
# Get circular tank input from user
layout = [[sg.Text("Enter diameter of tank:")],
[sg.InputText(enable_events=True, size=(5, 2), key="tank_dm_ft"), sg.Text("ft."),
sg.InputText(enable_events=True, size=(3, 2), key="tank_dm_in"), sg.Text("in.")],
[sg.Text(size=(40, 2))],
[sg.Text("Enter depth of tank:")],
[sg.InputText(enable_events=True, size=(5, 2), key="tank_dp_ft"), sg.Text("ft."),
sg.InputText(enable_events=True, size=(3, 2), key="tank_dp_in"), sg.Text("in.")],
[sg.Text("Please enter any extensions to depth:"),
sg.InputText(enable_events=True, size=(3, 2), key="tank_dp_ex_in"), sg.Text("in.")],
[sg.Text(size=(40, 2))],
[sg.Button("Back", size=(6, 1)), sg.Text(size=(34, 2)), sg.Button("Next", size=(6, 1))]]
# Create window
window = sg.Window("Quote Calculator", layout)
# Event reader
exit_b = self.circular_config_event_reader(window, quote)
# Close window
window.close()
# Return true if closed or back, false otherwise
return exit_b
# Circular configuration event reader
def circular_config_event_reader(self, window, quote):
# Capture values after next button is pushed
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED:
self.exit = True
return True
if event == "Next":
diameter_ft = float(values["tank_dm_ft"])
diameter_inch = float(values["tank_dm_in"])
depth_ft = float(values["tank_dp_ft"])
depth_inch = float(values["tank_dm_in"])
depth_extensions = float(values["tank_dp_ex_in"])
quote.lining_system.liner.info.configure(diameter_ft, diameter_inch, depth_ft,
depth_inch, depth_extensions)
return False
if event == "Back":
return True
# Creates rectangular configuration window
def create_rectangular_configuration_window(self, quote):
# Get rectangular tank input from user
layout = [[sg.Text("Enter length of tank:")],
[sg.InputText(enable_events=True, size=(5, 2), key="tank_lgth_ft"), sg.Text("ft."),
sg.InputText(enable_events=True, size=(3, 2), key="tank_lgth_in"), sg.Text("in.")],
[sg.Text(size=(40, 2))],
[sg.Text("Enter width of tank:")],
[sg.InputText(enable_events=True, size=(5, 2), key="tank_wdth_ft"), sg.Text("ft."),
sg.InputText(enable_events=True, size=(3, 2), key="tank_wdth_in"), sg.Text("in.")],
[sg.Text(size=(40, 2))],
[sg.Text("Enter depth of tank:")],
[sg.InputText(enable_events=True, size=(5, 2), key="tank_dp_ft"), sg.Text("ft."),
sg.InputText(enable_events=True, size=(3, 2), key="tank_dp_in"), sg.Text("in.")],
[sg.Text("Please enter any extensions to depth:"),
sg.InputText(enable_events=True, size=(3, 2), key="tank_dp_ex_in"), sg.Text("in.")],
[sg.Text(size=(40, 2))],
[sg.Button("Back", size=(6, 1)), sg.Text(size=(34, 2)), sg.Button("Next", size=(6, 1))]]
# Create window
window = sg.Window("Quote Calculator", layout)
# Event reader
exit_b = self.rectangular_config_event_reader(window, quote)
# Close window
window.close()
# Return true if closed or back, false otherwise
return exit_b
# Rectangular configuration event reader
def rectangular_config_event_reader(self, window, quote):
# Capture values after next button is pushed
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED:
self.exit = True
return True
if event == "Next":
length_ft = float(values["tank_lgth_ft"])
length_inch = float(values["tank_lgth_in"])
width_ft = float(values["tank_wdth_ft"])
width_inch = float(values["tank_wdth_in"])
depth_ft = float(values["tank_dp_ft"])
depth_inch = float(values["tank_dp_in"])
depth_extensions = float(values["tank_dp_ex_in"])
quote.lining_system.liner.info.configure(length_ft, length_inch, width_ft, width_inch, depth_ft
, depth_inch, depth_extensions)
return False
if event == "Back":
return True
# Creates flat sheet configuration window
def create_flat_sheet_configuration_window(self, quote):
# Get flat sheet input from user
layout = [[sg.Text("Enter length of liner:")],
[sg.InputText(enable_events=True, size=(5, 2), key="tank_lgth_ft"), sg.Text("ft."),
sg.InputText(enable_events=True, size=(3, 2), key="tank_lgth_in"), sg.Text("in.")],
[sg.Text(size=(40, 2))],
[sg.Text("Enter width of liner:")],
[sg.InputText(enable_events=True, size=(5, 2), key="tank_wdth_ft"), sg.Text("ft."),
sg.InputText(enable_events=True, size=(3, 2), key="tank_wdth_in"), sg.Text("in.")],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Button("Back", size=(6, 1)), sg.Text(size=(34, 2)), sg.Button("Next", size=(6, 1))]]
# Create window
window = sg.Window("Quote Calculator", layout)
# Event reader
exit_b = self.flat_sheet_config_event_reader(window, quote)
# Close window
window.close()
# Return true if closed or back, false otherwise
return exit_b
# Event reader
def flat_sheet_config_event_reader(self, window, quote):
# Capture values after next button is pushed
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED:
self.exit = True
return True
if event == "Next":
length_ft = float(values["tank_lgth_ft"])
length_inch = float(values["tank_lgth_in"])
width_ft = float(values["tank_wdth_ft"])
width_inch = float(values["tank_wdth_in"])
quote.lining_system.liner.info.configure(length_ft, length_inch, width_ft, width_inch)
return False
if event == "Back":
return True
# Creates third window (quote customizations)
def create_third_window(self, quote):
# Circular configuration
if isinstance(quote.lining_system.liner.info, CLiner):
exit_c = self.create_circular_customizations_window(quote)
elif isinstance(quote.lining_system.liner.info, RLiner):
exit_c = self.create_rectangular_customizations_window(quote)
elif isinstance(quote.lining_system.liner.info, FLiner):
exit_c = self.create_flat_sheet_customizations_window(quote)
else:
exit_c = False
return exit_c
# Creates rectangular customizations window
def create_rectangular_customizations_window(self, quote):
# Customizations available for rectangular liner
customizations_available = ["Geo", "Batten Strips", "J-bolts", "Oarlocks",
"Crate(s)", "Leak Detection", "Nailing Strip", "Stainless Clips",
"Lifting Hem", "Installation", "Boots", "Sumps", "Manways",
"Center poles", "Columns", "Add liner(s)", "Discount liner"]
# Set the layout for customization loop
layout = [[sg.Text("Choose a customization below:")],
[sg.InputCombo(customizations_available, size=(40, 1), enable_events=True,
key="customizations")],
[sg.Text(size=(40, 2))],
[sg.Text(size=(21, 2)), sg.Text("Dashboard:", size=(10, 3))]]
for order in quote.accessories.orders:
layout.append([[sg.Text(size=(24, 1)), sg.Text(order.to_string(), size=(10, 1))]])
layout.append([[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Button("Back", size=(6, 1)), sg.Text(size=(39, 1)), sg.Button("Choose", size=(6, 1))],
[sg.Text(size=(22, 1)), sg.Button("Finish", size=(6, 1))]])
# Create setup window
window = sg.Window("Quote Calculator", layout)
# Event reader
exit_c = self.customizations_event_reader(window, quote)
# Close window
window.close()
# Return true if closed or back, false otherwise
return exit_c
# Creates rectangular customizations window
def create_flat_sheet_customizations_window(self, quote):
# Customizations available for flat sheet liner
customizations_available = ["Geo", "Add liner(s)", "Discount liner"]
# Set the layout for customization loop
layout = [[sg.Text("Choose a customization below:")],
[sg.InputCombo(customizations_available, size=(40, 1), enable_events=True,
key="customizations")],
[sg.Text(size=(40, 2))],
[sg.Text(size=(21, 2)), sg.Text("Dashboard:", size=(10, 3))]]
for order in quote.accessories.orders:
layout.append([[sg.Text(size=(24, 1)), sg.Text(order.to_string(), size=(10, 1))]])
layout.append([[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Button("Back", size=(6, 1)), sg.Text(size=(39, 1)), sg.Button("Choose", size=(6, 1))],
[sg.Text(size=(22, 1)), sg.Button("Finish", size=(6, 1))]])
# Create setup window
window = sg.Window("Quote Calculator", layout)
# Event reader
exit_c = self.customizations_event_reader(window, quote)
# Close window
window.close()
# Return true if closed or back, false otherwise
return exit_c
# Creates circular customizations window
def create_circular_customizations_window(self, quote):
# Customizations available for circular liner
customizations_available = ["Geo", "Batten Strips", "J-bolts", "Oarlocks",
"Crate", "Leak Detection", "Nailing Strips", "Stainless Clips",
"Lifting Hem", "Installation", "Boots", "Sumps", "Manways",
"Center poles", "Columns", "Add liner(s)", "Discount liner"]
# Set the layout for customization loop
layout = [[sg.Text("Choose a customization below:")],
[sg.InputCombo(customizations_available, size=(40, 1), enable_events=True,
key="customizations")],
[sg.Text(size=(40, 2))],
[sg.Text(size=(21, 2)), sg.Text("Dashboard:", size=(10, 3))]]
for order in quote.accessories.orders:
if isinstance(order, type("")):
if order[0].lower() == "l":
layout.append([sg.Button("Lifting hem")])
elif order[0].lower() == "a":
layout.append([sg.Button(order)])
elif order[0].lower() == "d":
layout.append([sg.Button(order)])
else:
layout.append([sg.Button(order.to_string())])
layout.append([[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Button("Back", size=(6, 1)), sg.Text(size=(39, 1)), sg.Button("Choose", size=(6, 1))],
[sg.Text(size=(22, 1)), sg.Button("Finish", size=(6, 1))]])
# Create setup window
window = sg.Window("Quote Customizations", layout)
# Event reader
exit_c = self.customizations_event_reader(window, quote)
# Close window
window.close()
# Return true if closed or back, false otherwise
return exit_c
# Event reader
def customizations_event_reader(self, window, quote):
# Capture values after next button is pushed
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED:
self.exit = True
return True
if event == "Choose":
self.customization = values["customizations"].lower()
return False
if event == "Back":
quote.accessories.orders.clear()
return True
if event == "Finish":
self.exit = True
return True
# Updates dashboard of customizations window
def update(self, quote):
if isinstance(quote.lining_system.liner.info, CLiner):
return self.choose_circular_customization_window(quote)
# Creates fourth window for customization specification of circular tank
def choose_circular_customization_window(self, quote):
if self.customization == "geo":
exit_d = self.create_circular_geo_customization_window(quote)
elif self.customization == "batten strips":
exit_d = self.create_circular_batten_strips_customization_window(quote)
elif self.customization == "j-bolts":
exit_d = self.create_circular_j_bolts_customization_window(quote)
elif self.customization == "oarlocks":
exit_d = self.create_circular_oarlocks_customization_window(quote)
elif self.customization == "crate":
exit_d = self.create_crate_customization_window(quote)
elif self.customization == "leak detection":
exit_d = self.create_circular_leak_detection_customization_window(quote)
elif self.customization == "nailing strips":
exit_d = self.create_nailing_strips_customization_window(quote)
elif self.customization == "stainless clips":
exit_d = self.create_stainless_clips_customization_window(quote)
elif self.customization == "lifting hem":
exit_d = self.create_lifting_hem_customization_window(quote)
elif self.customization == "installation":
exit_d = self.create_circular_installation_package_customization_window(quote)
elif self.customization == "boots":
exit_d = self.create_boot_customization_window(quote)
elif self.customization == "sumps":
exit_d = self.create_sump_customization_window(quote)
elif self.customization == "manways":
exit_d = self.create_manway_customization_window(quote)
elif self.customization == "center poles":
exit_d = self.create_center_pole_customization_window(quote)
elif self.customization == "columns":
exit_d = self.create_column_customization_window(quote)
elif self.customization == "add liner(s)":
exit_d = self.create_add_liner_customization_window(quote)
elif self.customization == "discount liner":
exit_d = self.create_discount_liner_customization_window(quote)
return exit_d
# Discount liner customization window
def create_discount_liner_customization_window(self, quote):
# Set the layout for discount liner customization
layout = [[sg.Text("Enter discount percentage for liner: ")],
[sg.InputText(enable_events=True, size=(6, 2), key="discount_percentage"), sg.Text("%")],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Button("Back", size=(4, 1)), sg.Text(size=(31, 1)), sg.Button("Add", size=(6, 1))]]
window = sg.Window("Quote Customizations", layout)
# Event reader
exit_d = self.discount_liner_customization_event_reader(window, quote)
# Close window
window.close()
# Return true if closed or back, false if add or delete
return exit_d
# Event reader for manway customization window
def discount_liner_customization_event_reader(self, window, quote):
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED:
self.exit = True
return True
if event == "Add":
discount_percentage = int(values["discount_percentage"])
quote.accessories.discount_liner(quote, discount_percentage)
return False
if event == "Back":
return True
# Circular geo customization window
def create_circular_geo_customization_window(self, quote):
# Set the layout for geo customization
layout = [[sg.Text("Enter thickness in ounces: ")],
[sg.InputCombo(("8", "16"), enable_events=True, size=(3, 2), key="geo_size"), sg.Text
("oz.")],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Button("Back", size=(4, 1)), sg.Text(size=(31, 1)), sg.Button("Add", size=(6, 1))]]
window = sg.Window("Quote Customizations", layout)
# Event reader
exit_d = self.circular_geo_customization_event_reader(window, quote)
# Close window
window.close()
# Return true if closed or back, false if add or delete
return exit_d
# Event reader for geo customizations
def circular_geo_customization_event_reader(self, window, quote):
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED:
self.exit = True
return True
if event == "Add":
wall_thickness = int(values["geo_size"])
quote.accessories.add_geo(wall_thickness, quote)
return False
if event == "Back":
return True
if event == "Delete":
quote.accessories.delete(Geo(0, 0, 0))
return False
# Circular batten strip customization window
def create_circular_batten_strips_customization_window(self, quote):
layout = [[sg.Text("Choose batten strip type: ")],
[sg.InputCombo(("Poly-pro", "Stainless Steel"), enable_events=True, size=(18, 2), key="bs_type")],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Button("Back", size=(4, 1)), sg.Text(size=(31, 1)), sg.Button("Add", size=(6, 1))]]
window = sg.Window("Quote Customizations", layout)
# Event reader
exit_d = self.circular_batten_strips_customization_event_reader(window, quote)
# Close window
window.close()
# Return true if closed or back, false if add or delete
return exit_d
# Event reader for batten strip customizations
def circular_batten_strips_customization_event_reader(self, window, quote):
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED:
self.exit = True
return True
if event == "Add":
batten_strip_type = values["bs_type"]
quote.accessories.add_batten_strip(batten_strip_type,
quote.lining_system.liner.info.circumference_liner)
return False
if event == "Back":
return True
if event == "Delete":
quote.accessories.delete(BattenStrips(0))
return False
@staticmethod
# Circular batten strip customization window
def create_circular_j_bolts_customization_window(quote):
quote.accessories.add_j_bolts(quote.lining_system.liner.info.circumference_liner)
return False
# Circular oarlocks customization window
def create_circular_oarlocks_customization_window(self, quote):
layout = [[sg.Text("How many oarlocks would you like to add: ")],
[sg.InputText(enable_events=True, size=(6, 2), key="oarlocks_number")],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Button("Back", size=(4, 1)), sg.Text(size=(31, 1)), sg.Button("Add", size=(6, 1))]]
window = sg.Window("Quote Customizations", layout)
# Event reader
exit_d = self.circular_oarlocks_customization_event_reader(window, quote)
# Close window
window.close()
# Return true if closed or back, false if add or delete
return exit_d
# Event reader for batten strip customizations
def circular_oarlocks_customization_event_reader(self, window, quote):
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED:
self.exit = True
return True
if event == "Add":
oarlocks_number = int(values["oarlocks_number"])
quote.accessories.add_oarlocks(oarlocks_number)
return False
if event == "Back":
return True
if event == "Delete":
quote.accessories.delete(Oarlocks(0))
return False
# Crate customization window
def create_crate_customization_window(self, quote):
# Set the layout for crate customization
layout = [[sg.Text("Enter crate size: ")],
[sg.InputCombo(("Small", "Large"), enable_events=True, size=(8, 2), key="crate_size")],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Text("How many would you like?")],
[sg.InputText(enable_events=True, size=(6, 2), key="number_crates")],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Button("Back", size=(4, 1)), sg.Text(size=(31, 1)), sg.Button("Add", size=(6, 1))]]
window = sg.Window("Quote Customizations", layout)
# Event reader
exit_d = self.crate_customization_event_reader(window, quote)
# Close window
window.close()
# Return true if closed or back, false if add or delete
return exit_d
# Event reader for crate customizations
def crate_customization_event_reader(self, window, quote):
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED:
self.exit = True
return True
if event == "Add":
size = values["crate_size"]
number_crates = int(values["number_crates"])
for i in range(number_crates):
quote.accessories.add_crate(size)
return False
if event == "Back":
return True
if event == "Delete":
quote.accessories.delete(Crate("Default"))
return False
@staticmethod
# Circular leak detection customization window
def create_circular_leak_detection_customization_window(quote):
quote.accessories.add_leak_detection(quote.lining_system.liner.info.circumference_liner)
return False
@staticmethod
# Circular nailing strip customization window
def create_nailing_strips_customization_window(quote):
quote.accessories.add_nailing_strips(quote.lining_system.liner.info.circumference_liner)
return False
@staticmethod
# Circular stainless2 clips customization window
def create_stainless_clips_customization_window(quote):
quote.accessories.add_stainless_clips(quote.lining_system.liner.info.circumference_liner)
return False
@staticmethod
# Circular lifting hem customization window
def create_lifting_hem_customization_window(quote):
quote.accessories.add_lifting_hem(quote)
return False
# Circular installation customization window
def create_circular_installation_package_customization_window(self, quote):
# Set the layout for installation customization
layout = [[sg.Text("Is the site survey within the US? ")],
[sg.InputCombo(("Yes", "No"), enable_events=True, size=(4, 2), key="within_USA")],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Button("Back", size=(4, 1)), sg.Text(size=(31, 1)), sg.Button("Next", size=(6, 1))]]
window = sg.Window("Quote Customizations", layout)
# Event reader
exit_d = self.circular_installation_package_customization_event_reader(window, quote)
# Close window
window.close()
# Return true if closed or back, false if add or delete
return exit_d
# Event reader for installation package customizations
def circular_installation_package_customization_event_reader(self, window, quote):
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED:
self.exit = True
return True
if event == "Next":
within_usa = values["within_USA"].lower()
customized_site_survey = False
if within_usa[0] == "y":
# Returns True if exit or back, yes and no to answer question otherwise
is_within_600_miles = self.circular_installation_within_usa_window()
if isinstance(is_within_600_miles, bool):
return True
else:
is_within_600_miles = "no"
customized_site_survey = True
# Returns True if exit or back, float otherwise
site_survey_cost = self.installation_site_survey_cost_window()
# Returns True if exit or back, float otherwise
traveling_cost = self.circular_installation_traveling_cost_window()
if isinstance(traveling_cost, bool):
return True
quote.accessories.add_installation_package(within_usa, is_within_600_miles, traveling_cost,
quote.lining_system)
if customized_site_survey:
quote.accessories.orders[len(quote.accessories.orders) - 1].set_site_survey_cost(site_survey_cost)
return False
if event == "Back":
return True
# Circular installation within USA customization window
def circular_installation_within_usa_window(self):
layout = [[sg.Text("Is the site survey within 600 miles? ")],
[sg.InputCombo(("Yes", "No"), enable_events=True, size=(4, 2), key="within_600")],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Button("Back", size=(4, 1)), sg.Text(size=(31, 1)), sg.Button("Next", size=(6, 1))]]
window = sg.Window("Quote Customizations", layout)
# Event reader
exit_d = self.circular_installation_within_usa_event_reader(window)
# Close window
window.close()
# Return true if closed or back, false if add or delete
return exit_d
# Event reader for installation package customizations
def circular_installation_within_usa_event_reader(self, window):
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED:
self.exit = True
return True
if event == "Next":
within_usa = values["within_600"].lower()
if within_usa[0] == "y":
return "yes"
else:
return "no"
if event == "Back":
return True
# Asks for site survey cost in the case that project is outside of USA
def installation_site_survey_cost_window(self):
layout = [[sg.Text("Enter cost of site survey: ")],
[sg.Text("$"), sg.InputText(enable_events=True, key="site_survey_cost", size=(10, 1))],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Button("Back", size=(4, 1)), sg.Text(size=(31, 1)), sg.Button("Next", size=(6, 1))]]
window = sg.Window("Quote Customizations", layout)
# Event reader
site_survey_cost = self.installation_site_survey_event_reader(window)
# Close window
window.close()
# Return true if closed or back, traveling cost float if otherwise
return site_survey_cost
# Event reader for customized site survey
def installation_site_survey_event_reader(self, window):
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED:
self.exit = True
return True
if event == "Next":
return float(values["site_survey_cost"])
if event == "Back":
return True
# Circular installation within USA customization window
def circular_installation_traveling_cost_window(self):
layout = [[sg.Text("Enter cost of traveling: ")],
[sg.Text("$"), sg.InputText(enable_events=True, key="traveling_cost", size=(10, 1))],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Button("Back", size=(4, 1)), sg.Text(size=(31, 1)), sg.Button("Next", size=(6, 1))]]
window = sg.Window("Quote Customizations", layout)
# Event reader
traveling_cost = self.circular_installation_traveling_cost_event_reader(window)
# Close window
window.close()
# Return true if closed or back, traveling cost float if otherwise
return traveling_cost
# Event reader for installation package customizations
def circular_installation_traveling_cost_event_reader(self, window):
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED:
self.exit = True
return True
if event == "Next":
return float(values["traveling_cost"])
if event == "Back":
return True
# Boots customization window
def create_boot_customization_window(self, quote):
layout = [[sg.Text("Enter boot size in inches: ")],
[sg.InputText(enable_events=True, size=(6, 2), key="boot_size")],
[sg.Text(size=(40, 2))],
[sg.Text("How many would you like? ")],
[sg.InputText(enable_events=True, size=(6, 2), key="number_boots")],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Button("Back", size=(4, 1)), sg.Text(size=(31, 1)), sg.Button("Add", size=(6, 1))]]
window = sg.Window("Quote Customizations", layout)
# Event reader
exit_d = self.boot_customization_event_reader(window, quote)
# Close window
window.close()
# Return true if closed or back, false if add or delete
return exit_d
# Event reader for batten strip customizations
def boot_customization_event_reader(self, window, quote):
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED:
self.exit = True
return True
if event == "Add":
boot_size = float(values["boot_size"])
number_boots = int(values["number_boots"])
for i in range(number_boots):
quote.accessories.add_boot(boot_size)
return False
if event == "Back":
return True
if event == "Delete":
quote.accessories.delete(Boot(0))
return False
# Sump customization window
def create_sump_customization_window(self, quote):
layout = [[sg.Text("Enter square footage of material used for sump: ")],
[sg.InputText(enable_events=True, size=(6, 2), key="square_footage")],
[sg.Text(size=(40, 2))],
[sg.Text("How many would you like? ")],
[sg.InputText(enable_events=True, size=(6, 2), key="number_sumps")],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Button("Back", size=(4, 1)), sg.Text(size=(31, 1)), sg.Button("Add", size=(6, 1))]]
window = sg.Window("Quote Customizations", layout)
# Event reader
exit_d = self.sump_customization_event_reader(window, quote)
# Close window
window.close()
# Return true if closed or back, false if add or delete
return exit_d
# Event reader for sump customization window
def sump_customization_event_reader(self, window, quote):
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED:
self.exit = True
return True
if event == "Add":
square_footage = float(values["square_footage"])
number_sumps = int(values["number_sumps"])
for i in range(number_sumps):
quote.accessories.add_sump(square_footage, quote.lining_system.liner.sq_price)
return False
if event == "Back":
return True
if event == "Delete":
quote.accessories.delete(Sump(0, 0))
return False
# Manway customization window
def create_manway_customization_window(self, quote):
layout = [[sg.Text("Enter square footage of material used for manway: ")],
[sg.InputText(enable_events=True, size=(6, 2), key="square_footage")],
[sg.Text(size=(40, 2))],
[sg.Text("How many would you like? ")],
[sg.InputText(enable_events=True, size=(6, 2), key="number_manways")],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Button("Back", size=(4, 1)), sg.Text(size=(31, 1)), sg.Button("Add", size=(6, 1))]]
window = sg.Window("Quote Customizations", layout)
# Event reader
exit_d = self.manway_customization_event_reader(window, quote)
# Close window
window.close()
# Return true if closed or back, false if add or delete
return exit_d
# Event reader for manway customization window
def manway_customization_event_reader(self, window, quote):
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED:
self.exit = True
return True
if event == "Add":
square_footage = float(values["square_footage"])
number_manways = int(values["number_manways"])
for i in range(number_manways):
quote.accessories.add_manway(square_footage, quote.lining_system.liner.sq_price)
return False
if event == "Back":
return True
if event == "Delete":
quote.accessories.delete(ManWay(0, 0))
return False
# Center pole customization window
def create_center_pole_customization_window(self, quote):
layout = [[sg.Text("Enter square footage of material used for center pole: ")],
[sg.InputText(enable_events=True, size=(6, 2), key="square_footage")],
[sg.Text(size=(40, 2))],
[sg.Text("How many would you like? ")],
[sg.InputText(enable_events=True, size=(6, 2), key="number_center_poles")],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Button("Back", size=(4, 1)), sg.Text(size=(31, 1)), sg.Button("Add", size=(6, 1))]]
window = sg.Window("Quote Customizations", layout)
# Event reader
exit_d = self.center_pole_customization_event_reader(window, quote)
# Close window
window.close()
# Return true if closed or back, false if add or delete
return exit_d
# Event reader for center pole customization window
def center_pole_customization_event_reader(self, window, quote):
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED:
self.exit = True
return True
if event == "Add":
square_footage = float(values["square_footage"])
number_center_poles = int(values["number_center_poles"])
for i in range(number_center_poles):
quote.accessories.add_center_pole(square_footage, quote.lining_system.liner.sq_price)
return False
if event == "Back":
return True
if event == "Delete":
quote.accessories.delete(CenterPole(0, 0))
return False
# Column customization window
def create_column_customization_window(self, quote):
layout = [[sg.Text("Enter square footage of material used for column: ")],
[sg.InputText(enable_events=True, size=(6, 2), key="square_footage")],
[sg.Text(size=(40, 2))],
[sg.Text("How many would you like? ")],
[sg.InputText(enable_events=True, size=(6, 2), key="number_columns")],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Text(size=(40, 2))],
[sg.Button("Back", size=(4, 1)), sg.Text(size=(31, 1)), sg.Button("Add", size=(6, 1))]]
window = sg.Window("Quote Customizations", layout)
# Event reader
exit_d = self.column_customization_event_reader(window, quote)
# Close window
window.close()
# Return true if closed or back, false if add or delete
return exit_d
# Event reader for column customization window
def column_customization_event_reader(self, window, quote):
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED:
self.exit = True
return True
if event == "Add":
square_footage = float(values["square_footage"])
number_columns = int(values["number_columns"])
for i in range(number_columns):
quote.accessories.add_column(square_footage, quote.lining_system.liner.sq_price)
return False
if event == "Back":