-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.py
52 lines (38 loc) · 1.12 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
#!/usr/bin/env python3
try:
import readline
except Exception:
pass
import logging
import argparse
import logging.config
import signal
from args_parser import ArgsParser
from network.client import ChatClient
from database.chat_dbhelper import ChatDBHelper
from chats.console.main_chat import MainChat
# from chats.gui.main_chat import GMainChat, gmain
LOG_FILE = 'logging_config.ini'
def main():
logging.basicConfig(filename='app.log',
format='%(asctime)s : %(module)s : %(levelname)s : %(message)s',
level=logging.DEBUG)
parser = ArgsParser()
gui, host, port, recv_port, dis_enc = parser.get_params()
if not gui:
if host is None:
client = ChatClient(recv_port, dis_enc=dis_enc)
else:
client = ChatClient(recv_port, dis_enc=dis_enc,
server_host=(host, port))
# Create entity of console chat
chat = MainChat(client=client)
chat.run()
else:
pass
# gmain()
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
pass