File size: 1,263 Bytes
1e4a2ab |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
import os
import sys
import json
import platform
import subprocess
sys.path.append(os.getcwd())
from main.app.core.ui import gr_info
from main.app.variables import python, translations, configs_json
def restart_app(app):
gr_info(translations["30s"])
os.system("cls" if platform.system() == "Windows" else "clear")
app.close()
subprocess.run([python, os.path.join("main", "app", "app.py")] + sys.argv[1:])
def change_language(lang, app):
configs = json.load(open(configs_json, "r"))
if lang != configs["language"]:
configs["language"] = lang
with open(configs_json, "w") as f:
json.dump(configs, f, indent=4)
restart_app(app)
def change_theme(theme, app):
configs = json.load(open(configs_json, "r"))
if theme != configs["theme"]:
configs["theme"] = theme
with open(configs_json, "w") as f:
json.dump(configs, f, indent=4)
restart_app(app)
def change_font(font, app):
configs = json.load(open(configs_json, "r"))
if font != configs["font"]:
configs["font"] = font
with open(configs_json, "w") as f:
json.dump(configs, f, indent=4)
restart_app(app) |