add guiDeckReview request (#11)

This commit is contained in:
Alex Yatskov 2017-07-02 17:27:31 -07:00
parent a626da9df9
commit 7e3e6fd5fc

View File

@ -457,12 +457,12 @@ class AnkiBridge:
def guiReviewActive(self): def guiReviewActive(self):
return self.reviewer().card is not None return self.reviewer().card is not None and self.window().state == 'review'
def guiCurrentCard(self): def guiCurrentCard(self):
if not self.guiReviewActive(): if not self.guiReviewActive():
return False return
reviewer = self.reviewer() reviewer = self.reviewer()
card = reviewer.card card = reviewer.card
@ -507,6 +507,7 @@ class AnkiBridge:
reviewer._answerCard(ease) reviewer._answerCard(ease)
return True return True
def guiDeckOverview(self, name): def guiDeckOverview(self, name):
collection = self.collection() collection = self.collection()
if collection is not None: if collection is not None:
@ -515,10 +516,21 @@ class AnkiBridge:
collection.decks.select(deck['id']) collection.decks.select(deck['id'])
self.window().onOverview() self.window().onOverview()
return True return True
return False return False
def guiDeckBrowser(self): def guiDeckBrowser(self):
self.window().moveToState("deckBrowser") self.window().moveToState('deckBrowser')
def guiDeckReview(self, name):
if self.guiDeckOverview(name):
self.window().moveToState('review')
return True
else:
return False
# #
# AnkiConnect # AnkiConnect
@ -643,13 +655,19 @@ class AnkiConnect:
def api_guiShowAnswer(self): def api_guiShowAnswer(self):
return self.anki.guiShowAnswer() return self.anki.guiShowAnswer()
def api_guiDeckOverview(self, name): def api_guiDeckOverview(self, name):
return self.anki.guiDeckOverview(name) return self.anki.guiDeckOverview(name)
def api_guiDeckBrowser(self): def api_guiDeckBrowser(self):
return self.anki.guiDeckBrowser() return self.anki.guiDeckBrowser()
def api_guiDeckReview(self, name):
self.anki.guiDeckReview(name)
# #
# Entry # Entry
# #