CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-plover

Open Source Stenography Software providing real-time stenographic typing, machine support, and plugin architecture.

Pending
Overview
Eval results
Files

registry.mddocs/

Plugin Registry System

The Plover plugin registry provides centralized management for all extensible components including machines, dictionaries, GUI tools, extensions, and other plugin types. It enables dynamic discovery, registration, and access to plugins throughout the application.

Capabilities

Registry Management

Central registry for plugin discovery and management with support for dynamic registration and plugin enumeration.

class Registry:
    """Central plugin registry for all Plover extensions."""
    
    PLUGIN_TYPES = (
        'command', 'dictionary', 'extension', 'gui', 
        'gui.qt.machine_option', 'gui.qt.tool', 'machine', 
        'macro', 'meta', 'system'
    )
    
    def register_plugin(self, plugin_type: str, name: str, obj) -> None:
        """
        Register a plugin with the registry.
        
        Args:
            plugin_type: Type of plugin from PLUGIN_TYPES
            name: Unique name for the plugin
            obj: Plugin class or object to register
            
        Registers plugin for discovery by other components.
        """
    
    def get_plugin(self, plugin_type: str, plugin_name: str) -> Plugin:
        """
        Get specific plugin by type and name.
        
        Args:
            plugin_type: Type of plugin to retrieve
            plugin_name: Name of specific plugin
            
        Returns:
            Plugin wrapper object with metadata
            
        Raises:
            KeyError: If plugin not found
        """
    
    def list_plugins(self, plugin_type: str) -> list:
        """
        List all plugins of specified type.
        
        Args:
            plugin_type: Type of plugins to list
            
        Returns:
            List of Plugin objects of specified type
            
        Useful for enumerating available options like machines or dictionaries.
        """
    
    def list_distributions(self) -> list:
        """
        List all plugin distributions.
        
        Returns:
            List of distribution objects containing plugins
            
        Shows all installed packages that provide plugins.
        """
    
    def update(self) -> None:
        """
        Update registry from entry points.
        
        Scans installed packages for new plugins and updates
        the registry with any discoveries.
        """

Global Registry Instance

registry: Registry
"""
Global registry instance used throughout Plover.

All components access plugins through this shared instance.
"""

Plugin Wrapper

Individual plugin metadata and access wrapper.

class Plugin:
    """Wrapper for individual plugin with metadata."""
    
    def __init__(self, plugin_type: str, name: str, obj):
        """
        Initialize plugin wrapper.
        
        Args:
            plugin_type: Type classification of plugin
            name: Unique identifier for plugin
            obj: Actual plugin class or object
        """
    
    plugin_type: str
    """Type classification from Registry.PLUGIN_TYPES"""
    
    name: str
    """Unique plugin identifier"""
    
    obj: object
    """Actual plugin class or implementation object"""
    
    __doc__: str
    """Plugin documentation string"""

Plugin Types

Command Plugins ('command')

Execute specific stenographic commands or configuration changes.

Examples:

  • set_config: Configuration modification commands

Dictionary Plugins ('dictionary')

Support different dictionary file formats for stenographic translations.

Examples:

  • json: JSON dictionary format support
  • rtf: RTF/CRE dictionary format support

Extension Plugins ('extension')

Background extensions that enhance Plover functionality.

Examples:

  • Custom automation extensions
  • Integration with external applications
  • Workflow enhancement tools

GUI Plugins ('gui')

Main GUI interface implementations.

Examples:

  • none: Headless operation mode
  • qt: Qt-based graphical interface

GUI Machine Option Plugins ('gui.qt.machine_option')

Machine-specific configuration dialogs for the Qt GUI.

GUI Tool Plugins ('gui.qt.tool')

Specialized tools and windows within the Qt GUI.

Examples:

  • add_translation: Translation addition tool
  • lookup: Dictionary lookup tool
  • paper_tape: Stroke display tool
  • suggestions: Suggestion display tool

