-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathapp.py
More file actions
50 lines (36 loc) · 1.2 KB
/
app.py
File metadata and controls
50 lines (36 loc) · 1.2 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import importlib
# Ensure project root is on sys.path so package imports work reliably
path = os.path.dirname(os.path.abspath(__file__))
if path not in sys.path:
sys.path.insert(0, path)
from cps.setup_manager import is_first_run, run_interactive_setup
from cps.main import main as cps_main
def hide_console_windows():
try:
import ctypes
kernel32 = ctypes.WinDLL('kernel32')
user32 = ctypes.WinDLL('user32')
SW_HIDE = 0
hWnd = kernel32.GetConsoleWindow()
if hWnd:
user32.ShowWindow(hWnd, SW_HIDE)
except Exception:
# Non-Windows platforms or ctypes failures are safe to ignore
pass
def create_app():
cps_pkg = importlib.import_module('cps.__init__')
return cps_pkg.create_app()
if __name__ == '__main__':
# Check if first-run setup is needed
if is_first_run():
print("\n🚀 First-run setup detected. Starting configuration wizard...\n")
if not run_interactive_setup():
print("\n❌ Setup cancelled or failed. Exiting.")
sys.exit(1)
if os.name == "nt":
hide_console_windows()
cps_main()