mirror of
https://github.com/Omni-guides/Jackify.git
synced 2026-01-17 19:47:00 +01:00
v0.0.31 - Clean public release
- Updated to v0.0.31 with GUI startup warning fix - Updated jackify-engine for improved compatibility - Removed development-only files from public repo - Added LICENSE and CONTRIBUTING.md for professional release - Professional public repository ready for alpha release
This commit is contained in:
@@ -3,6 +3,52 @@ UI Utilities for Jackify
|
||||
Shared UI components and utilities used across frontend interfaces
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
def clear_screen():
|
||||
"""
|
||||
Clear the terminal screen with AppImage compatibility.
|
||||
|
||||
This function provides robust screen clearing that works in various environments
|
||||
including AppImage containers where standard terminal utilities might not work properly.
|
||||
"""
|
||||
try:
|
||||
# Method 1: Try standard os.system approach first
|
||||
if os.name == 'nt':
|
||||
# Windows
|
||||
result = os.system('cls')
|
||||
else:
|
||||
# Unix/Linux - try clear command
|
||||
result = os.system('clear')
|
||||
|
||||
# If os.system failed (non-zero return), try fallback methods
|
||||
if result != 0:
|
||||
_clear_screen_fallback()
|
||||
|
||||
except Exception:
|
||||
# If os.system completely fails, use fallback
|
||||
_clear_screen_fallback()
|
||||
|
||||
def _clear_screen_fallback():
|
||||
"""
|
||||
Fallback screen clearing methods for environments where os.system doesn't work.
|
||||
This is particularly useful in AppImage environments.
|
||||
"""
|
||||
try:
|
||||
# Method 2: ANSI escape sequences (works in most terminals)
|
||||
# \033[H moves cursor to home position (0,0)
|
||||
# \033[2J clears entire screen
|
||||
# \033[3J clears scroll buffer (optional, not all terminals support)
|
||||
print('\033[H\033[2J\033[3J', end='', flush=True)
|
||||
except Exception:
|
||||
try:
|
||||
# Method 3: Alternative ANSI sequence
|
||||
print('\033c', end='', flush=True) # Full terminal reset
|
||||
except Exception:
|
||||
# Method 4: Last resort - print enough newlines to "clear" screen
|
||||
print('\n' * 50)
|
||||
|
||||
def print_jackify_banner():
|
||||
"""Print the Jackify application banner"""
|
||||
print("""
|
||||
|
||||
Reference in New Issue
Block a user