-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
84 lines (70 loc) · 2.22 KB
/
Copy pathmain.py
File metadata and controls
84 lines (70 loc) · 2.22 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env python3
"""
WiFi Auto Login System
=====================
This module serves as the main entry point for the WiFi Auto Login application.
It handles the initialization, splash screen display, and main program flow.
The application provides automated WiFi login capabilities with the following features:
- User-friendly menu interface
- Automatic startup configuration
- Splash screen display
- Error handling for graceful exits
Dependencies:
- menu.menuHandler: Handles all menu-related operations
- utils.platformUtils: Provides platform-specific utility functions
- startup.startupGenerator: Manages application startup configuration
"""
import os
import sys
from pathlib import Path
from menu.menuHandler import MenuHandler
from utils.platformUtils import clear_screen
from startup.startupGenerator import StartupGenerator
def show_splash() -> None:
"""
Display the application's splash screen.
Attempts to load and display custom splash art from assets/splash.txt.
Falls back to a simple text header if the splash file is not found.
Returns:
None
"""
splash_path = Path(__file__).parent / "assets" / "splash.txt"
if splash_path.exists():
with open(splash_path, "r", encoding="utf-8") as f:
print(f.read())
else:
print("=== WiFi Auto Login ===")
def setup_startup() -> None:
"""
Configure application to run at system startup.
Raises:
SystemExit: If startup configuration fails
"""
try:
startup = StartupGenerator()
startup.setup_startup()
except Exception as e:
print(f"Error creating startup: {e}")
sys.exit(1)
def main() -> None:
"""
Main application entry point.
Handles the primary program flow:
1. Clears the screen
2. Shows splash screen
3. Initializes and runs menu system
4. Sets up startup configuration
"""
clear_screen()
show_splash()
# Initialize and run menu system
menu = MenuHandler()
menu.main_menu()
# Configure startup after successful setup
setup_startup()
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
print("\nAborted by user.")
sys.exit(0)