-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
66 lines (43 loc) · 1.31 KB
/
main.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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import tkinter.ttk as ttk
import gui
import message
import state
_root = None
# GUI initialization ###########################################################
def main_area(parent):
frame = ttk.Frame(parent)
gui.init_maintext(frame)
return frame
def message_area(parent):
frame = ttk.Frame(parent)
message.init(frame)
return frame
################################################################################
def cleanup():
if _root:
_root.destroy()
def close_app():
message.info("Quitting")
cleanup()
def main():
global _root
s = state.load()
_root = root = gui.MainWindow(s)
root.wm_title("Text Transformer")
root.geometry(s.window_geometry)
root.bind("<Alt-F4>", lambda event: close_app())
root.protocol('WM_DELETE_WINDOW', close_app)
pw = ttk.PanedWindow(root, orient="vertical")
pw.pack(fill="both", expand=True)
pw.add(main_area(pw), weight=100)
pw.add(message_area(pw), weight=1)
gui.TransformerLoader(root)
message.debug("Initialized")
message.info("Initialized")
message.warn("Initialized")
message.error("Initialized")
root.mainloop()
if __name__ == "__main__":
main()