aqt.browser.table.model#
Classes#
Data manager for the browser table. |
Functions#
|
Return a column with generic fields and a label indicating to the user that this column was |
Module Contents#
- class aqt.browser.table.model.DataModel(parent: QObject, col: anki.collection.Collection, state: aqt.browser.table.state.ItemState, row_state_will_change_callback: aqt.qt.Callable, row_state_changed_callback: aqt.qt.Callable)#
Bases:
QAbstractTableModelData manager for the browser table.
- _items – The card or note ids currently hold and corresponding to the
table’s rows.
_rows – The cached data objects to render items to rows. columns – The data objects of all available columns, used to define the display
of active columns and list all toggleable columns to the user.
_block_updates – If True, serve stale content to avoid hitting the DB. _stale_cutoff – A threshold to decide whether a cached row has gone stale.
- columns: dict[str, aqt.browser.table.Column]#
- get_cell(index: QModelIndex) aqt.browser.table.Cell#
- get_row(index: QModelIndex) aqt.browser.table.CellRow#
- get_cached_row(index: QModelIndex) aqt.browser.table.CellRow | None#
Get row if it is cached, regardless of staleness.
- mark_cache_stale() None#
- reset() None#
- begin_reset() None#
- end_reset() None#
- begin_blocking() None#
- end_blocking() None#
- redraw_cells() None#
Update cell contents, without changing search count/columns/sorting.
- is_empty() bool#
- len_rows() int#
- len_columns() int#
- get_item(index: QModelIndex) aqt.browser.table.ItemId#
- get_items(indices: list[QModelIndex]) collections.abc.Sequence[aqt.browser.table.ItemId]#
- get_card_ids(indices: list[QModelIndex]) collections.abc.Sequence[anki.cards.CardId]#
- get_note_ids(indices: list[QModelIndex]) collections.abc.Sequence[anki.notes.NoteId]#
- get_note_id(index: QModelIndex) anki.notes.NoteId | None#
- get_item_row(item: aqt.browser.table.ItemId) int | None#
- get_item_rows(items: collections.abc.Sequence[aqt.browser.table.ItemId]) list[int]#
- get_card_row(card_id: anki.cards.CardId) int | None#
- get_card(index: QModelIndex) anki.cards.Card | None#
Try to return the indicated, possibly deleted card.
- get_note(index: QModelIndex) anki.notes.Note | None#
Try to return the indicated, possibly deleted note.
- toggle_state(context: aqt.browser.table.SearchContext) aqt.browser.table.state.ItemState#
- search(context: aqt.browser.table.SearchContext) None#
- reverse() None#
- column_at(index: QModelIndex) aqt.browser.table.Column#
- column_at_section(section: int) aqt.browser.table.Column#
Returns the column object corresponding to the active column at index or the default column object if no data is associated with the active column.
- active_column_index(column: str) int | None#
- toggle_column(column: str) None#
- rowCount(parent: QModelIndex = QModelIndex()) int#
- columnCount(parent: QModelIndex = QModelIndex()) int#
- data(index: QModelIndex = QModelIndex(), role: int = 0) anki.consts.Any#
- headerData(section: int, orientation: Qt.Orientation, role: int = 0) str | None#
- flags(index: QModelIndex) Qt.ItemFlag#
- aqt.browser.table.model.addon_column_fillin(key: str) aqt.browser.table.Column#
Return a column with generic fields and a label indicating to the user that this column was added by an add-on.