Rename addAndClose to closeAfterAdding

This commit is contained in:
Henrik Giesel 2019-01-18 03:56:02 +01:00
parent b7258de5b7
commit d08d2510e7
2 changed files with 8 additions and 8 deletions

View File

@ -1044,14 +1044,14 @@ class AnkiConnect:
self.collection().models.update(model) self.collection().models.update(model)
addAndClose = False closeAfterAdding = False
if note is not None and 'options' in note: if note is not None and 'options' in note:
if 'addAndClose' in note['options']: if 'closeAfterAdding' in note['options']:
addAndClose = note['options']['addAndClose'] closeAfterAdding = note['options']['closeAfterAdding']
if type(addAndClose) is not bool: if type(closeAfterAdding) is not bool:
raise Exception('option parameter \'addAndClose\' must be boolean') raise Exception('option parameter \'closeAfterAdding\' must be boolean')
if addAndClose: if closeAfterAdding:
# an "AddCards" dialogue, that closes when you add a note # an "AddCards" dialogue, that closes when you add a note
class AddCardsAndClose(aqt.addcards.AddCards): class AddCardsAndClose(aqt.addcards.AddCards):

View File

@ -1345,7 +1345,7 @@ guarantee that your application continues to function properly in the future.
Invokes the *Add Cards* dialog and presets the note using the given deck and model, with the provided field values Invokes the *Add Cards* dialog and presets the note using the given deck and model, with the provided field values
and tags. Invoking it multiple times will open multiple windows. and tags. Invoking it multiple times will open multiple windows.
The `addAndClose` member inside `options` group can be set to true to create a dialog that closes upon adding the first note. The `closeAfterAdding` member inside `options` group can be set to true to create a dialog that closes upon adding the note.
*Sample request*: *Sample request*:
```json ```json
@ -1361,7 +1361,7 @@ guarantee that your application continues to function properly in the future.
"Extra": "Romania is a country in Europe" "Extra": "Romania is a country in Europe"
}, },
"options": { "options": {
"addAndClose": true "closeAfterAdding": true
}, },
"tags": [ "tags": [
"yomichan" "yomichan"