mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
temporary fix for error on deleting (#1374)
This commit is contained in:
parent
66fc9cdbd8
commit
9720592519
1 changed files with 17 additions and 5 deletions
|
@ -9,7 +9,13 @@ import aqt
|
||||||
import aqt.forms
|
import aqt.forms
|
||||||
from anki._legacy import deprecated
|
from anki._legacy import deprecated
|
||||||
from anki.cards import Card, CardId
|
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.consts import *
|
||||||
from anki.errors import NotFoundError
|
from anki.errors import NotFoundError
|
||||||
from anki.lang import without_unicode_isolation
|
from anki.lang import without_unicode_isolation
|
||||||
|
@ -54,6 +60,7 @@ from aqt.utils import (
|
||||||
saveState,
|
saveState,
|
||||||
showWarning,
|
showWarning,
|
||||||
skip_if_selection_is_empty,
|
skip_if_selection_is_empty,
|
||||||
|
tooltip,
|
||||||
tr,
|
tr,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -593,11 +600,16 @@ class Browser(QMainWindow):
|
||||||
return
|
return
|
||||||
|
|
||||||
nids = self.table.get_selected_note_ids()
|
nids = self.table.get_selected_note_ids()
|
||||||
|
|
||||||
|
def after_remove(changes: OpChangesWithCount) -> None:
|
||||||
|
tooltip(tr.browsing_cards_deleted(count=changes.count))
|
||||||
# select the next card if there is one
|
# select the next card if there is one
|
||||||
self.focusTo = self.editor.currentField
|
self.focusTo = self.editor.currentField
|
||||||
self.table.to_next_row()
|
self.table.to_next_row()
|
||||||
|
|
||||||
remove_notes(parent=self, note_ids=nids).run_in_background()
|
remove_notes(parent=self, note_ids=nids).success(
|
||||||
|
after_remove
|
||||||
|
).run_in_background()
|
||||||
|
|
||||||
# legacy
|
# legacy
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue