-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy path__main__.py
More file actions
48 lines (36 loc) · 1.08 KB
/
__main__.py
File metadata and controls
48 lines (36 loc) · 1.08 KB
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 time
from loguru import logger
from xcoder import clear
from xcoder.config import config
from xcoder.features.initialization import initialize
from xcoder.localization import locale
from xcoder.main_menu import check_auto_update, check_files_updated, menu, refill_menu
def main():
if not config.initialized:
config.change_language(locale.change())
if not config.initialized:
initialize(True)
exit()
check_auto_update()
check_files_updated()
refill_menu()
interrupted = False
while not interrupted:
try:
handler = menu.choice()
if handler is None:
continue
start_time = time.time()
with logger.catch():
handler()
logger.opt(colors=True).info(
f"<green>{locale.done % (time.time() - start_time)}</green>"
)
input(locale.to_continue)
except KeyboardInterrupt:
interrupted = True
finally:
clear()
logger.info("Exit.")
if __name__ == "__main__":
main()