Machine Plugins ('machine')

Stenotype machine drivers for hardware communication.

Examples:

  • Gemini PR: Gemini PR protocol machine
  • Keyboard: Computer keyboard input
  • Passport: Passport stenotype machine
  • ProCAT: ProCAT stenotype machine
  • Stentura: Stentura stenotype machine
  • TX Bolt: TX Bolt protocol machine

Macro Plugins ('macro')

Automated stroke sequences and text manipulation macros.

Examples:

  • repeat_last_stroke: Repeat previous stroke
  • retro_delete_space: Delete preceding space
  • retro_insert_space: Insert space before text
  • retro_toggle_asterisk: Toggle asterisk in previous stroke
  • undo: Undo previous translation

Meta Plugins ('meta')

Text formatting and output manipulation commands.

Examples:

  • attach: Control text attachment
  • case: Case formatting control
  • carry_capitalize: Capitalization carry-forward
  • comma: Comma insertion with formatting
  • command: Execute system commands
  • glue: Text gluing without spaces
  • key_combo: Send key combinations
  • mode: Mode switching control
  • retro_case: Retroactive case changes
  • retro_currency: Currency formatting
  • stop: Stop translation processing
  • word_end: Word ending control

System Plugins ('system')

Stenotype system definitions with key layouts and rules.

Examples:

  • English Stenotype: Standard English stenotype system

Usage Examples

from plover.registry import registry

# Update registry from installed packages
registry.update()

# List available machines
machines = registry.list_plugins('machine')
for machine in machines:
    print(f"Machine: {machine.name}")

# Get specific machine plugin
gemini_plugin = registry.get_plugin('machine', 'Gemini PR')
gemini_machine = gemini_plugin.obj

# List all GUI tools
tools = registry.list_plugins('gui.qt.tool')
for tool in tools:
    print(f"Tool: {tool.name} - {tool.__doc__}")

# Register custom plugin
class CustomExtension:
    def __init__(self, engine):
        self.engine = engine
    
    def start(self):
        pass
    
    def stop(self):
        pass

registry.register_plugin('extension', 'my_extension', CustomExtension)

# List dictionary formats
dict_formats = registry.list_plugins('dictionary')
for fmt in dict_formats:
    print(f"Dictionary format: {fmt.name}")

# Get meta command
attach_meta = registry.get_plugin('meta', 'attach')
attach_command = attach_meta.obj

Plugin Development

Plugin Entry Points

Plugins are registered through Python entry points in setup.py or pyproject.toml:

# setup.py
entry_points={
    'plover.machine': [
        'My Machine = my_package.machine:MyMachine',
    ],
    'plover.extension': [
        'My Extension = my_package.extension:MyExtension',
    ],
    'plover.dictionary': [
        'My Format = my_package.dictionary:MyDictionary',
    ],
}

Plugin Discovery

The registry automatically discovers plugins through:

  1. Entry Points: Scans pkg_resources entry points for plugin types
  2. Distribution Scanning: Examines installed packages for Plover plugins
  3. Dynamic Registration: Allows runtime plugin registration

Plugin Interface Requirements

Each plugin type has specific interface requirements:

  • Machine plugins: Must inherit from StenotypeBase
  • Dictionary plugins: Must inherit from StenoDictionary
  • Extension plugins: Must implement __init__(engine), start(), stop()
  • GUI tool plugins: Must inherit from Tool base class
  • Meta plugins: Must be callable functions taking translation arguments

Types

from typing import List, Dict, Any, Callable, Type, Union

PluginType = str
PluginName = str
PluginObject = Union[Type, Callable, object]

PluginTypesList = tuple[str, ...]
PluginsList = List[Plugin]
DistributionsList = List[Any]

Install with Tessl CLI

npx tessl i tessl/pypi-plover

docs

configuration.md

dictionaries.md

engine.md

extensions.md

index.md

machines.md

registry.md

steno-data.md

tile.json