-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathonetrainer-ui.py
More file actions
executable file
·64 lines (51 loc) · 2.14 KB
/
onetrainer-ui.py
File metadata and controls
executable file
·64 lines (51 loc) · 2.14 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python3
"""
OneTrainer UI Launcher
Automatically selects the best UI implementation available
"""
import os
import sys
import platform
import subprocess
def main():
# Get script directory
script_dir = os.path.dirname(os.path.abspath(__file__))
os.chdir(script_dir) # Switch to script directory
print("OneTrainer UI Launcher")
print("=====================")
# Order of preference for UI implementation
launcher_scripts = [
# 1st priority: DPG UI with full features
("start-ui-dpg.py", "GPU-accelerated DearPyGui UI with full features"),
# 2nd priority: Legacy DPG UI from onetrainer_dpg_full.py
("launch-dpg-ui.py", "Basic DearPyGui UI"),
# 3rd priority: Original CustomTkinter UI
("start-ui.sh" if platform.system() != "Windows" else "start-ui.bat", "Original CustomTkinter UI")
]
# Try each launcher in order
for launcher, description in launcher_scripts:
launcher_path = os.path.join(script_dir, launcher)
if os.path.exists(launcher_path):
print(f"Launching {description}...")
# Platform-specific launch
try:
if platform.system() == "Windows":
if launcher.endswith(".py"):
subprocess.run([sys.executable, launcher_path])
else:
subprocess.run([launcher_path], shell=True)
else:
if launcher.endswith(".py"):
subprocess.run([sys.executable, launcher_path])
else:
subprocess.run(["bash", launcher_path])
# If we got here, the launcher ran successfully
return 0
except Exception as e:
print(f"Failed to launch {launcher}: {e}")
print("Trying next launcher...")
# If we reached here, all launchers failed
print("ERROR: Failed to launch any UI. Please check your installation.")
return 1
if __name__ == "__main__":
sys.exit(main())