From 20bbe355a3606f91b38df6988bf70ba00f053708 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 22 May 2012 14:43:44 +0900 Subject: [PATCH] support note type column, alphabetize --- aqt/browser.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/aqt/browser.py b/aqt/browser.py index dd125efd3..c45923317 100644 --- a/aqt/browser.py +++ b/aqt/browser.py @@ -72,7 +72,7 @@ class DataModel(QAbstractTableModel): if role == Qt.TextAlignmentRole: align = Qt.AlignVCenter if self.activeCols[index.column()] not in ("question", "answer", - "template", "deck", "noteFld"): + "template", "deck", "noteFld", "note"): align |= Qt.AlignHCenter return align elif role == Qt.DisplayRole or role == Qt.EditRole: @@ -217,6 +217,8 @@ class DataModel(QAbstractTableModel): return str(c.reps) elif type == "cardLapses": return str(c.lapses) + elif type == "note": + return c.model()['name'] elif type == "cardIvl": if c.type == 0: return _("(new)") @@ -413,8 +415,8 @@ class Browser(QMainWindow): def setupColumns(self): self.columns = [ - ('question', _("Question")), - ('answer', _("Answer")), + ('question', _("Front")), + ('answer', _("Back")), ('template', _("Card")), ('deck', _("Deck")), ('noteFld', _("Sort Field")), @@ -426,7 +428,9 @@ class Browser(QMainWindow): ('cardEase', _("Ease")), ('cardReps', _("Reviews")), ('cardLapses', _("Lapses")), + ('note', _("Note")), ] + self.columns.sort(key=itemgetter(1)) # Searching ###################################################################### @@ -548,7 +552,7 @@ class Browser(QMainWindow): def onSortChanged(self, idx, ord): type = self.model.activeCols[idx] - noSort = ("question", "answer", "template", "deck") + noSort = ("question", "answer", "template", "deck", "note") if type in noSort: if type == "template": showInfo(_("""\