build_tools.syllable_walk_tui.modules.database.screen ===================================================== .. py:module:: build_tools.syllable_walk_tui.modules.database.screen .. autoapi-nested-parse:: Database viewer screen modal component. This module provides the DatabaseScreen modal for browsing corpus SQLite database contents with pagination and sorting. Classes ------- .. autoapisummary:: build_tools.syllable_walk_tui.modules.database.screen.SyllableDetailModal build_tools.syllable_walk_tui.modules.database.screen.DatabaseScreen Module Contents --------------- .. py:class:: SyllableDetailModal(syllable_data, feature_details, *args, **kwargs) Bases: :py:obj:`textual.screen.ModalScreen` Modal showing detailed feature breakdown for a syllable. Initialize with syllable data and feature mapping. .. py:attribute:: BINDINGS :value: [('escape', 'close', 'Close'), ('enter', 'close', 'Close')] A list of key bindings. .. py:attribute:: DEFAULT_CSS :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ SyllableDetailModal { align: center middle; } SyllableDetailModal > Vertical { width: 50; height: auto; max-height: 80%; background: $surface; border: solid $primary; padding: 1 2; } SyllableDetailModal .detail-header { text-style: bold; color: $accent; text-align: center; margin-bottom: 1; } SyllableDetailModal .detail-freq { text-align: center; margin-bottom: 1; } SyllableDetailModal .detail-section { text-style: bold; color: $secondary; margin-top: 1; } SyllableDetailModal .detail-feature { padding-left: 2; } SyllableDetailModal .detail-help { text-align: center; color: $text-muted; margin-top: 1; } """ .. raw:: html
Default TCSS. .. py:attribute:: syllable_data .. py:attribute:: feature_details .. py:method:: compose() Create detail modal layout. .. py:method:: action_close() Close the modal. .. py:class:: DatabaseScreen(db_path = None, patch_name = '', *args, **kwargs) Bases: :py:obj:`textual.screen.Screen` Modal screen for viewing corpus database contents. Displays the syllables table from the corpus.db SQLite database with pagination and sorting by frequency. :param db_path: Path to the corpus.db SQLite database :param patch_name: Name of the patch (A or B) for display Keybindings: Esc: Close screen and return to main view j/k: Navigate rows down/up Enter: Show row details n/l/Right: Next page p/h/Left: Previous page [/]: Cycle sort column (prev/next) f: Toggle sort order (asc/desc) Home: Go to first page End: Go to last page Initialize database screen. :param db_path: Path to corpus.db file :param patch_name: Patch identifier for display (A or B) .. py:attribute:: FEATURE_DETAILS .. py:attribute:: SORTABLE_COLUMNS :value: [('syllable', 'Syllable'), ('frequency', 'Freq'), ('starts_with_vowel', 'V→'),... .. py:attribute:: BINDINGS :value: [('escape', 'close_screen', 'Close'), ('j', 'cursor_down', 'Down'), ('k', 'cursor_up', 'Up'),... A list of key bindings. .. py:attribute:: DEFAULT_CSS :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ DatabaseScreen { background: $surface; padding: 1; } DatabaseScreen .db-header { text-style: bold; color: $accent; margin-bottom: 1; } DatabaseScreen .db-meta { color: $text-muted; margin-bottom: 1; } DatabaseScreen .db-status { dock: bottom; height: 1; background: $boost; padding: 0 1; } DatabaseScreen .db-help { dock: bottom; height: 1; color: $text-muted; padding: 0 1; } DatabaseScreen DataTable { height: 1fr; } """ .. raw:: html
Default TCSS. .. py:attribute:: db_path :value: None .. py:attribute:: patch_name :value: '' .. py:attribute:: current_page :value: 1 .. py:attribute:: total_pages :value: 1 .. py:attribute:: total_rows :value: 0 .. py:attribute:: page_size :value: 50 .. py:attribute:: sort_column_index :value: 1 .. py:attribute:: sort_by :value: 'frequency' .. py:attribute:: sort_direction :type: str :value: 'DESC' .. py:attribute:: metadata :type: dict[str, str] .. py:attribute:: current_rows :type: list[dict] :value: [] .. py:method:: compose() Create database screen layout. .. py:method:: on_mount() Load data when screen is mounted. .. py:method:: action_close_screen() Close this screen and return to main view. .. py:method:: action_cursor_down() Move cursor down one row. .. py:method:: action_cursor_up() Move cursor up one row. .. py:method:: on_data_table_row_selected(event) Handle row selection (Enter key) to show details. .. py:method:: action_show_details() Show detailed feature breakdown for the selected row (fallback). .. py:method:: action_next_page() Go to next page. .. py:method:: action_prev_page() Go to previous page. .. py:method:: action_first_page() Go to first page. .. py:method:: action_last_page() Go to last page. .. py:method:: action_prev_column() Cycle to previous sortable column. .. py:method:: action_next_column() Cycle to next sortable column. .. py:method:: action_toggle_sort() Toggle sort order (ascending/descending).