6767
6868Rickrolled LOL
6969"""
70- print ("MCToast 生成器 1.11.1\n " )
71- toasts = (mctoast .ADVANCEMENT ,mctoast .RECIPE ,mctoast .SYSTEM )
72- toast = mctoast .ADVANCEMENT
73- image = None
74- text1 = "进度已达成!"
75- color1 = "yellow"
76- text2 = "MCToast示例"
77- color2 = "white"
78- savepath = None
79- if len (sys .argv )> 1 :
80- argv = sys .argv [1 :]
81- for arg in argv :
82- if arg .startswith ("--toast=" ) or arg .startswith ("-t=" ):
83- toast = arg .split ("=" )[1 ]
84- elif arg .startswith ("--image=" ) or arg .startswith ("-i=" ):
85- image = arg .split ("=" )[1 ]
86- elif arg .startswith ("--title=" ) or arg .startswith ("-t1=" ):
87- text1 = arg .split ("=" )[1 ]
88- elif arg .startswith ("--title-color=" ) or arg .startswith ("-c1=" ):
89- color1 = arg .split ("=" )[1 ]
90- elif arg .startswith ("--text=" ) or arg .startswith ("-t2=" ):
91- text2 = arg .split ("=" )[1 ]
92- elif arg .startswith ("--text-color=" ) or arg .startswith ("-c2=" ):
93- color2 = arg .split ("=" )[1 ]
94- elif arg .startswith ("--help" ) or arg .startswith ("-h" ) or arg .startswith ("-?" ):
95- print (help )
96- exit (0 )
97- elif arg == "--moo" :
98- print (moo )
99- exit (0 )
100- else :
101- savepath = arg
102- else :
103- print ("WARNING: 未指定参数,将弹出默认Toast,请使用 --help 查看帮助" )
104- if savepath == None :
105- mctoast .init ()
106- mctoast .new_toast ()
107- mctoast .wait_no_toast ()
108- else :
109- mctoast .generate_image (toast ,image ,text1 ,color1 ,text2 ,color2 ,mctoast .RETURN_SAVETOFILE , False , savepath )
110- print ("已保存:" ,savepath )
70+ def mian ():
71+ global help ,moo
72+ print ("MCToast 生成器 1.12\n " )
73+ toasts = (mctoast .ADVANCEMENT ,mctoast .RECIPE ,mctoast .SYSTEM )
74+ toast = mctoast .ADVANCEMENT
75+ image = None
76+ text1 = "进度已达成!"
77+ color1 = "yellow"
78+ text2 = "MCToast示例"
79+ color2 = "white"
80+ savepath = None
81+ if len (sys .argv )> 1 :
82+ argv = sys .argv [1 :]
83+ for arg in argv :
84+ if arg .startswith ("--toast=" ) or arg .startswith ("-t=" ):
85+ try :
86+ toast = toasts [int (arg .split ("=" )[1 ])]
87+ except ValueError :
88+ print ("ERROR: 无效的Toast类型" )
89+ exit (1 )
90+ print (toast )
91+ elif arg .startswith ("--image=" ) or arg .startswith ("-i=" ):
92+ image = arg .split ("=" )[1 ]
93+ elif arg .startswith ("--title=" ) or arg .startswith ("-t1=" ):
94+ text1 = arg .split ("=" )[1 ]
95+ elif arg .startswith ("--title-color=" ) or arg .startswith ("-c1=" ):
96+ color1 = arg .split ("=" )[1 ]
97+ elif arg .startswith ("--text=" ) or arg .startswith ("-t2=" ):
98+ text2 = arg .split ("=" )[1 ]
99+ elif arg .startswith ("--text-color=" ) or arg .startswith ("-c2=" ):
100+ color2 = arg .split ("=" )[1 ]
101+ elif arg .startswith ("--help" ) or arg .startswith ("-h" ) or arg .startswith ("-?" ):
102+ print (help )
103+ exit (0 )
104+ elif arg == "--moo" :
105+ print (moo )
106+ exit (0 )
107+ else :
108+ savepath = arg
109+ else :
110+ print ("WARNING: 未指定参数,将弹出默认Toast,请使用 --help 查看帮助" )
111+ if savepath == None :
112+ mctoast .init ()
113+ mctoast .new_toast (toast ,image ,text1 ,color1 ,text2 ,color2 )
114+ mctoast .wait_no_toast ()
115+ else :
116+ mctoast .generate_image (toast ,image ,text1 ,color1 ,text2 ,color2 ,mctoast .RETURN_SAVETOFILE , False , savepath )
117+ print ("已保存:" ,savepath )
118+
119+ if __name__ == "__main__" :
120+ mian ()
0 commit comments