-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsbmm_gui.py
More file actions
40 lines (35 loc) · 1.46 KB
/
sbmm_gui.py
File metadata and controls
40 lines (35 loc) · 1.46 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
#!/usr/bin/env python3
"""Universal Mod Manager – GUI entry point.
Requires: pip install customtkinter Pillow (already in .venv)
Run with: .venv/bin/python sbmm_gui.py
When packaged as a single frozen executable the GUI spawns subprocesses of
itself with CLI flags (--enable, --disable, etc.). argv is inspected here so
those invocations are routed to the CLI backend instead of opening a second
GUI window.
nxm:// links are also handled here: if a running GUI instance is found via
the IPC socket, the URL is forwarded and this process exits immediately.
Otherwise the GUI starts with the URL queued for download.
"""
import sys
_CLI_FLAGS = {
"--enable", "--disable", "--list", "--conflicts", "--check",
"--install", "--uninstall", "--purge", "--clean",
"--assetcheck", "--extract",
}
if __name__ == "__main__":
args = sys.argv[1:]
nxm_url = next((a for a in args if a.lower().startswith("nxm://")), None)
if nxm_url:
# Try to hand off to an already-running instance first
from mm.gui.ipc import try_send
if try_send(nxm_url):
sys.exit(0)
# No running instance — open the GUI with the URL queued
from mm.gui import main as _gui_main
_gui_main(nxm_url=nxm_url)
elif any(a in _CLI_FLAGS for a in args):
from mm.commands import main as _cli_main
_cli_main()
else:
from mm.gui import main as _gui_main
_gui_main()