From 3f080b3871b48b81a71d05bd1ce9a778ea4fa3ca Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 17 Apr 2012 19:45:13 +0900 Subject: [PATCH] allow user to hit enter to show current deck --- aqt/browser.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/aqt/browser.py b/aqt/browser.py index b7f7e7a08..11373f611 100644 --- a/aqt/browser.py +++ b/aqt/browser.py @@ -435,6 +435,7 @@ class Browser(QMainWindow): "Careful: if reset is true, the current note is saved." txt = unicode(self.form.searchEdit.lineEdit().text()).strip() sh = self.mw.pm.profile['searchHistory'] + prompt = _("") if txt not in sh: sh.insert(0, txt) sh = sh[:30] @@ -444,21 +445,15 @@ class Browser(QMainWindow): if self.mw.reviewer.card: txt = txt.replace("is:current", "nid:%d"%self.mw.reviewer.card.nid) elif "is:current" in txt: - self.form.searchEdit.lineEdit().setText( - _("")) + self.form.searchEdit.lineEdit().setText(prompt) self.form.searchEdit.lineEdit().selectAll() + elif txt == prompt: + self.form.searchEdit.lineEdit().setText("deck:current") + txt = "deck:current" self.model.search(txt, reset) if not self.model.cards: # no row change will fire self.onRowChanged(None, None) - # somewhat distracting - # txt = _("No matches found.") - # if not self.mw.pm.profile['fullSearch']: - # txt += "

" + _( - # _("If your cards have formatting, you may want
" - # "to enable 'search within formatting' in the
" - # "browser options.")) - # tooltip(txt) def updateTitle(self): selected = len(self.form.tableView.selectionModel().selectedRows())