-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
63 lines (56 loc) · 2.17 KB
/
main.py
File metadata and controls
63 lines (56 loc) · 2.17 KB
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
import os
import sys
import datetime
from PyQt5.QtWidgets import QApplication
from widgets import *
from auxiliary_tools import DatabaseOperation
import logging
from logging.handlers import RotatingFileHandler
for handler in logging.root.handlers[:]:
logging.root.removeHandler(handler)
if not os.path.exists('./data/log'):
os.mkdir('./data/log')
handler = RotatingFileHandler('./data/log/app.log', maxBytes=1e6, backupCount=5)
logging.getLogger('').setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s',
datefmt='%a, %d %b %Y %H:%M:%S')
handler.setFormatter(formatter)
logging.getLogger().addHandler(handler)
logging.info("WELCOME TO THE SYSTEM")
import multiprocessing
if __name__ == "__main__":
multiprocessing.freeze_support()
app = QApplication(sys.argv)
# win = LogMain()
student_id = int(sys.argv[1])
window_type = int(sys.argv[2])
# win = Reaction_Train_Main(0, 0, 0, using_sensor=)
db = DatabaseOperation()
if window_type == 0:
logging.info("student{} start std_train".format(student_id))
win = Center_Menu_Main(db, student_id, True)
else:
logging.info("student{} start reaction_train".format(student_id))
win = Center_Menu_Main(db, student_id, False)
# camera = "rtsp://admin:nvidia001@192.168.1.64/Streaming/Channels/1"
win.show()
code = app.exec_()
for course_dir in os.listdir('./data/course_action'):
course_dir = os.path.join('./data/course_action', course_dir)
if not os.path.isdir(course_dir):
continue
for file in os.listdir(course_dir):
path_ = os.path.join(course_dir, file)
if os.path.isdir(path_):
for file_ in os.listdir(path_):
try:
os.remove(os.path.join(path_, file_))
except:
continue
else:
try:
os.remove(path_)
except:
continue
sys.exit(code)
# sys.exit(app.exec_())