Skip to content

Commit

Permalink
Implemented automatic Kivy config default_font fix. The global Kivy d…
Browse files Browse the repository at this point in the history
…efault_font property is got messed up due nicoboss#154 president in older version which causes the NSZ 4.6 GUI to not boot for affected users as reported in nicoboss#164.
  • Loading branch information
nicoboss committed Dec 18, 2023
1 parent c127fd4 commit 3aaafb3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions nsz/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,20 @@ def main():
if len(argv) > 1:
args = ParseArguments.parse()
else:
kivyConfigPathObj = Path.home().joinpath('.kivy').joinpath('config.ini')
if kivyConfigPathObj.exists():
kivyConfigPath = str(kivyConfigPathObj)
with open(kivyConfigPath, 'r', encoding='utf-8') as f:
lines = f.readlines()
brokenKivyConfig = False
for i, line in enumerate(lines):
if line.startswith('default_font') and 'MPLUS1p-Medium.ttf' in line:
brokenKivyConfig = True
lines[i] = "default_font = ['Roboto', 'data/fonts/Roboto-Regular.ttf', 'data/fonts/Roboto-Italic.ttf', 'data/fonts/Roboto-Bold.ttf', 'data/fonts/Roboto-BoldItalic.ttf']\n"
if brokenKivyConfig:
Print.info(f'[INFO ] Fixing {kivyConfigPath}')
with open(kivyConfigPath, 'w', encoding='utf-8') as f:
f.writelines(lines)
try:
from nsz.gui.NSZ_GUI import GUI
except ImportError:
Expand Down

0 comments on commit 3aaafb3

Please sign in to comment.