mirror of
https://github.com/ankitects/anki.git
synced 2025-12-13 23:00:58 -05:00
Fix error on 'Previous Card Info' when deleting a note (#2790)
This commit is contained in:
parent
ef6f533c49
commit
252b4e7f00
1 changed files with 5 additions and 0 deletions
|
|
@ -8,6 +8,7 @@ from typing import Callable
|
||||||
|
|
||||||
import aqt
|
import aqt
|
||||||
from anki.cards import Card, CardId
|
from anki.cards import Card, CardId
|
||||||
|
from anki.errors import NotFoundError
|
||||||
from anki.lang import without_unicode_isolation
|
from anki.lang import without_unicode_isolation
|
||||||
from aqt.qt import *
|
from aqt.qt import *
|
||||||
from aqt.utils import (
|
from aqt.utils import (
|
||||||
|
|
@ -67,6 +68,10 @@ class CardInfoDialog(QDialog):
|
||||||
self.update_card(card_id)
|
self.update_card(card_id)
|
||||||
|
|
||||||
def update_card(self, card_id: CardId | None) -> None:
|
def update_card(self, card_id: CardId | None) -> None:
|
||||||
|
try:
|
||||||
|
self.mw.col.get_card(card_id)
|
||||||
|
except NotFoundError:
|
||||||
|
card_id = None
|
||||||
self.web.eval(
|
self.web.eval(
|
||||||
f"anki.cardInfoPromise.then((c) => c.updateStats({json.dumps(card_id)}));"
|
f"anki.cardInfoPromise.then((c) => c.updateStats({json.dumps(card_id)}));"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue