-
Notifications
You must be signed in to change notification settings - Fork 1
/
demo_launcher.py
75 lines (64 loc) · 2.11 KB
/
demo_launcher.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
70
71
72
73
74
75
import os, re
import time
SETTINGS = ""
def clear():
os.system("cls" if os.name == "nt" else "clear")
def print_programs():
folders = [
name
for name in os.listdir("./visualization/")
if os.path.isdir("./visualization/" + name)
]
apps = [
"_".join(s.lower() for s in name) + ".py"
for name in (re.findall("[A-Z][^A-Z]*", folder) for folder in folders)
]
print(*[f"[{i}]: {name}\n" for i, name in enumerate(apps)], sep="")
choice = input("> ")
if choice not in {str(x) for x in range(len(apps))}:
return
choice = int(choice)
print(
f"launching 'python visualization/{folders[choice]}/{apps[choice]} {SETTINGS}".strip(
" "
)
+ "'"
)
os.system(
f"python visualization/{folders[choice]}/{apps[choice]} {SETTINGS}".strip(" ")
)
def print_settings():
print(
"""optional arguments:
-wnd {glfw,headless,pygame2,pyglet,pyqt5,pyside2,sdl2,tk}, --window {glfw,headless,pygame2,pyglet,pyqt5,pyside2,sdl2,tk}
Name for the window type to use
-fs, --fullscreen Open the window in fullscreen mode
-vs VSYNC, --vsync VSYNC
Enable or disable vsync
-r RESIZABLE, --resizable RESIZABLE
Enable/disable window resize
-s SAMPLES, --samples SAMPLES
Specify the desired number of samples to use for
multisampling
-c CURSOR, --cursor CURSOR
Enable or disable displaying the mouse cursor
--size SIZE Window size
--size_mult SIZE_MULT
Multiplier for the window size making it easy scale
the window
"""
)
global SETTINGS
SETTINGS = input("> ")
user_input = ""
while user_input not in {"q", "exit", "quit"}:
clear()
user_input = input("launch ['l'], settings ['s'], quit ['q']\n> ").lower()
if user_input == "l":
# launch a application
clear()
print_programs()
if user_input == "s":
# show settings
clear()
print_settings()