From edfb1ba32c9d7a14356cd73680c966bb947a62cd Mon Sep 17 00:00:00 2001 From: ZtRXR Date: Sun, 5 May 2024 22:37:50 +0800 Subject: [PATCH] update --- .gitignore | 3 ++- build.py | 9 +++++---- webp_to_png/__main__.pyw | 5 ++++- 3 files changed, 11 insertions(+), 6 deletions(-) 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"]