-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmp_advanced.py
5734 lines (5306 loc) · 288 KB
/
mp_advanced.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 datetime
import pickle
import random
import tkinter as tk
from tkinter import filedialog, ttk, messagebox
from tkinter import StringVar
import os
import pygame
import re
from tkinter.ttk import Progressbar, Combobox
import sched, time
import sys
from mutagen.easyid3 import EasyID3
from mutagen.mp3 import MP3
from PIL import ImageTk, Image
import subprocess
import math
import shutil
import urllib3
from bs4 import BeautifulSoup
from abc import ABC
from tkinter import font
from urllib3.exceptions import NewConnectionError
from fractions import Fraction
from PIL import GifImagePlugin #used for animated gifs
class Playlist:
def __init__(self):
self.isSongPause = False
self.isSongStopped = False
self.VolumeLevel=1.0
self.useMassFileEditor=False
self.dirFilePath = None
self.danthologyMode=False
self.danthologyDuration=0
self.danthologyTimer=0
self.windowOpacity=1.0
self.progressTime = "Ascending" #possible values: Ascending and Descending
self.skin=0
self.SHUFFLE = False
self.isListOrdered = 17 #0-on songrating ; 1-sorted by name 2-sorted by name reversed; 3-random ....;
self.validFiles = []
self.slideImages = []
self.slideImagesTransitionSeconds = 0
self.usePlayerTitleTransition = True
self.playingFileNameTransition = "separation" # values : separation, typewriting, none
self.usingSlideShow = False
self.slideImageIndex = 0
self.currentSongIndex = None
self.currentSongPosition = 0
self.REPEAT = 1 # 1 is value for repeat all, 0 - repeat off, 2, repeat one, 3 - repeat none
self.RESUMED=False
self.viewModel = "COMPACT" # COMPACT value on this one will make the playList compact.
self.playTime = 0
self.customFont = None
self.customElementBackground = None
self.customLabelBackground = None
self.customBackgroundPicture = None
self.customFontColor = None
self.customChangeBackgroundedLabelsColor = None
self.userCreatedColors = []
self.ProgressBarType = "determinate"
self.LyricsActiveSource = LyricsOnlineSources[0] #default, all sources
self.resetSettings = False
self.useCrossFade = False
self.crossFadeDuration = 10 #default value not customizable
self.crossFadeGap = 3 #default value not customizable
self.shufflingHistory = []
self.playerXPos = 100 #Music player X coordinate
self.playerYPos = 100 #Music player Y coordinate
self.listboxNoRows = 35
self.listboxWidth = "Auto"
self.buttonSpacing = 50 #default value
self.keepSongsStats = True
self.PlaylistListenedTime = 0
self.BornDate = datetime.datetime.now()
class Song:
def __init__(self, filename, filepath, filesize):
self.fileName = filename
self.filePath = filepath
self.fileSize = filesize
self.Rating = 0
self.NumberOfPlays = 0
audio = MP3(self.filePath)
self.sample_rate = audio.info.sample_rate
self.channels = audio.info.channels
self.Length = audio.info.length
self.SongListenedTime = 0
mp3 = MP3(self.filePath) # if the mp3 file has no tags, then the tags will be added to the file.
if mp3.tags is None:
mp3.add_tags()
mp3.save()
audio = EasyID3(self.filePath)
try:
self.Genre = audio["genre"]
except: #enter here if you can't get the genre
self.Genre = "Various"
else:
self.Genre = self.Genre[0]
try:
self.Artist = audio["artist"]
except:
self.Artist = "Various"
else:
self.Artist = self.Artist[0]
try:
self.Title = audio["title"]
except:
self.Title = "Various"
else:
self.Title = self.Title[0]
try:
self.Year = audio["date"]
except:
self.Year = "Various"
else:
self.Year = self.Year[0]
try:
self.Album = audio["album"]
except:
self.Album = "Various"
else:
self.Album = self.Album[0]
self.startPos = 0
self.endPos = self.Length
self.fadein_duration = 0
self.fadeout_duration = 0
class Window(ABC): #let this class be abstract
def destroyEsc(self,event):
self.destroy()
def destroy(self):
global dialog
self.top.destroy()
if type(dialog) == Mp3TagModifierTool:
global progressViewRealTime
progressViewRealTime = 0.8 # set back the default value for progress.
dialog = None
def take_focus(self):
self.top.wm_attributes("-topmost", 1)
self.top.grab_set()
def focus_out(self, event):
window.wm_attributes("-topmost", 1)
window.grab_set()
window.focus_force()
class CuttingTool(Window):
def __init__(self, parent, fileIndex=None):
global allButtonsFont
global dialog
color = OpenFileButton["bg"] # get the color which the rest of elements is using at the moment
self.index = play_list.currentSongIndex
if fileIndex!=None:
self.index = fileIndex
if self.index != None:
self.top = tk.Toplevel(parent, bg=color)
self.top.protocol("WM_DELETE_WINDOW", self.destroy)
Window_Title = "Cutting Tool"
self.top.title(Window_Title)
self.top.geometry("410x350+100+100")
self.top.attributes('-alpha', play_list.windowOpacity)
allButtonsFont = skinOptions[2][play_list.skin]
columnOne = 10
columnTwo = 220
self.InfoLabelText = StringVar()
self.InfoLabelText.set("Welcome to MP3 Cutting capability:\n\n"
+"Please enter Start and End value and Hit OK.\n"
+"This will NOT change the original file.\n\n\n")
tk.Label(self.top, textvariable=self.InfoLabelText, fg=fontColor.get(), font=allButtonsFont, bg=color).place(x=columnOne+30, y=10)
tk.Label(self.top, text="Selected File: " + play_list.validFiles[self.index].fileName,
fg=fontColor.get(), font=allButtonsFont, bg=color).place(x=columnOne, y=100)
tk.Label(self.top, text="Start Value (0 - " + str(int(play_list.validFiles[self.index].Length)) + "):",
fg=fontColor.get(), font=allButtonsFont, bg=color).place(x=columnOne, y=140)
self.startValue = tk.Entry(self.top)
self.startValue.place(x=columnOne, y=160)
self.startValue.insert(tk.END, str(datetime.timedelta(seconds=int(play_list.validFiles[self.index].startPos))))
self.startValue.bind("<Return>", self.cutItem)
tk.Label(self.top, text="End Value (0 - " + str(int(play_list.validFiles[self.index].Length)) + "):", fg=fontColor.get(),
font=allButtonsFont, bg=color).place(x=columnOne, y=182)
self.endValue = tk.Entry(self.top)
self.endValue.place(x=columnOne, y=202)
self.endValue.insert(tk.END, str(datetime.timedelta(seconds=int(play_list.validFiles[self.index].endPos))))
self.endValue.bind("<Return>", self.cutItem)
self.buttonOK = tk.Button(self.top, text="Cut Song", command=self.okButtonPressed, bg=color, fg=fontColor.get(), font=allButtonsFont)
self.buttonOK.place(x=columnOne, y=230)
tk.Label(self.top, text="Add FadeIn: ", fg=fontColor.get(), font=allButtonsFont, bg=color).place(x=columnTwo, y=140)
self.FadeIn = StringVar()
self.FadeIn.set(str(play_list.validFiles[self.index].fadein_duration))
fadeOptions = ["5","10","15", "20"]
self.fadeInBox = Combobox(self.top, textvariable=self.FadeIn, values=fadeOptions, state="readonly", font=allButtonsFont)
self.fadeInBox.place(x=columnTwo, y=160)
self.fadeInBox.bind("<<ComboboxSelected>>", self.addFadeIn)
tk.Label(self.top, text="Add FadeOut: ", fg=fontColor.get(), font=allButtonsFont, bg=color).place(x=columnTwo, y=182)
self.FadeOut = StringVar()
self.FadeOut.set(str(play_list.validFiles[self.index].fadeout_duration))
self.fadeOutBox = Combobox(self.top, textvariable=self.FadeOut, values=fadeOptions, state="readonly", font=allButtonsFont)
self.fadeOutBox.place(x=columnTwo, y=202)
self.fadeOutBox.bind("<<ComboboxSelected>>", self.addFadeOut)
self.top.bind("<Escape>", self.destroyEsc)
self.top.bind("<Tab>", self.focus_Input)
self.addFadeInOutAll = tk.Button(self.top, text="Add Fading to All", command=self.addFadingOnPlaylist,
bg=color,
fg=fontColor.get(), font=allButtonsFont)
self.addFadeInOutAll.place(x=columnTwo, y=230)
self.restoreButton = tk.Button(self.top, text="Restore Defaults for This Song", command=self.restoreCurrentSong, bg=color, fg=fontColor.get(), font=allButtonsFont)
self.restoreButton.place(x=80, y=280)
self.restoreForAllButton = tk.Button(self.top, text="Restore Defaults for All Songs",
command=self.restoreAllSongs, bg=color, fg=fontColor.get(),
font=allButtonsFont)
self.restoreForAllButton.place(x=80, y=310)
dialog = self #each instance of CuttingTool will be assigned to this variable:
def addFadingOnPlaylist(self):
global play_list
message = ""
for song in play_list.validFiles:
if int(self.FadeIn.get()) + int(self.FadeOut.get()) > (song.endPos-song.startPos):
message+= song.fileName + "\n"
else:
song.fadein_duration = int(self.FadeIn.get())
song.fadeout_duration = int(self.FadeOut.get())
if message!= "":
messagebox.showinfo("Information", "Operation Done.\n\nFading was added to all Songs in the Playlist.\n\n"
+"Some songs are too short for such long fading: " + message)
else:
messagebox.showinfo("Information", "Operation Done.\n\nFading was added to all Songs in the Playlist.")
def restoreCurrentSong(self):
global play_list
play_list.validFiles[self.index].fadein_duration = 0
play_list.validFiles[self.index].fadeout_duration = 0
play_list.validFiles[self.index].startPos = 0
play_list.validFiles[self.index].endPos = play_list.validFiles[self.index].Length
self.FadeIn.set(str(play_list.validFiles[self.index].fadein_duration))
self.FadeOut.set(str(play_list.validFiles[self.index].fadeout_duration))
messagebox.showinfo("Information", "Operation Done.\n\nCutting\Fading was removed from current Song.")
textFadeIn.set("FadeIn: " + str(play_list.validFiles[self.index].fadein_duration)+"s")
textFadeOut.set("FadeOut: " + str(play_list.validFiles[self.index].fadeout_duration)+"s")
textEndTime.set("End Time: {:0>8}".format(str(datetime.timedelta(seconds=int(play_list.validFiles[self.index].endPos)))))
textStartTime.set("Start Time: {:0>8}".format(str(datetime.timedelta(seconds=int(play_list.validFiles[self.index].startPos)))))
self.endValue.delete(0, tk.END)
self.startValue.delete(0, tk.END)
self.endValue.insert(tk.END, str(datetime.timedelta(seconds=int(play_list.validFiles[self.index].endPos))))
self.startValue.insert(tk.END, str(datetime.timedelta(seconds=int(play_list.validFiles[self.index].startPos))))
def restoreAllSongs(self):
global play_list
for song in play_list.validFiles:
song.fadein_duration = 0
song.fadeout_duration = 0
song.startPos = 0
song.endPos = song.Length
self.FadeIn.set(str(play_list.validFiles[self.index].fadein_duration))
self.FadeOut.set(str(play_list.validFiles[self.index].fadeout_duration))
messagebox.showinfo("Information", "Operation Done.\n\nCutting\Fading was removed for all Songs in the Playlist.")
textFadeIn.set("FadeIn: " + str(play_list.validFiles[self.index].fadein_duration)+"s")
textFadeOut.set("FadeOut: " + str(play_list.validFiles[self.index].fadeout_duration)+"s")
textEndTime.set("End Time: {:0>8}".format(str(datetime.timedelta(seconds=int(play_list.validFiles[self.index].endPos)))))
textStartTime.set("Start Time: {:0>8}".format(str(datetime.timedelta(seconds=int(play_list.validFiles[self.index].startPos)))))
self.endValue.delete(0, tk.END)
self.startValue.delete(0, tk.END)
self.endValue.insert(tk.END, str(datetime.timedelta(seconds=int(play_list.validFiles[self.index].endPos))))
self.startValue.insert(tk.END, str(datetime.timedelta(seconds=int(play_list.validFiles[self.index].startPos))))
def take_focus(self):
self.top.wm_attributes("-topmost", 1)
self.top.grab_set()
self.startValue.focus_force()
def focus_Input(self, event):
if self.startValue.focus_get():
self.endValue.focus_force()
else:
self.startValue.focus_force()
def addFadeIn(self, event):
global play_list
if self.index !=None:
if int(self.FadeIn.get()) + int(self.FadeOut.get()) > (play_list.validFiles[self.index].endPos-play_list.validFiles[self.index].startPos):
messagebox.showinfo("Information", "Song PlayTime is too short for these values.")
else:
play_list.validFiles[self.index].fadein_duration = int(self.FadeIn.get())
textFadeIn.set("FadeIn: " + str(play_list.validFiles[self.index].fadein_duration)+"s")
showCurrentSongInList() #select/highlist the current song in the listbox
def addFadeOut(self, event):
global play_list
if self.index!= None:
if int(self.FadeIn.get()) + int(self.FadeOut.get()) > (play_list.validFiles[self.index].endPos-play_list.validFiles[self.index].startPos):
messagebox.showinfo("Information", "Song PlayTime is too short for these values.")
else:
play_list.validFiles[self.index].fadeout_duration = int(self.FadeOut.get())
textFadeOut.set("FadeOut: " + str(play_list.validFiles[self.index].fadeout_duration)+"s")
showCurrentSongInList() #select/highlist the current song in the listbox
def cutItem(self, event):
self.okButtonPressed()
def okButtonPressed(self):
global dialog
if self.startValue.get()!="" and self.index!=None:
st_value = computeTimeToSeconds(self.startValue.get()) #let assume user entered a value in time format.
if st_value < 0:
try:
st_value = float(self.startValue.get())
except:
messagebox.showinfo("Information", "You have entered and invalid START value.\nCutting was aborted.")
else:
if self.endValue.get() != "":
try:
ed_value = float(self.endValue.get())
except:
pass #don't say anything, the user will bey informed about this mistake in the next block
else:
if st_value > ed_value:
#interchange values
aux = st_value
st_value = ed_value
ed_value = aux
if st_value >= 0 and st_value < play_list.validFiles[self.index].Length:
play_list.validFiles[self.index].startPos = st_value
startPos = int(play_list.validFiles[self.index].startPos)
textStartTime.set("Start Time: {:0>8}".format(str(datetime.timedelta(seconds=startPos))))
else:
messagebox.showinfo("Information", "Start Value is out of range.\nThe START was kept the same.")
if self.endValue.get() != "" and self.index!=None:
ed_value = computeTimeToSeconds(self.endValue.get()) #let assume user entered a value in time format.
if ed_value < 0:
try:
ed_value = float(self.endValue.get())
except:
messagebox.showinfo("Information", "You have entered and invalid END value.\nCutting was aborted.")
else:
if self.startValue.get() !="":
try:
st_value = float(self.startValue.get())
except:
pass #don't say anything, the user was already informed about this mistake.
else:
if st_value > ed_value:
#interchange values
aux = st_value
st_value = ed_value
ed_value = aux
if ed_value > 0 and ed_value <= play_list.validFiles[self.index].Length:
play_list.validFiles[self.index].endPos = ed_value
endPos = int(play_list.validFiles[self.index].endPos)
textEndTime.set("End Time: {:0>8}".format(str(datetime.timedelta(seconds=endPos))))
else:
messagebox.showinfo("Information", "End Value is out of range.\nThe END was kept the same.")
if (self.startValue.get()=="" and self.endValue.get() == ""):
messagebox.showinfo("Information", "You didn't entered any value, so the song was left untouched.")
class SearchTool(Window):
def __init__(self, parent):
global allButtonsFont
global dialog
self.index = play_list.currentSongIndex
color = OpenFileButton["bg"] # get the color which the rest of elements is using at the moment
self.top = tk.Toplevel(parent, bg=color)
Window_Title = "Search Tool"
self.top.title(Window_Title)
self.top.geometry("300x180+100+100")
self.top.protocol("WM_DELETE_WINDOW", self.closeDestroy)
self.top.attributes('-alpha', play_list.windowOpacity)
allButtonsFont = skinOptions[2][play_list.skin]
InfoLabelText = StringVar()
InfoLabelText.set("Search for song: \n")
tk.Label(self.top, textvariable=InfoLabelText, fg=fontColor.get(), font=allButtonsFont, bg=color).pack()
tk.Label(self.top, text="Value: ", fg=fontColor.get(), font=allButtonsFont, bg=color).pack()
self.searchValue = tk.Entry(self.top)
#this is used for normal search
self.searchValue.bind("<Return>", self.showResults)
#these are used for instant search, but require multi-processing/threading:
#self.searchValue.bind("<Key>", self.showResultsOnSpace)
self.top.bind("<Key>", self.focus_Input)
self.top.bind("<Tab>", self.focus_out)
self.searchValue.bind("<Escape>", self.destroyEsc)
self.searchValue.bind("<Shift_R>", self.playPreviousSearch)
self.searchValue.bind("<Control_R>", self.playNextSearch)
self.top.bind("<Escape>", self.destroyEsc)
self.searchValue.pack(padx=5)
ForwardButton = tk.Button(self.top, text="Forward", command= lambda:self.playNextSearch("<Return>"), fg=fontColor.get(), font=allButtonsFont,
bg=color)
ForwardButton.pack(pady=10)
BackwardButton = tk.Button(self.top, text="Backward", command=lambda:self.playPreviousSearch("<Shift_R>"), fg=fontColor.get(), font=allButtonsFont,
bg=color)
BackwardButton.pack()
dialog = self
def focus_Input(self,event):
self.top.wm_attributes("-topmost", 1)
self.searchValue.focus_force()
def showResultsOnSpace(self, event):
if event.char == " ":
self.showResults(event)
def showResults(self, event):
global listBox_Song_selected_index
if len(self.searchValue.get()) > 0:
self.index=None
listbox.delete(0, tk.END)
value = self.searchValue.get().lower()
for element in play_list.validFiles:
if value in element.fileName.lower():
listbox.insert(tk.END, str(play_list.validFiles.index(element)) + ". " + element.fileName)
window.update()
else:
displayElementsOnPlaylist()
self.index=play_list.currentSongIndex
def playPreviousSearch(self, event):
global play_list
global listBox_Song_selected_index
elements = listbox.get(0, tk.END)
if self.index == None:
self.index = len(elements) - 1
elif self.index - 1 >= 0:
self.index -= 1
else:
self.index = len(elements)-1
real_index = elements[self.index]
real_index = real_index.split(". ")
real_index = real_index[0]
listBox_Song_selected_index = self.index
listbox.see(listBox_Song_selected_index) # Makes sure the given list index is visible. You can use an integer index,
listbox.selection_clear(0, tk.END) # clear existing selection
listbox.select_set(listBox_Song_selected_index)
play_list.currentSongIndex = int(real_index)
if play_list.danthologyMode == False:
play_list.currentSongPosition = 0
play_music()
def playNextSearch(self, event):
global play_list
global listBox_Song_selected_index
elements = listbox.get(0,tk.END)
if self.index == None:
self.index = 0
elif self.index + 1 < len(elements):
self.index += 1
else:
self.index = 0
real_index = elements[self.index]
real_index = real_index.split(". ")
real_index = real_index[0]
listBox_Song_selected_index = self.index
listbox.see(listBox_Song_selected_index) # Makes sure the given list index is visible. You can use an integer index,
listbox.selection_clear(0, tk.END) # clear existing selection
listbox.select_set(listBox_Song_selected_index)
play_list.currentSongIndex = int(real_index)
if play_list.danthologyMode == False:
play_list.currentSongPosition = 0
play_music()
def destroyEsc(self,event):
self.closeDestroy()
def closeDestroy(self):
global dialog
global listBox_Song_selected_index
self.top.destroy()
dialog = None
displayElementsOnPlaylist()
showCurrentSongInList()
def take_focus(self):
self.top.wm_attributes("-topmost", 1)
self.top.grab_set()
self.searchValue.focus_force()
class Slideshow(Window):
#static variables
timer = 0
seconds = None
slide_image = None
slideshow = None
top=None
Window_Title=None #can be used as a reference to check if window is opened
def __init__(self):
global allButtonsFont
color = OpenFileButton["bg"] # get the color which the rest of elements is using at the moment
Slideshow.top = tk.Toplevel(window, bg=color)
Slideshow.top.protocol("WM_DELETE_WINDOW", self.destroy)
if type(allButtonsFont) == StringVar:
allButtonsFont = allButtonsFont.get()
Slideshow.Window_Title = "Slideshow"
Slideshow.top.title(Slideshow.Window_Title)
Slideshow.top.geometry("300x300+10+10")
Slideshow.top.attributes('-alpha', play_list.windowOpacity)
Slideshow.seconds = StringVar()
if play_list.slideImagesTransitionSeconds != "0":
Slideshow.seconds.set(play_list.slideImagesTransitionSeconds)
else:
Slideshow.seconds.set("1")
durationOptions = [1,2,3,4,5,10,15,30,60]
self.infoText = StringVar()
self.infoText.set("Welcome to Slideshow!\n\n"+
"Please setup your slideshow before\n" +
"proceed or hit Continue Button\n"+
"(if available) to resume.\n\n" +
"Number of Seconds on Transition:")
self.InfoLabel = tk.Label(Slideshow.top, textvariable=self.infoText, fg=fontColor.get(), font=allButtonsFont,
bg=color)
self.InfoLabel.pack()
self.imageDuration = Combobox(Slideshow.top, textvariable=Slideshow.seconds, values=durationOptions, state="readonly", font=allButtonsFont)
self.imageDuration.pack(pady=5)
self.imageDuration.bind("<<ComboboxSelected>>", self.time_set)
self.loadImagesButton = tk.Button(Slideshow.top, text="Load Images",
command=self.loadImages, bg=color, fg=fontColor.get(),
font=allButtonsFont)
self.loadImagesButton.pack(pady=10)
self.clearImages = tk.Button(Slideshow.top, text="Clear Slideshow",
command=self.clearSlideshow, bg=color, fg=fontColor.get(),
font=allButtonsFont)
self.clearImages.pack()
self.startSlideshowButtonText = StringVar()
if int(self.seconds.get()) > 0 and len(play_list.slideImages) > 0:
self.startSlideshowButtonText.set("Continue")
else:
self.startSlideshowButtonText.set("Start")
self.startSlideshow = tk.Button(Slideshow.top, textvariable = self.startSlideshowButtonText,
command=self.start, bg=color, fg=fontColor.get(),
font=allButtonsFont)
self.startSlideshow.pack(pady=10)
self.numberOfImages = StringVar()
self.numberOfImages.set("Number of Images: " + str(len(play_list.slideImages)))
self.labelNumberOfImages = tk.Label(Slideshow.top, textvariable=self.numberOfImages, fg=fontColor.get(), font=allButtonsFont,
bg=color)
self.labelNumberOfImages.pack()
Slideshow.top.bind("<Escape>", self.destroyEsc)
Slideshow.top.bind("<Tab>", self.focus_out)
def loadImages(self):
global play_list
slidePictures = filedialog.askopenfilenames(initialdir="/", title="Please select one or more files", filetypes=(
("jpg files", "*.jpg"), ("png files", "*.png"),("gif files", "*.gif"), ("jpeg files", "*.jpeg"),("all files", "*.*")))
play_list.slideImages += list(slidePictures)
if len(play_list.slideImages) == 0:
messagebox.showinfo("Information", "Slideshow is empty. No valid files were found. Please load only .jpg, .jpeg, .png, or .gif files.")
self.numberOfImages.set("Number of Images: " + str(len(play_list.slideImages)))
def destroyEsc(self,event):
self.destroy()
def time_set(self,event):
global play_list
play_list.slideImagesTransitionSeconds = Slideshow.seconds.get()
showCurrentSongInList() #select/highlight the current song in the listbox
def clearSlideshow(self):
play_list.slideImages.clear()
Slideshow.seconds.set("1")
self.startSlideshowButtonText.set("Start")
self.numberOfImages.set("Number of Images: " + str(len(play_list.slideImages)))
def destroy(self):
global play_list
self.top.destroy()
play_list.usingSlideShow = False
Slideshow.timer = 0
Slideshow.seconds = None
Slideshow.slide_image = None
Slideshow.slideshow = None
Slideshow.top = None
Slideshow.Window_Title = None
@staticmethod
def take_focus():
Slideshow.top.wm_attributes("-topmost", 1)
Slideshow.top.grab_set()
Slideshow.top.focus_force()
@staticmethod
def countSeconds():
global play_list
if (time.time() - Slideshow.timer) >= int(Slideshow.seconds.get()):
if play_list.slideImageIndex+1 < len(play_list.slideImages):
play_list.slideImageIndex+=1
else:
play_list.slideImageIndex = 0
Slideshow.start()
if Slideshow.slide_image.width() != Slideshow.top.winfo_width() or Slideshow.slide_image.height()!= Slideshow.top.winfo_height(): #this means window was resized()
Slideshow.start() #this will redraw the image with the new size
@staticmethod
def start():
global play_list
Slideshow.timer = time.time()
play_list.usingSlideShow = True
if len(play_list.slideImages) > 0:
Slideshow.slide_image = ImageTk.PhotoImage(Image.open(play_list.slideImages[play_list.slideImageIndex]).resize((Slideshow.top.winfo_width(), Slideshow.top.winfo_height()))) # open all kind of images like this
Slideshow.slideshow = tk.Label(Slideshow.top, image=Slideshow.slide_image)
Slideshow.slideshow.pack(fill="both")
Slideshow.slideshow.place(x=0, y=0, relwidth=1, relheight=1)
else:
messagebox.showinfo("Information",
"Slideshow is empty. No valid files were found. Please load only .jpg, .jpeg or .gif files.")
class SleepingTool(Window):
def __init__(self, parent):
global allButtonsFont
global dialog
color = OpenFileButton["bg"] # get the color which the rest of elements is using at the moment
self.top = tk.Toplevel(parent, bg=color)
self.top.protocol("WM_DELETE_WINDOW", self.destroy)
Window_Title = "Sleeping Tool"
self.top.title(Window_Title)
self.top.geometry("300x230+100+100")
self.top.attributes('-alpha', play_list.windowOpacity)
if type(allButtonsFont) == StringVar:
allButtonsFont = allButtonsFont.get()
self.wakeUpScheduler = None
self.sleepTimer = 0;
self.sleepTime = 0;
self.wakeUpTimer = 0;
self.wakeUpTime = 0;
self.sleepingScheduler = None
InfoLabelText = StringVar()
InfoLabelText.set("Enter the time interval: \n")
tk.Label(self.top , textvariable=InfoLabelText, fg=fontColor.get(), font=allButtonsFont, bg=color).pack()
tk.Label(self.top , text="Timer Value: ", fg=fontColor.get(), font=allButtonsFont, bg=color).pack()
self.timeInterval = tk.Entry(self.top)
self.timeInterval.pack(padx=5)
SleepButton = tk.Button(self.top , text="Set Sleep Timer", command=self.sleeping, fg=fontColor.get(), font=allButtonsFont, bg=color)
SleepButton.pack(pady=5)
wakeUpButton = tk.Button(self.top, text="Set WakeUp Timer", command=self.wakeUp, fg=fontColor.get(), font=allButtonsFont,
bg=color)
wakeUpButton.pack(pady=5)
self.top.bind("<Escape>", self.destroyEsc)
self.top.bind("<Tab>", self.focus_Input)
dialog = self
def eventSleeping(self, event):
self.sleeping()
def focus_Input(self, event):
self.top.wm_attributes("-topmost", 1)
self.timeInterval.focus_force()
def wakeUp(self):
global dialog
if self.timeInterval.get() != "":
self.wakeUpTime = computeTimeToSeconds(self.timeInterval.get() )#let assume user entered a value in time format.
if self.wakeUpTime > 0:
self.sleepTime=0 #if it was supposed to sleep, overwrite that.
self.sleepingScheduler=None #if it was supposed to sleep, overwrite that.
textFallAsleep.set("Fall Asleep: Never") #if it was supposed to sleep, overwrite that.
self.wakeUpTimer = time.time()
self.wakeUpScheduler = sched.scheduler(time.time, time.sleep)
self.wakeUpScheduler.enter(1, 1, lambda : self.whenToWakeUp())
self.wakeUpScheduler.run()
else: #maybe user entered only seconds
try:
self.wakeUpTime = int(self.timeInterval.get())
except Exception as exp:
messagebox.showinfo("Information", "An invalid value was entered.")
else:
self.sleepTime=0 #if it was supposed to sleep, overwrite that.
self.sleepingScheduler=None #if it was supposed to sleep, overwrite that.
textFallAsleep.set("Fall Asleep: Never") #if it was supposed to sleep, overwrite that.
self.wakeUpTimer = time.time()
self.wakeUpScheduler = sched.scheduler(time.time, time.sleep)
self.wakeUpScheduler.enter(1, 1, lambda : self.whenToWakeUp())
self.wakeUpScheduler.run()
self.top.destroy()
dialog = None
def take_focus(self):
self.top.wm_attributes("-topmost", 1)
self.top.grab_set()
self.timeInterval.focus_force()
def sleeping(self):
global dialog
if self.timeInterval.get() != "":
self.sleepTime = computeTimeToSeconds(self.timeInterval.get()) #let assume user entered a value in time format.
if self.sleepTime > 0:
self.wakeUpTime = 0 #if it was supposed to wake up, overwrite that
self.wakeUpScheduler=None #if it was supposed to wake up, overwrite that
textWakeUp.set("Wake Up: Never") #if it was supposed to wake up, overwrite that
self.sleepTimer = time.time()
self.sleepingScheduler = sched.scheduler(time.time, time.sleep)
self.sleepingScheduler.enter(1, 1, lambda : self.whenToSleep())
self.sleepingScheduler.run()
textWakeUp.set("Wake Up: Never")
else: #maybe user entered only seconds
try:
self.sleepTime = int(self.timeInterval.get())
except Exception as exp:
messagebox.showinfo("Information", "An invalid value was entered.")
else:
self.wakeUpTime = 0 #if it was supposed to wake up, overwrite that
self.wakeUpScheduler=None #if it was supposed to wake up, overwrite that
textWakeUp.set("Wake Up: Never") #if it was supposed to wake up, overwrite that
self.sleepTimer = time.time()
self.sleepingScheduler = sched.scheduler(time.time, time.sleep)
self.sleepingScheduler.enter(1, 1, lambda : self.whenToSleep())
self.sleepingScheduler.run()
textWakeUp.set("Wake Up: Never")
self.top.destroy()
dialog = None
def whenToSleep(self):
secondsLeft = int(self.sleepTime - (time.time() - self.sleepTimer))
textFallAsleep.set("Fall Asleep: {:0>8}" .format(str(datetime.timedelta(seconds=secondsLeft))))
if secondsLeft<=0:
pause_music()
self.sleepTime=0
self.sleepingScheduler = None
textFallAsleep.set("Fall Asleep: Never")
else:
window.update()
self.sleepingScheduler.enter(1, 1, lambda : self.whenToSleep())
def whenToWakeUp(self):
global play_list
secondsLeft = int(self.wakeUpTime - (time.time() - self.wakeUpTimer))
textWakeUp.set("Wake Up: {:0>8}".format(str(datetime.timedelta(seconds=secondsLeft))))
if secondsLeft <= 0:
self.wakeUpTime = 0
self.wakeUpScheduler=None
play_list.VolumeLevel = 1.0
VolumeScale.set(play_list.VolumeLevel * 100)
textWakeUp.set("Wake Up: Never")
play_music()
else:
window.update()
self.wakeUpScheduler.enter(1, 1, lambda : self.whenToWakeUp())
class Customize(Window):
def __init__(self, parent):
global allButtonsFont
global dialog
global play_list
color = OpenFileButton["bg"] # get the color which the rest of elements is using at the moment
self.top = tk.Toplevel(parent, bg=color)
self.top.protocol("WM_DELETE_WINDOW", self.destroy)
Window_Title = "Customize"
self.top.title(Window_Title)
self.top.geometry("680x590+100+100")
self.top.attributes('-alpha', play_list.windowOpacity)
columnOne = 10
columnTwo = 250
columnThree = 490
if type(allButtonsFont) == StringVar:
allButtonsFont = allButtonsFont.get()
self.InfoLabelText = StringVar()
self.InfoLabelText.set("Welcome to Customize capability:\n\n"
+"Here you can customize your player appearance\n"
+"in any way you like.\n")
tk.Label(self.top, textvariable=self.InfoLabelText, fg=fontColor.get(), font=allButtonsFont, bg=color).place(x=180, y=5)
self.labelFontColor = tk.Label(self.top, text="Button&Label Color: ", fg=fontColor.get(), font=allButtonsFont, bg=color)
self.labelFontColor.place(x=columnOne, y=80)
self.colorBox = Combobox(self.top, textvariable=SkinColor, values=custom_color_list, state="readonly", font=allButtonsFont)
self.colorBox.place(x=columnOne, y=102)
self.colorBox.bind("<<ComboboxSelected>>", changingBackgroundElementColor)
tk.Label(self.top, text="Font: ", fg=fontColor.get(), font=allButtonsFont, bg=color).place(x=columnOne, y=124)
aux = allButtonsFont
allButtonsFont = StringVar() #making this string variable.
allButtonsFont.set(aux)
self.fontBox = Combobox(self.top, textvariable=allButtonsFont, values=custom_font_list, state="readonly", font=allButtonsFont.get())
self.fontBox.place(x=columnOne, y=146)
self.fontBox.bind("<<ComboboxSelected>>", customFontChange)
tk.Label(self.top, text="Label Background: ", fg=fontColor.get(), font=allButtonsFont.get(), bg=color).place(x=10, y=168)
self.labelColorBox = Combobox(self.top, textvariable=labelBackground, values=custom_color_list, state="readonly", font=allButtonsFont.get())
self.labelColorBox.place(x=columnOne, y=190)
self.labelColorBox.bind("<<ComboboxSelected>>", changingLabelBackgroundColor)
tk.Label(self.top, text="Font Color: ", fg=fontColor.get(), font=allButtonsFont.get(), bg=color).place(x=columnOne, y=212)
self.FontMainColorBox = Combobox(self.top, textvariable=fontColor, values=custom_color_list, state="readonly", font=allButtonsFont.get())
self.FontMainColorBox.place(x=columnOne, y=234)
self.FontMainColorBox.bind("<<ComboboxSelected>>", changingFontColor)
tk.Label(self.top, text="Playing Label Transition: ", fg=fontColor.get(), font=allButtonsFont.get(), bg=color).place(x=columnOne, y=256)
self.FontTransitionText = StringVar()
self.FontTransitionText.set(play_list.playingFileNameTransition)
self.FontTransitionBox = Combobox(self.top, textvariable=self.FontTransitionText, values=["none", "separation", "typewriting"], \
state="readonly", font=allButtonsFont.get())
self.FontTransitionBox.place(x=columnOne, y=278)
self.FontTransitionBox.bind("<<ComboboxSelected>>", self.changeFileNameTransition)
tk.Label(self.top, text="Color Picker Result Usage: ", fg=fontColor.get(), font=allButtonsFont.get(), bg=color).place(x=columnOne, y=300)
self.textColorPickerUsage = StringVar()
self.textColorPickerUsage.set("No Usage")
self.ColorPickerUsage = Combobox(self.top, textvariable=self.textColorPickerUsage, font=allButtonsFont.get(),
values=["No Usage", "Button&Label Color", "Label Background", "Font Color"], state="readonly")
self.ColorPickerUsage.place(x=columnOne, y=322)
self.ColorPickerUsage.bind("<<ComboboxSelected>>", self.useColorPicked)
tk.Label(self.top, text="ProgressBar Type: ", fg=fontColor.get(), font=allButtonsFont.get(), bg=color).place(x=columnOne, y=344)
self.textProgressBarType = StringVar()
self.textProgressBarType.set(play_list.ProgressBarType)
self.ProgressBarTypeBox = Combobox(self.top, textvariable=self.textProgressBarType, state="readonly",
values=["determinate", "indeterminate"], font=allButtonsFont.get())
self.ProgressBarTypeBox.place(x=columnOne, y=366)
self.ProgressBarTypeBox.bind("<<ComboboxSelected>>", self.changeProgressBar)
tk.Label(self.top, text="Playlist Max. Rows: ", fg=fontColor.get(), font=allButtonsFont.get(), bg=color).place(
x=columnOne, y=388)
self.textPlaylistRows = StringVar()
self.textPlaylistRows.set(str(play_list.listboxNoRows))
self.PlaylistNoRowsBox = Combobox(self.top, textvariable=self.textPlaylistRows, state="readonly", font=allButtonsFont.get(),
values=["22","23","24","25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35"])
self.PlaylistNoRowsBox.place(x=columnOne, y=410)
self.PlaylistNoRowsBox.bind("<<ComboboxSelected>>", self.changePlaylistHeight)
self.TitleTransitionButtonText = StringVar()
if play_list.usePlayerTitleTransition == True:
self.TitleTransitionButtonText.set("Title Transition ON")
else:
self.TitleTransitionButtonText.set("Title Transition OFF")
self.TitleTransition = tk.Button(self.top, textvariable=self.TitleTransitionButtonText, command=self.changeTitleTransition, bg=color, fg=fontColor.get(),
font=allButtonsFont.get())
self.TitleTransition.place(x=columnTwo, y=80)
tk.Label(self.top, text="Color Bg Labels: ", fg=fontColor.get(), font=allButtonsFont.get(), bg=color).place(x=columnTwo, y=110)
self.colorBgLabels = tk.IntVar()
if labelPlaying["fg"] == OpenFileButton["fg"]:
self.colorBgLabels.set(1)
else:
self.colorBgLabels.set(0)
self.RbFalse = tk.Radiobutton(self.top, text="False", variable=self.colorBgLabels, value=0, width=5, bg=color,
command=lambda: changingBackgroundedLabelsColor(self.colorBgLabels,0), fg=fontColor.get(), selectcolor="black", font=allButtonsFont.get())
self.RbTrue = tk.Radiobutton(self.top, text="True", variable=self.colorBgLabels, value=1, width=5, bg=color,
command=lambda: changingBackgroundedLabelsColor(self.colorBgLabels,0), fg=fontColor.get(), selectcolor="black", font=allButtonsFont.get())
self.RbFalse.place(x=columnTwo, y=130)
self.RbTrue.place(x=columnTwo+80, y=130)
self.browseBackgroundPicture = tk.Button(self.top, text="Load Background", command=self.browse_background_picture, bg=color, fg=fontColor.get(),
font=allButtonsFont.get())
self.browseBackgroundPicture.place(x=columnTwo, y=160)
self.startSlideshow = tk.Button(self.top, text="Start Slideshow", command=showSlideshowWindow, bg=color, fg=fontColor.get(), font=allButtonsFont.get())
self.startSlideshow.place(x=columnTwo, y=190)
tk.Label(self.top, text="Window Opacity: ", fg=fontColor.get(), font=allButtonsFont.get(),
bg=color).place(x=columnTwo, y=220)
self.WindowOpacityText = StringVar()
self.WindowOpacityText.set(play_list.windowOpacity)
self.WindowOpacityBox = Combobox(self.top, textvariable=self.WindowOpacityText, state="readonly", font=allButtonsFont.get(),
values=["1.0", "0.9", "0.8", "0.7", "0.6", "0.5"])
self.WindowOpacityBox.place(x=columnTwo, y=240)
self.WindowOpacityBox.bind("<<ComboboxSelected>>", self.changeWindowOpacity)
tk.Label(self.top, text="Progress Time: ", fg=fontColor.get(), font=allButtonsFont.get(),
bg=color).place(x=columnTwo, y=262)
self.ProgressTimeText = StringVar()
if play_list.progressTime == "Ascending":
self.ProgressTimeText.set("Playing Time")
else:
self.ProgressTimeText.set("Remaining Time")
self.ProgressTimeBox = Combobox(self.top, textvariable=self.ProgressTimeText, state="readonly", font=allButtonsFont.get(),
values=["Playing Time", "Remaining Time"])
self.ProgressTimeBox.place(x=columnTwo, y=284)
self.ProgressTimeBox.bind("<<ComboboxSelected>>", self.changeProgressTime)
tk.Label(self.top, text="Lyrics Active Source: ", fg=fontColor.get(), font=allButtonsFont.get(),
bg=color).place(x=columnTwo, y=306)
self.LyricsSourcesText = StringVar()
self.LyricsSourcesText.set(play_list.LyricsActiveSource)
self.LyricsSourcesBox = Combobox(self.top, textvariable=self.LyricsSourcesText, state="readonly", font=allButtonsFont.get(),
values=LyricsOnlineSources)
self.LyricsSourcesBox.place(x=columnTwo, y=328)
self.LyricsSourcesBox.bind("<<ComboboxSelected>>", self.changeActiveLyricsSource)
tk.Label(self.top, text="Playlist Width: ", fg=fontColor.get(), font=allButtonsFont.get(),
bg=color).place(x=columnTwo, y=350)
self.textPlaylistWidth = StringVar()
self.textPlaylistWidth.set(play_list.listboxWidth)
self.PlaylistWidthBox = Combobox(self.top, textvariable=self.textPlaylistWidth, state="readonly", font=allButtonsFont.get(),
values=["Auto", "65", "70", "75", "80", "85", "90", "95"])
self.PlaylistWidthBox.place(x=columnTwo, y=372)
self.PlaylistWidthBox.bind("<<ComboboxSelected>>", self.changePlaylistWidth)
RestoreDefaultsButton = tk.Button(self.top, text="Restore Defaults", command=self.restoreDefaults, fg=fontColor.get(), font=allButtonsFont.get(),
bg=color)
RestoreDefaultsButton.place(x=columnTwo, y=404)
self.textDanthologyMode = StringVar()
if play_list.danthologyMode == True:
self.textDanthologyMode.set("Danthology Mode ON")
else:
self.textDanthologyMode.set("Danthology Mode OFF")
self.danthologyMode = tk.Button(self.top, textvariable=self.textDanthologyMode, command=self.changeDanthologyMode, bg=color, fg=fontColor.get(),
font=allButtonsFont.get())
self.danthologyMode.place(x=columnThree, y=80)
self.DanthologyInterval = StringVar()
self.DanthologyInterval.set(play_list.danthologyDuration)
tk.Label(self.top, text="Danthology Duration: ", fg=fontColor.get(), font=allButtonsFont.get(), bg=color).place(x=columnThree, y=110)
self.DanthologySetBox = Combobox(self.top, textvariable=self.DanthologyInterval, values=["0", "10", "30", "60", "90"], state="readonly", font=allButtonsFont.get())
self.DanthologySetBox.place(x=columnThree, y=130)
self.DanthologySetBox.bind("<<ComboboxSelected>>", self.changeDanthologyDuration)
tk.Label(self.top, text="Color Picker: ", fg=fontColor.get(), font=allButtonsFont.get(),
bg=color).place(x=columnThree, y=152)
self.scaleRed = tk.Scale(self.top, from_=0, to=255, orient=tk.HORIZONTAL, fg=fontColor.get(), font=allButtonsFont.get(), bg=color, length=140, \
sliderlength=10, width=10, bd=1, label="Red:")
self.scaleRed.place(x=columnThree, y=172)
self.scaleRed.bind("<ButtonRelease-1>", self.composeColor)
self.scaleGreen = tk.Scale(self.top, from_=0, to=255, orient=tk.HORIZONTAL, fg=fontColor.get(), length=140, \
font=allButtonsFont.get(), bg=color, sliderlength=10, width=10, bd=1, label="Green:")
self.scaleGreen.place(x=columnThree, y=232)
self.scaleGreen.bind("<ButtonRelease-1>", self.composeColor)
self.scaleBlue = tk.Scale(self.top, from_=0, to=255, orient=tk.HORIZONTAL, fg=fontColor.get(), length=140, \
font=allButtonsFont.get(), bg=color, sliderlength=10, width=10, bd=1, label="Blue:")
self.scaleBlue.place(x=columnThree, y=292)
self.scaleBlue.bind("<ButtonRelease-1>", self.composeColor)
self.ColorPickerResult = tk.Label(self.top, text=" Result ", fg=fontColor.get(), font=allButtonsFont.get(),
bg="black")
self.ColorPickerResult.place(x=columnThree, y=352)
self.textButtonSpace = StringVar()
self.textButtonSpace.set(str(play_list.buttonSpacing))
tk.Label(self.top, text="Element Spacing: ", fg=fontColor.get(), font=allButtonsFont.get(), bg=color).place(
x=columnThree, y=375)
self.buttonSpacingBox = Combobox(self.top, textvariable=self.textButtonSpace,
values=["15","20", "25", "30", "35", "40", "45", "50", "55", "60"], state="readonly",
font=allButtonsFont.get())
self.buttonSpacingBox.place(x=columnThree, y=397)
self.buttonSpacingBox.bind("<<ComboboxSelected>>", self.changeButtonSpacing)
self.MaintainSongsStats = tk.IntVar()
self.MaintainSongsStats.set(int(play_list.keepSongsStats))
tk.Checkbutton(self.top, text="Maintain Songs Stats on All Playlists.", fg=fontColor.get(), font=allButtonsFont.get(),
bg=color, variable=self.MaintainSongsStats, command=self.enableDisableSongsStatsKeeping,
selectcolor="black").place(x=200, y=440)
self.MassFileEditorUsage = tk.IntVar()
self.MassFileEditorUsage.set(play_list.useMassFileEditor)
tk.Checkbutton(self.top, text="Use mass file editor capabilities.", fg=fontColor.get(), font=allButtonsFont.get(),
bg=color, variable=self.MassFileEditorUsage, command=self.enableDisableMassFileEditor,
selectcolor="black").place(x=200, y=460)
self.resetSettingsVar = tk.IntVar()
self.resetSettingsVar.set(int(play_list.resetSettings))
tk.Checkbutton(self.top, text="Reset Settings on New Playlist.", fg=fontColor.get(), font=allButtonsFont.get(),
bg=color, variable=self.resetSettingsVar, command=self.resetSettingsOnNewPlaylist,
selectcolor="black").place(x=200, y=480)
self.crossFadeBetweenTracks = tk.IntVar()
self.crossFadeBetweenTracks.set(int(play_list.useCrossFade))
tk.Checkbutton(self.top, text="Use cross-fading.", fg=fontColor.get(), font=allButtonsFont.get(),
bg=color, variable=self.crossFadeBetweenTracks, command=self.enableDisableCrossFade,
selectcolor="black").place(x=columnOne, y=432)
tk.Label(self.top, text="Danthology refers to resuming the next song \n"+
"at the duration the current one has ended.\n" +
"This feature enables easier browse among \n"+
"unknown media.", fg=fontColor.get(),
font=allButtonsFont.get(), bg=color).place(x=180, y=510)
self.top.bind("<Escape>", self.destroyEsc)
self.top.bind("<Tab>", self.focus_Input)
dialog = self
def enableDisableSongsStatsKeeping(self):
global play_list
if self.MaintainSongsStats.get() == 1:
play_list.keepSongsStats = True
else: