-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.configure.py
59 lines (58 loc) · 1.94 KB
/
main.configure.py
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
import shutil
try:
shutil.copyfile("FileTP.log","FileTP.log.bak")
except:
pass
from filetp_consoleui import *
try:#可能是不必要的
nullio=open(os.devnull,"w+")
except:
nullio=open("null.tmp","w+")
if(platform.uname()[0]=="Windows"):
from ctypes import windll
from subprocess import Popen
cp=windll.kernel32.GetConsoleCP()
path=os.path.join(os.getenv("SystemRoot"),"System32","chcp.com")#%SystemRoot%\System32\chcp.com
p=Popen([path,str(cp)],shell=True,stdout=sys.stdout,stderr=nullio,cwd=os.getcwd())#重新加载codepage
p.wait()
def main():
Log.info("----------FileTP Setting "+main_thread().name+" Start: argv="+str(sys.argv)+
",cwd="+str(os.getcwd())+
",mainthread_ident="+str(main_thread().ident)+
",pid:"+str(os.getpid())+
",time="+str(time.strftime("%Y-%m-%d %H:%M:%S",time.gmtime()))+
"----------"
)
ui=ConsoleUI()
ui.init()
ui.settitle("FileTP Settings")
ConsoleUILabel(ui,text="").update()
ConsoleUILabel(ui,text="114514",layout=LAYOUT_MIDDLE)
ConsoleUILabel(ui,text="1919810",layout=LAYOUT_MIDDLE)
ConsoleUISeperator(ui)
m=ConsoleUIMenu(ui,layout=LAYOUT_MIDDLE)
m.set(["1"*10,"2","3"])
m.update()
ui.regkeyevent("\x1b",ui.end)#Esc
Thread(target=ui.mainloop,daemon=True).start()
c=m.l[m.getchoise()]
m.destroy()
print("choise:",c)
os.system("pause")
i=ConsoleUIInput(ui,"输入:")
print(i.get())
os.system("pause")
ui.end()
if(__name__=="__main__"):
try:
main()
sys.exit(0)
except SystemExit as e:
raise e
except:
print("\n"+strings.app.error.fatalmsg.replace("{msg}",getexc()))
Log.fatal("----------UNHANDLED EXCEPTION!!!!!!!----------")
Log.printerror()
sys.exit(-1)
import curses
curses.getch