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 f961632..3430b61 100644 Binary files a/palworld_server_toolkit/.DS_Store and b/palworld_server_toolkit/.DS_Store differ 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') #