mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
single try in onModelChange
This commit is contained in:
parent
936bb31997
commit
d427e1028b
1 changed files with 5 additions and 7 deletions
|
@ -100,16 +100,14 @@ class AddCards(QDialog):
|
||||||
newFields = list(note.keys())
|
newFields = list(note.keys())
|
||||||
for n, f in enumerate(note.model()["flds"]):
|
for n, f in enumerate(note.model()["flds"]):
|
||||||
fieldName = f["name"]
|
fieldName = f["name"]
|
||||||
try:
|
|
||||||
oldFieldName = oldNote.model()["flds"][n]["name"]
|
|
||||||
except IndexError:
|
|
||||||
oldFieldName = None
|
|
||||||
# copy identical fields
|
# copy identical fields
|
||||||
if fieldName in oldFields:
|
if fieldName in oldFields:
|
||||||
note[fieldName] = oldNote[fieldName]
|
note[fieldName] = oldNote[fieldName]
|
||||||
|
else:
|
||||||
# set non-identical fields by field index
|
# set non-identical fields by field index
|
||||||
elif oldFieldName and oldFieldName not in newFields:
|
|
||||||
try:
|
try:
|
||||||
|
oldFieldName = oldNote.model()["flds"][n]["name"]
|
||||||
|
if oldFieldName not in newFields:
|
||||||
note.fields[n] = oldNote.fields[n]
|
note.fields[n] = oldNote.fields[n]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in a new issue