aqt.browser.sidebar.item#
Classes#
Create a collection of name/value pairs. |
|
Module Contents#
- class aqt.browser.sidebar.item.SidebarItemType(*args, **kwds)#
Bases:
enum.EnumCreate a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3
Access them by:
attribute access:
>>> Color.RED <Color.RED: 1>
value lookup:
>>> Color(1) <Color.RED: 1>
name lookup:
>>> Color['RED'] <Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3
>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
- ROOT#
- SAVED_SEARCH_ROOT#
- SAVED_SEARCH#
- TODAY_ROOT#
- TODAY#
- FLAG_ROOT#
- FLAG#
- FLAG_NONE#
- CARD_STATE_ROOT#
- CARD_STATE#
- DECK_ROOT#
- DECK_CURRENT#
- DECK#
- NOTETYPE_ROOT#
- NOTETYPE#
- NOTETYPE_TEMPLATE#
- NOTETYPE_FIELD#
- TAG_ROOT#
- TAG_NONE#
- TAG#
- CUSTOM#
- static section_roots() → collections.abc.Iterable[SidebarItemType]#
- is_section_root() → bool#
- is_editable() → bool#
- can_be_added_to() → bool#
- is_deletable() → bool#
- class aqt.browser.sidebar.item.SidebarItem(name: str, icon: str | aqt.theme.ColoredIcon, search_node: anki.collection.SearchNode | None = None, on_expanded: collections.abc.Callable[[bool], None] | None = None, expanded: bool = False, item_type: SidebarItemType = SidebarItemType.CUSTOM, id: int = 0, name_prefix: str = '')#
- name#
- name_prefix = ''#
- full_name#
- icon#
- item_type#
- id = 0#
- search_node = None#
- on_expanded = None#
- children: list[SidebarItem] = []#
- tooltip: str#
- add_child(cb: SidebarItem) → None#
- add_simple(name: str, icon: str | aqt.theme.ColoredIcon, type: SidebarItemType, search_node: anki.collection.SearchNode | None) → SidebarItem#
Add child sidebar item, and return it.
- property expanded: bool#
- show_expanded(searching: bool) → bool#
- is_highlighted() → bool#
- search(lowered_text: str) → bool#
True if we or child matched.
- has_same_id(other: SidebarItem) → bool#
True if other is same type, with same id/name.