mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 15:02:21 -04:00
allow user to hit enter to show current deck
This commit is contained in:
parent
33d2da33c0
commit
3f080b3871
1 changed files with 5 additions and 10 deletions
|
@ -435,6 +435,7 @@ class Browser(QMainWindow):
|
||||||
"Careful: if reset is true, the current note is saved."
|
"Careful: if reset is true, the current note is saved."
|
||||||
txt = unicode(self.form.searchEdit.lineEdit().text()).strip()
|
txt = unicode(self.form.searchEdit.lineEdit().text()).strip()
|
||||||
sh = self.mw.pm.profile['searchHistory']
|
sh = self.mw.pm.profile['searchHistory']
|
||||||
|
prompt = _("<type here to search; hit enter to show current deck>")
|
||||||
if txt not in sh:
|
if txt not in sh:
|
||||||
sh.insert(0, txt)
|
sh.insert(0, txt)
|
||||||
sh = sh[:30]
|
sh = sh[:30]
|
||||||
|
@ -444,21 +445,15 @@ class Browser(QMainWindow):
|
||||||
if self.mw.reviewer.card:
|
if self.mw.reviewer.card:
|
||||||
txt = txt.replace("is:current", "nid:%d"%self.mw.reviewer.card.nid)
|
txt = txt.replace("is:current", "nid:%d"%self.mw.reviewer.card.nid)
|
||||||
elif "is:current" in txt:
|
elif "is:current" in txt:
|
||||||
self.form.searchEdit.lineEdit().setText(
|
self.form.searchEdit.lineEdit().setText(prompt)
|
||||||
_("<type here to search>"))
|
|
||||||
self.form.searchEdit.lineEdit().selectAll()
|
self.form.searchEdit.lineEdit().selectAll()
|
||||||
|
elif txt == prompt:
|
||||||
|
self.form.searchEdit.lineEdit().setText("deck:current")
|
||||||
|
txt = "deck:current"
|
||||||
self.model.search(txt, reset)
|
self.model.search(txt, reset)
|
||||||
if not self.model.cards:
|
if not self.model.cards:
|
||||||
# no row change will fire
|
# no row change will fire
|
||||||
self.onRowChanged(None, None)
|
self.onRowChanged(None, None)
|
||||||
# somewhat distracting
|
|
||||||
# txt = _("No matches found.")
|
|
||||||
# if not self.mw.pm.profile['fullSearch']:
|
|
||||||
# txt += "<p>" + _(
|
|
||||||
# _("If your cards have formatting, you may want <br>"
|
|
||||||
# "to enable 'search within formatting' in the<br>"
|
|
||||||
# "browser options."))
|
|
||||||
# tooltip(txt)
|
|
||||||
|
|
||||||
def updateTitle(self):
|
def updateTitle(self):
|
||||||
selected = len(self.form.tableView.selectionModel().selectedRows())
|
selected = len(self.form.tableView.selectionModel().selectedRows())
|
||||||
|
|
Loading…
Reference in a new issue