aqt.browser.sidebar.item
========================

.. py:module:: aqt.browser.sidebar.item


Classes
-------

.. autoapisummary::

   aqt.browser.sidebar.item.SidebarItemType
   aqt.browser.sidebar.item.SidebarItem


Module Contents
---------------

.. py:class:: SidebarItemType(*args, **kwds)

   Bases: :py:obj:`enum.Enum`


   Create 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.


   .. py:attribute:: ROOT


   .. py:attribute:: SAVED_SEARCH_ROOT


   .. py:attribute:: SAVED_SEARCH


   .. py:attribute:: TODAY_ROOT


   .. py:attribute:: TODAY


   .. py:attribute:: FLAG_ROOT


   .. py:attribute:: FLAG


   .. py:attribute:: FLAG_NONE


   .. py:attribute:: CARD_STATE_ROOT


   .. py:attribute:: CARD_STATE


   .. py:attribute:: DECK_ROOT


   .. py:attribute:: DECK_CURRENT


   .. py:attribute:: DECK


   .. py:attribute:: NOTETYPE_ROOT


   .. py:attribute:: NOTETYPE


   .. py:attribute:: NOTETYPE_TEMPLATE


   .. py:attribute:: NOTETYPE_FIELD


   .. py:attribute:: TAG_ROOT


   .. py:attribute:: TAG_NONE


   .. py:attribute:: TAG


   .. py:attribute:: CUSTOM


   .. py:method:: section_roots() -> collections.abc.Iterable[SidebarItemType]
      :staticmethod:



   .. py:method:: is_section_root() -> bool


   .. py:method:: is_editable() -> bool


   .. py:method:: can_be_added_to() -> bool


   .. py:method:: is_deletable() -> bool


.. py:class:: 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 = '')

   .. py:attribute:: name


   .. py:attribute:: name_prefix
      :value: ''



   .. py:attribute:: full_name


   .. py:attribute:: icon


   .. py:attribute:: item_type


   .. py:attribute:: id
      :value: 0



   .. py:attribute:: search_node
      :value: None



   .. py:attribute:: on_expanded
      :value: None



   .. py:attribute:: children
      :type:  list[SidebarItem]
      :value: []



   .. py:attribute:: tooltip
      :type:  str


   .. py:method:: add_child(cb: SidebarItem) -> None


   .. py:method:: 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.



   .. py:property:: expanded
      :type: bool



   .. py:method:: show_expanded(searching: bool) -> bool


   .. py:method:: is_highlighted() -> bool


   .. py:method:: search(lowered_text: str) -> bool

      True if we or child matched.



   .. py:method:: has_same_id(other: SidebarItem) -> bool

      True if `other` is same type, with same id/name.



