From c813cd9c7f87f6c9117145b2f8062a4021072823 Mon Sep 17 00:00:00 2001 From: MagicBear Date: Tue, 13 Feb 2024 03:17:03 +0800 Subject: [PATCH] v0.5.9 --- CHANGELOG.rst | 1 + CxFreezeCompile.py | 27 +++++++++++++++++++++++++++ palworld_server_toolkit/.DS_Store | Bin 6148 -> 8196 bytes palworld_server_toolkit/editor.py | 11 ++++++++++- 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 CxFreezeCompile.py diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ebbd5cd..b2190bb 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -20,6 +20,7 @@ v0.5.9 Feature: - Open GUI for drag file to the exe +- Add icons for release v0.5.8 ------- diff --git a/CxFreezeCompile.py b/CxFreezeCompile.py new file mode 100644 index 0000000..98d5d2d --- /dev/null +++ b/CxFreezeCompile.py @@ -0,0 +1,27 @@ +import sys, os +from cx_Freeze import setup, Executable + +build_options = { + "includes": ["pyperclip"], + "excludes": [], + "zip_include_packages": [], + "include_files": ["save_tools", "palworld_server_toolkit/PalEdit"], + "zip_includes": ["palworld_server_toolkit/resources/", "palworld_server_toolkit/PalEdit"], +} + +base = "Win32GUI" if sys.platform == "win32" else None + +ver = "" +with open("setup.cfg", "r") as f: + for line in f: + line = line.split(" = ") + if line[0] == "version": + ver = line[1].strip() + +setup( + name = f"Palworld-Save-Editor {ver}", + version = ver, + description = "A simple tool for editing PalWorld saves", + options={"build_exe": build_options}, + executables=[Executable("palworld_server_toolkit/editor.py", base=base, icon="palworld_server_toolkit/resources/palworld-save-editor.ico")], +) diff --git a/palworld_server_toolkit/.DS_Store b/palworld_server_toolkit/.DS_Store index f96163277862d1e6ccf850c8497a70aa383d11f9..3430b619b11236e6b4d3f193f01c69e62dc862c9 100644 GIT binary patch delta 164 zcmZoMXmOBWU|?W$DortDU;r^WfEYvza8E20o2aMA$g?qEH}hr%jz7$c**Q2SHn1@A zZ02FP$|TImP{feRP|T3ePzq!vgV>W9*%~-Z3=MS@42>-(cd|KPRdk6hVzWBWb7n3H iZlFc3AiFjTa(ri=%rD|O*`J4lgAw8khRyLjbC?0hXCdDJ delta 107 zcmZp1XfcprU|?W$DortDU=RQ@Ie-{Mvv5r;6q~50$jG%ZU^g=(*Jd7pt4x#c342a# txVxC0gF}!Rs0auIxPgQ#Nd3mb@640=WjsN;8JHj@fedHZ9M3a{82}jd5|97@ diff --git a/palworld_server_toolkit/editor.py b/palworld_server_toolkit/editor.py index d8189e4..729136a 100644 --- a/palworld_server_toolkit/editor.py +++ b/palworld_server_toolkit/editor.py @@ -13,7 +13,10 @@ import traceback from functools import reduce -module_dir = os.path.dirname(os.path.abspath(__file__)) +module_dir = os.path.dirname(os.path.realpath(__file__)) +if not os.path.exists("%s/resources/gui.json" % module_dir) and getattr(sys, 'frozen', False): + module_dir = os.path.dirname(sys.executable) + # sys.path.insert(0, module_dir) sys.path.insert(0, os.path.join(module_dir, "../save_tools")) @@ -36,6 +39,7 @@ from tkinter import messagebox from tkinter import filedialog from tkinter import simpledialog + from PIL import ImageTk, Image except ImportError: print("ERROR: Without Tkinter Environment, GUI not work") pass @@ -1915,11 +1919,16 @@ def characterInstanceName(self, instance): def build_gui(self): # self.gui = tk.Tk() + self.gui.iconphoto(True, ImageTk.PhotoImage( + Image.open(f'{module_dir}/resources/palworld-save-editor.png').resize((240, 240)))) + self.gui.parent = self try: __version__ = importlib.metadata.version('palworld-server-toolkit') except importlib.metadata.PackageNotFoundError: __version__ = "0.0.1" + with open(f"{module_dir}/resources/version.txt", "r"): + __version__ = f.read().strip() self.gui.title(f'PalWorld Save Editor v{__version__} - Author by MagicBear') # self.gui.geometry('640x200') #