limit find&replace fields to selected notes
This commit is contained in:
parent
ea9d2e2d64
commit
5bce218312
13
anki/find.py
13
anki/find.py
@ -539,6 +539,19 @@ def fieldNames(col, downcase=True):
|
||||
return list(fields)
|
||||
return names
|
||||
|
||||
def fieldNamesForNotes(col, nids):
|
||||
downcasedNames = set()
|
||||
origNames = []
|
||||
mids = col.db.list("select distinct mid from notes where id in %s" % ids2str(nids))
|
||||
for mid in mids:
|
||||
model = col.models.get(mid)
|
||||
for field in col.models.fieldNames(model):
|
||||
if field.lower() not in downcasedNames:
|
||||
downcasedNames.add(field.lower())
|
||||
origNames.append(field)
|
||||
|
||||
return sorted(origNames, key=lambda x: x.lower())
|
||||
|
||||
# Find duplicates
|
||||
##########################################################################
|
||||
# returns array of ("dupestr", [nids])
|
||||
|
@ -1717,7 +1717,7 @@ update cards set usn=?, mod=?, did=? where id in """ + scids,
|
||||
if not sf:
|
||||
return
|
||||
import anki.find
|
||||
fields = sorted(anki.find.fieldNames(self.col, downcase=False))
|
||||
fields = anki.find.fieldNamesForNotes(self.mw.col, sf)
|
||||
d = QDialog(self)
|
||||
frm = aqt.forms.findreplace.Ui_Dialog()
|
||||
frm.setupUi(d)
|
||||
|
Loading…
Reference in New Issue
Block a user