aqt.browser.table.state
=======================

.. py:module:: aqt.browser.table.state


Classes
-------

.. autoapisummary::

   aqt.browser.table.state.ItemState
   aqt.browser.table.state.CardState
   aqt.browser.table.state.NoteState


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

.. py:class:: ItemState(col: anki.collection.Collection)

   Bases: :py:obj:`abc.ABC`


   Helper class that provides a standard way to create an ABC using
   inheritance.


   .. py:attribute:: GEOMETRY_KEY_PREFIX
      :type:  str


   .. py:attribute:: SORT_COLUMN_KEY
      :type:  str


   .. py:attribute:: SORT_BACKWARDS_KEY
      :type:  str


   .. py:attribute:: col


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

      Return True if the state is a NoteState.



   .. py:method:: note_ids_from_card_ids(items: collections.abc.Sequence[aqt.browser.table.ItemId]) -> collections.abc.Sequence[anki.notes.NoteId]


   .. py:method:: card_ids_from_note_ids(items: collections.abc.Sequence[aqt.browser.table.ItemId]) -> collections.abc.Sequence[anki.cards.CardId]


   .. py:method:: column_key_at(index: int) -> str


   .. py:method:: column_label(column: aqt.browser.table.Column) -> str


   .. py:method:: column_tooltip(column: aqt.browser.table.Column) -> str


   .. py:property:: active_columns
      :type: list[str]

      :abstractmethod:


      Return the saved or default columns for the state.



   .. py:method:: toggle_active_column(column: str) -> None
      :abstractmethod:


      Add or remove an active column.



   .. py:property:: sort_column
      :type: str



   .. py:property:: sort_backwards
      :type: bool


      If true, descending order.



   .. py:method:: get_card(item: aqt.browser.table.ItemId) -> anki.cards.Card
      :abstractmethod:


      Return the item if it's a card or its first card if it's a note.



   .. py:method:: get_note(item: aqt.browser.table.ItemId) -> anki.notes.Note
      :abstractmethod:


      Return the item if it's a note or its note if it's a card.



   .. py:method:: find_items(search: str, order: bool | str | aqt.browser.table.Column, reverse: bool) -> collections.abc.Sequence[aqt.browser.table.ItemId]
      :abstractmethod:


      Return the item ids fitting the given search and order.



   .. py:method:: get_item_from_card_id(card: anki.cards.CardId) -> aqt.browser.table.ItemId
      :abstractmethod:


      Return the appropriate item id for a card id.



   .. py:method:: get_card_ids(items: collections.abc.Sequence[aqt.browser.table.ItemId]) -> collections.abc.Sequence[anki.cards.CardId]
      :abstractmethod:


      Return the card ids for the given item ids.



   .. py:method:: get_note_ids(items: collections.abc.Sequence[aqt.browser.table.ItemId]) -> collections.abc.Sequence[anki.notes.NoteId]
      :abstractmethod:


      Return the note ids for the given item ids.



   .. py:method:: toggle_state() -> ItemState
      :abstractmethod:


      Return an instance of the other state.



   .. py:method:: get_new_items(old_items: collections.abc.Sequence[aqt.browser.table.ItemId]) -> aqt.browser.table.ItemList
      :abstractmethod:


      Given a list of ids from the other state, return the corresponding ids for this state.



.. py:class:: CardState(col: anki.collection.Collection)

   Bases: :py:obj:`ItemState`


   Helper class that provides a standard way to create an ABC using
   inheritance.


   .. py:attribute:: GEOMETRY_KEY_PREFIX
      :value: 'editor'



   .. py:attribute:: SORT_COLUMN_KEY
      :value: 'sortType'



   .. py:attribute:: SORT_BACKWARDS_KEY
      :value: 'sortBackwards'



   .. py:property:: active_columns
      :type: list[str]


      Return the saved or default columns for the state.



   .. py:method:: toggle_active_column(column: str) -> None

      Add or remove an active column.



   .. py:method:: get_card(item: aqt.browser.table.ItemId) -> anki.cards.Card

      Return the item if it's a card or its first card if it's a note.



   .. py:method:: get_note(item: aqt.browser.table.ItemId) -> anki.notes.Note

      Return the item if it's a note or its note if it's a card.



   .. py:method:: find_items(search: str, order: bool | str | aqt.browser.table.Column, reverse: bool) -> collections.abc.Sequence[aqt.browser.table.ItemId]

      Return the item ids fitting the given search and order.



   .. py:method:: get_item_from_card_id(card: anki.cards.CardId) -> aqt.browser.table.ItemId

      Return the appropriate item id for a card id.



   .. py:method:: get_card_ids(items: collections.abc.Sequence[aqt.browser.table.ItemId]) -> collections.abc.Sequence[anki.cards.CardId]

      Return the card ids for the given item ids.



   .. py:method:: get_note_ids(items: collections.abc.Sequence[aqt.browser.table.ItemId]) -> collections.abc.Sequence[anki.notes.NoteId]

      Return the note ids for the given item ids.



   .. py:method:: toggle_state() -> NoteState

      Return an instance of the other state.



   .. py:method:: get_new_items(old_items: collections.abc.Sequence[aqt.browser.table.ItemId]) -> collections.abc.Sequence[anki.cards.CardId]

      Given a list of ids from the other state, return the corresponding ids for this state.



.. py:class:: NoteState(col: anki.collection.Collection)

   Bases: :py:obj:`ItemState`


   Helper class that provides a standard way to create an ABC using
   inheritance.


   .. py:attribute:: GEOMETRY_KEY_PREFIX
      :value: 'editorNotesMode'



   .. py:attribute:: SORT_COLUMN_KEY
      :value: 'noteSortType'



   .. py:attribute:: SORT_BACKWARDS_KEY
      :value: 'browserNoteSortBackwards'



   .. py:property:: active_columns
      :type: list[str]


      Return the saved or default columns for the state.



   .. py:method:: toggle_active_column(column: str) -> None

      Add or remove an active column.



   .. py:method:: get_card(item: aqt.browser.table.ItemId) -> anki.cards.Card

      Return the item if it's a card or its first card if it's a note.



   .. py:method:: get_note(item: aqt.browser.table.ItemId) -> anki.notes.Note

      Return the item if it's a note or its note if it's a card.



   .. py:method:: find_items(search: str, order: bool | str | aqt.browser.table.Column, reverse: bool) -> collections.abc.Sequence[aqt.browser.table.ItemId]

      Return the item ids fitting the given search and order.



   .. py:method:: get_item_from_card_id(card: anki.cards.CardId) -> aqt.browser.table.ItemId

      Return the appropriate item id for a card id.



   .. py:method:: get_card_ids(items: collections.abc.Sequence[aqt.browser.table.ItemId]) -> collections.abc.Sequence[anki.cards.CardId]

      Return the card ids for the given item ids.



   .. py:method:: get_note_ids(items: collections.abc.Sequence[aqt.browser.table.ItemId]) -> collections.abc.Sequence[anki.notes.NoteId]

      Return the note ids for the given item ids.



   .. py:method:: toggle_state() -> CardState

      Return an instance of the other state.



   .. py:method:: get_new_items(old_items: collections.abc.Sequence[aqt.browser.table.ItemId]) -> collections.abc.Sequence[anki.notes.NoteId]

      Given a list of ids from the other state, return the corresponding ids for this state.



