Merge pull request #509 from Arthur-Milchior/type_queue_in_browser

adding missing constants in browser file
This commit is contained in:
Damien Elmes 2020-03-17 21:33:08 +10:00 committed by GitHub
commit dfa10f5a1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)