Add guiSelectedNotes action (#292)
This commit is contained in:
parent
ca60bf6c61
commit
064fbef413
21
README.md
21
README.md
@ -1018,6 +1018,27 @@ corresponding to when the API was available for use.
|
||||
}
|
||||
```
|
||||
|
||||
* **guiSelectedNotes**
|
||||
|
||||
Finds the open instance of the *Card Browser* dialog and returns an array of identifiers of the notes that are
|
||||
selected. Returns an empty list if the browser is not open.
|
||||
|
||||
*Sample request*:
|
||||
```json
|
||||
{
|
||||
"action": "guiSelectedNotes",
|
||||
"version": 6
|
||||
}
|
||||
```
|
||||
|
||||
*Sample result*:
|
||||
```json
|
||||
{
|
||||
"result": [1494723142483, 1494703460437, 1494703479525],
|
||||
"error": null
|
||||
}
|
||||
```
|
||||
|
||||
* **guiAddCards**
|
||||
|
||||
Invokes the *Add Cards* dialog, presets the note using the given deck and model, with the provided field values and tags.
|
||||
|
@ -1354,6 +1354,12 @@ class AnkiConnect:
|
||||
|
||||
return self.findCards(query)
|
||||
|
||||
@util.api()
|
||||
def guiSelectedNotes(self):
|
||||
(creator, instance) = aqt.dialogs._dialogs['Browser']
|
||||
if instance is None:
|
||||
return []
|
||||
return instance.selectedNotes()
|
||||
|
||||
@util.api()
|
||||
def guiAddCards(self, note=None):
|
||||
|
@ -9,6 +9,9 @@ class TestGui(unittest.TestCase):
|
||||
# guiBrowse
|
||||
util.invoke('guiBrowse', query='deck:Default')
|
||||
|
||||
# guiSelectedNotes
|
||||
util.invoke('guiSelectedNotes')
|
||||
|
||||
# guiAddCards
|
||||
util.invoke('guiAddCards')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user