Explorer¶
FileExplorer¶
- class kable.explorer.FileExplorer(root)[source]
Bases:
TreeA file explorer widget with Git-aware styling and hidden file filtering.
- Parameters:
root (Path)
- __init__(root)[source]¶
Initialize the file explorer.
- Parameters:
root (Path) – Root directory to display.
- build_tree(node, path, ignore=False)[source]¶
Recursively populate the tree view.
- Parameters:
node (TreeNode) – Parent tree node.
path (Path) – Directory being traversed.
ignore (bool) – Whether descendants should be treated as ignored.
- Return type:
None
- add_file_node(node, file_path, is_ignored=False)[source]¶
Add a file node to the tree.
- Parameters:
node (TreeNode) – Parent tree node.
file_path (Path) – Path to the file.
is_ignored (bool) – Whether the file is Git ignored.
- Return type:
None
- is_git_ignored(path)[source]¶
Check whether a path is ignored by Git.
- Parameters:
path (Path) – Path to check.
- Returns:
True if the path is ignored.
- Return type:
bool
- on_tree_node_selected(event)[source]¶
Handle tree node selection.
Directories are expanded or collapsed. Files emit a
FileClickedmessage.- Parameters:
event (NodeSelected) – Tree selection event.
- Return type:
None
Check whether a file or directory is hidden.
On Windows this uses the hidden file attribute.
- Parameters:
path (Path) – Path to check.
- Returns:
True if the path is hidden.
- Return type:
bool
Confirm¶
- class kable.explorer.Confirm(prompt)[source]
Bases:
ModalScreen[bool]Modal confirmation dialog.
- Parameters:
prompt (str)
- __init__(prompt)[source]¶
Initialize the confirmation dialog.
- Parameters:
prompt (str) – Message displayed to the user.
- Return type:
None