-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
30 lines (24 loc) · 835 Bytes
/
main.py
File metadata and controls
30 lines (24 loc) · 835 Bytes
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
#!/usr/bin/python3
import sys
import json
import argparse
from PyQt5 import QtCore
import core
import utils
parser = argparse.ArgumentParser(description='')
parser.add_argument('-c', '--config', type=str, default='config.json', help='Start core with a certain config file')
args = parser.parse_args()
def load_config(filename):
with open(filename, mode='r', encoding='utf-8') as f:
return json.load(f)
if __name__ == '__main__':
app = QtCore.QCoreApplication(sys.argv)
configs = utils.Config(load_config(args.config))
core_inst = core.Core(configs)
core_thread = QtCore.QThread()
core_inst.moveToThread(core_thread)
listener = utils.ConsoleListener()
listener.newline.connect(core_inst.command)
core_thread.started.connect(core_inst.init)
core_thread.start()
listener.listen()