-
Notifications
You must be signed in to change notification settings - Fork 0
/
reproc.py
78 lines (52 loc) · 1.8 KB
/
reproc.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
from tkinter import Tk
from tkinter.ttk import Style
from ui import images as b64img
from ui.images.utilities import *
from data import config
from program import MusicTab, external_events
import os
import gettext
#==================================================
class Reproc(Tk):
def __init__(self):
super().__init__()
self.title("Reproc")
self.iconphoto(True, b64ToTk(b64img.icon))
self.geometry("400x480")
self.eval("tk::PlaceWindow . center")
self.resizable(width=False, height=True)
self.protocol("WM_DELETE_WINDOW", self.onExit)
self.style = Style(self)
self.setTheme()
self.setLanguage()
self.tab_music = MusicTab(self)
self.tab_music.pack(fill="both", expand=True)
self.extraevents = external_events.createExtraEvents(self)
#__________________________________________________
def onExit(self):
self.saveJson()
self.extraevents.release()
self.destroy()
def saveJson(self):
'''
Other saves are updated when their associated event is called
'''
config.general.update(self.tab_music.playback.getStates())
config.save_user_config()
def setTheme(self):
theme = config.general["theme"]
self.tk.call("source",
os.path.join("ui", "ttk_themes", theme + ".tcl"))
self.style.theme_use(theme)
#reconfig window
def setLanguage(self):
language = gettext.translation("base",
localedir=os.path.join("data", "locale"),
languages=[config.general["lang"]])
language.install()
_ = language.gettext
#reconfig window
#==================================================
if __name__ == "__main__":
app = Reproc()
app.mainloop()