build_tools.syllable_walk_tui.controls.browsers =============================================== .. py:module:: build_tools.syllable_walk_tui.controls.browsers .. autoapi-nested-parse:: Corpus browser modal widget for Syllable Walker TUI. This module provides the CorpusBrowserScreen modal for selecting corpus directories. It wraps the shared DirectoryBrowserScreen from tui_common with corpus-specific validation. **Migration Note:** This module now uses the shared DirectoryBrowserScreen from tui_common. The CorpusBrowserScreen is a convenience wrapper that pre-configures the browser with corpus validation. For custom directory browsers, use DirectoryBrowserScreen directly: .. code-block:: python from build_tools.tui_common.controls import DirectoryBrowserScreen result = await app.push_screen_wait( DirectoryBrowserScreen( title="Select Directory", validator=my_validator, ) ) Classes ------- .. autoapisummary:: build_tools.syllable_walk_tui.controls.browsers.CorpusBrowserScreen Module Contents --------------- .. py:class:: CorpusBrowserScreen(initial_dir = None) Bases: :py:obj:`build_tools.tui_common.controls.DirectoryBrowserScreen` Modal screen for browsing and selecting a corpus directory. This is a convenience wrapper around DirectoryBrowserScreen that pre-configures it for corpus selection with appropriate validation. A valid corpus directory contains either NLTK or pyphen normalized output: - NLTK corpus: ``nltk_syllables_unique.txt`` + ``nltk_syllables_frequencies.json`` - Pyphen corpus: ``pyphen_syllables_unique.txt`` + ``pyphen_syllables_frequencies.json`` :returns: Selected Path when "Select" is pressed, or None if cancelled .. admonition:: Example .. code-block:: python result = await self.app.push_screen_wait( CorpusBrowserScreen(initial_dir=Path.home() / "corpora") ) if result: self.load_corpus(result) Initialize corpus browser with corpus validation. :param initial_dir: Starting directory for browser (defaults to home directory) .. py:attribute:: CSS :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ CorpusBrowserScreen { align: center middle; } #browser-container { width: 80; height: 30; background: $panel; border: thick $primary; padding: 1; } #browser-header { text-align: center; text-style: bold; color: $accent; margin-bottom: 1; } #directory-tree { width: 100%; height: 1fr; border: solid $primary; margin-bottom: 1; } #help-text { height: 2; width: 100%; color: $text-muted; text-align: center; margin-bottom: 1; } #validation-status { height: 3; width: 100%; border: solid $primary; padding: 0 1; margin-bottom: 1; } .status-valid { color: $success; } .status-invalid { color: $error; } .status-none { color: $text-muted; } #button-bar { width: 100%; height: auto; align: center middle; } #button-bar Button { margin: 0 1; } """ .. raw:: html
Inline CSS, useful for quick scripts. Rules here take priority over CSS_PATH. .. note:: This CSS applies to the whole app.