-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain1.py
More file actions
58 lines (51 loc) · 2 KB
/
main1.py
File metadata and controls
58 lines (51 loc) · 2 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
import os
import sys
from PyQt5.QtWidgets import QApplication
from widgets import *
from auxiliary_tools import DatabaseOperation
import multiprocessing
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)
if __name__ == "__main__":
multiprocessing.freeze_support()
app = QApplication(sys.argv)
student_id = int(sys.argv[1])
course_id = int(sys.argv[2])
window_type = int(sys.argv[3])
db = DatabaseOperation()
if window_type == 0:
win = Reaction_Train_Main(None, db=db, course_id=course_id, student_id=student_id)
elif window_type == 1:
win = Action_Follow_Main(None, db=db, action_id=course_id)
elif window_type == 2:
win = Action_Eval_Main(None, db=db, action_id=course_id, student_id=student_id)
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)