mirror of
https://github.com/ankitects/anki.git
synced 2025-09-22 07:52:24 -04:00
onModelChange: replacing try by if
This commit is contained in:
parent
d427e1028b
commit
f2fbf667cd
1 changed files with 4 additions and 7 deletions
|
@ -103,14 +103,11 @@ class AddCards(QDialog):
|
||||||
# copy identical fields
|
# copy identical fields
|
||||||
if fieldName in oldFields:
|
if fieldName in oldFields:
|
||||||
note[fieldName] = oldNote[fieldName]
|
note[fieldName] = oldNote[fieldName]
|
||||||
else:
|
elif n < len(oldNote.model()["flds"]):
|
||||||
# set non-identical fields by field index
|
# set non-identical fields by field index
|
||||||
try:
|
oldFieldName = oldNote.model()["flds"][n]["name"]
|
||||||
oldFieldName = oldNote.model()["flds"][n]["name"]
|
if oldFieldName not in newFields:
|
||||||
if oldFieldName not in newFields:
|
note.fields[n] = oldNote.fields[n]
|
||||||
note.fields[n] = oldNote.fields[n]
|
|
||||||
except IndexError:
|
|
||||||
pass
|
|
||||||
self.removeTempNote(oldNote)
|
self.removeTempNote(oldNote)
|
||||||
self.editor.note = note
|
self.editor.note = note
|
||||||
# When on model change is called, reset is necessarily called.
|
# When on model change is called, reset is necessarily called.
|
||||||
|
|
Loading…
Reference in a new issue