mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 23:12:21 -04:00
use readable name instead of mid in browser searches
mid should no longer be required now that note type names are made unique
This commit is contained in:
parent
a0afec9938
commit
27b42fcac9
1 changed files with 4 additions and 4 deletions
|
@ -856,7 +856,7 @@ by clicking on one on the left."""))
|
||||||
def _modelTree(self, root):
|
def _modelTree(self, root):
|
||||||
for m in sorted(self.col.models.all(), key=itemgetter("name")):
|
for m in sorted(self.col.models.all(), key=itemgetter("name")):
|
||||||
mitem = self.CallbackItem(
|
mitem = self.CallbackItem(
|
||||||
root, m['name'], lambda m=m: self.setFilter("mid", str(m['id'])))
|
root, m['name'], lambda m=m: self.setFilter("note", m['name']))
|
||||||
mitem.setIcon(0, QIcon(":/icons/notetype.svg"))
|
mitem.setIcon(0, QIcon(":/icons/notetype.svg"))
|
||||||
|
|
||||||
# Filter tree
|
# Filter tree
|
||||||
|
@ -1005,18 +1005,18 @@ by clicking on one on the left."""))
|
||||||
for nt in sorted(self.col.models.all(), key=lambda nt: nt['name'].lower()):
|
for nt in sorted(self.col.models.all(), key=lambda nt: nt['name'].lower()):
|
||||||
# no sub menu if it's a single template
|
# no sub menu if it's a single template
|
||||||
if len(nt['tmpls']) == 1:
|
if len(nt['tmpls']) == 1:
|
||||||
noteTypes.addItem(nt['name'], self._filterFunc("mid", str(nt['id'])))
|
noteTypes.addItem(nt['name'], self._filterFunc("note", nt['name']))
|
||||||
else:
|
else:
|
||||||
subm = noteTypes.addMenu(nt['name'])
|
subm = noteTypes.addMenu(nt['name'])
|
||||||
|
|
||||||
subm.addItem(_("All Card Types"), self._filterFunc("mid", str(nt['id'])))
|
subm.addItem(_("All Card Types"), self._filterFunc("note", nt['name']))
|
||||||
subm.addSeparator()
|
subm.addSeparator()
|
||||||
|
|
||||||
# add templates
|
# add templates
|
||||||
for c, tmpl in enumerate(nt['tmpls']):
|
for c, tmpl in enumerate(nt['tmpls']):
|
||||||
name = _("%(n)d: %(name)s") % dict(n=c+1, name=tmpl['name'])
|
name = _("%(n)d: %(name)s") % dict(n=c+1, name=tmpl['name'])
|
||||||
subm.addItem(name, self._filterFunc(
|
subm.addItem(name, self._filterFunc(
|
||||||
"mid", str(nt['id']), "card", str(c+1)))
|
"note", nt['name'], "card", str(c+1)))
|
||||||
|
|
||||||
m.addChild(noteTypes.chunked())
|
m.addChild(noteTypes.chunked())
|
||||||
return m
|
return m
|
||||||
|
|
Loading…
Reference in a new issue