canns.pipeline.asa_gui.core.state¶
State management for ASA GUI.
This module provides centralized workflow state management with Qt signals for reactive UI updates. All file paths are stored relative to the working directory for portability.
Classes¶
Reactive state manager with Qt signals. |
|
Centralized state for ASA analysis workflow. |
Functions¶
|
Convert absolute path to workdir-relative path. |
|
Convert relative path to absolute path. |
|
Check if required files exist and are valid. |
|
Check if preprocessing is complete. |
Module Contents¶
- class canns.pipeline.asa_gui.core.state.StateManager(parent=None)[source]¶
Bases:
PySide6.QtCore.QObjectReactive state manager with Qt signals.
Emits signals when state changes to enable reactive UI updates. Supports undo/redo through state history.
- batch_update(**kwargs)[source]¶
Update multiple fields without emitting individual signals.
Emits state_replaced at the end.
- update(**kwargs)[source]¶
Update state fields and emit signals.
- Parameters:
**kwargs (Any) – Field names and their new values
- property state: WorkflowState[source]¶
Get current workflow state.
- class canns.pipeline.asa_gui.core.state.WorkflowState[source]¶
Centralized state for ASA analysis workflow.
All file paths are relative to workdir for portability.
- artifacts: dict[str, pathlib.Path][source]¶
- asa_file: pathlib.Path | None = None[source]¶
- embed_data: numpy.typing.NDArray[numpy.floating] | None = None[source]¶
- neuron_file: pathlib.Path | None = None[source]¶
- traj_file: pathlib.Path | None = None[source]¶
- workdir: pathlib.Path[source]¶
- canns.pipeline.asa_gui.core.state.relative_path(state, path)[source]¶
Convert absolute path to workdir-relative path.
- Parameters:
state (WorkflowState) – Current workflow state
path (pathlib.Path) – Absolute path to convert
- Returns:
Path relative to workdir
- Return type:
- canns.pipeline.asa_gui.core.state.resolve_path(state, path)[source]¶
Convert relative path to absolute path.
- Parameters:
state (WorkflowState) – Current workflow state
path (pathlib.Path | None) – Relative path to convert
- Returns:
Absolute path or None if path is None
- Return type:
pathlib.Path | None
- canns.pipeline.asa_gui.core.state.validate_files(state)[source]¶
Check if required files exist and are valid.
- Parameters:
state (WorkflowState) – Current workflow state
- Returns:
Tuple of (is_valid, error_message)
- Return type: