aqt.browser.browser

Contents

aqt.browser.browser#

Classes#

MockModel

This class only exists to support some legacy aliases.

Browser

Module Contents#

class aqt.browser.browser.MockModel(browser: aqt.browser.Browser)#

This class only exists to support some legacy aliases.

browser#
beginReset() → None#
endReset() → None#
reset() → None#
class aqt.browser.browser.Browser(mw: aqt.AnkiQt, card: anki.cards.Card | None = None, search: tuple[str | anki.collection.SearchNode] | None = None)#

Bases: QMainWindow

mw: aqt.AnkiQt#
col: anki.collection.Collection#
editor: aqt.editor.Editor | aqt.editor.NewEditor | None#
table: aqt.browser.table.Table#
lastFilter = ''#
focusTo: int | None = None#
auto_layout = True#
aspect_ratio = 0.0#
form#
card: anki.cards.Card | None = None#
current_card: anki.cards.Card | None = None#
model#
on_operation_did_execute(changes: anki.collection.OpChanges, handler: object | None) → None#
on_focus_change(new: QWidget | None, old: QWidget | None) → None#
set_layout(mode: aqt.browser.layout.BrowserLayout, init: bool = False) → None#
maybe_update_layout(aspect_ratio: float, force: bool = False) → None#
resizeEvent(event: QResizeEvent | None) → None#
get_active_note_type_id() → anki.models.NotetypeId | None#

If multiple cards are selected the note type will be derived from the final card selected

add_card(deck_id: anki.decks.DeckId)#
setupMenus() → None#
closeEvent(evt: QCloseEvent | None) → None#
closeWithCallback(onsuccess: collections.abc.Callable) → None#
keyPressEvent(evt: QKeyEvent | None) → None#
reopen(_mw: aqt.AnkiQt, card: anki.cards.Card | None = None, search: tuple[str | anki.collection.SearchNode] | None = None) → None#
setupSearch(card: anki.cards.Card | None = None, search: tuple[str | anki.collection.SearchNode] | None = None) → None#
onSearchActivated() → None#
search_for(search: str, prompt: str | None = None) → None#

Keep track of search string so that we reuse identical search when refreshing, rather than whatever is currently in the search field. Optionally set the search bar to a different text than the actual search.

search() → None#

Search triggered programmatically. Caller must have saved note first.

update_history() → None#
updateTitle() → None#
search_for_terms(*search_terms: str | anki.collection.SearchNode) → None#
onReset() → None#
begin_reset() → None#
end_reset() → None#
setup_table() → None#
setupEditor() → None#
on_all_or_selected_rows_changed() → None#

Called after the selected or all rows (searching, toggling mode) have changed. Update window title, card preview, context actions, and editor.

onRowChanged(*args: anki.consts.Any) → None#
on_current_row_changed() → None#

Called after the row of the current element has changed.

on_table_state_changed(checked: bool) → None#
setupSidebar() → None#
showSidebar(show: bool = True) → None#
onSidebarVisibilityChange(visible)#
focusSidebar() → None#
focusSidebarSearchBar() → None#
toggle_sidebar() → None#
setFilter(*terms: str) → None#
showCardInfo() → None#
selected_cards() → collections.abc.Sequence[anki.cards.CardId]#
selected_notes() → collections.abc.Sequence[anki.notes.NoteId]#
selectedNotesAsCards() → collections.abc.Sequence[anki.cards.CardId]#
onHelp() → None#
selectedCards#
selectedNotes#
on_create_copy() → None#
onChangeModel() → None#
createFilteredDeck() → None#
onTogglePreview() → None#
toggle_preview_button_state(active: bool) → None#
delete_selected_notes() → None#
deleteNotes#
set_deck_of_selected_cards() → None#
setDeck#
add_tags_to_selected_notes(tags: str | None = None) → None#

Shows prompt if tags not provided.

remove_tags_from_selected_notes(tags: str | None = None) → None#

Shows prompt if tags not provided.

clear_unused_tags() → None#
addTags#
deleteTags#
clearUnusedTags#
suspend_selected_cards(checked: bool) → None#
bury_selected_cards(checked: bool) → None#
set_flag_of_selected_cards(flag: int) → None#
toggle_mark_of_selected_notes(checked: bool) → None#
reposition() → None#
set_due_date() → None#
forget_cards() → None#
grade_now() → None#

Show dialog to grade selected cards.

selectNotes() → None#
setupHooks() → None#
teardownHooks() → None#
undo() → None#
redo() → None#
on_undo_state_change(info: aqt.undo.UndoActionsInfo) → None#
onFindReplace() → None#
onFindDupes() → None#
has_previous_card() → bool#
has_next_card() → bool#
onPreviousCard() → None#
onNextCard() → None#
onFirstCard() → None#
onLastCard() → None#
onFind() → None#
onNote() → None#
onCardList() → None#