This commit is contained in:
Alex Yatskov 2017-07-01 12:49:44 -07:00
parent d529cc12f4
commit e5ff8eea78

View File

@ -409,10 +409,10 @@ class AnkiBridge:
return collection.models.allNames() return collection.models.allNames()
def modelNameFromId(self, mid): def modelNameFromId(self, modelId):
collection = self.collection() collection = self.collection()
if collection is not None: if collection is not None:
model = collection.models.get(mid) model = collection.models.get(modelId)
if model is not None: if model is not None:
return model['name'] return model['name']
@ -431,10 +431,10 @@ class AnkiBridge:
return collection.decks.allNames() return collection.decks.allNames()
def deckNameFromId(self, did): def deckNameFromId(self, deckId):
collection = self.collection() collection = self.collection()
if collection is not None: if collection is not None:
deck = collection.decks.get(did) deck = collection.decks.get(deckId)
if deck is not None: if deck is not None:
return deck['name'] return deck['name']
@ -443,7 +443,7 @@ class AnkiBridge:
browser = aqt.dialogs.open('Browser', self.window()) browser = aqt.dialogs.open('Browser', self.window())
browser.activateWindow() browser.activateWindow()
if query: if len(query) > 0:
query = unicode('"{}"').format(query) query = unicode('"{}"').format(query)
browser.form.searchEdit.lineEdit().setText(query) browser.form.searchEdit.lineEdit().setText(query)
browser.onSearch() browser.onSearch()
@ -460,14 +460,8 @@ class AnkiBridge:
return self.reviewer().card is not None return self.reviewer().card is not None
def guiReview(self):
window = self.window()
window.moveToState('review')
return self.guiReviewActive()
def guiCurrentCard(self): def guiCurrentCard(self):
if self.guiReviewActive(): if not self.guiReviewActive():
return False return False
reviewer = self.reviewer() reviewer = self.reviewer()
@ -625,16 +619,12 @@ class AnkiConnect:
return self.anki.guiAddCards() return self.anki.guiAddCards()
def api_guiReview(self):
return self.anki.guiReview()
def api_guiCurrentCard(self): def api_guiCurrentCard(self):
return self.anki.guiCurrentCard() return self.anki.guiCurrentCard()
def api_guiAnswerCard(self, id, ease): def api_guiAnswerCard(self, cardId, ease):
return self.anki.guiAnswerCard(id, ease) return self.anki.guiAnswerCard(cardId, ease)
def api_guiShowQuestion(self): def api_guiShowQuestion(self):