don't wait before scrolling to current card

https://github.com/ankitects/anki/pull/1222#discussion_r647017566
This commit is contained in:
Damien Elmes 2021-06-08 12:54:05 +10:00
parent 6878d4ca24
commit afaaa763ec
2 changed files with 3 additions and 5 deletions

View file

@ -106,9 +106,9 @@ class Browser(QMainWindow):
self.setupEditor()
# disable undo/redo
self.on_undo_state_change(mw.undo_actions_info())
self.setupSearch(card, search)
gui_hooks.browser_will_show(self)
self.show()
self.setupSearch(card, search)
def on_operation_did_execute(
self, changes: OpChanges, handler: Optional[object]

View file

@ -129,8 +129,7 @@ class Table:
self.clear_selection()
if (row := self._model.get_card_row(card_id)) is not None:
self._view.selectRow(row)
# editor may pop up and hide the row later on
QTimer.singleShot(100, lambda: self._scroll_to_row(row))
self._scroll_to_row(row)
# Reset
@ -408,8 +407,7 @@ class Table:
current = current or rows[0]
self._select_rows(rows)
self._set_current(current)
# editor may pop up and hide the row later on
QTimer.singleShot(100, lambda: self._scroll_to_row(current))
self._scroll_to_row(current)
if self.len_selection() == 0:
# no row change will fire
self.browser.onRowChanged(QItemSelection(), QItemSelection())