temporary fix for error on deleting (#1374)

This commit is contained in:
Damien Elmes 2021-09-20 22:02:44 +10:00
parent 66fc9cdbd8
commit 9720592519

View file

@ -9,7 +9,13 @@ import aqt
import aqt.forms
from anki._legacy import deprecated
from anki.cards import Card, CardId
from anki.collection import Collection, Config, OpChanges, SearchNode
from anki.collection import (
Collection,
Config,
OpChanges,
OpChangesWithCount,
SearchNode,
)
from anki.consts import *
from anki.errors import NotFoundError
from anki.lang import without_unicode_isolation
@ -54,6 +60,7 @@ from aqt.utils import (
saveState,
showWarning,
skip_if_selection_is_empty,
tooltip,
tr,
)
@ -593,11 +600,16 @@ class Browser(QMainWindow):
return
nids = self.table.get_selected_note_ids()
# select the next card if there is one
self.focusTo = self.editor.currentField
self.table.to_next_row()
remove_notes(parent=self, note_ids=nids).run_in_background()
def after_remove(changes: OpChangesWithCount) -> None:
tooltip(tr.browsing_cards_deleted(count=changes.count))
# select the next card if there is one
self.focusTo = self.editor.currentField
self.table.to_next_row()
remove_notes(parent=self, note_ids=nids).success(
after_remove
).run_in_background()
# legacy