-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
76 lines (60 loc) · 1.91 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
67
68
69
70
71
72
73
74
75
'''
import pentai.t_all as t_m
t_m.main()
import sys
sys.exit(0)
'''
import os
import platform
'''
def _total_size(source):
total_size = os.path.getsize(source)
for item in os.listdir(source):
itempath = os.path.join(source, item)
if os.path.isfile(itempath):
total_size += os.path.getsize(itempath)
elif os.path.isdir(itempath):
dir_size = _total_size(itempath)
print "%s: %s" % (itempath, dir_size)
total_size += dir_size
return total_size
def main():
print _total_size("..")
"""
source = os.path.join(".", "txt")
for item in os.listdir(source):
itempath = os.path.join(source, item)
if os.path.isfile(itempath):
print "%s: %s" % (itempath, os.path.getsize(itempath))
"""
'''
import sys
def setup_logging():
formatter = logging.Formatter("[%(asctime)s.%(msecs)03d][%(levelname)s][%(message)s]",
"%H:%M:%S")
console = logging.StreamHandler()
console.setFormatter(formatter)
sys._kivy_logging_handler = console
sys.setrecursionlimit(500)
logging.getLogger("ZODB.FileStorage").addHandler(console)
logging.getLogger("ZODB.lock_file").addHandler(console)
logging.getLogger("ZODB.Connection").addHandler(console)
def main():
# TEMP WORKAROUND for Kivy prob.
os.environ["KIVY_GLES_LIMITS"] = '0'
if platform.system() == 'Windows':
# TEST WORKAROUND. SDL2 is supposed to be even better :)
os.environ['KIVY_AUDIO'] = 'pygame'
setup_logging()
import startup
startup.run()
import logging, sys
if __name__ == "__main__":
'''
import pstats, cProfile
cProfile.runctx("main()", globals(), locals(), "Profile.prof")
s = pstats.Stats("Profile.prof")
s.strip_dirs().sort_stats("cumulative").print_stats(20) # or "time"
#s.strip_dirs().sort_stats("time").print_stats(20)
'''
main()