diff --git a/qt/aqt/table.py b/qt/aqt/table.py index 424319741..dac6bbb26 100644 --- a/qt/aqt/table.py +++ b/qt/aqt/table.py @@ -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 diff --git a/qt/tools/genhooks_gui.py b/qt/tools/genhooks_gui.py index d10af0831..7a268c97d 100644 --- a/qt/tools/genhooks_gui.py +++ b/qt/tools/genhooks_gui.py @@ -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