Allow setting theme color theme from the menu bar

This functions essentially the same as the language selector. The language selector now also checks the currently set option on launch, and both the language and theme selectors spawn a popup prompting the user to restart NUSGet after selecting a new value.
This commit is contained in:
2025-05-27 14:44:48 -04:00
parent db6dc65791
commit 109e3dc25a
5 changed files with 162 additions and 10 deletions

View File

@@ -6,6 +6,18 @@ from modules.config import update_setting
from PySide6.QtCore import QLocale, QTranslator
LANGS = {
"en": "English",
"es": "Español",
"de": "Deutsch",
"fr": "Français",
"it": "Italiano",
"no": "Norsk",
"ro": "Românǎ",
"ko": "한국어",
}
def set_language(config_data: dict, lang: str) -> None:
# Match the selected language. These names will NOT be translated since they represent each language in that
# language, but the "System (Default)" option will, so that will match the default case.
@@ -46,6 +58,9 @@ def get_language(translator: QTranslator, config_data: dict, path: str) -> QTran
lang = ""
# A specific language was set in the app's settings.
if lang != "":
# If the target language is English, then return an empty translator because that's the default.
if lang == "en":
return translator
if translator.load(QLocale(lang), 'nusget', '_', path):
return translator
else: