Skip to content

Commit

Permalink
v0.5.9
Browse files Browse the repository at this point in the history
  • Loading branch information
magicbear committed Feb 12, 2024
1 parent 1508e89 commit c813cd9
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ v0.5.9
Feature:

- Open GUI for drag file to the exe
- Add icons for release

v0.5.8
-------
Expand Down
27 changes: 27 additions & 0 deletions CxFreezeCompile.py
Original file line number Diff line number Diff line change
@@ -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")],
)
Binary file modified palworld_server_toolkit/.DS_Store
Binary file not shown.
11 changes: 10 additions & 1 deletion palworld_server_toolkit/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))

Expand All @@ -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
Expand Down Expand Up @@ -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')
#
Expand Down

0 comments on commit c813cd9

Please sign in to comment.