mirror of
https://github.com/ankitects/anki.git
synced 2025-09-22 16:02:23 -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
|
||||
if fieldName in oldFields:
|
||||
note[fieldName] = oldNote[fieldName]
|
||||
else:
|
||||
elif n < len(oldNote.model()["flds"]):
|
||||
# set non-identical fields by field index
|
||||
try:
|
||||
oldFieldName = oldNote.model()["flds"][n]["name"]
|
||||
if oldFieldName not in newFields:
|
||||
note.fields[n] = oldNote.fields[n]
|
||||
except IndexError:
|
||||
pass
|
||||
self.removeTempNote(oldNote)
|
||||
self.editor.note = note
|
||||
# When on model change is called, reset is necessarily called.
|
||||
|
|
Loading…
Reference in a new issue