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

PatchValidationResult

Result of patch validation for generation readiness.

Functions

compute_metrics_for_patch(patch)

Compute corpus shape metrics for a patch.

open_database_for_patch(app, patch_name)

Open database viewer for the specified patch.

get_initial_browse_dir(app, patch_name)

Get smart initial directory for corpus browser.

validate_patch_ready(app, patch_name)

Validate that a patch is ready for generation operations.

update_combiner_panel(app, patch_name, meta_output)

Update the combiner panel with generation metadata.

update_selector_panel(app, patch_name, meta_output, ...)

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.

is_valid: bool
patch: PatchState | None = None
error_message: str | 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:
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:
Returns:

Path to start browsing from

Return type:

pathlib.Path

build_tools.syllable_walk_tui.core.actions.validate_patch_ready(app, patch_name)[source]

Validate that a patch is ready for generation operations.

Parameters:
Returns:

PatchValidationResult with is_valid=True and patch if ready, or is_valid=False with error_message if not ready.

Return type:

PatchValidationResult

build_tools.syllable_walk_tui.core.actions.update_combiner_panel(app, patch_name, meta_output)[source]

Update the combiner panel with generation metadata.

Parameters:
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: