From b4c20606e66658916239f6108cea216df939aff9 Mon Sep 17 00:00:00 2001 From: dengrb1 <125752069+dengrb1@users.noreply.github.com> Date: Sat, 29 Apr 2023 22:38:12 +0800 Subject: [PATCH] chatGPT --- client.pyw | 38 +++++++++++++++++++++++++++----- if_file.py | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 6 deletions(-) create mode 100644 if_file.py diff --git a/client.pyw b/client.pyw index c8aa989..c2bd776 100644 --- a/client.pyw +++ b/client.pyw @@ -2,6 +2,7 @@ import os import platform import tkinter as tk from tkinter import messagebox +from time import sleep # Define constants CURRENT_DIR = os.getcwd() @@ -30,13 +31,13 @@ def update(): else: messagebox.showerror('update', '更新日志文件丢失,请检查文件并重新安装') -'''def user_xy(): +def user_xy(): if os.path.exists(os.path.join(CURRENT_DIR, "使用协议.docx")): os.system("start 使用协议.docx") else: messagebox.showerror('使用协议','文档丢失,请检查文件内容并重新安装') pass - pass''' + pass def quit_exe(): os.system('taskkill -f -t -im aiyunos.exe') @@ -46,6 +47,35 @@ def quit_exe(): os.system('taskkill -f -t -im wuguokai.exe') root.destroy() +def file_jc(): + if os.path.exists(os.path.join(CURRENT_DIR, "if_file.exe")): + os.system('start if_file.exe') + else: + messagebox.showerror('sittings', '系统文件丢失,程序出现错误!') + sleep(1) + quit_exe() + pass + +def gk(): + open_exe("gk") + +def sittings(): + st = tk.Tk() + bt_xy = tk.Button(st, text='使用协议(使用前必看)', command=user_xy) + bt_update = tk.Button(st, text='更新日志', command=update) + bt_gk = tk.Button(st, text='关于', command=gk) + bt_fj = tk.Button(st, text='检查文件完整度', command=file_jc) + # pack + bt_update.pack() + bt_gk.pack() + bt_fj.pack() + bt_xy.pack() + # mainloop + st.title('设置') + st.geometry("200x200+400+600") + st.mainloop() + + # Create GUI root = tk.Tk() root.title('chatGPT') @@ -55,15 +85,11 @@ tk.Label(root, text='chatGPT').pack() bt_w = tk.Button(root, text='wuguokai网站', command=wuguokai) bt_e = tk.Button(root, text='extkj网站', command=extkj) bt_f1 = tk.Button(root, text='aitianhu网站', command=f1) -# bt_xy = tk.Button(root, text='使用协议(使用前必看)', command=user_xy) -bt_update = tk.Button(root, text='更新日志', command=update) quit_bt = tk.Button(root, text='退出', command=quit_exe) bt_w.pack() bt_e.pack() bt_f1.pack() -# bt_xy.pack() -bt_update.pack() quit_bt.pack() # mainloop diff --git a/if_file.py b/if_file.py new file mode 100644 index 0000000..0f32584 --- /dev/null +++ b/if_file.py @@ -0,0 +1,64 @@ +import os +from time import sleep + + +file_error = '文件丢失,请检查目录文件完整度' +ml = os.getcwd +maths = 0 +error = 0 + + +def file_jx(exe_name): + maths += 1 + if os.path.exists(os.path.join(ml, f"{exe_name}")): + print(f'文件{maths}正常存在') + else: + error += 1 + print(f"丢失{error}文件") + pass + pass + +def extkj(): + file_jx("extkj") + +def wuguokai(): + file_jx("wuguokai") + +def f1(): + file_jx("aiyunos") + +def update(): + if os.path.exists(os.path.join(ml, "update.exe")): + maths += 1 + print(f'文件{maths}正常存在') + else: + error += 1 + print(f"丢失{error}文件") + pass + pass + +def gk(): + file_jx("gk") + + +# mainloop +print('检查中') +sleep(0.85555) + +extkj() +wuguokai() +f1() +update() +gk() + +sleep(0.5) +print('检查完成,共有{maths}个文件正常,{error}个文件丢失') + +if str(input('是否退出?(Y.是 B.不是')) == "Y" or 'y' or '1': + exit() +else: + print('请手动退出') + while True: + sleep(1) + pass + \ No newline at end of file