fix: ListDataSource cache and camera dependency resolution

Two critical fixes:

1. ListDataSource Cache Bug
   - Previously, ListDataSource.__init__ cached raw tuples directly
   - get_items() would return cached raw tuples without converting to SourceItem
   - This caused SourceItemsToBufferStage to receive tuples and stringify them
   - Results: ugly tuple representations in terminal/pygame instead of formatted text
   - Fix: Store raw items in _raw_items, let fetch() convert to SourceItem
   - Cache now contains proper SourceItem objects

2. Camera Dependency Resolution
   - CameraStage declared dependency on 'source.items' exactly
   - DataSourceStage provides 'source.headlines' (or 'source.poetry', etc.)
   - Capability matching didn't trigger prefix match for exact dependency
   - Fix: Change CameraStage dependency to 'source' for prefix matching

3. Added app.py Camera Stage Support
   - Pipeline now adds camera stage from preset.camera config
   - Supports vertical, horizontal, omni, floating, bounce modes
   - Tests now passing with proper data flow through all stages

Tests: All 502 tests passing, 16 skipped
This commit is contained in:
2026-03-16 21:55:57 -07:00
parent 85d8b29bab
commit affafe810c
17 changed files with 708 additions and 1301 deletions

37
engine/render/__init__.py Normal file
View File

@@ -0,0 +1,37 @@
"""Modern block rendering system - OTF font to terminal half-block conversion.
This module provides the core rendering capabilities for big block letters
and styled text output using PIL fonts and ANSI terminal rendering.
Exports:
- make_block: Render a headline into a content block with color
- big_wrap: Word-wrap text and render with OTF font
- render_line: Render a line of text as terminal rows using half-blocks
- font_for_lang: Get appropriate font for a language
- clear_font_cache: Reset cached font objects
- lr_gradient: Color block characters with left-to-right gradient
- lr_gradient_opposite: Complementary gradient coloring
"""
from engine.render.blocks import (
big_wrap,
clear_font_cache,
font_for_lang,
list_font_faces,
load_font_face,
make_block,
render_line,
)
from engine.render.gradient import lr_gradient, lr_gradient_opposite
__all__ = [
"big_wrap",
"clear_font_cache",
"font_for_lang",
"list_font_faces",
"load_font_face",
"lr_gradient",
"lr_gradient_opposite",
"make_block",
"render_line",
]