diff --git a/qt/aqt/browser.py b/qt/aqt/browser.py index 53d426c85..3b7c900f7 100644 --- a/qt/aqt/browser.py +++ b/qt/aqt/browser.py @@ -85,7 +85,7 @@ class DataModel(QAbstractTableModel): self.cards: List[int] = [] self.cardObjs: Dict[int, Card] = {} - def getCard(self, index): + def getCard(self, index: QModelIndex) -> Card: id = self.cards[index.row()] if not id in self.cardObjs: self.cardObjs[id] = self.col.getCard(id) @@ -316,13 +316,13 @@ class DataModel(QAbstractTableModel): elif type == "note": return c.model()["name"] elif type == "cardIvl": - if c.type == 0: + if c.type == CARD_TYPE_NEW: return _("(new)") - elif c.type == 1: + elif c.type == CARD_TYPE_LRN: return _("(learning)") return self.col.backend.format_time_span(c.ivl * 86400) elif type == "cardEase": - if c.type == 0: + if c.type == CARD_TYPE_NEW: return _("(new)") return "%d%%" % (c.factor / 10) elif type == "deck": @@ -406,7 +406,7 @@ class StatusDelegate(QItemDelegate): col = theme_manager.qcolor(f"flag{c.userFlag()}-bg") elif c.note().hasTag("Marked"): col = theme_manager.qcolor("marked-bg") - elif c.queue == -1: + elif c.queue == QUEUE_TYPE_SUSPENDED: col = theme_manager.qcolor("suspended-bg") if col: brush = QBrush(col) @@ -1933,7 +1933,7 @@ update cards set usn=?, mod=?, did=? where id in """ ###################################################################### def isSuspended(self): - return not not (self.card and self.card.queue == -1) + return not not (self.card and self.card.queue == QUEUE_TYPE_SUSPENDED) def onSuspend(self): self.editor.saveNow(self._onSuspend)