mirror of
https://github.com/ankitects/anki.git
synced 2025-09-22 16:02:23 -04:00
match a single note type in browser even if duplicate names
This commit is contained in:
parent
22877fd789
commit
120c1d4136
2 changed files with 8 additions and 1 deletions
|
@ -164,6 +164,8 @@ select distinct(n.id) from cards c, notes n where c.nid=n.id and """+preds
|
|||
add(self._findTemplate(val))
|
||||
elif cmd == "note":
|
||||
add(self._findModel(val))
|
||||
elif cmd == "mid":
|
||||
add(self._findMid(val))
|
||||
elif cmd == "deck":
|
||||
add(self._findDeck(val))
|
||||
elif cmd == "prop":
|
||||
|
@ -332,6 +334,11 @@ select distinct(n.id) from cards c, notes n where c.nid=n.id and """+preds
|
|||
return
|
||||
return "n.id in (%s)" % val
|
||||
|
||||
def _findMid(self, val):
|
||||
if re.search("[^0-9]", val):
|
||||
return
|
||||
return "n.mid = %s" % val
|
||||
|
||||
def _findModel(self, val):
|
||||
ids = []
|
||||
val = val.lower()
|
||||
|
|
|
@ -778,7 +778,7 @@ by clicking on one on the left."""))
|
|||
def _modelTree(self, root):
|
||||
for m in sorted(self.col.models.all(), key=itemgetter("name")):
|
||||
mitem = self.CallbackItem(
|
||||
m['name'], lambda m=m: self.setFilter("note", m['name']))
|
||||
m['name'], lambda m=m: self.setFilter("mid", m['id']))
|
||||
mitem.setIcon(0, QIcon(":/icons/product_design.png"))
|
||||
root.addChild(mitem)
|
||||
# for t in m['tmpls']:
|
||||
|
|
Loading…
Reference in a new issue