Fix browser_did_fetch_row hook
This commit is contained in:
parent
13a0e2c82f
commit
2c7940e247
@ -892,7 +892,7 @@ class DataModel(QAbstractTableModel):
|
||||
self._rows[item] = self._fetch_row_from_backend(item)
|
||||
return self._rows[item]
|
||||
|
||||
def _fetch_row_from_backend(self, item: int) -> CellRow:
|
||||
def _fetch_row_from_backend(self, item: ItemId) -> CellRow:
|
||||
try:
|
||||
row = CellRow(*self.col.browser_row_for_id(item))
|
||||
except NotFoundError:
|
||||
@ -900,8 +900,9 @@ class DataModel(QAbstractTableModel):
|
||||
except Exception as e:
|
||||
return CellRow.generic(self.len_columns(), str(e))
|
||||
|
||||
# fixme: hook needs state
|
||||
gui_hooks.browser_did_fetch_row(item, row, self._state.active_columns)
|
||||
gui_hooks.browser_did_fetch_row(
|
||||
item, not self._state.is_card_state(), row, self._state.active_columns
|
||||
)
|
||||
return row
|
||||
|
||||
# Reset
|
||||
|
@ -406,7 +406,12 @@ hooks = [
|
||||
),
|
||||
Hook(
|
||||
name="browser_did_fetch_row",
|
||||
args=["card_id: int", "row: aqt.table.CellRow", "columns: Sequence[str]"],
|
||||
args=[
|
||||
"card_or_note_id: aqt.table.ItemId",
|
||||
"is_note: bool",
|
||||
"row: aqt.table.CellRow",
|
||||
"columns: Sequence[str]",
|
||||
],
|
||||
doc="""Allows you to add or modify content to a row in the browser.
|
||||
|
||||
You can mutate the row object to change what is displayed. Any columns the
|
||||
|
Loading…
Reference in New Issue
Block a user