This commit is contained in:
ZtRXR 2024-05-05 22:37:50 +08:00
parent 3ef857725e
commit edfb1ba32c
3 changed files with 11 additions and 6 deletions

3
.gitignore vendored
View File

@ -2,4 +2,5 @@
/poetry.lock /poetry.lock
/build /build
__pycache__/ __pycache__/
/.vscode /.vscode
/test.py

View File

@ -5,13 +5,14 @@ import sys
script_dir = os.path.dirname(os.path.abspath(__file__)) script_dir = os.path.dirname(os.path.abspath(__file__))
source_dir = os.path.join(script_dir,"webp_to_png","data") 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'): 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) print("You are on the windows platform,it will put data into",des_dir)
else: else:
print("you are on the other platform please put webp_to_png/data \"data\" directory into the exe directory") 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) shutil.copytree(source_dir,des_dir)

View File

@ -1,3 +1,4 @@
from os import path
import threading import threading
import PySimpleGUI as sg import PySimpleGUI as sg
from webp_to_png.tools import convert_webp_to_png 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),)] [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", window = sg.Window("批量webp格式转化为png格式 -by Zengtudor",
layout, layout,
size=(800,400), size=(800,400),
resizable=True, resizable=True,
icon="favicon.ico" icon=path.join(path.dirname(__file__),"data","favicon.ico")
) )
bar = window["bar"] bar = window["bar"]