From ecc54ea2221c0c006937de5b195329b3e89596c8 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 13 Apr 2009 12:42:55 +0900 Subject: [PATCH 1/4] convert "_" to " " in tag list --- ankiqt/ui/cardlist.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ankiqt/ui/cardlist.py b/ankiqt/ui/cardlist.py index 2cfd6ce26..ffaf8af24 100644 --- a/ankiqt/ui/cardlist.py +++ b/ankiqt/ui/cardlist.py @@ -345,7 +345,8 @@ class EditDeck(QMainWindow): self.dialog.tagList.setFixedWidth(130) self.dialog.tagList.clear() self.dialog.tagList.addItems(QStringList( - [_(''), _('No tags')] + self.alltags)) + [_(''), _('No tags')] + + [x.replace("_", " ") for x in self.alltags])) self.dialog.tagList.view().setFixedWidth(200) def drawSort(self): From c239768d1941878d40ea506f7cf795d518fa9222 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 13 Apr 2009 12:43:24 +0900 Subject: [PATCH 2/4] add 'sort by fact creation' --- ankiqt/ui/cardlist.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/ankiqt/ui/cardlist.py b/ankiqt/ui/cardlist.py index ffaf8af24..5368a8545 100644 --- a/ankiqt/ui/cardlist.py +++ b/ankiqt/ui/cardlist.py @@ -123,12 +123,22 @@ class DeckModel(QAbstractTableModel): sort = "" if isinstance(self.sortKey, types.StringType): # card property - sort = "order by cards." + self.sortKey + if self.sortKey == "fact": + sort = "order by facts.created, cards.created" + else: + sort = "order by cards." + self.sortKey if self.sortKey in ("question", "answer"): sort += " collate nocase" - query = ("select id from cards ") - if ads: - query += "where %s " % ads + if self.sortKey == "fact": + query = """ +select cards.id from cards, facts +where cards.factId = facts.id """ + if ads: + query += ads + " " + else: + query = "select id from cards " + if ads: + query += "where %s " % ads query += sort else: # field value @@ -359,6 +369,7 @@ class EditDeck(QMainWindow): _("Interval"), _("Reps"), _("Ease"), + _("Fact Created"), ] self.sortFields = sorted(self.deck.allFields()) self.sortList.extend([_("'%s'") % f for f in self.sortFields]) @@ -385,8 +396,10 @@ class EditDeck(QMainWindow): self.sortKey = "reps" elif idx == 7: self.sortKey = "factor" + elif idx == 8: + self.sortKey = "fact" else: - self.sortKey = ("field", self.sortFields[idx-8]) + self.sortKey = ("field", self.sortFields[idx-9]) self.rebuildSortIndex(self.sortKey) self.sortIndex = idx self.deck.setVar('sortIndex', idx) From 029345e2a67ce6c514996e2abb47fe74a3b53fa7 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 14 Apr 2009 01:25:25 +0900 Subject: [PATCH 3/4] trailing whitespace --- ankiqt/ui/status.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ankiqt/ui/status.py b/ankiqt/ui/status.py index e5bdc0c16..1383d3bdb 100644 --- a/ankiqt/ui/status.py +++ b/ankiqt/ui/status.py @@ -182,15 +182,15 @@ class StatusView(object): ngettext("There is %d failed card due soon.", \ "There are %d failed cards due soon.", \ stats['failed']) % stats['failed'] + "
" + - ngettext("There is %d card awaiting review.", + ngettext("There is %d card awaiting review.", "There are %d cards awaiting review.", \ - stats['rev']) % stats['rev'] + "
" + + stats['rev']) % stats['rev'] + "
" + ngettext("There is %d new card due today.", \ "There are %d new cards due today.",\ - stats['new']) % stats['new'] + "

" + + stats['new']) % stats['new'] + "

" + ngettext("There is %d new card in total.", \ "There are %d new cards in total.",\ - stats['new2']) % stats['new2'] + "
" + + stats['new2']) % stats['new2'] + "
" + ngettext("There is %d delayed card.", \ "There are %d delayed cards.", \ stats['spaced']) % stats['spaced']) From 783e9ceac9eab1a37ca827b05102aebb76a77b73 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 14 Apr 2009 01:32:50 +0900 Subject: [PATCH 4/4] fix statusbar corruption --- ankiqt/ui/status.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ankiqt/ui/status.py b/ankiqt/ui/status.py index 1383d3bdb..044359029 100644 --- a/ankiqt/ui/status.py +++ b/ankiqt/ui/status.py @@ -70,6 +70,7 @@ class StatusView(object): self.sep1.setShown(shown) self.sep2.setShown(shown) self.sep3.setShown(shown) + self.statusbar.hideOrShow() # Setup and teardown ##########################################################################