File tree 2 files changed +23
-0
lines changed
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 16
16
11: 18:00-18:45
17
17
12: 18:50-19:35
18
18
13: 19:40-20:25
19
+
20
+ [on-exit]
21
+ pause-on-exit = true
Original file line number Diff line number Diff line change 1
1
from course import Config , EAMS
2
+ from configparser import ConfigParser
2
3
import sys
3
4
5
+ cfg = ConfigParser ()
6
+ cfg .read ('config.ini' )
7
+ pause_cfg = cfg .get ('on-exit' , 'pause-on-exit' ).strip ().lower ()
8
+ pause_on_exit = False
9
+ if pause_cfg == 'true' :
10
+ pause_on_exit = True
11
+
12
+
13
+ def pause () -> None :
14
+ if not pause_on_exit :
15
+ return
16
+ sys .stdin .flush ()
17
+ input ('按回车键退出...' )
18
+
19
+
4
20
print ('==== CourseTable2ICS for SSPU by ReekyStive ====' )
5
21
username = input ('请输入学号: ' ).strip ()
6
22
password = input ('请输入密码: ' )
24
40
print ('成功' )
25
41
except :
26
42
print ('失败' )
43
+ pause ()
27
44
sys .exit (1 )
28
45
print ()
29
46
62
79
63
80
if len (courses ) == 0 :
64
81
print ('未找到任何课程' )
82
+ pause ()
65
83
sys .exit (1 )
66
84
67
85
print ('找到课程:' )
90
108
e .generate_ics (courses , date )
91
109
except :
92
110
print ('失败' )
111
+ pause ()
93
112
sys .exit (1 )
94
113
print ('已保存: courses.ics' )
114
+ pause ()
You can’t perform that action at this time.
0 commit comments