-
Notifications
You must be signed in to change notification settings - Fork 0
/
cw_typist.py
51 lines (38 loc) · 1.01 KB
/
cw_typist.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
import argparse
import asyncio
import logging
import os
import sys
def setup_logger():
os.environ["KIVY_NO_CONSOLELOG"] = "1"
os.environ["KIVY_NO_FILELOG"] = "1"
logger = logging.getLogger('cw_typist')
formatter = logging.Formatter(
fmt='%(asctime)s.%(msecs)03d %(levelname)7s %(filename).6s:%(lineno)3s: %(message)s',
datefmt="%Y-%m-%d %H:%M:%S"
)
handler = logging.StreamHandler(stream=sys.stdout)
handler.setFormatter(formatter)
logger.setLevel(logging.DEBUG)
logger.addHandler(handler)
logging.root = logger
async def main():
from src.ui.app_window import AppWindow
parser = argparse.ArgumentParser()
parser.add_argument(
'--debug',
action='store_true',
default=False,
required=False,
help='Enable debug logging.',
)
arg_values = parser.parse_args()
if arg_values.debug:
AppWindow.force_debug = True
setup_logger()
app_window = AppWindow()
await app_window.async_run()
return
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(main())