- eg/Classes/ActionBase.py - Base class for all plugin actions
- eg/Classes/ActionGroup.py - Handles grouping of related actions
- eg/Classes/ActionItem.py - Represents individual action instances
- eg/Classes/ActionSelectButton.py - UI component for action selection
- eg/Classes/ActionThread.py - Main execution thread for actions
- eg/Classes/ActionWithStringParameter.py - Action subclass with string config
- eg/Classes/AddActionDialog.py - Dialog for adding new actions
- eg/Classes/AddActionGroupDialog.py - Dialog for adding action groups
- eg/Classes/AddEventDialog.py - Dialog for adding new events
- eg/Classes/AddPluginDialog.py - Dialog for adding plugins
- eg/Classes/AnimatedWindow.py - Animated UI component
- eg/Classes/App.py - Main application class
- eg/Classes/AutostartItem.py - Handles autostart functionality
- eg/Classes/BoxedGroup.py - UI layout component
- eg/Classes/ButtonRow.py - UI button container
- eg/Classes/CheckBoxGrid.py - UI grid of checkboxes
- eg/Classes/CheckUpdate.py - Update checker functionality
- eg/Classes/Choice.py - UI choice component
- eg/Classes/Colour.py - Color management
- eg/Classes/ColourSelectButton.py - UI color picker
- eg/Classes/Config.py - Configuration management
- eg/Classes/ConfigDialog.py - Base configuration dialog
- eg/Classes/ConfigPanel.py - Configuration panel component
- eg/Classes/ContainerItem.py - Base container class
- eg/NamedPipe.py - IPC via Windows named pipes
- Implements command processing via named pipes
- Handles multi-instance pipe connections
- Provides secure IPC between admin/user contexts
- Supports async command execution
- Uses daemon threads for pipe management
- eg/EventThread.py
- Manages event filtering and execution
- Handles memory quotas and limitations
- Controls event session lifecycle
- Provides synchronous/async event triggers
- Implements event filtering system
- eg/Classes/ThreadWorker.py - Core message pumping and task execution system
- eg/Classes/Tasklet.py - Stackless Python tasklet wrapper implementation
- eg/Classes/TaskletDialog.py - Dialog management using tasklets
- eg/Classes/Scheduler.py - Task scheduling and timing system
- eg/init.py - Core initialization and stackless integration
- extensions/cFunctions/hooks.c - Native hooks and idle detection system
- eg/Classes/PluginBase.py - Base plugin class and lifecycle management
- eg/Classes/PluginManager.py - Plugin loading and instance management
- eg/Classes/PluginModuleInfo.py - Plugin metadata and registration
- eg/Classes/PluginInstanceInfo.py - Plugin instance state tracking
- eg/Classes/PluginItem.py - Plugin tree item representation
- eg/Classes/PluginInstall.py - Plugin installation and updates
-
plugins/GlobalMonitor/ - System performance monitoring and metrics
- Performance counter system
- Resource monitoring
- Event generation pipeline
- Data collection services
-
plugins/Mouse/ - Mouse input and control
- Event generation (button, movement, wheel)
- Mouse actions and state management
- Movement control system
- Multi-monitor support
- Complete Rust implementation with async/await
-
plugins/RadioSure/ - Media player control plugin
- Window observation system
- Event generation pipeline
- Thread management
- Windows API integration
-
plugins/EventGhost/ - Core plugin for events and macros
- Action management (Python scripts, macros)
- Flow control (jumps, conditionals)
- UI integration (messages, displays)
- System integration
-
plugins/Keyboard/ - Keyboard event handling
- Hotkey detection and blocking
- Key code translation
- Windows hook integration
- Event system binding
-
plugins/System/ - System control and hardware
- Power management
- Display control
- Audio control
- System integration
-
plugins/FileOperations/ - File system operations and monitoring
- File system watchers
- Operation interceptors
- Path management
- Event triggers
-
plugins/DirectoryWatcher/ - Directory monitoring and change detection
- Directory monitor service
- Change detection system
- Filter management
- Event dispatcher
- Event creation and propagation
- Event queue management
- Event filtering and routing
- Event binding and callbacks
- Custom event types (eg.EventGhostEvent)
- Event Thread Implementation:
- ThreadWorker-based event processing
- Memory management and quotas
- Event filtering system
- Event execution modes:
- Normal events
- Enduring events
- Wait-for-completion events
- Event Execution:
- Action thread delegation
- Event source filtering
- Payload handling
- Timeout management
- Session control
- Event Processing Flow:
- Event source detection
- Event object creation
- Queue management
- Event dispatching
- Action triggering
- Event Types:
- System events
- Plugin events
- User events
- Remote events
- Timer events
- Event Properties:
- Event prefix
- Event suffix
- Payload data
- Source information
- Timestamp
- Main thread (UI)
- Action thread (Plugin execution)
- Worker threads (Background tasks)
- Stackless Python tasklets
- Thread synchronization mechanisms
- Named pipe communication
- Inter-process messaging
- Windows-specific thread handling
- Plugin loading/unloading
- Plugin lifecycle management
- Plugin configuration
- Action registration
- Event handling registration
- Dynamic module imports
- Plugin dependency resolution
- Version compatibility checking
- Base class for all EventGhost plugins
- Provides core plugin lifecycle methods:
__init__
: Plugin initialization and action registration__start__
: Called when plugin is enabled__stop__
: Called when plugin is disabled__close__
: Called when plugin is unloaded
- Handles event triggering and management
- Provides configuration interface
- Manages plugin metadata (name, description, version)
- Supports internationalization through text attribute
- Manages plugin lifecycle and instances
- Maintains plugin database and registration
- Handles plugin loading and instantiation
- Provides plugin info lookup and management
- Supports multi-loading of plugins
- Manages plugin dependencies and versions
- Tracks individual plugin instance state
- Manages plugin actions and events
- Handles plugin evaluation names
- Maintains instance configuration
- Tracks plugin execution state
- Manages plugin exceptions
- Handles plugin module registration
- Manages plugin metadata and properties
- Supports plugin localization
- Handles plugin icons and resources
- Validates plugin requirements
- Tracks plugin paths and GUIDs
- Handles plugin package installation
- Manages plugin dependencies
- Validates plugin compatibility
- Handles plugin updates
- Manages plugin resources
- Base class for all plugin actions
- Supports action configuration
- Handles action execution
- Manages action metadata
- Provides action grouping
- Supports action localization
-
Plugin Discovery
- Scans plugin directories
- Loads plugin metadata
- Validates plugin requirements
-
Plugin Loading
- Imports plugin module
- Creates plugin instance
- Initializes plugin state
- Registers plugin actions
-
Plugin Execution
- Handles plugin start/stop
- Manages plugin state
- Processes plugin events
- Executes plugin actions
-
Plugin Cleanup
- Handles plugin shutdown
- Cleans up resources
- Unregisters actions
- Removes plugin instance
-
Module Structure
- Plugin base class
- Action definitions
- Event handlers
- Configuration interface
-
Resource Management
- Plugin icons
- Localization files
- Configuration data
- Plugin dependencies
-
Security Model
- Plugin isolation
- Resource access control
- Event filtering
- Configuration validation
-
Extension Points
- Action registration
- Event handling
- Configuration interface
- Resource management
-
Base Classes
- PluginBase for core functionality
- ActionBase for plugin actions
- Custom exceptions for error handling
-
Registration System
- Plugin metadata declaration
- Action registration
- Event binding
- Resource declaration
-
Configuration System
- Plugin settings
- Action configuration
- Persistent storage
- UI integration
-
Event System
- Event generation
- Event handling
- Event filtering
- Event persistence
- XML-based configuration storage
- Runtime configuration
- User preferences
- Plugin settings persistence
- Tree structure serialization
- Registry interaction
- Environment variables
- System state detection
- Main window
- Tree view
- Configuration dialogs
- Log window
- System tray integration
- Central UI container using wxPython
- Manages layout with wxAUI (Advanced User Interface)
- Handles window events and user interactions
- Implements menu and toolbar systems
- Manages dialog lifecycle
- Provides configuration persistence
- Supports window state management
- Base Dialog class with common functionality
- TaskletDialog for async operations
- ConfigDialog for plugin/action configuration
- MessageDialog for user notifications
- TransferDialog for progress indication
- Custom dialog controls and layouts
- Modal and non-modal support
- Hierarchical view of configuration
- Drag and drop support
- Context menu integration
- Item editing capabilities
- Selection management
- Visual feedback system
- Custom item rendering
- Event logging display
- Column management
- Filtering capabilities
- Auto-scrolling
- Text formatting
- Timestamp handling
- Custom controls and widgets
- Header boxes
- Animated windows
- Hyperlink controls
- Color pickers
- Button arrays
- Grid layouts
-
Window Layout
- Dockable panels
- Persistent layouts
- Size management
- Position tracking
- Split views
-
Dialog Management
- Dialog stacking
- Modal handling
- Window positioning
- Focus management
- Dialog persistence
-
Control Integration
- Custom control creation
- Event routing
- State management
- Visual feedback
- Accessibility support
-
Theme Support
- Custom drawing
- Icon management
- Color schemes
- Font handling
- Visual styles
-
Input Handling
- Keyboard shortcuts
- Mouse events
- Context menus
- Drag and drop
- Focus tracking
-
Visual Feedback
- Status messages
- Progress indicators
- Error displays
- Tooltips
- Highlighting
-
Configuration Interface
- Property editors
- Value validation
- Live preview
- Default handling
- State persistence
-
Window Management
- Minimize/Maximize
- System tray
- Multiple monitors
- Window states
- Focus handling
-
Core Dependencies
- wxPython for UI framework
- wxAUI for docking
- wx.TreeCtrl for tree view
- wx.ListCtrl for logging
- Custom wx controls
-
Platform Integration
- Native widgets
- System dialogs
- Window management
- Clipboard handling
- Drag and drop
-
Potential Frameworks
- Iced for native Rust UI
- Druid for performance
- egui for immediate mode
- gtk-rs for GTK binding
- Qt bindings via rust-qt
-
Framework Requirements
- Tree view support
- Docking capability
- Rich text display
- Custom controls
- Native look and feel
-
Migration Challenges
- Complex layouts
- Custom controls
- Event handling
- Dialog system
- Plugin UI integration
-
Implementation Strategy
- Gradual component migration
- Parallel UI systems
- Compatibility layer
- State synchronization
- Plugin adaptation
-
UI Integration
- Plugin dialog system
- Custom controls
- Resource management
- Event handling
- State persistence
-
Compatibility Layer
- wxPython wrapper
- Control mapping
- Event translation
- Resource handling
- State management
-
Migration Path
- Plugin UI guidelines
- Transition helpers
- UI component library
- Testing tools
- Documentation
- Named Pipe Communication
- Inter-process messaging
- Remote control interface
- Plugin communication
- Command processing
- Security descriptor handling
- Multiple pipe instance support
- Message queuing system
- Windows API Wrappers
- Dynamic API loading
- Error handling
- Resource management
- Win32 security attributes
- File handle management
- Pipe state management
- System Hooks
- Keyboard monitoring
- Mouse tracking
- Window events
- Message filtering
- Event propagation
- Registry Access
- Configuration storage
- System settings
- Application detection
- Permission handling
- Process Management
- Application launching
- Window manipulation
- Process monitoring
- Thread synchronization
- Resource cleanup
- Event creation from various sources
- Event binding to actions
- Event filtering and conditions
- Event logging
- Event replay
- Event Binding System:
- Dynamic binding registration
- Binding priority handling
- Conditional binding
- Binding groups
- Temporary bindings
- Event Sources:
- Hardware input devices
- System state changes
- Plugin-generated events
- Network events
- Timer events
- User-triggered events
- Event Processing Pipeline:
- Source validation
- Event normalization
- Queue prioritization
- Action triggering
- Result handling
- Action execution
- Action groups
- Action configuration
- Action compilation
- Action state management
- Macro creation
- Macro execution
- Macro nesting
- Conditional execution
- Variables and scope
- Base plugin class
- Action definition
- Event generation
- Configuration interface
- Resource management
- Item hierarchy
- Item types:
- Folders
- Macros
- Actions
- Events
- Plugins
- Drag and drop
- Copy/paste
- Import/export
- Debug logging
- Action logging
- Event logging
- Error handling
- Log filtering
- Network interface
- Remote execution
- API endpoints
- Security
- Application launching
- Window management
- Process control
- System commands
- Input devices
- Output devices
- System hardware
- Custom hardware
- TCP/IP communication
- HTTP requests
- Network protocols
- Remote control
- Media players
- Sound control
- Display control
- Media keys
- Registry manipulation
- File operations
- System settings
- Power management
- Plugin templates
- Action templates
- Testing framework
- Documentation tools
- Debug output
- Event monitor
- Action tester
- Plugin logger
- Tree editor
- Action editor
- Event binding
- Plugin configuration
- String handling
- Threading model
- Exception handling
- Print statements
- Division operations
- Library compatibility
- FFI interface
- Memory management
- Thread safety
- Error handling
- Plugin system
- UI framework selection
-
Current Stackless Usage:
- Core Threading Model:
- Stackless tasklets for lightweight concurrency
- Custom ThreadWorker bridging tasklets with Win32 messages
- Event processing and UI interactions
- Dialog Management:
- Modal and non-modal dialog handling via tasklets
- Asynchronous UI updates through channels
- Dialog lifecycle management
- Event Processing:
- Event filtering and routing via tasklets
- Event queuing through stackless channels
- Cross-thread event synchronization
- Core Threading Model:
-
Migration Challenges:
- Tasklet Replacement:
- Implementing Rust async/await equivalents
- Tokio runtime for async event loop
- Custom task scheduling requirements
- Channel Communication:
- Replacing stackless channels with Rust channels
- Cross-thread communication patterns
- Event routing through async channels
- Threading Model:
- ThreadWorker reimplementation in Rust
- Async tasks vs stackless tasklets
- Thread safety considerations
- Win32 Integration:
- Windows-rs API bindings usage
- Message pump reimplementation
- COM initialization handling
- Tasklet Replacement:
-
Rust Advantages:
- Threading Model:
- Ownership system prevents data races
- Modern async/await concurrency
- No Global Interpreter Lock
- Performance:
- Native code execution
- Zero-cost abstractions
- Improved memory management
- Safety:
- Memory safety guarantees
- Thread safety by design
- Enhanced error handling
- Modern Async:
- Built-in async/await support
- Rich async ecosystem
- Superior async performance
- Threading Model:
-
Implementation Patterns:
- Event System:
// Event processing with async struct EventSystem { event_tx: mpsc::Sender<Event>, event_rx: mpsc::Receiver<Event>, } impl EventSystem { async fn process_events(&mut self) { while let Some(event) = self.event_rx.recv().await { self.handle_event(event).await; } } }
- UI Integration:
// UI message handling use windows_rs::Win32::UI::WindowsAndMessaging::*; struct MessagePump { msg_tx: mpsc::Sender<Message>, } impl MessagePump { async fn run(&mut self) { let mut msg = MSG::default(); while GetMessage(&mut msg, None, 0, 0).as_bool() { TranslateMessage(&msg); DispatchMessage(&msg); } } }
- Task Management:
// Instead of stackless tasklets async fn handle_event(event: Event) { // Event processing } // Instead of stackless channels use tokio::sync::mpsc; let (tx, rx) = mpsc::channel(32);
- Event System:
-
Migration Benefits:
- Eliminates Stackless Python dependency
- Provides modern async/await system
- Improves performance and safety
- Better Windows integration
- Enhanced error handling
- Simplified concurrency model
- Reduced memory overhead
- Improved debugging capabilities
-
Key Considerations:
- Careful handling of existing plugin interfaces
- Gradual migration of core components
- Maintaining Windows API compatibility
- Testing strategy for async behavior
- Performance monitoring during transition
- Documentation of new patterns
- Training for Rust async concepts
- Unit tests
- Integration tests
- Plugin tests
- UI tests
- Migration validation
- Architecture documentation
- API documentation
- Plugin development guide
- User guide
- Migration guide
-
Config Class (
Config.py
)- Central configuration store with default values
- Handles persistent storage of application settings
- Manages runtime configuration state
- Supports section-based organization of settings
-
PersistentData (
PersistentData.py
)- Metaclass-based configuration persistence
- Automatic configuration hierarchy building
- Supports nested configuration sections
-
Document Management (
Document.py
)- XML-based configuration file handling
- Undo/Redo support for configuration changes
- Save/Load functionality with change tracking
- Configuration tree state persistence
-
Configuration UI (
ConfigDialog.py
,OptionsDialog.py
)- Dialog-based configuration interface
- Settings categorization and organization
- Real-time configuration updates
- User preference management
-
File Format
- Primary storage in Python-based config files
- XML format for tree configuration
- Base64 encoding for sensitive data
- Hierarchical structure matching UI tree
-
Configuration Paths
- User-specific configuration directory
- Application-wide default settings
- Plugin-specific configuration storage
- Temporary configuration handling
-
State Management
- Tree expansion state tracking
- Window positions and sizes
- User preferences persistence
- Plugin state management
-
Current Implementation
- Python-based configuration files
- Direct filesystem access
- wxPython UI integration
- In-memory configuration caching
-
Rust Migration Path
- Consider using Serde for serialization
- Implement configuration trait system
- Maintain backward compatibility
- Add migration tooling support
-
Key Challenges
- Configuration format versioning
- Plugin configuration compatibility
- UI state persistence
- Cross-platform paths handling
-
Plugin Considerations
- Plugin-specific configuration storage
- Configuration validation system
- Default value handling
- Configuration upgrade paths
-
Sensitive Data
- Password storage encryption
- Secure configuration paths
- Permission management
- Configuration backup
-
Access Control
- User-specific settings
- Plugin sandboxing
- Configuration isolation
- Validation and sanitization
-
Log Class (
Log.py
)- Central logging manager
- Handles multiple log types (info, error, debug, warning)
- Supports log listeners and event listeners
- Manages stdout/stderr redirection
- Debug level control
- Stack trace formatting
-
LogCtrl (
MainFrame/LogCtrl.py
)- Virtual list control for log display
- Circular buffer implementation
- Configurable display options
- Copy/paste support
- Event replay functionality
- Custom formatting
-
Debug System
- Debug level configuration
- Debug notice printing
- Warning notice handling
- Performance logging
- System information logging
-
UI Integration
- Log window with filtering
- Color-coded messages
- Timestamp formatting
- Indentation support
- Context menu actions
- Drag and drop support
-
Log Types
- Standard output logging
- Error logging
- Debug logging
- Event logging
- Warning messages
- Stack traces
- System information
-
Display Features
- Configurable timestamps
- Message indentation
- Color coding by type
- Icon indicators
- Virtual scrolling
- Auto-scrolling
-
Interaction
- Copy to clipboard
- Event replay
- Message filtering
- Clear log
- Select all
- Drag and drop
-
Performance
- Circular buffer management
- Virtual list implementation
- Batch updates
- Memory management
- Buffer size control
-
Current Implementation
- Python logging integration
- wxPython UI components
- File-based logging
- Memory-based buffering
- Thread-safe logging
-
Rust Migration Path
- Consider using
tracing
crate - Implement structured logging
- Support async logging
- Maintain performance
- Enable log rotation
- Consider using
-
Key Challenges
- Log format compatibility
- Performance optimization
- UI integration
- Thread safety
- Buffer management
-
Plugin Considerations
- Plugin-specific logging
- Log level control
- Format standardization
- Performance impact
- Debug support
-
Log Content
- Sensitive data filtering
- Log file permissions
- User data protection
- Error message safety
- Debug info control
-
Access Control
- Log file access
- Clear log permissions
- Export restrictions
- Remote logging security
- Debug level control
Rust's channels (mpsc, crossbeam) could replace stackless channels Would need to handle cross-thread communication differently Could use async channels for event routing Threading Model: Would need to reimplement the ThreadWorker using Rust's threading model Could use async tasks instead of stackless tasklets
Would need careful consideration of thread safety Win32 Integration: Rust has good Win32 bindings through windows-rs Message pump implementation would need to be rewritten Would need to handle COM initialization differently Advantages of moving to Rust: Better Threading Model: Rust's ownership system prevents data races Async/await provides modern concurrency No GIL limitations Performance: Native code execution Zero-cost abstractions Better memory management Safety: Memory safety guarantees Thread safety by design Better error handling Modern Async: Built-in async/await Rich ecosystem of async tools Better performance than Python's async
EventGhost's architecture is built on several key principles that should be maintained in the Rust implementation:
-
Event-Driven Simplicity
- Direct event handling without unnecessary complexity
- Synchronous processing where possible
- Clear and predictable event flow
-
Plugin Architecture
- Simple plugin lifecycle (start/stop)
- Direct event handling methods
- Minimal interface requirements
- Easy plugin development
-
Resource Management
- Direct resource acquisition and release
- Clear ownership and cleanup patterns
- Predictable resource lifecycles
While Rust provides powerful async capabilities, they should be used judiciously:
-
When to Use Async:
- Network I/O operations
- Long-running file operations
- External service communication
-
When to Avoid Async:
- Simple event handling
- Direct system calls
- UI interactions
- Plugin lifecycle methods
-
Implementation Guidelines:
- Keep async at the edges (e.g., network boundaries)
- Use synchronous core for event processing
- Maintain simple plugin interfaces
- Avoid unnecessary complexity
Example Plugin Interface:
pub trait Plugin {
// Core lifecycle methods
fn start(&mut self) -> Result<(), Error>;
fn stop(&mut self) -> Result<(), Error>;
// Direct event handling
fn handle_event(&mut self, event: &Event) -> Result<(), Error>;
// Optional async operations where necessary
#[cfg(feature = "async")]
async fn handle_network_io(&mut self) -> Result<(), Error>;
}