This repository has been archived by the owner on Jan 19, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.py
54 lines (50 loc) · 1.51 KB
/
index.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
from colorama import Fore, Style, init
import runpy, os
import functions
init()
storm_processes = [
{
"name": "System Information",
"desc": "Basic infomation about your system",
"path": "sysinfo.py",
"colour": "GREEN",
},
{
"name": "Resource Monitor",
"desc": "A basic resource monitor.",
"path": "monitor.py",
"colour": "BLUE",
},
{
"name": "Directory Storage Analysis",
"desc": "Analyze file sizes in a specified directory",
"path": "fileStoreAnalyse.py",
"colour": "MAGENTA",
},
]
color_map = {
"BLACK": Fore.LIGHTBLACK_EX,
"RED": Fore.LIGHTRED_EX,
"GREEN": Fore.LIGHTGREEN_EX,
"YELLOW": Fore.LIGHTYELLOW_EX,
"BLUE": Fore.LIGHTBLUE_EX,
"MAGENTA": Fore.LIGHTMAGENTA_EX,
"CYAN": Fore.LIGHTCYAN_EX,
"WHITE": Fore.LIGHTWHITE_EX,
"RESET": Style.RESET_ALL,
}
path = os.path.dirname(__file__)
for index, process in enumerate(storm_processes):
print(f"{color_map[process['colour']]}[{index}={process['name']}]{Style.RESET_ALL} {process['desc']}{Style.RESET_ALL}")
try:
choice = int(input("Please enter your choice:"))
except Exception as failure:
print(f"Failure: {failure}")
exit(1)
except KeyboardInterrupt:
functions.exit_and_retract(len(storm_processes)+1, 0)
try:
functions.retract_lines(len(storm_processes)+1)
runpy.run_path(os.path.join(path, 'storm_processes', storm_processes[choice]["path"]))
except Exception as failure:
print(f"Failure: {failure}")