diff --git a/.gitignore b/.gitignore index e438f3a..f878262 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ /poetry.lock /build __pycache__/ -/.vscode \ No newline at end of file +/.vscode +/test.py \ No newline at end of file diff --git a/build.py b/build.py index 2897535..001f571 100644 --- a/build.py +++ b/build.py @@ -5,13 +5,14 @@ import sys script_dir = os.path.dirname(os.path.abspath(__file__)) source_dir = os.path.join(script_dir,"webp_to_png","data") -des_dir = os.path.join(source_dir,"dist","pyinstaller") +des_dir = os.path.join(script_dir,"dist","pyinstaller") if sys.platform.startswith('win32'): - des_dir = os.path.join(des_dir,"win_amd64") + des_dir = os.path.join(des_dir,"win_amd64","data") print("You are on the windows platform,it will put data into",des_dir) else: print("you are on the other platform please put webp_to_png/data \"data\" directory into the exe directory") + exit(1) -subprocess.run(["poetry","build"], check=True) - +# subprocess.run(["poetry","build"], check=True) +print(f"copying {source_dir} to {des_dir}") shutil.copytree(source_dir,des_dir) \ No newline at end of file diff --git a/webp_to_png/__main__.pyw b/webp_to_png/__main__.pyw index 30693c5..a54342c 100644 --- a/webp_to_png/__main__.pyw +++ b/webp_to_png/__main__.pyw @@ -1,3 +1,4 @@ +from os import path import threading import PySimpleGUI as sg from webp_to_png.tools import convert_webp_to_png @@ -9,11 +10,13 @@ layout = [ [sg.Text("完成进度:"),sg.ProgressBar(max_value=100,key="bar",size=(50,20),)] ] +print(path.join(__file__,"data","favicon.ico")) + window = sg.Window("批量webp格式转化为png格式 -by Zengtudor", layout, size=(800,400), resizable=True, - icon="favicon.ico" + icon=path.join(path.dirname(__file__),"data","favicon.ico") ) bar = window["bar"]