-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain_GUI.py
More file actions
43 lines (33 loc) · 1.17 KB
/
Copy pathmain_GUI.py
File metadata and controls
43 lines (33 loc) · 1.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
from sys import exit
import warnings
import traceback
from imageshow import show_image
from configtoargs import configtoargs
from GUI import GUI, Message
warnings.filterwarnings("ignore", ".*GUI is implemented.*") # matplotlib2.0.2会跳出警告
VERSION = 'v2.1'
if __name__ == '__main__':
print('程序初始化中...')
args = configtoargs()
args.version = 'Random Image Viewer ' + VERSION
print('本次运行随机种子为:{}'.format(args.seed))
app = GUI(args)
app.__enter__()
args = app.args
args.app = app
if args.debug:
print(args.__dict__)
if app.end_state:
if args.debug:
print('-' * 10 + 'Debug模式已启用' + '-' * 10)
try:
if args.initialize or args.update:
if '+' in args.collection:
raise ValueError('数据库表名中有非法字符“+”')
show_image(args) # 主程序
except Exception as e:
print('\n', traceback.format_exc())
print('\n错误!', e.args[0])
error = str(traceback.format_exc())+'\n\n错误!'+str(e.args[0])
Message(error).__enter__()
exit()