mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
support note type column, alphabetize
This commit is contained in:
parent
cf7ed9ea2f
commit
20bbe355a3
1 changed files with 8 additions and 4 deletions
|
@ -72,7 +72,7 @@ class DataModel(QAbstractTableModel):
|
||||||
if role == Qt.TextAlignmentRole:
|
if role == Qt.TextAlignmentRole:
|
||||||
align = Qt.AlignVCenter
|
align = Qt.AlignVCenter
|
||||||
if self.activeCols[index.column()] not in ("question", "answer",
|
if self.activeCols[index.column()] not in ("question", "answer",
|
||||||
"template", "deck", "noteFld"):
|
"template", "deck", "noteFld", "note"):
|
||||||
align |= Qt.AlignHCenter
|
align |= Qt.AlignHCenter
|
||||||
return align
|
return align
|
||||||
elif role == Qt.DisplayRole or role == Qt.EditRole:
|
elif role == Qt.DisplayRole or role == Qt.EditRole:
|
||||||
|
@ -217,6 +217,8 @@ class DataModel(QAbstractTableModel):
|
||||||
return str(c.reps)
|
return str(c.reps)
|
||||||
elif type == "cardLapses":
|
elif type == "cardLapses":
|
||||||
return str(c.lapses)
|
return str(c.lapses)
|
||||||
|
elif type == "note":
|
||||||
|
return c.model()['name']
|
||||||
elif type == "cardIvl":
|
elif type == "cardIvl":
|
||||||
if c.type == 0:
|
if c.type == 0:
|
||||||
return _("(new)")
|
return _("(new)")
|
||||||
|
@ -413,8 +415,8 @@ class Browser(QMainWindow):
|
||||||
|
|
||||||
def setupColumns(self):
|
def setupColumns(self):
|
||||||
self.columns = [
|
self.columns = [
|
||||||
('question', _("Question")),
|
('question', _("Front")),
|
||||||
('answer', _("Answer")),
|
('answer', _("Back")),
|
||||||
('template', _("Card")),
|
('template', _("Card")),
|
||||||
('deck', _("Deck")),
|
('deck', _("Deck")),
|
||||||
('noteFld', _("Sort Field")),
|
('noteFld', _("Sort Field")),
|
||||||
|
@ -426,7 +428,9 @@ class Browser(QMainWindow):
|
||||||
('cardEase', _("Ease")),
|
('cardEase', _("Ease")),
|
||||||
('cardReps', _("Reviews")),
|
('cardReps', _("Reviews")),
|
||||||
('cardLapses', _("Lapses")),
|
('cardLapses', _("Lapses")),
|
||||||
|
('note', _("Note")),
|
||||||
]
|
]
|
||||||
|
self.columns.sort(key=itemgetter(1))
|
||||||
|
|
||||||
# Searching
|
# Searching
|
||||||
######################################################################
|
######################################################################
|
||||||
|
@ -548,7 +552,7 @@ class Browser(QMainWindow):
|
||||||
|
|
||||||
def onSortChanged(self, idx, ord):
|
def onSortChanged(self, idx, ord):
|
||||||
type = self.model.activeCols[idx]
|
type = self.model.activeCols[idx]
|
||||||
noSort = ("question", "answer", "template", "deck")
|
noSort = ("question", "answer", "template", "deck", "note")
|
||||||
if type in noSort:
|
if type in noSort:
|
||||||
if type == "template":
|
if type == "template":
|
||||||
showInfo(_("""\
|
showInfo(_("""\
|
||||||
|
|
Loading…
Reference in a new issue