Skip to content

Commit

Permalink
Add 微软雅黑 for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
magicbear committed Feb 5, 2024
1 parent 8173052 commit 4157e48
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
20 changes: 13 additions & 7 deletions palworld_server_toolkit/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,23 @@
import sys
import threading
import pprint
import tkinter.font
import uuid
import argparse
import copy
import importlib.metadata

import tkinter as tk
import tkinter.font
from tkinter import ttk
from tkinter import font
from tkinter import messagebox
from tkinter import filedialog
from tkinter import simpledialog

module_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, module_dir)
sys.path.insert(0, os.path.join(module_dir, "PalEdit/"))
sys.path.insert(0, os.path.join(module_dir, "../"))
sys.path.insert(0, os.path.join(module_dir, "PalEdit"))
# sys.path.insert(0, os.path.join(module_dir, "../save_tools"))
# sys.path.insert(0, os.path.join(module_dir, "../palworld-save-tools"))

Expand All @@ -29,6 +31,9 @@
from palworld_save_tools.paltypes import PALWORLD_CUSTOM_PROPERTIES, PALWORLD_TYPE_HINTS
from palworld_save_tools.archive import *

from palworld_server_toolkit.PalEdit import PalInfo
from palworld_server_toolkit.PalEdit.PalEdit import PalEditConfig, PalEdit

pp = pprint.PrettyPrinter(width=80, compact=True, depth=4)
wsd = None
output_file = None
Expand Down Expand Up @@ -358,7 +363,7 @@ def __init__(self):
self.gui = self
self.parent = self
#
self.font = font.Font(family="Courier New")
self.font = tk.font.Font(family="Courier New")

def build_subgui(self, g_frame, attribute_key, attrib_var, attrib):
sub_frame = ttk.Frame(master=g_frame)
Expand Down Expand Up @@ -730,10 +735,6 @@ def savedata(self):
self.save(self.player, self.gui_attribute)
self.destroy()


from PalEdit import PalEditConfig, PalEdit
import PalInfo

class PalEditGUI(PalEdit):
def createWindow(self):
root = tk.Toplevel()
Expand Down Expand Up @@ -1019,6 +1020,11 @@ def edit_player_save(self):
PlayerSaveEdit(target_uuid)

def pal_edit(self):
font_list = ('微软雅黑', 'Courier New', 'Arial')
for font in font_list:
if font in tkinter.font.families():
PalEditConfig.font = font
break
pal = PalEditGUI()
pal.load(None)
pal.mainloop()
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ classifiers =

[options]
packages = find:
python_requires = >=3.9
python_requires = >=3.9

0 comments on commit 4157e48

Please sign in to comment.