forked from Smacksmack206/P9Debian
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenhance_script_visuals.py
More file actions
386 lines (313 loc) · 15 KB
/
enhance_script_visuals.py
File metadata and controls
386 lines (313 loc) · 15 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
#!/usr/bin/env python3
"""
Visual and UX Enhancement Suggestions for Ultima-interactive.py
This script contains improvements to make the installer more visually appealing and user-friendly.
"""
# Enhanced visual improvements to add to the script
VISUAL_ENHANCEMENTS = """
# =============================================================================
# VISUAL AND UX ENHANCEMENTS FOR ULTIMA-INTERACTIVE.PY
# =============================================================================
## 1. ENHANCED STARTUP BANNER
def show_enhanced_banner():
'''Enhanced startup banner with system info and ASCII art'''
# ASCII Art Banner
banner_art = '''
╔══════════════════════════════════════════════════════════════════╗
║ ██╗ ██╗██╗ ████████╗██╗███╗ ███╗ █████╗ ██████╗ ██╗ ║
║ ██║ ██║██║ ╚══██╔══╝██║████╗ ████║██╔══██╗ ██╔═══██╗██║ ║
║ ██║ ██║██║ ██║ ██║██╔████╔██║███████║ ██║ ██║██║ ║
║ ██║ ██║██║ ██║ ██║██║╚██╔╝██║██╔══██║ ██║▄▄ ██║╚═╝ ║
║ ╚██████╔╝███████╗██║ ██║██║ ╚═╝ ██║██║ ██║ ╚██████╔╝██╗ ║
║ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚══▀▀═╝ ╚═╝ ║
║ ║
║ 🚀 DEBIAN ARM64 ULTIMATE INSTALLER 🚀 ║
║ Enhanced with AI-Powered Features ║
╚══════════════════════════════════════════════════════════════════╝
'''
console.print(Panel(
Text(banner_art, style="bold cyan", justify="center"),
title="🎯 Ultimate AVF Debian Setup",
subtitle=f"v2.0 | {datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}",
border_style="bright_blue",
padding=(1, 2)
))
## 2. SYSTEM INFORMATION DISPLAY
def show_system_info():
'''Display comprehensive system information before installation'''
import platform
import psutil
# Get system information
system_info = {
"🖥️ Architecture": platform.machine(),
"🐧 OS": f"{platform.system()} {platform.release()}",
"🧠 CPU Cores": f"{psutil.cpu_count(logical=False)} physical, {psutil.cpu_count(logical=True)} logical",
"💾 Memory": f"{psutil.virtual_memory().total // (1024**3)} GB total, {psutil.virtual_memory().available // (1024**3)} GB available",
"💿 Disk Space": f"{psutil.disk_usage('/').free // (1024**3)} GB free of {psutil.disk_usage('/').total // (1024**3)} GB total",
"🌐 Network": f"{len(psutil.net_if_addrs())} interfaces detected",
"👤 Current User": f"{os.getenv('USER', 'unknown')} (UID: {os.getuid()})",
"🔐 Privileges": "Root" if os.geteuid() == 0 else "User"
}
info_text = "\\n".join([f"{key}: [yellow]{value}[/yellow]" for key, value in system_info.items()])
console.print(Panel(
info_text,
title="📊 System Information",
border_style="green",
expand=False
))
## 3. ENHANCED PROGRESS VISUALIZATION
def create_enhanced_progress():
'''Create a more visually appealing progress display'''
return Progress(
SpinnerColumn(spinner_style="cyan"),
TextColumn("[progress.description]{task.description}"),
BarColumn(
bar_width=None,
complete_style="green",
finished_style="bright_green"
),
TextColumn("[progress.percentage]{task.percentage:>3.0f}%"),
TimeElapsedColumn(),
TextColumn("•"),
TextColumn("[blue]{task.completed}/{task.total}[/blue]"),
console=console,
transient=False,
expand=True
)
## 4. FEATURE PREVIEW DISPLAY
def show_feature_preview():
'''Show what features will be installed with visual icons'''
features = [
("🐳", "Docker CE", "Container platform with multi-arch support"),
("🖥️", "QEMU Emulation", "x86 applications on ARM64 architecture"),
("🌐", "Enhanced Samba", "Network file sharing including root filesystem"),
("📦", "Package Tools", "tasksel, aptitude, and advanced package management"),
("⭐", "Starship Prompt", "Beautiful cross-shell command prompt"),
("🔒", "Security Hardening", "SSH, VNC, and firewall configurations"),
("🎮", "VNC Desktop", "Remote GNOME desktop with optimizations"),
("🔗", "ZeroTier VPN", "Secure network connectivity"),
("📊", "System Monitoring", "htop, neofetch, and system utilities"),
("🛠️", "Development Tools", "Rust, just, build-essential, and more")
]
feature_text = "\\n".join([
f"{icon} [bold cyan]{name}[/bold cyan]: [dim]{desc}[/dim]"
for icon, name, desc in features
])
console.print(Panel(
feature_text,
title="🎯 Features to be Installed",
border_style="magenta",
expand=False
))
## 5. INTERACTIVE CONFIRMATION WITH PREVIEW
def enhanced_confirmation(args):
'''Enhanced confirmation dialog with better formatting'''
if args.non_interactive:
console.print("[yellow]⚡ Running in non-interactive mode - proceeding automatically[/yellow]")
return True
# Show system requirements
requirements = [
"✅ Root/sudo privileges (currently satisfied)",
"✅ Internet connectivity (will be verified)",
"✅ 4GB+ free disk space (will be checked)",
"✅ ARM64 Debian system (detected)",
"⚠️ Backup important data before proceeding"
]
req_text = "\\n".join(requirements)
console.print(Panel(
req_text,
title="📋 Prerequisites Check",
border_style="yellow"
))
# Enhanced confirmation prompt
console.print("\\n" + "="*60)
console.print("[bold red]⚠️ IMPORTANT NOTICE ⚠️[/bold red]")
console.print("This installer will make significant system changes including:")
console.print("• Installing 60+ packages and dependencies")
console.print("• Modifying system configurations (/etc/ssh, /etc/samba, etc.)")
console.print("• Creating storage volumes and mount points")
console.print("• Setting up network services and firewall rules")
console.print("="*60 + "\\n")
return Confirm.ask(
"[bold green]🚀 Ready to transform your system?[/bold green]",
default=False
)
## 6. STEP COMPLETION ANIMATIONS
def show_step_completion(step_name, success=True, details=None):
'''Show animated step completion with details'''
if success:
icon = "✅"
style = "bold green"
status = "COMPLETED"
else:
icon = "❌"
style = "bold red"
status = "FAILED"
console.print(f"\\n{icon} [${style}]{step_name}: {status}[/${style}]")
if details:
console.print(f" [dim]→ {details}[/dim]")
# Add a small delay for visual effect
time.sleep(0.3)
## 7. REAL-TIME STATUS UPDATES
def show_live_status(command, description):
'''Show live status updates during long-running commands'''
with console.status(f"[cyan]{description}[/cyan]", spinner="dots"):
# This would wrap around the actual command execution
time.sleep(0.1) # Placeholder
## 8. ENHANCED ERROR HANDLING WITH SUGGESTIONS
def show_enhanced_error(error_msg, step_name, suggestions=None):
'''Display errors with helpful suggestions and recovery options'''
error_panel = f"[bold red]❌ Error in step: {step_name}[/bold red]\\n\\n"
error_panel += f"[red]{error_msg}[/red]\\n"
if suggestions:
error_panel += "\\n[yellow]💡 Suggested solutions:[/yellow]\\n"
for i, suggestion in enumerate(suggestions, 1):
error_panel += f" {i}. {suggestion}\\n"
error_panel += "\\n[dim]Check the log file for detailed information:[/dim]\\n"
error_panel += f"[dim]{LOG_FILENAME}[/dim]"
console.print(Panel(
error_panel,
title="🚨 Installation Error",
border_style="red",
expand=False
))
## 9. COMPLETION CELEBRATION
def show_completion_celebration():
'''Show a celebration screen when installation completes'''
celebration = '''
🎉🎊🎉🎊🎉🎊🎉🎊🎉🎊🎉🎊🎉🎊🎉🎊🎉
██████╗ ██████╗ ███╗ ███╗██████╗ ██╗ ███████╗████████╗███████╗██╗
██╔════╝██╔═══██╗████╗ ████║██╔══██╗██║ ██╔════╝╚══██╔══╝██╔════╝██║
██║ ██║ ██║██╔████╔██║██████╔╝██║ █████╗ ██║ █████╗ ██║
██║ ██║ ██║██║╚██╔╝██║██╔═══╝ ██║ ██╔══╝ ██║ ██╔══╝ ╚═╝
╚██████╗╚██████╔╝██║ ╚═╝ ██║██║ ███████╗███████╗ ██║ ███████╗██╗
╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚══════╝╚══════╝ ╚═╝ ╚══════╝╚═╝
🎉🎊🎉🎊🎉🎊🎉🎊🎉🎊🎉🎊🎉🎊🎉🎊🎉
'''
console.print(Panel(
Text(celebration, style="bold green", justify="center"),
title="🏆 Installation Successful!",
border_style="bright_green",
padding=(1, 2)
))
## 10. INTERACTIVE MENU SYSTEM
def show_interactive_menu():
'''Show an interactive menu for advanced options'''
from rich.prompt import IntPrompt
menu_options = [
"🚀 Full Installation (Recommended)",
"🔧 Custom Installation (Choose components)",
"📊 System Analysis Only",
"🧪 Dry Run (Show what would be installed)",
"❌ Exit"
]
console.print(Panel(
"\\n".join([f"{i+1}. {option}" for i, option in enumerate(menu_options)]),
title="🎯 Installation Options",
border_style="cyan"
))
choice = IntPrompt.ask(
"Select an option",
choices=[str(i+1) for i in range(len(menu_options))],
default="1"
)
return choice
## 11. COMPONENT SELECTION INTERFACE
def show_component_selection():
'''Allow users to select which components to install'''
from rich.prompt import Confirm
components = {
"docker": ("🐳 Docker CE", "Container platform with multi-architecture support"),
"qemu": ("🖥️ QEMU Emulation", "Run x86 applications on ARM64"),
"samba": ("🌐 Enhanced Samba", "Network file sharing with root access"),
"vnc": ("🎮 VNC Desktop", "Remote GNOME desktop environment"),
"starship": ("⭐ Starship Prompt", "Beautiful cross-shell prompt"),
"security": ("🔒 Security Hardening", "SSH, firewall, and security configs"),
"dev_tools": ("🛠️ Development Tools", "Rust, build tools, and utilities"),
"monitoring": ("📊 Monitoring Tools", "System monitoring and analysis tools")
}
selected = {}
console.print(Panel(
"Select which components to install:",
title="🎯 Component Selection",
border_style="magenta"
))
for key, (name, desc) in components.items():
console.print(f"\\n{name}")
console.print(f"[dim] {desc}[/dim]")
selected[key] = Confirm.ask(f"Install {name}?", default=True)
return selected
## 12. PROGRESS ESTIMATION
def show_progress_estimation(total_steps):
'''Show estimated time and progress information'''
# Rough time estimates per step type (in seconds)
step_estimates = {
"package_install": 120,
"service_config": 30,
"file_operations": 15,
"system_config": 45
}
estimated_time = sum(step_estimates.values()) * (total_steps / len(step_estimates))
console.print(Panel(
f"📊 [bold]Installation Overview[/bold]\\n\\n"
f"• Total Steps: [yellow]{total_steps}[/yellow]\\n"
f"• Estimated Time: [yellow]{estimated_time//60:.0f}-{(estimated_time*1.5)//60:.0f} minutes[/yellow]\\n"
f"• Network Required: [yellow]Yes[/yellow]\\n"
f"• Disk Space Needed: [yellow]~2-4 GB[/yellow]\\n"
f"• Reboot Required: [yellow]Recommended[/yellow]",
title="⏱️ Time Estimate",
border_style="blue"
))
"""
# Additional UX improvements
UX_IMPROVEMENTS = """
## 13. KEYBOARD SHORTCUTS AND HOTKEYS
- Ctrl+C: Graceful cancellation with cleanup
- Ctrl+Z: Pause installation (with resume capability)
- 'q': Quick exit from menus
- 's': Skip optional components
- 'h': Show help during installation
## 14. SOUND NOTIFICATIONS (Optional)
- Success sound on completion
- Error sound on failures
- Progress chimes for major milestones
## 15. TERMINAL TITLE UPDATES
- Update terminal title with current step
- Show progress percentage in title
- Display ETA in terminal title
## 16. RESPONSIVE DESIGN
- Adapt to different terminal sizes
- Graceful degradation for small terminals
- Mobile-friendly output for SSH sessions
## 17. ACCESSIBILITY FEATURES
- High contrast mode option
- Screen reader friendly output
- Keyboard-only navigation
- Text-only mode for low-bandwidth connections
## 18. RECOVERY AND RESUME
- Save installation state
- Resume from last successful step
- Rollback capability for failed installations
- Checkpoint system for long installations
## 19. PERFORMANCE MONITORING
- Real-time resource usage display
- Network speed monitoring during downloads
- Disk I/O monitoring during installations
- Temperature monitoring (if available)
## 20. INTEGRATION FEATURES
- Export installation report
- Generate system documentation
- Create backup scripts automatically
- Integration with system monitoring tools
"""
def main():
"""Display all enhancement suggestions"""
print("🎨 VISUAL AND UX ENHANCEMENT SUGGESTIONS")
print("=" * 50)
print(VISUAL_ENHANCEMENTS)
print("\n" + "=" * 50)
print("🚀 ADDITIONAL UX IMPROVEMENTS")
print("=" * 50)
print(UX_IMPROVEMENTS)
if __name__ == "__main__":
main()