forked from genewildish/Mainline
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.
98 lines
3.2 KiB
Python
98 lines
3.2 KiB
Python
"""
|
|
Mainline stage component registration.
|
|
|
|
This module registers all Mainline-specific stage components with the Sideline framework.
|
|
It should be called during application startup to ensure all components are available.
|
|
|
|
Terminology:
|
|
- Stage: A pipeline component (source, effect, display, camera, overlay)
|
|
- Plugin: A distributable package containing one or more stages
|
|
- This module registers stage components, not plugins themselves
|
|
"""
|
|
|
|
import logging
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
def register_stages(registry):
|
|
"""Register Mainline-specific stage components with the Sideline registry.
|
|
|
|
This function is called by Sideline's plugin discovery system.
|
|
|
|
Args:
|
|
registry: StageRegistry instance from Sideline
|
|
"""
|
|
logger.info("Registering Mainline stage components")
|
|
|
|
# Register data sources
|
|
_register_data_sources(registry)
|
|
|
|
# Register effects
|
|
_register_effects(registry)
|
|
|
|
# Register any other Mainline-specific stages
|
|
_register_other_stages(registry)
|
|
|
|
|
|
def _register_data_sources(registry):
|
|
"""Register Mainline data source stages."""
|
|
try:
|
|
from engine.data_sources.sources import HeadlinesDataSource, PoetryDataSource
|
|
from engine.data_sources.pipeline_introspection import (
|
|
PipelineIntrospectionSource,
|
|
)
|
|
|
|
registry.register("source", HeadlinesDataSource)
|
|
registry.register("source", PoetryDataSource)
|
|
registry.register("source", PipelineIntrospectionSource)
|
|
|
|
# Register with friendly aliases
|
|
registry._categories["source"]["headlines"] = HeadlinesDataSource
|
|
registry._categories["source"]["poetry"] = PoetryDataSource
|
|
registry._categories["source"]["pipeline-inspect"] = PipelineIntrospectionSource
|
|
|
|
logger.info("Registered Mainline data sources")
|
|
except ImportError as e:
|
|
logger.warning(f"Failed to register data sources: {e}")
|
|
|
|
|
|
def _register_effects(registry):
|
|
"""Register Mainline effect stages."""
|
|
try:
|
|
# Register effects
|
|
from sideline.effects import EffectRegistry
|
|
from sideline.effects.registry import get_registry
|
|
|
|
# Get the global effect registry instance
|
|
effect_registry = get_registry()
|
|
|
|
# Note: EffectRegistry stores effect instances, not classes
|
|
# For now, skip effect registration since it requires more refactoring
|
|
logger.info("Effect registration skipped (requires effect refactoring)")
|
|
except ImportError as e:
|
|
logger.warning(f"Failed to register effects: {e}")
|
|
|
|
|
|
def _register_other_stages(registry):
|
|
"""Register other Mainline-specific stage components."""
|
|
try:
|
|
# Register buffer stages
|
|
from sideline.pipeline.stages.framebuffer import FrameBufferStage
|
|
|
|
registry.register("effect", FrameBufferStage)
|
|
logger.info("Registered Mainline buffer stages")
|
|
except ImportError as e:
|
|
logger.warning(f"Failed to register buffer stages: {e}")
|
|
|
|
|
|
# Convenience function for explicit registration
|
|
def register_all_stages():
|
|
"""Explicitly register all Mainline stages.
|
|
|
|
This can be called directly instead of using plugin discovery.
|
|
"""
|
|
from sideline.pipeline import StageRegistry
|
|
|
|
register_stages(StageRegistry)
|