Skip to content
This repository was archived by the owner on Mar 31, 2020. It is now read-only.

Commit c564b69

Browse files
committed
Main
1 parent 12dc1a5 commit c564b69

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

src/main.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,65 @@ def __init__(self, *args, **kwds):
2929
self.front = Front(self.frame)
3030
self.front.pack(fill='both', expand=True)
3131

32+
def cleanup(self):import configparser
33+
import tkinter as tk
34+
from contextlib import suppress
35+
36+
from .view import Window, View
37+
from .front import Front
38+
# from .splash import Splash
39+
from . import SETTINGS
40+
41+
42+
parser = configparser.ConfigParser()
43+
parser.read(SETTINGS)
44+
45+
46+
class App(tk.Tk):
47+
appconfig = parser['APP']
48+
49+
def __init__(self, *args, **kwds):
50+
super().__init__(*args, **kwds)
51+
self.resizable(False, False)
52+
for name, val in parser['APP'].items():
53+
getattr(self, name)(val)
54+
55+
#self.window = Window(self)
56+
#self.window.pack(expand=True, fill='both')
57+
#elf.update()
58+
59+
# self.splash = Splash(self)
60+
self.front = Front(self)
61+
self.front.pack(fill='both', expand=True)
62+
# self.execution_order = iter((
63+
# # self.splash,
64+
# self.front,
65+
# # self.result
66+
# ))
67+
self.update()
68+
69+
def switch(self):
70+
try:
71+
self.update()
72+
if self.current is not None:
73+
self.current.data.cleanup()
74+
self.current.data.pack_forget()
75+
self.current.data.destroy()
76+
self.current = next(self.execution_order)
77+
self.build(self.current)
78+
except StopIteration:
79+
self.cleanup()
80+
81+
def build(self, view):
82+
self.update()
83+
view.data.build()
84+
self.window.set_view(view)
85+
3286
def cleanup(self):
87+
with suppress(Exception):
88+
self.current.cleanup()
89+
self.destroy()
90+
3391
with suppress(Exception):
3492
self.front.cleanup()
3593
self.destroy()

0 commit comments

Comments
 (0)