pyqt_reactive.widgets.mixins.cross_window_preview_mixin
Mixin for widgets that consume cross-window ParameterFormManager updates.
SIMPLIFIED ARCHITECTURE: - Listen for any change via ObjectStateRegistry.connect_listener() - Debounce + full refresh (no complex field path matching) - Use ObjectStateRegistry.get_ancestor_objects() to get fresh values
Classes
Helpers for widgets that respond to cross-window preview updates. |
- class pyqt_reactive.widgets.mixins.cross_window_preview_mixin.CrossWindowPreviewMixin[source]
Helpers for widgets that respond to cross-window preview updates.
SIMPLIFIED: Any change triggers a debounced full refresh. No complex field path matching - just refresh everything.
- Usage:
- class MyWidget(QWidget, CrossWindowPreviewMixin):
- def __init__(self):
super().__init__() self._init_cross_window_preview_mixin()
# Configure which fields to show in previews self.enable_preview_for_field(‘napari_streaming_config’,
format_streaming_indicator)
# Implement _handle_full_preview_refresh()…
- PREVIEW_UPDATE_DEBOUNCE_MS = 20
- enable_preview_for_field(field_path: str, formatter: Callable[[Any], str] | None = None, *, scope_root: str | None = None, fallback_resolver: Callable[[Any, Dict[str, Any]], Any] | None = None) None[source]
Enable preview label for a specific field.
- Parameters:
field_path – Dot-separated field path (e.g., ‘napari_streaming_config’)
formatter – Optional formatter function. If None, uses str().
scope_root – IGNORED (kept for backward compatibility)
fallback_resolver – Optional resolver for computing value from context
- disable_preview_for_field(field_path: str) None[source]
Disable preview label for a specific field.