build_tools.syllable_walk_tui.core.actions
Action implementations for Syllable Walker TUI.
Contains action logic extracted from the main App class. The actual action_* methods remain on the App (Textual requirement), but delegate complex logic here for testability and reuse.
This module provides: - Patch validation helpers (validate_patch_ready) - Database viewer opening (open_database_for_patch) - Browse directory selection (get_initial_browse_dir) - Metrics computation (compute_metrics_for_patch) - Panel update helpers (update_combiner_panel, update_selector_panel)
Classes
Result of patch validation for generation readiness. |
Functions
|
Compute corpus shape metrics for a patch. |
|
Open database viewer for the specified patch. |
|
Get smart initial directory for corpus browser. |
|
Validate that a patch is ready for generation operations. |
|
Update the combiner panel with generation metadata. |
|
Update the selector panel with selection metadata. |
Module Contents
- class build_tools.syllable_walk_tui.core.actions.PatchValidationResult[source]
Result of patch validation for generation readiness.
- patch: PatchState | None = None
- build_tools.syllable_walk_tui.core.actions.compute_metrics_for_patch(patch)[source]
Compute corpus shape metrics for a patch.
- Parameters:
patch (build_tools.syllable_walk_tui.modules.oscillator.PatchState) – PatchState to compute metrics for
- Returns:
CorpusShapeMetrics if patch has loaded data, None otherwise
- build_tools.syllable_walk_tui.core.actions.open_database_for_patch(app, patch_name)[source]
Open database viewer for the specified patch.
- Parameters:
app (build_tools.syllable_walk_tui.core.app.SyllableWalkerApp) – Application instance for screen navigation and notifications
patch_name (str) – “A” or “B”
- build_tools.syllable_walk_tui.core.actions.get_initial_browse_dir(app, patch_name)[source]
Get smart initial directory for corpus browser.
Priority order: 1. Patch’s current corpus_dir (if already set) 2. Last browsed directory (if set) 3. _working/output/ (if exists) 4. Home directory (fallback)
- Parameters:
app (build_tools.syllable_walk_tui.core.app.SyllableWalkerApp) – Application instance for state access
patch_name (str) – “A” or “B”
- Returns:
Path to start browsing from
- Return type:
- build_tools.syllable_walk_tui.core.actions.validate_patch_ready(app, patch_name)[source]
Validate that a patch is ready for generation operations.
- Parameters:
app (build_tools.syllable_walk_tui.core.app.SyllableWalkerApp) – Application instance for state access and notifications
patch_name (str) – “A” or “B”
- Returns:
PatchValidationResult with is_valid=True and patch if ready, or is_valid=False with error_message if not ready.
- Return type:
- build_tools.syllable_walk_tui.core.actions.update_combiner_panel(app, patch_name, meta_output)[source]
Update the combiner panel with generation metadata.
- Parameters:
app (build_tools.syllable_walk_tui.core.app.SyllableWalkerApp) – Application instance for widget queries
patch_name (str) – “A” or “B”
meta_output (dict) – Metadata dict from combiner result
- build_tools.syllable_walk_tui.core.actions.update_selector_panel(app, patch_name, meta_output, selected_names)[source]
Update the selector panel with selection metadata.
- Parameters:
app (build_tools.syllable_walk_tui.core.app.SyllableWalkerApp) – Application instance for widget queries
patch_name (str) – “A” or “B”
meta_output (dict) – Metadata dict from selector result