Skip to content

Commit

Permalink
Merge pull request #16 from Zian25/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Zian25 authored Apr 29, 2024
2 parents 4fe60f7 + 45a075c commit bcd7e46
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
4 changes: 2 additions & 2 deletions data/config/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"language": 0,
"language": -1,
"path": null,
"auto-update": true,
"menuSpace": 3,
"sleep": 3,
"preferGit": false,
"debug": false
}
}
2 changes: 1 addition & 1 deletion data/config/version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "1.0.3"
"version": "1.0.5"
}
20 changes: 11 additions & 9 deletions src/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def setLanguageInput():
src.core.clear()
print(space() + "Please select a language\n")
cachedLang.listLanguages()
choose = int(input(space() + getVars['input']))
choose = int(input(space() + "Select an option: "))
if choose <= cachedLang.enum():
cachedSettings['language'] = choose
src.settings.Settings.setSettings(cachedSettings)
Expand All @@ -88,18 +88,19 @@ def downloadTool(toolObj: object):
def changeSettings():
keys = list(cachedSettings.keys())
values = list(cachedSettings.values())
langs = src.settings.Language.available()
available = len(keys)
changes = 0

while True:
try:
src.core.clear()
print(f"\n{space()}{red}{getVars['warningConfig']}{white}\n")
cachedLang.listLanguages()
print("\n")

for i, key in enumerate(keys):
print(space() + f"[{i}] {key}: {values[i]}")
if key.lower() == "language":
print(space() + f"[{i}] {key}: {langs['languages'][values[i]]['name']}")
else:
print(space() + f"[{i}] {key}: {values[i]}")

if changes >= 1:
print(space() + f"[R] Restart")
Expand All @@ -117,15 +118,16 @@ def changeSettings():
if 0 <= choice < available:
key = keys[choice]
value = values[choice]
if key.lower() in ["language", "menuspace", "sleep"]:
if key.lower() in ["language"]:
setLanguageInput()

elif key.lower() in ["menuspace", "sleep"]:
new_value = int(input(space() + getVars['inputSet'] + f"{key}: "))
cachedSettings[key] = new_value
src.settings.Settings.setSettings(cachedSettings)

elif key.lower() in ["auto-update", "debug", "prefergit"]:
new_value_str = input(space() + getVars['inputSet'] + f"{key}: ")
new_value = new_value_str.lower() == "true"
cachedSettings[key] = new_value
cachedSettings[key] = not cachedSettings[key]
src.settings.Settings.setSettings(cachedSettings)

elif key.lower() in ["path"]:
Expand Down
3 changes: 2 additions & 1 deletion utx.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ def main():

if __name__ == '__main__':
cachedSettings = Settings.getSettings()
if 0 > cachedSettings['language'] > src.settings.Language.enum():
if cachedSettings['language'] not in range(src.settings.Language.enum()+1):
src.core.setLanguageInput()
src.core.restart_program()

if cachedSettings['path'] is None or not os.path.exists(cachedSettings['path']):
cachedSettings['path'] = os.path.expanduser('~')
Expand Down

0 comments on commit bcd7e46

Please sign in to comment.