forked from genewildish/Mainline
chore(pipeline): improve pipeline architecture
- Add capability-based dependency resolution with prefix matching - Add EffectPluginStage with sensor binding support - Add CameraStage adapter for camera integration - Add DisplayStage adapter for display integration - Add Pipeline metrics collection - Add deprecation notices to legacy modules - Update app.py with pipeline integration
This commit is contained in:
@@ -352,7 +352,18 @@ def pick_effects_config():
|
||||
|
||||
|
||||
def run_demo_mode():
|
||||
"""Run demo mode - showcases effects and camera modes with real content."""
|
||||
"""Run demo mode - showcases effects and camera modes with real content.
|
||||
|
||||
.. deprecated::
|
||||
This is legacy code. Use run_pipeline_mode() instead.
|
||||
"""
|
||||
import warnings
|
||||
|
||||
warnings.warn(
|
||||
"run_demo_mode is deprecated. Use run_pipeline_mode() instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
import random
|
||||
|
||||
from engine import config
|
||||
@@ -559,7 +570,18 @@ def run_demo_mode():
|
||||
|
||||
|
||||
def run_pipeline_demo():
|
||||
"""Run pipeline visualization demo mode - shows ASCII pipeline animation."""
|
||||
"""Run pipeline visualization demo mode - shows ASCII pipeline animation.
|
||||
|
||||
.. deprecated::
|
||||
This demo mode uses legacy rendering. Use run_pipeline_mode() instead.
|
||||
"""
|
||||
import warnings
|
||||
|
||||
warnings.warn(
|
||||
"run_pipeline_demo is deprecated. Use run_pipeline_mode() instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
import time
|
||||
|
||||
from engine import config
|
||||
@@ -700,7 +722,18 @@ def run_pipeline_demo():
|
||||
|
||||
|
||||
def run_preset_mode(preset_name: str):
|
||||
"""Run mode using animation presets."""
|
||||
"""Run mode using animation presets.
|
||||
|
||||
.. deprecated::
|
||||
Use run_pipeline_mode() with preset parameter instead.
|
||||
"""
|
||||
import warnings
|
||||
|
||||
warnings.warn(
|
||||
"run_preset_mode is deprecated. Use run_pipeline_mode() instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
from engine import config
|
||||
from engine.animation import (
|
||||
create_demo_preset,
|
||||
@@ -839,28 +872,41 @@ def run_preset_mode(preset_name: str):
|
||||
|
||||
def main():
|
||||
from engine import config
|
||||
from engine.pipeline import list_presets
|
||||
|
||||
# Show pipeline diagram if requested
|
||||
if config.PIPELINE_DIAGRAM:
|
||||
from engine.pipeline import generate_pipeline_diagram
|
||||
|
||||
try:
|
||||
from engine.pipeline import generate_pipeline_diagram
|
||||
except ImportError:
|
||||
print("Error: pipeline diagram not available")
|
||||
return
|
||||
print(generate_pipeline_diagram())
|
||||
return
|
||||
|
||||
if config.PIPELINE_MODE:
|
||||
run_pipeline_mode(config.PIPELINE_PRESET)
|
||||
return
|
||||
|
||||
if config.PIPELINE_DEMO:
|
||||
run_pipeline_demo()
|
||||
return
|
||||
# Unified preset-based entry point
|
||||
# All modes are now just presets
|
||||
preset_name = None
|
||||
|
||||
# Check for --preset flag first
|
||||
if config.PRESET:
|
||||
run_preset_mode(config.PRESET)
|
||||
return
|
||||
preset_name = config.PRESET
|
||||
# Check for legacy --pipeline flag (mapped to demo preset)
|
||||
elif config.PIPELINE_MODE:
|
||||
preset_name = config.PIPELINE_PRESET
|
||||
# Default to demo if no preset specified
|
||||
else:
|
||||
preset_name = "demo"
|
||||
|
||||
if config.DEMO:
|
||||
run_demo_mode()
|
||||
return
|
||||
# Validate preset exists
|
||||
available = list_presets()
|
||||
if preset_name not in available:
|
||||
print(f"Error: Unknown preset '{preset_name}'")
|
||||
print(f"Available presets: {', '.join(available)}")
|
||||
sys.exit(1)
|
||||
|
||||
# Run with the selected preset
|
||||
run_pipeline_mode(preset_name)
|
||||
|
||||
atexit.register(lambda: print(CURSOR_ON, end="", flush=True))
|
||||
|
||||
@@ -1079,6 +1125,11 @@ def run_pipeline_mode(preset_name: str = "demo"):
|
||||
if result.success:
|
||||
display.show(result.data)
|
||||
|
||||
if hasattr(display, "is_quit_requested") and display.is_quit_requested():
|
||||
if hasattr(display, "clear_quit_request"):
|
||||
display.clear_quit_request()
|
||||
raise KeyboardInterrupt()
|
||||
|
||||
time.sleep(1 / 60)
|
||||
frame += 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user