-
Notifications
You must be signed in to change notification settings - Fork 25
/
utx.py
executable file
·69 lines (54 loc) · 1.82 KB
/
utx.py
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env python3
# coding: UTF-8
import sys
if sys.version_info[0] < 3:
print("Python 2 is not supported, use Python 3!")
exit(1)
import os.path
import time
import src.core
from src.settings import Settings, Language
from src.core import clear, banner, updateUTX, changeSettings
from src.manager import listTools
def main():
cachedSettings = Settings.getSettings()
langVar = Language.getVars()
options = langVar["options"]
menuSpace = cachedSettings['menuSpace']
while True:
try:
clear()
banner()
print("\n")
for index, item in enumerate(options, start=1):
print(" " * menuSpace + f"{item['display']}")
print("\n")
choose = input(" " * menuSpace + langVar['input'])
if choose in ["0", "00"]:
clear()
exit(0)
elif choose in ["1", "2", "3", "4", "5", "6"]:
listTools(int(choose))
elif choose == "7":
clear()
changeSettings()
except ValueError:
clear()
print(langVar['invalid'])
time.sleep(cachedSettings['sleep'])
except KeyboardInterrupt:
clear()
exit(1)
if __name__ == '__main__':
cachedSettings = Settings.getSettings()
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('~')
Settings.setSettings(cachedSettings)
src.core.restart_program()
if cachedSettings["auto-update"] and not cachedSettings["debug"]:
clear()
updateUTX()
main()