Repository navigation
API turboframe.ui.filter
Source: turboframe/ui/filter.py. Generated from the code of TurboFrame 0.3.0 by tools/wiki_api.py.
A filter over a list or a tree: one line above it, typed into from the list itself.
With the list (or tree) focused, a letter, a digit or a sign goes to the filter, Backspace takes one back, Escape empties it; only the items that hold the filter (a substring, case ignored) stay. Space keeps its job (fold, choose).
-
FilteredList: a ListBox mixin.focused,focus_item()andselect_item()stay the ListBox's own (the rows shown);currentis the focused row as an index of the whole list,original()turns a shown row into one, andfocus_original()puts the bar on an item (emptying the filter when it hides it). -
FilteredTree: a Tree mixin. Shown: what matches, the nodes above it, and what hangs from a node that matches.filter_text_of(node)is what is matched (the label by default). -
Filtered(widget): the filter line abovewidget, in a container.
PROMPT, matches, FilterLine, Filtered, FilteredList, FilteredTree
'» '
def matches(text: str, query: str) -> boolclass FilterLine(Static)
FilterLine(target: Widget)» filter (3/40), or a dim » type to filter when empty, in the list's colours.
show() -> None
class Filtered(Vertical)
Filtered(widget: Widget, fill: bool = True, **kwargs)The filter line, then widget; fill: take the room left (1fr), else as tall as the widget.
class FilteredList(_Filter)ListBox mixin (before ListBox in the bases): the items that hold the filter.
set_list(items: list[str]) -> Noneapply_filter() -> Nonefilter_counts() -> tuple[int, int]-
original(shown: int) -> int: The index in the whole list of a row shown (-1: none). -
current(property): The focused item, as an index of the whole list (-1: nothing shown). -
focus_original(index: int) -> None: The bar on an item of the whole list (the filter is emptied if it hides it). tv_handle_key(event: events.Key) -> bool
class FilteredTree(_Filter)Tree mixin (before Tree in the bases): what matches, what is above it, and what hangs from a node that matches (folds still fold, below a match).
-
process_label(label) -> Text: A label as it reads: Tree takes a str for Rich markup, and a commit's subject, a template's[/$products]or a JSON key would be read as markup (or fail as one). filter_text_of(node) -> strapply_filter() -> Nonefilter_counts() -> tuple[int, int]
TurboFrame · part of Divengine · GPL-3.0-or-later · report an issue
Tutorial
Examples
The desktop
- The Desktop
- Application Mixins
- Windows and Lists
- Dialogs
- Histories
- Progress
- Themes and Colors
- Glyphs
- Settings and Recent Files
- Command Palette
Editing
Tasks
Languages
Running
Reference
Links