forked from genewildish/Mainline
Major changes: - Pipeline architecture with capability-based dependency resolution - Effects plugin system with performance monitoring - Display abstraction with multiple backends (terminal, null, websocket) - Camera system for viewport scrolling - Sensor framework for real-time input - Command-and-control system via ntfy - WebSocket display backend for browser clients - Comprehensive test suite and documentation Issue #48: ADR for preset scripting language included This commit consolidates 110 individual commits into a single feature integration that can be reviewed and tested before further refinement.
51 lines
1.4 KiB
Python
51 lines
1.4 KiB
Python
"""
|
|
Multi display backend - forwards to multiple displays.
|
|
"""
|
|
|
|
|
|
class MultiDisplay:
|
|
"""Display that forwards to multiple displays.
|
|
|
|
Supports reuse - passes reuse flag to all child displays.
|
|
"""
|
|
|
|
width: int = 80
|
|
height: int = 24
|
|
|
|
def __init__(self, displays: list):
|
|
self.displays = displays
|
|
self.width = 80
|
|
self.height = 24
|
|
|
|
def init(self, width: int, height: int, reuse: bool = False) -> None:
|
|
"""Initialize all child displays with dimensions.
|
|
|
|
Args:
|
|
width: Terminal width in characters
|
|
height: Terminal height in rows
|
|
reuse: If True, use reuse mode for child displays
|
|
"""
|
|
self.width = width
|
|
self.height = height
|
|
for d in self.displays:
|
|
d.init(width, height, reuse=reuse)
|
|
|
|
def show(self, buffer: list[str], border: bool = False) -> None:
|
|
for d in self.displays:
|
|
d.show(buffer, border=border)
|
|
|
|
def clear(self) -> None:
|
|
for d in self.displays:
|
|
d.clear()
|
|
|
|
def get_dimensions(self) -> tuple[int, int]:
|
|
"""Get dimensions from the first child display that supports it."""
|
|
for d in self.displays:
|
|
if hasattr(d, "get_dimensions"):
|
|
return d.get_dimensions()
|
|
return (self.width, self.height)
|
|
|
|
def cleanup(self) -> None:
|
|
for d in self.displays:
|
|
d.cleanup()
|