Main¶
Kable¶
- class kable.main.Kable(file_path)[source]
Bases:
AppMain Kable application class.
A Textual-based terminal editor with file explorer sidebar, Git-aware status bar, integrated editor, and config persistence.
- Parameters:
file_path (Path)
- __init__(file_path)[source]¶
Initialize the application.
- Parameters:
file_path (Path) – Path to the file to open initially.
- Return type:
None
- _load_config()[source]¶
Load application configuration from disk.
- Returns:
Configuration dictionary. Empty dict if loading fails.
- Return type:
dict
- on_mount()[source]¶
Called when the application is mounted.
Initializes UI, theme, sidebar state, and editor focus.
- Return type:
None
- action_quit(should_exit=True)[source]¶
Quit the application.
- Parameters:
should_exit (bool) – If True, exit immediately; otherwise check unsaved changes.
- Return type:
None
- check_saved_app(should_exit)[source]¶
Check for unsaved changes before quitting.
- Parameters:
should_exit (bool) – Whether to exit after handling save prompt.
- Return type:
None
- handle_save_choice(save, should_exit)[source]¶
Handle save confirmation dialog result.
- Parameters:
save (bool | None) – Whether user chose to save.
should_exit (bool) – Whether to exit after handling.
- Return type:
None
- compose()[source]¶
Build the UI layout.
- Returns:
ComposeResult widget tree.
- Return type:
Iterable[Widget]