feat: Implement Sideline plugin system with consistent terminology
This commit implements the Sideline/Mainline split with a clean plugin architecture: ## Core Changes ### Sideline Framework (New Directory) - Created directory containing the reusable pipeline framework - Moved pipeline core, controllers, adapters, and registry to - Moved display system to - Moved effects system to - Created plugin system with security and compatibility management in - Created preset pack system with ASCII art encoding in - Added default font (Corptic) to - Added terminal ANSI constants to ### Mainline Application (Updated) - Created for Mainline stage component registration - Updated to register Mainline stages at startup - Updated as a compatibility shim re-exporting from sideline ### Terminology Consistency - : Base class for all pipeline components (sources, effects, displays, cameras) - : Base class for distributable plugin packages (was ) - : Base class for visual effects (was ) - Backward compatibility aliases maintained for existing code ## Key Features - Plugin discovery via entry points and explicit registration - Security permissions system for plugins - Compatibility management with semantic version constraints - Preset pack system for distributable configurations - Default font bundled with Sideline (Corptic.otf) ## Testing - Updated tests to register Mainline stages before discovery - All StageRegistry tests passing Note: This is a major refactoring that separates the framework (Sideline) from the application (Mainline), enabling Sideline to be used by other applications.
This commit is contained in:
108
sideline/terminal.py
Normal file
108
sideline/terminal.py
Normal file
@@ -0,0 +1,108 @@
|
||||
"""
|
||||
ANSI escape codes and terminal control constants.
|
||||
|
||||
Provides standard ANSI escape sequences for terminal manipulation.
|
||||
This module belongs in Sideline as it's a framework-level concern.
|
||||
"""
|
||||
|
||||
# ─── ANSI RESET ──────────────────────────────────────────
|
||||
RST = "\033[0m"
|
||||
|
||||
# ─── TEXT STYLES ─────────────────────────────────────────
|
||||
BOLD = "\033[1m"
|
||||
DIM = "\033[2m"
|
||||
UNDERLINE = "\033[4m"
|
||||
REVERSE = "\033[7m"
|
||||
|
||||
# ─── MATRIX GREENS (Sideline default theme) ─────────────
|
||||
G_HI = "\033[38;5;46m" # Bright green
|
||||
G_MID = "\033[38;5;34m" # Medium green
|
||||
G_LO = "\033[38;5;22m" # Dark green
|
||||
G_DIM = "\033[2;38;5;34m" # Dim green
|
||||
|
||||
# ─── COOL TONES ──────────────────────────────────────────
|
||||
W_COOL = "\033[38;5;250m" # Cool white
|
||||
W_DIM = "\033[2;38;5;245m" # Dim white
|
||||
W_GHOST = "\033[2;38;5;238m" # Ghost white
|
||||
C_DIM = "\033[2;38;5;37m" # Dim cyan
|
||||
|
||||
# ─── TERMINAL CONTROL ────────────────────────────────────
|
||||
CLR = "\033[2J\033[H" # Clear screen and home cursor
|
||||
CURSOR_OFF = "\033[?25l" # Hide cursor
|
||||
CURSOR_ON = "\033[?25h" # Show cursor
|
||||
|
||||
|
||||
# ─── CURSOR POSITIONING ──────────────────────────────────
|
||||
def cursor_pos(row: int, col: int) -> str:
|
||||
"""Move cursor to position (row, col)."""
|
||||
return f"\033[{row};{col}H"
|
||||
|
||||
|
||||
# ─── COLOR UTILITIES ─────────────────────────────────────
|
||||
def fg_color(code: int) -> str:
|
||||
"""Set foreground color (0-255)."""
|
||||
return f"\033[38;5;{code}m"
|
||||
|
||||
|
||||
def bg_color(code: int) -> str:
|
||||
"""Set background color (0-255)."""
|
||||
return f"\033[48;5;{code}m"
|
||||
|
||||
|
||||
# ─── COMMON COLORS ───────────────────────────────────────
|
||||
BLACK = "\033[30m"
|
||||
RED = "\033[31m"
|
||||
GREEN = "\033[32m"
|
||||
YELLOW = "\033[33m"
|
||||
BLUE = "\033[34m"
|
||||
MAGENTA = "\033[35m"
|
||||
CYAN = "\033[36m"
|
||||
WHITE = "\033[37m"
|
||||
|
||||
# ─── BRIGHT COLORS ───────────────────────────────────────
|
||||
BRIGHT_BLACK = "\033[90m"
|
||||
BRIGHT_RED = "\033[91m"
|
||||
BRIGHT_GREEN = "\033[92m"
|
||||
BRIGHT_YELLOW = "\033[93m"
|
||||
BRIGHT_BLUE = "\033[94m"
|
||||
BRIGHT_MAGENTA = "\033[95m"
|
||||
BRIGHT_CYAN = "\033[96m"
|
||||
BRIGHT_WHITE = "\033[97m"
|
||||
|
||||
__all__ = [
|
||||
"RST",
|
||||
"BOLD",
|
||||
"DIM",
|
||||
"UNDERLINE",
|
||||
"REVERSE",
|
||||
"G_HI",
|
||||
"G_MID",
|
||||
"G_LO",
|
||||
"G_DIM",
|
||||
"W_COOL",
|
||||
"W_DIM",
|
||||
"W_GHOST",
|
||||
"C_DIM",
|
||||
"CLR",
|
||||
"CURSOR_OFF",
|
||||
"CURSOR_ON",
|
||||
"cursor_pos",
|
||||
"fg_color",
|
||||
"bg_color",
|
||||
"BLACK",
|
||||
"RED",
|
||||
"GREEN",
|
||||
"YELLOW",
|
||||
"BLUE",
|
||||
"MAGENTA",
|
||||
"CYAN",
|
||||
"WHITE",
|
||||
"BRIGHT_BLACK",
|
||||
"BRIGHT_RED",
|
||||
"BRIGHT_GREEN",
|
||||
"BRIGHT_YELLOW",
|
||||
"BRIGHT_BLUE",
|
||||
"BRIGHT_MAGENTA",
|
||||
"BRIGHT_CYAN",
|
||||
"BRIGHT_WHITE",
|
||||
]
|
||||
Reference in New Issue
Block a user