forked from fogleman/FeedNotifier
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
48 lines (44 loc) · 1.27 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
def init_path():
import os
import dummy
file = dummy.__file__
file = os.path.abspath(file)
while file and not os.path.isdir(file):
file, ext = os.path.split(file)
os.chdir(file)
def init_logging():
import sys
import logging
logging.basicConfig(
level=logging.DEBUG,
filename='log.txt',
filemode='w',
format='%(asctime)s %(levelname)s %(message)s',
datefmt='%H:%M:%S',
)
if not hasattr(sys, 'frozen'):
console = logging.StreamHandler(sys.stdout)
console.setLevel(logging.DEBUG)
formatter = logging.Formatter(
'%(asctime)s %(levelname)s %(message)s',
'%H:%M:%S',
)
console.setFormatter(formatter)
logging.getLogger('').addHandler(console)
def main():
init_path()
init_logging()
import wx
import ipc
import controller
container, message = ipc.init()
if not container:
return
app = wx.PySimpleApp()#redirect=True, filename='log.txt')
wx.Log_SetActiveTarget(wx.LogStderr())
ctrl = controller.Controller()
container.callback = ctrl.parse_args
container(message)
app.MainLoop()
if __name__ == '__main__':
main()