Skip to content

OpenHCSDev/PyQT-reactor

Repository files navigation

pyqt-reactor

React-quality reactive form generation framework for PyQt6

PyPI version Documentation Status Python 3.11+ License: MIT

Features

  • Dataclass-Driven Forms: Automatically generate UI forms from Python dataclasses
  • ObjectState Integration: First-class support for lazy configuration and hierarchical inheritance
  • ABC-Based Protocols: Type-safe widget contracts with clean interfaces
  • Reactive Updates: React-style lifecycle hooks with cross-window synchronization
  • Theming System: ColorScheme-based styling with dynamic theme switching
  • Flash Animations: Game-engine inspired visual feedback for value changes
  • Window Management: Scoped window registry with navigation support

Quick Start

from dataclasses import dataclass
from PyQt6.QtWidgets import QApplication
from pyqt_reactor.forms import ParameterFormManager

@dataclass
class ProcessingConfig:
    input_path: str = ""
    output_path: str = ""
    num_workers: int = 4
    enable_gpu: bool = False

app = QApplication([])
form = ParameterFormManager(ProcessingConfig)
form.show()
app.exec()

Installation

pip install pyqt-reactor

For development:

git clone https://github.com/trissim/pyqt-reactor.git
cd pyqt-reactor
pip install -e ".[dev]"

Architecture

The package is organized in layers:

pyqt_reactor/
├── core/        # Tier 1: Pure PyQt6 utilities
├── protocols/   # Tier 2: Widget ABCs and adapters
├── services/    # Tier 3: Reusable service layer
├── forms/       # Tier 4: ParameterFormManager
├── theming/     # Color schemes and styling
├── widgets/     # Extended widget implementations
└── animation/   # Flash effects and visual feedback

Key Components

ParameterFormManager

Auto-generates forms from dataclasses with full type support:

from pyqt_reactor.forms import ParameterFormManager

form = ParameterFormManager(MyConfig)
config = form.collect_values()  # Get typed config back

WindowManager

Singleton window registry with scope-based navigation:

from pyqt_reactor.services import WindowManager

window = WindowManager.show_or_focus("config:plate1", lambda: ConfigWindow(...))
WindowManager.navigate_to("config:plate1", field="exposure_time")

Theming

Dynamic theme switching with consistent styling:

from pyqt_reactor.theming import ColorScheme, apply_theme

apply_theme(widget, ColorScheme.DARK)

Documentation

Full documentation available at pyqt-reactor.readthedocs.io

License

MIT License - see LICENSE file for details

Contributing

Contributions welcome! Please see CONTRIBUTING.md for guidelines.

Credits

Developed by Tristan Simas. Extracted from OpenHCS for general-purpose use.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •