aqt.browser.table.state#

Classes#

ItemState

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

CardState

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

NoteState

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

Module Contents#

class aqt.browser.table.state.ItemState(col: anki.collection.Collection)#

Bases: abc.ABC

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

GEOMETRY_KEY_PREFIX: str#
SORT_COLUMN_KEY: str#
SORT_BACKWARDS_KEY: str#
col#
is_notes_mode() bool#

Return True if the state is a NoteState.

note_ids_from_card_ids(items: collections.abc.Sequence[aqt.browser.table.ItemId]) collections.abc.Sequence[anki.notes.NoteId]#
card_ids_from_note_ids(items: collections.abc.Sequence[aqt.browser.table.ItemId]) collections.abc.Sequence[anki.cards.CardId]#
column_key_at(index: int) str#
column_label(column: aqt.browser.table.Column) str#
column_tooltip(column: aqt.browser.table.Column) str#
property active_columns: list[str]#
Abstractmethod:

Return the saved or default columns for the state.

abstractmethod toggle_active_column(column: str) None#

Add or remove an active column.

property sort_column: str#
property sort_backwards: bool#

If true, descending order.

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

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

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

abstractmethod get_item_from_card_id(card: anki.cards.CardId) aqt.browser.table.ItemId#

Return the appropriate item id for a card id.

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

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

abstractmethod toggle_state() ItemState#

Return an instance of the other state.

abstractmethod get_new_items(old_items: collections.abc.Sequence[aqt.browser.table.ItemId]) aqt.browser.table.ItemList#

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

class aqt.browser.table.state.CardState(col: anki.collection.Collection)#

Bases: ItemState

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

GEOMETRY_KEY_PREFIX = 'editor'#
SORT_COLUMN_KEY = 'sortType'#
SORT_BACKWARDS_KEY = 'sortBackwards'#
property active_columns: list[str]#

Return the saved or default columns for the state.

toggle_active_column(column: str) None#

Add or remove an active column.

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.

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.

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.

get_item_from_card_id(card: anki.cards.CardId) aqt.browser.table.ItemId#

Return the appropriate item id for a card id.

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.

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.

toggle_state() NoteState#

Return an instance of the other state.

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.

class aqt.browser.table.state.NoteState(col: anki.collection.Collection)#

Bases: ItemState

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

GEOMETRY_KEY_PREFIX = 'editorNotesMode'#
SORT_COLUMN_KEY = 'noteSortType'#
SORT_BACKWARDS_KEY = 'browserNoteSortBackwards'#
property active_columns: list[str]#

Return the saved or default columns for the state.

toggle_active_column(column: str) None#

Add or remove an active column.

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.

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.

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.

get_item_from_card_id(card: anki.cards.CardId) aqt.browser.table.ItemId#

Return the appropriate item id for a card id.

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.

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.

toggle_state() CardState#

Return an instance of the other state.

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.