build_tools.corpus_db_viewer.app
Textual TUI application for corpus database viewer.
Provides an interactive terminal interface for browsing database tables.
Classes
Modal screen for displaying table schema information. |
|
Modal screen for export options. |
|
Modal screen showing keyboard shortcuts. |
|
A Textual app for viewing corpus database provenance records. |
Module Contents
- class build_tools.corpus_db_viewer.app.SchemaModal(schema_data, table_name)
Bases:
textual.screen.ModalScreen[None]Modal screen for displaying table schema information.
Initialize schema modal.
Parameters
- schema_datadict[str, Any]
Schema information from queries.get_table_schema()
- table_namestr
Name of the table
- DEFAULT_CSS = Multiline-String
Show Value
""" SchemaModal { align: center middle; } SchemaModal > Container { width: 90%; height: 85%; border: thick $background 80%; background: $surface; } #schema-content { width: 100%; height: 1fr; overflow-y: auto; } .schema-section { margin: 1; padding: 1; border: solid $primary; } .schema-title { text-style: bold; color: $accent; } """
- schema_data
- table_name
- compose()
Create child widgets.
- close_modal()
Close the schema modal.
- class build_tools.corpus_db_viewer.app.ExportModal(default_filename)
Bases:
textual.screen.ModalScreen[dict[str,str]]Modal screen for export options.
Initialize export modal.
Parameters
- default_filenamestr
Default filename (without extension)
- DEFAULT_CSS = Multiline-String
Show Value
""" ExportModal { align: center middle; } ExportModal > Container { width: 60; height: auto; border: thick $background 80%; background: $surface; padding: 1 2; } ExportModal Input { margin: 1 0; } ExportModal Horizontal { height: auto; align: center middle; margin: 1 0; } """
- default_filename
- compose()
Create child widgets.
- export_csv()
Export as CSV.
- export_json()
Export as JSON.
- cancel_export()
Cancel export.
- class build_tools.corpus_db_viewer.app.HelpModal
Bases:
textual.screen.ModalScreen[None]Modal screen showing keyboard shortcuts.
- DEFAULT_CSS = Multiline-String
Show Value
""" HelpModal { align: center middle; } HelpModal > Container { width: 70; height: auto; border: thick $background 80%; background: $surface; padding: 2; } """
- compose()
Create child widgets.
- close_help()
Close help modal.
- on_key(event)
Close on any key press.
- class build_tools.corpus_db_viewer.app.CorpusDBViewerApp(db_path, export_dir, page_size=50)
Bases:
textual.app.App[None]A Textual app for viewing corpus database provenance records.
This interactive TUI provides table browsing, schema viewing, and export functionality for SQLite databases.
Initialize the app.
Parameters
- db_pathPath
Path to SQLite database
- export_dirPath
Directory for exported files
- page_sizeint, optional
Number of rows per page, by default 50
- CSS = Multiline-String
Show Value
""" Screen { layout: horizontal; } #sidebar { width: 30; height: 100%; border-right: solid $primary; background: $boost; } #main-content { width: 1fr; height: 100%; } #table-info { height: 3; background: $boost; padding: 0 1; } #data-table-container { height: 1fr; } DataTable { height: 100%; } ListView { height: 100%; } ListItem { padding: 0 1; } .sidebar-title { text-style: bold; padding: 1; background: $primary; color: $text; } """
- BINDINGS
- db_path
- export_dir
- page_size = 50
- compose()
Create child widgets.
- on_mount()
Initialize the app after mounting.
- load_table_data()
Load data for the current table.
- on_table_selected(event)
Handle table selection from sidebar.
- action_switch_table()
Focus the table list for switching tables.
- action_show_schema()
Show schema information for current table.
- action_export_data()
Export current table data.
- action_refresh()
Refresh current table data.
- action_show_help()
Show help modal with keyboard shortcuts.
- action_prev_page()
Go to previous page.
- action_next_page()
Go to next page.
- action_jump_back()
Jump back 10 pages.
- action_jump_forward()
Jump forward 10 pages.
- action_first_page()
Go to first page.
- action_last_page()
Go to last page.