Fix issues pointed out in the PR. More consistent API function names.

This commit is contained in:
Glutanimate 2017-05-28 22:21:20 +02:00
parent 9e6d963b1a
commit 36c9528153

View File

@ -417,20 +417,19 @@ class AnkiBridge:
return collection.decks.allNames() return collection.decks.allNames()
def launchBrowser(self, query): def guiBrowse(self, query):
browser = aqt.dialogs.open("Browser", self.window()) browser = aqt.dialogs.open("Browser", self.window())
browser.activateWindow() browser.activateWindow()
if query: if query:
query = u'"{}"'.format(query) query = unicode('"{}"'.format(query))
browser.form.searchEdit.lineEdit().setText(query) browser.form.searchEdit.lineEdit().setText(query)
browser.onSearch() browser.onSearch()
return browser.model.cards return browser.model.cards
def launchAddCards(self): def guiAddCards(self):
addcards = aqt.dialogs.open("AddCards", self.window()) addcards = aqt.dialogs.open("AddCards", self.window())
addcards.activateWindow() addcards.activateWindow()
return 0
# #
@ -532,12 +531,12 @@ class AnkiConnect:
return API_VERSION return API_VERSION
def api_guiSearch(self, query): def api_guiBrowse(self, query):
return self.anki.launchBrowser(query) return self.anki.guiBrowse(query)
def api_guiAdd(self): def api_guiAddCards(self):
return self.anki.launchAddCards() return self.anki.guiAddCards()
# #
# Entry # Entry