Merge pull request #12 from txgio/deck-browser-and-deck-overview

Include actions to open the Deck Overview for a given deck name and go to the Deck Browser
This commit is contained in:
Alex Yatskov 2017-07-02 14:02:46 -07:00 committed by GitHub
commit a626da9df9
2 changed files with 52 additions and 0 deletions

View File

@ -507,6 +507,18 @@ class AnkiBridge:
reviewer._answerCard(ease)
return True
def guiDeckOverview(self, name):
collection = self.collection()
if collection is not None:
deck = collection.decks.byName(name)
if deck is not None:
collection.decks.select(deck['id'])
self.window().onOverview()
return True
return False
def guiDeckBrowser(self):
self.window().moveToState("deckBrowser")
#
# AnkiConnect
@ -631,6 +643,12 @@ class AnkiConnect:
def api_guiShowAnswer(self):
return self.anki.guiShowAnswer()
def api_guiDeckOverview(self, name):
return self.anki.guiDeckOverview(name)
def api_guiDeckBrowser(self):
return self.anki.guiDeckBrowser()
#
# Entry

View File

@ -390,6 +390,40 @@ Below is a list of currently supported actions. Requests with invalid actions or
```
true
```
* **guiDeckOverview**
Opens the Deck Overview screen for the deck with the given name; returns `true` if succeeded or `false` otherwise.
*Sample request*:
```
{
"action": "guiDeckOverview",
"params": {
"name": "Default"
}
}
```
*Sample response*:
```
true
```
* **guiDeckBrowser**
Opens the Deck Browser screen.
*Sample request*:
```
{
"action": "guiDeckBrowser"
}
```
*Sample response*:
```
null
```
* **upgrade**