-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIP Calculator.py
More file actions
4303 lines (3759 loc) · 208 KB
/
Copy pathIP Calculator.py
File metadata and controls
4303 lines (3759 loc) · 208 KB
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
from tkinter import CENTER, W,E, Tk,Label, PhotoImage,Frame,Button,Entry,Radiobutton,IntVar
from tkinter.font import BOLD, Font
import os
import sys
def create_files_loading() :
main_window.after(100,main_root_new)
def vercion_set():
#version
global version
version = Label(main_window ,text="V 10.3" ,fg="#ffffff" ,bg="#100e17")
version.place(rely=0.01 ,relx=0.96)
###################################################
###################################################
###################################################
###################################################
###################################################
###################################################
def superscripted(val,start,end):
sup= {"0":"⁰","1":"¹","2":"²","3":"³","4":"⁴","5":"⁵","6":"⁶","7":"⁷","8":"⁸","9":"⁹"}
try:
try:
val = int(val)
except :
val = val.replace(",","")
val = int(val)
power = 0
while True:
if 2**power >= val:
break
power += 1
power = str(power)
super_script = ""
for i in power:
super_script += sup[i]
value = str(start +"2"+super_script+end)
except:
value = ""
return value
#############################################################
#############################################################
#############################################################
#############################################################
#############################################################
#############################################################
def geometry_reader():
global window_relx_geomatry_read
global window_rely_geomatry_read
root_geomatry = main_window.geometry()
window_relx = ""
window_rely = ""
window_relx_can_start = False
window_relx_can_end = False
window_rely_can_start = False
for i in root_geomatry:
for x in window_relx:
for y in range(0,10) :
if str(x) == str(y) :
window_relx_can_end = True
if window_relx_can_end == True and i == "+" :
window_rely_can_start = True
window_relx_can_start = False
if i == "+" and window_relx_can_end == False :
window_relx_can_start = True
if window_relx_can_start == True :
window_relx += i
if window_rely_can_start == True :
window_rely += i
window_relx_geomatry_read = window_relx.replace("+","")
window_rely_geomatry_read = window_rely.replace("+","")
main_window.after(20,geometry_reader)
#############################################################
#############################################################
#############################################################
def loading001():
global loading_display001
loading_display001 = 0
global loading_resolution_change_frame001
global loading_resolution_change_label001
loading_resolution_change_frame001 = Frame(main_window ,bg="#101010")
loading_resolution_change_label001= Label(loading_resolution_change_frame001,text="Loading...",bg="#101010" ,fg="#00ff0f")
def loading_001():
global loading_display001
loading_display001 += 1
loading_resolution_change_label001.config(font=Font(size=font_most ,weight=BOLD))
loading_resolution_change_frame001.place(relwidth=1 ,relheight=1)
loading_resolution_change_label001.place(relx=0.47 ,rely=0.45)
if loading_display001 <= 10 :
main_window.after(50,loading_001)
else:
loading_resolution_change_label001.destroy()
loading_resolution_change_frame001.destroy()
loading_001()
def change_fslm_vlsm():
# VLSM or FSLM Frame
global vlsm_or_flsm_label
global vlsm_or_flsm_frame
vlsm_or_flsm_frame = Frame(main_window ,bg="#100e17")
vlsm_or_flsm_label = Label(vlsm_or_flsm_frame ,bg="#100e17")
vlsm_or_flsm_label.pack()
# VLSM or FSLM RadioButton
global W100
global W101
var1 = IntVar()
W100 = Radiobutton(vlsm_or_flsm_frame, variable=var1 ,value=1
,bg="#000000" ,fg="#000000" ,activebackground="#000000" ,command=FLSM_mode ,cursor="hand2")
W101 = Radiobutton(vlsm_or_flsm_frame, variable=var1 ,value=2
,bg="#000000" ,fg="#000000" ,activebackground="#000000" ,command=VLSM_mode ,cursor="hand2")
global variable_length_label
global fixed_length_label
fixed_length_label = Button(vlsm_or_flsm_frame, text="FLSM" ,bg="#000000" ,fg="#00ff00" ,cursor="hand2" ,command=FLSM_mode,border=False ,activebackground="#000000" ,activeforeground="#00FF00")
variable_length_label = Button(vlsm_or_flsm_frame, text="VLSM" ,bg="#000000" ,fg="#00ff00" ,cursor="hand2",command=VLSM_mode,border=False ,activebackground="#000000" ,activeforeground="#00FF00")
#didplayinformation about ..
info1 = Label(main_window,text="Fixed Length Subnet-Mask",font=Font(weight=BOLD,size=8) ,bg="#100e17",fg="#00FFFF")
info2 = Label(main_window,text="Variable Length Subnet-Mask",font=Font(weight=BOLD,size=8),bg="#100e17",fg="#00FFFF")
######################################################
def info1_display(e):
global fixed_length_button_live
global info_diplay_time_wait
info_diplay_time_wait = 10
fixed_length_button_live = True
def loop():
global info_diplay_time_wait
info_diplay_time_wait += 7
if info_diplay_time_wait > 100 :
if fixed_length_button_live == True:
if real_resolution == 720:
f_size ,rel_x ,rel_y = 8 ,0.06 ,0.04
elif real_resolution == 900:
f_size ,rel_x ,rel_y = 10 ,0.06 ,0.04
else:
f_size ,rel_x ,rel_y = 13 ,0.06 ,0.04
info1.config(font=Font(size=f_size,weight=BOLD))
info1.place(relx=rel_x,rely=rel_y)
else:
main_window.after(100,loop)
loop()
######################################################
def info1_display_re(e):
global fixed_length_button_live
fixed_length_button_live = False
info1.place_forget()
######################################################
fixed_length_label.bind('<Enter>',info1_display)
fixed_length_label.bind('<Leave>',info1_display_re)
######################################################
######################################################
######################################################
def info2_display(e):
global variable_length_button_live
global info2_diplay_time_wait
info2_diplay_time_wait = 10
variable_length_button_live = True
def loop():
global info2_diplay_time_wait
info2_diplay_time_wait +=7
if info2_diplay_time_wait > 100 :
if variable_length_button_live == True:
if real_resolution == 720:
f_size ,rel_x ,rel_y = 8 ,0.12 ,0.04
elif real_resolution == 900:
f_size ,rel_x ,rel_y = 10 ,0.12 ,0.04
else:
f_size ,rel_x ,rel_y = 13 ,0.12 ,0.04
info2.config(font=Font(size=f_size,weight=BOLD))
info2.place(relx=rel_x,rely=rel_y)
else:
main_window.after(100,loop)
loop()
######################################################
def info2_display_re(e):
global variable_length_button_live
variable_length_button_live = False
info2.place_forget()
variable_length_label.bind('<Enter>',info2_display)
variable_length_label.bind('<Leave>',info2_display_re)
######################################################
######################################################
######################################################
#############################################################
#place vlms_flsm mode change radio buttons
def vlsm_flsm_radio_button_select():
if running_mode == "VLSM":
W100.deselect()
W101.select()
else:
W100.select()
W101.deselect()
main_window.after(100,vlsm_flsm_radio_button_select)
vlsm_flsm_radio_button_select()
#############################################################
#############################################################
#############################################################
#############################################################
#############################################################
#############################################################
def loading002():
global loading_display
loading_display = 0
global loading_resolution_change_frame
global loading_resolution_change_label
loading_resolution_change_frame = Frame(main_window ,bg="#101010")
loading_resolution_change_label = Label(loading_resolution_change_frame,text="Loading...",bg="#101010" ,fg="#00ff0f")
def loading_show_when_resolution_change():
global loading_display
loading_display += 1
loading_resolution_change_label.config(font=Font(size=font_most ,weight=BOLD))
loading_resolution_change_frame.place(relwidth=1 ,relheight=1)
loading_resolution_change_label.place(relx=0.47 ,rely=0.45)
if loading_display <= 10 :
main_window.after(125,loading_show_when_resolution_change)
else:
loading_resolution_change_label.destroy()
loading_resolution_change_frame.destroy()
loading_show_when_resolution_change()
#############################################################
#############################################################
#############################################################
#############################################################
#############################################################
#############################################################
def auto_close_side_panel(e):
global side_panel_open
if side_panel_open == True :
side_panel_open = False
global close_x
close_x = 0.76
setting_button.config(command=display_side_panel ,activebackground="#100e17")
def closing():
global close_x
close_x += 0.02
side_panel_frame.place(relx=close_x ,rely=0)
if close_x > 1 :
pass
else:
main_window.after(8,closing)
closing()
output_frame1.place(relwidth = 0.31 ,relheight=0.25 ,relx= 0.5 ,rely=0.13 )
output_frame2.place(relwidth = 0.487 ,relheight=0.2 ,relx= 0.42,rely=0.4 )
output_frame3.place(relwidth = 0.288 ,relheight=0.31 ,relx= 0.1 ,rely=0.62 )
output_frame4.place(relwidth = 0.288 ,relheight=0.31 ,relx= 0.45 ,rely=0.62 )
#############################################################
#############################################################
#############################################################
#############################################################
#############################################################
#############################################################
def side_panel():
global side_panel_frame
global side_panel_label
side_panel_frame = Frame(main_window ,bg="#100e17" )
side_panel_frame.pack(side="right")
side_panel_label = Label(side_panel_frame ,bg="#100e17" )
side_panel_label.place(rely=0,relx=0)
#############################################################
#############################################################
#############################################################
def p720_button_change(e):
p720_button.config(bg="#00FFFF" ,fg="#000000" ,border=False)
def p720_button_change_re(e):
if real_resolution != 720:
p720_button.config(fg="#00FFFF" ,bg="#101010" ,border=1)
else:
p720_button.config(fg="#ff0000" ,bg="#101010" ,border=1)
#############################################################
def p900_button_change(e):
p900_button.config(fg="#000000" ,bg="#00FFFF" ,border=False)
def p900_button_change_re(e):
if real_resolution != 900:
p900_button.config(fg="#00FFFF" ,bg="#101010" ,border=1)
else:
p900_button.config(fg="#ff0000" ,bg="#101010" ,border=1)
#############################################################
def p1080_button_change(e):
p1080_button.config(fg="#000000" ,bg="#00FFFF" ,border=False)
def p1080_button_change_re(e):
if real_resolution != 1080:
p1080_button.config(fg="#00FFFF" ,bg="#101010" ,border=1)
else:
p1080_button.config(fg="#ff0000" ,bg="#101010" ,border=1)
#############################################################
#############################################################
def resolution_setting_save(resolution):
resolution = str(resolution)
if int(resolution) == 720 :
width = "1280"
elif int(resolution) == 900 :
width = "1600"
else:
width = "1920"
f = open('Sources\\Settings\\Resolution_width\\resolution_width.rapa',"w")
f.write(width)
f.close()
f = open('Sources\\Settings\\Resolution_height\\resolution_height.rapa',"w")
f.write(resolution)
f.close()
#############################################################
def change_resolution_to_720p():
global real_resolution
if real_resolution != 720 :
loading002()
fonts_720p()
real_resolution = 720
p900_button.config(fg="#00FFFF" ,bg="#101010" )
p1080_button.config(fg="#00FFFF" ,bg="#101010")
p720_button.config(fg="#ff0000" ,bg="#101010")
check_resolution()
vlsm_check_resolution()
resolution_setting_save(real_resolution)
#############################################################
def change_resolution_to_900p():
global real_resolution
if real_resolution != 900 :
loading002()
fonts_900p()
real_resolution = 900
p720_button.config(fg="#00FFFF" ,bg="#101010")
p1080_button.config(fg="#00FFFF" ,bg="#101010")
p900_button.config(fg="#ff0000" ,bg="#101010" )
check_resolution()
vlsm_check_resolution()
resolution_setting_save(real_resolution)
#############################################################
def change_resolution_to_1080p():
global real_resolution
if real_resolution != 1080 :
loading002()
fonts_1080p()
real_resolution = 1080
p720_button.config(fg="#00FFFF" ,bg="#101010" ,border=1)
p900_button.config(fg="#00FFFF" ,bg="#101010" ,border=1)
p1080_button.config(fg="#ff0000" ,bg="#101010")
check_resolution()
vlsm_check_resolution()
resolution_setting_save(real_resolution)
global resolution_label
global p720_button
global p900_button
global p1080_button
resolution_label = Label(side_panel_frame ,text="Resolution :" ,fg="#FFFFFF" ,bg="#000000")
resolution_label.place(rely=0.15 ,relx=0.1)
p720_button = Button(side_panel_frame ,text="720p (1280 X 720)" ,fg="#00FFFF" ,bg="#101010" ,border=1 ,
cursor="hand2",command=change_resolution_to_720p)
p720_button.place(rely=0.19 , relwidth=0.9 ,relx=0.05)
p900_button = Button(side_panel_frame ,text="900p (1600 X 900)" ,fg="#00FFFF" ,bg="#101010" ,border=1 ,
cursor="hand2" ,command=change_resolution_to_900p )
p900_button.place(rely=0.24 , relwidth=0.9 ,relx=0.05)
p1080_button = Button(side_panel_frame ,text="1080p (1920 X 1080)" ,fg="#00FFFF" ,bg="#101010" ,border=1 ,
cursor="hand2" ,command=change_resolution_to_1080p)
p1080_button.place(rely=0.29 , relwidth=0.9 ,relx=0.05)
if real_resolution == 720 :
p720_button.config(fg="#ff0000" ,bg="#101010")
if real_resolution == 900 :
p900_button.config(fg="#ff0000" ,bg="#101010")
if real_resolution == 1080 :
p1080_button.config(fg="#ff0000" ,bg="#101010")
p720_button.bind('<Enter>' ,p720_button_change)
p720_button.bind('<Leave>' ,p720_button_change_re)
p900_button.bind('<Enter>' ,p900_button_change)
p900_button.bind('<Leave>' ,p900_button_change_re)
p1080_button.bind('<Enter>' ,p1080_button_change)
p1080_button.bind('<Leave>' ,p1080_button_change_re)
#############################################################
#############################################################
def transparency_on_now ():
global theme_transparent_value
transparent_on_button.config(text="Enabled")
transparent_off_button.config(text="Disable Transparency")
transparent_off_button.config(fg="#00FFFF" ,bg="#101010" ,border=1)
transparent_on_button.config(fg="#ff0000" ,bg="#101010" ,border=1)
try:
file = open("Sources\\Settings\\Theme\\transparency_value_temp.rapa" ,"r")
theme_transparent_value = float(file.readline())
file.close()
except :
theme_transparent_value = 0.9
main_window.attributes('-alpha',theme_transparent_value)
f = open("Sources\\Settings\\Theme\\transparency.rapa","w")
f.write(str(theme_transparent_value))
f.close()
def set_radio_button():
radio_button_list = [W1,W2,W3,W4,W5]
if real_resolution == 720 :
transparent_radio_button_rely = trancparency_radio_button_rely_720p
if real_resolution == 900 :
transparent_radio_button_rely = trancparency_radio_button_rely_900p
if real_resolution == 1080 :
transparent_radio_button_rely = trancparency_radio_button_rely_1080p
relx_radio = 0.55
for radio_button in radio_button_list :
radio_button.place(relx=relx_radio ,rely=transparent_radio_button_rely)
relx_radio = relx_radio + 0.05
set_radio_button()
def transparency_off_now ():
global theme_transparent_value
transparent_on_button.config(text="Enable Transparency")
transparent_off_button.config(text="Disabled")
transparent_on_button.config(fg="#00FFFF" ,bg="#101010" ,border=1)
transparent_off_button.config(fg="#ff0000" ,bg="#101010" ,border=1)
if theme_transparent_value != 1 :
theme_transparent_value = 1
main_window.attributes('-alpha',1)
f = open("Sources\\Settings\\Theme\\transparency.rapa","w")
f.write("1")
f.close()
W1.place_forget()
W2.place_forget()
W3.place_forget()
W4.place_forget()
W5.place_forget()
def transparent_on_button_change(e):
transparent_on_button.config(bg="#00FFFF" ,fg="#000000" ,border=False)
try:
f = open("Sources\\Settings\\Theme\\transparency_value_temp.rapa" ,"r")
temp_val = float(f.readline())
f.close()
except:
temp_val = 0.9
main_window.attributes('-alpha',temp_val)
def transparent_on_button_change_re(e):
if theme_transparent_value ==1 :
transparent_on_button.config(fg="#00FFFF" ,bg="#101010" ,border=1)
else:
transparent_on_button.config(fg="#ff0000" ,bg="#101010" ,border=1)
main_window.attributes('-alpha',theme_transparent_value)
def transparent_off_button_change(e):
transparent_off_button.config(fg="#000000" ,bg="#00FFFF" ,border=False)
main_window.attributes('-alpha',1)
def transparent_off_button_change_re(e):
if theme_transparent_value != 1 :
transparent_off_button.config(fg="#00FFFF" ,bg="#101010" ,border=1)
else:
transparent_off_button.config(fg="#ff0000" ,bg="#101010" ,border=1)
main_window.attributes('-alpha',theme_transparent_value)
def transparancy_radio_button1():
global theme_transparent_value
theme_transparent_value = 0.9
f = open("Sources\\Settings\\Theme\\transparency_value_temp.rapa" ,"w")
f.write(str(theme_transparent_value))
f.close()
transparency_on_now ()
def transparancy_radio_button2():
global theme_transparent_value
theme_transparent_value = 0.85
f = open("Sources\\Settings\\Theme\\transparency_value_temp.rapa" ,"w")
f.write(str(theme_transparent_value))
f.close()
transparency_on_now ()
def transparancy_radio_button3():
global theme_transparent_value
theme_transparent_value = 0.8
f = open("Sources\\Settings\\Theme\\transparency_value_temp.rapa" ,"w")
f.write(str(theme_transparent_value))
f.close()
transparency_on_now ()
def transparancy_radio_button4():
global theme_transparent_value
theme_transparent_value = 0.75
f = open("Sources\\Settings\\Theme\\transparency_value_temp.rapa" ,"w")
f.write(str(theme_transparent_value))
f.close()
transparency_on_now ()
def transparancy_radio_button5():
global theme_transparent_value
theme_transparent_value = 0.7
f = open("Sources\\Settings\\Theme\\transparency_value_temp.rapa" ,"w")
f.write(str(theme_transparent_value))
f.close()
transparency_on_now ()
global W1
global W2
global W3
global W4
global W5
var = IntVar()
W1 = Radiobutton(side_panel_frame, variable=var ,value=1 ,cursor="hand2"
,bg="#000000" ,fg="#0000ff" ,activebackground="#000000" ,command=transparancy_radio_button1 )
W2 = Radiobutton(side_panel_frame, variable=var ,value=2 ,cursor="hand2"
,bg="#000000" ,fg="#0000ff" ,activebackground="#000000" ,command=transparancy_radio_button2 )
W3 = Radiobutton(side_panel_frame, variable=var ,value=3 ,cursor="hand2"
,bg="#000000" ,fg="#0000ff" ,activebackground="#000000" ,command=transparancy_radio_button3 )
W4 = Radiobutton(side_panel_frame, variable=var ,value=4 ,cursor="hand2"
,bg="#000000" ,fg="#0000ff" ,activebackground="#000000" ,command=transparancy_radio_button4 )
W5 = Radiobutton(side_panel_frame, variable=var ,value=5 ,cursor="hand2"
,bg="#000000" ,fg="#0000ff" ,activebackground="#000000" ,command=transparancy_radio_button5 )
global transparent_mode_label
global transparent_on_button
global transparent_off_button
transparent_mode_label = Label(side_panel_frame ,text="Transparency :"
,fg="#FFFFFF" ,bg="#000000")
transparent_mode_label.place(rely=0.4 ,relx=0.1)
transparent_on_button = Button(side_panel_frame ,text="Enable Transparency" ,fg="#00FFFF" ,bg="#101010"
,border=1 ,cursor="hand2" ,command=transparency_on_now)
transparent_on_button.place(rely=0.44 , relwidth=0.9 ,relx=0.05)
transparent_off_button = Button(side_panel_frame ,text="Disable Transparency" ,fg="#00FFFF" ,bg="#101010"
,border=1 ,cursor="hand2" ,command=transparency_off_now )
transparent_off_button.place(rely=0.49 , relwidth=0.9 ,relx=0.05)
transparent_on_button.bind('<Enter>' ,transparent_on_button_change )
transparent_on_button.bind('<Leave>' , transparent_on_button_change_re)
transparent_off_button.bind('<Enter>' ,transparent_off_button_change )
transparent_off_button.bind('<Leave>' , transparent_off_button_change_re)
if theme_transparent_value == 1:
transparency_off_now ()
else:
transparency_on_now ()
#############################################################
#############################################################
def transparency_radio_button_select():
if theme_transparent_value == 1:
pass
else:
if theme_transparent_value == 0.9 :
W1.select()
W2.deselect()
W3.deselect()
W4.deselect()
W5.deselect()
elif theme_transparent_value == 0.85 :
W2.select()
W1.deselect()
W3.deselect()
W4.deselect()
W5.deselect()
elif theme_transparent_value == 0.8 :
W3.select()
W1.deselect()
W2.deselect()
W4.deselect()
W5.deselect()
elif theme_transparent_value == 0.75 :
W4.select()
W1.deselect()
W2.deselect()
W3.deselect()
W5.deselect()
else:
W5.select()
W1.deselect()
W2.deselect()
W3.deselect()
W4.deselect()
main_window.after(100,transparency_radio_button_select)
transparency_radio_button_select()
#############################################################
#############################################################
global close_side_panel
def close_side_panel():
global side_panel_open
side_panel_open = False
global close_x
close_x = 0.76
setting_button.config(command=display_side_panel ,activebackground="#100e17")
def closing():
global close_x
close_x += 0.02
side_panel_frame.place(relx=close_x ,rely=0)
if close_x > 1 :
pass
else:
main_window.after(8,closing)
closing()
output_frame1.place(relwidth = 0.31 ,relheight=0.25 ,relx= 0.5 ,rely=0.13 )
output_frame2.place(relwidth = 0.487 ,relheight=0.2 ,relx= 0.42,rely=0.4 )
output_frame3.place(relwidth = 0.288 ,relheight=0.31 ,relx= 0.1 ,rely=0.62 )
output_frame4.place(relwidth = 0.288 ,relheight=0.31 ,relx= 0.45 ,rely=0.62 )
#############################################################
#############################################################
global display_side_panel
def display_side_panel():
global side_panel_open
side_panel_open = True
global open_x
open_x = 1
setting_button.config(command=close_side_panel ,activebackground="#000000")
def opening():
global open_x
open_x -= 0.02
side_panel_frame.place(relx=open_x ,rely=0)
if open_x < 0.76 :
pass
else:
main_window.after(8,opening)
opening()
output_frame1.place(relwidth = 0.31 ,relheight=0.25 ,relx= 0.416 ,rely=0.13 )
output_frame2.place(relwidth = 0.487 ,relheight=0.2 ,relx= 0.24,rely=0.425 )
output_frame3.place(relwidth = 0.288 ,relheight=0.31 ,relx= 0.1 ,rely=0.65 )
output_frame4.place(relwidth = 0.288 ,relheight=0.31 ,relx= 0.434 ,rely=0.65 )
############################################################
#############################################################
global setting_button_set
def setting_button_set():
global setting_button
setting_button = Button(main_window ,bg="#100e17" ,cursor="hand2" ,image=setting_button_image
,activebackground="#100e17" ,border=False ,command=display_side_panel )
setting_button.place(rely=0.94 ,relx=0.97)
def change_setting_button(e):
setting_button.config(image=setting_button_re_image)
def change_setting_button_re(e):
setting_button.config(image=setting_button_image)
setting_button.bind('<Enter>',change_setting_button)
setting_button.bind('<Leave>',change_setting_button_re)
side_panel_frame.pack_forget()
#############################################################
#############################################################
#############################################################
def VLSM_mode():
global first_time_change_vlsm_flsm_mode
global running_mode
if first_time_change_vlsm_flsm_mode == True or running_mode == "FLSM":
first_time_change_vlsm_flsm_mode = False
loading001()
try:
close_side_panel()
except:
pass
running_mode = "VLSM"
f = open("Sources\\Settings\\Running_mode\\mode.rapa","w")
f.write("VLSM")
f.close()
vlsm_main_window.place(relwidth=1,relheight=1)
def FLSM_mode():
global first_time_change_vlsm_flsm_mode
global running_mode
if first_time_change_vlsm_flsm_mode == True or running_mode == "VLSM":
first_time_change_vlsm_flsm_mode = False
loading001()
try:
close_side_panel()
except:
pass
running_mode = "FLSM"
f = open("Sources\\Settings\\Running_mode\\mode.rapa","w")
f.write("FLSM")
f.close()
vlsm_main_window.place_forget()
#############################################################
#############################################################
#############################################################
#############################################################
#############################################################
#############################################################
def fonts_1080p() :
global loading_title_font_size
global loading_font_most
global font_most
global font_most_1
global font_table_title
global vlsm_flsm_font
global available_host_label_font
global vlsm_table_font
font_most = 17
font_most_1 = 17
font_table_title = 20
loading_font_most = 13
loading_title_font_size = 23
vlsm_flsm_font = 14
available_host_label_font = 12
vlsm_table_font = 15
##########################################################
def fonts_900p() :
global loading_title_font_size
global loading_font_most
global font_most
global font_most_1
global font_table_title
global vlsm_flsm_font
global available_host_label_font
global vlsm_table_font
font_most = 14
font_most_1 = 13
font_table_title = 17
loading_font_most = 11
loading_title_font_size=19
vlsm_flsm_font = 11
available_host_label_font = 10
vlsm_table_font = 13
##########################################################
def fonts_720p() :
global loading_title_font_size
global loading_font_most
global font_most
global font_most_1
global font_table_title
global vlsm_flsm_font
global available_host_label_font
global vlsm_table_font
font_most = 11
font_most_1 = 10
font_table_title = 15
loading_font_most = 9
loading_title_font_size=15
vlsm_flsm_font = 9
available_host_label_font = 8
vlsm_table_font = 10
##########################################################
##########################################################
##########################################################
##########################################################
##########################################################
##########################################################
##########################################################
##########################################################
##########################################################
##########################################################
##########################################################
##########################################################
##########################################################
##########################################################
##########################################################
##########################################################
##########################################################
def vlsm_set_resolution(flsm_vlsm_mode_image,flsm_vlsm_frame_relwidth,
flsm_vlsm_frame_relheight,flsm_vlsm_frame_rely,fixed_variable_length_button_rely,
fixed_variable_length_radiobutton_rely,vlsm_input_frame_image,
vlsm_input_ipaddress_entry_rely,
vlsm_title_inputipaddress_label_rely,vlsm_input_networks_entry_rely,
vlsm_title_inputnetworks_label_rely,
calculate_button_image_def,calculate_button_image_re_def,
calculate_button_error_image_def,reset_button_image,
vlsm_table_head_image_def,vlsm_table_row_1_image_def,vlsm_table_head_end_image_def,
vlsm_table_th_rely_def,vlsm_table_th_relx_def,vlsm_table_td_relx,vlsm_table_td1_rely,vlsm_table_td_rely_change,
table_hiding_frame_relx_def,vlsm_table_range_split_dash1_relx,vlsm_table_range_split_dash2_relx,
table_frame_change_special_button_image_def,table_frame_change_special_button_re_image_def,table_frame_change_special_button_error_image_def,
vlsm_table_head_full_image_def,vlsm_table_head_end_full_image_def,
table_frame_change_special_button_back_image_def,table_frame_change_special_button_back_re_image_def):
global vlsm_input_frame_rel_y
global vlsm_input_frame_rel_height
if real_resolution == 1080 :
vlsm_input_frame_rel_height=0.8
vlsm_input_frame_rel_y = 0.12
W100_relx = 0.14
W101_relx = 0.55
fixed_length_button_relx = 0.22
variable_length_button_relx = 0.63
elif real_resolution == 900 :
vlsm_input_frame_rel_height=0.8
vlsm_input_frame_rel_y = 0.12
W100_relx = 0.16
W101_relx = 0.54
fixed_length_button_relx = 0.25
variable_length_button_relx = 0.63
else:
vlsm_input_frame_rel_height=0.84
vlsm_input_frame_rel_y = 0.114
W100_relx = 0.14
W101_relx = 0.51
fixed_length_button_relx = 0.25
variable_length_button_relx = 0.62
vlsm_table_th_relx = vlsm_table_th_relx_def
vlsm_table_th_rely = vlsm_table_th_rely_def
#fslm vlsm mode change frame
if full_table_enable == False:
vlsm_input_frame.place(relwidth=0.31 ,relheight=vlsm_input_frame_rel_height,relx=0.05 ,rely=vlsm_input_frame_rel_y)
vlsm_input_label.config(image=vlsm_input_frame_image)
vlsm_or_flsm_label.config(image=flsm_vlsm_mode_image)
vlsm_or_flsm_frame.place(relwidth=flsm_vlsm_frame_relwidth ,relheight=flsm_vlsm_frame_relheight ,relx=0.07 ,rely=flsm_vlsm_frame_rely)
W100.place(relx=W100_relx,rely=fixed_variable_length_radiobutton_rely)
W101.place(relx=W101_relx,rely=fixed_variable_length_radiobutton_rely)
variable_length_label.config(font=Font(weight=BOLD,size=vlsm_flsm_font))
fixed_length_label.config(font=Font(weight=BOLD,size=vlsm_flsm_font))
fixed_length_label.place(relx=fixed_length_button_relx,rely=fixed_variable_length_button_rely)
variable_length_label.place(relx=variable_length_button_relx,rely=fixed_variable_length_button_rely)
# input labels , entrys
vlsm_input_ipaddress.place(rely=vlsm_input_ipaddress_entry_rely ,relx=0.55)
vlsm_title_inputipaddress.place(rely=vlsm_title_inputipaddress_label_rely ,relx=0.11)
vlsm_input_networks.place(rely=vlsm_input_networks_entry_rely ,relx=0.55)
vlsm_title_inputnetworks.place(rely=vlsm_title_inputnetworks_label_rely ,relx=0.11)
vlsm_input_dash0.place(rely= vlsm_title_inputipaddress_label_rely ,relx=0.45)
vlsm_input_dash1.place(rely= vlsm_title_inputnetworks_label_rely ,relx=0.45)
#set fonts font most size
widgets = [vlsm_input_ipaddress,vlsm_title_inputipaddress,vlsm_input_networks,vlsm_title_inputnetworks,
vlsm_input_dash0,vlsm_input_dash1]
for widget in widgets :
widget.config(font=Font(size=font_most ,weight=BOLD))
for widget in vlsm_host_input_label_list :
widget.config(font=Font(size=vlsm_flsm_font+1 ,weight=BOLD))
for widget in vlsm_host_input_label_dash_list :
widget.config(font=Font(size=vlsm_flsm_font+1 ,weight=BOLD))
for widget in vlsm_host_input_entry_list :
widget.config(font=Font(size=vlsm_flsm_font+1 ,weight=BOLD))
#button widget loading
global calculate_button_image , calculate_button_image_re
calculate_button_image,calculate_button_image_re=calculate_button_image_def,calculate_button_image_re_def
global calculate_button_error_image
calculate_button_error_image = calculate_button_error_image_def
#button
vlsm_calculate_button.config(image=calculate_button_image)
vlsm_reset_button.config(image=reset_button_image)
vlsm_available_host_label.config(font=Font(size=available_host_label_font,weight=BOLD))
#output label table
global vlsm_table_row_1_image
vlsm_table_row_1_image = vlsm_table_row_1_image_def
for widget in vlsm_table_rows_list :
widget.config(image=vlsm_table_row_1_image)
#table rows labels
vlsm_table_th_relx = vlsm_table_th_relx_def
vlsm_table_th_rely = vlsm_table_th_rely_def
index = 0
for title_lable in vlsm_table_head_list:
title_lable.config(font=Font(size=font_most,weight=BOLD))
title_lable.config(title_lable.place(relx=vlsm_table_th_relx[index],rely=vlsm_table_th_rely))
index += 1
#table lables config
for label in table_td_rows_lables :
label.config(font=Font(size=vlsm_table_font ,weight=BOLD))
count_table_row = 0
for row in table_td_rows_lable_lists :
index=0
if count_table_row == 0 :
vlsm_table_lable_rely = vlsm_table_td1_rely
else:
vlsm_table_lable_rely += vlsm_table_td_rely_change
count_table_row += 1
for lable in row:
lable.place(relx=vlsm_table_td_relx[index] ,rely=vlsm_table_lable_rely)
index+=1
#place dash in range
count = 1
for i in vlsm_table_all_dashes:
index = 0
for i in i :
if index == 0 :
vlsm_table_dash_rely = vlsm_table_td1_rely
else:
vlsm_table_dash_rely += vlsm_table_td_rely_change
if count == 1:
rel_x_dash = vlsm_table_range_split_dash1_relx
else:
rel_x_dash = vlsm_table_range_split_dash2_relx
i.place(relx=rel_x_dash,rely=vlsm_table_dash_rely)
index += 1
count += 1
for i in vlsm_table_range1_spliter+vlsm_table_range2_spliter:
i.config(font=Font(weight=BOLD,size=vlsm_flsm_font))
# table hiding frame
global table_hiding_frame_relx
table_hiding_frame_relx = table_hiding_frame_relx_def
table_hiding_frame.place(relx=table_hiding_frame_relx ,rely=0.1,relwidth=0.2 ,relheight=1)
#change table special button
global table_frame_change_special_button_image
table_frame_change_special_button_image = table_frame_change_special_button_image_def
global table_frame_change_special_button_re_image
table_frame_change_special_button_re_image = table_frame_change_special_button_re_image_def
global table_frame_change_special_button_back_image
global table_frame_change_special_button_back_re_image
global table_frame_change_special_button_error_image
table_frame_change_special_button_error_image = table_frame_change_special_button_error_image_def
table_frame_change_special_button_back_image = table_frame_change_special_button_back_image_def,
table_frame_change_special_button_back_re_image = table_frame_change_special_button_back_re_image_def
if vlsm_calculation_done == True:
if full_table_enable == False :
table_change_special_button.config(image=table_frame_change_special_button_image)
else:
table_change_special_button.config(image=table_frame_change_special_button_back_image)
else:
table_change_special_button.config(image=table_frame_change_special_button_error_image)
#table head 2nd image
global vlsm_table_head_end_image
vlsm_table_head_end_image = vlsm_table_head_end_image_def
global vlsm_table_head_full_image
vlsm_table_head_full_image = vlsm_table_head_full_image_def
global vlsm_table_head_end_full_image
vlsm_table_head_end_full_image = vlsm_table_head_end_full_image_def
global vlsm_table_head_image
vlsm_table_head_image = vlsm_table_head_image_def
if full_table_enable == False:
vlsm_table_head_label.config(image = vlsm_table_head_image_def)
vlsm_table_last_row.config(image=vlsm_table_head_end_image)
else:
vlsm_table_head_label.config(image = vlsm_table_head_full_image)
vlsm_table_last_row.config(image=vlsm_table_head_end_full_image)