From 5d482ff4ce5afe4446f9a772af1e79e4bcdf9d5c Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sun, 28 May 2017 15:54:28 -0700 Subject: [PATCH] minor fixups --- AnkiConnect.py | 10 ++++++---- README.md | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/AnkiConnect.py b/AnkiConnect.py index f54a4ee..25483da 100644 --- a/AnkiConnect.py +++ b/AnkiConnect.py @@ -28,7 +28,7 @@ import socket # Constants # -API_VERSION = 2 +API_VERSION = 3 TICK_INTERVAL = 25 URL_TIMEOUT = 10 URL_UPGRADE = 'https://raw.githubusercontent.com/FooSoft/anki-connect/master/anki_connect.py' @@ -418,18 +418,20 @@ class AnkiBridge: def guiBrowse(self, query): - browser = aqt.dialogs.open("Browser", self.window()) + browser = aqt.dialogs.open('Browser', self.window()) browser.activateWindow() + if query: query = unicode('"{}"').format(query) browser.form.searchEdit.lineEdit().setText(query) browser.onSearch() + return browser.model.cards def guiAddCards(self): - addcards = aqt.dialogs.open("AddCards", self.window()) - addcards.activateWindow() + addCards = aqt.dialogs.open('AddCards', self.window()) + addCards.activateWindow() # diff --git a/README.md b/README.md index fb0fb62..681907f 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ The installation process is similar to that of other Anki plugins and can be acc Anki must be kept running in the background in order for other applications to be able to use AnkiConnect. You can verify that AnkiConnect is running at any time by accessing [localhost:8765](http://localhost:8765) in your browser. If -the server is running, you should see the message *AnkiConnect v.2* displayed in your browser window. +the server is running, you should see the message *AnkiConnect v.3* displayed in your browser window. ### Notes for Windows Users ### @@ -88,7 +88,7 @@ rather than raw JSON. If you are writing raw requests be sure to send valid JSON * **version** - Gets the version of the API exposed by this plugin. Currently only versions `1` and `2` are defined. + Gets the version of the API exposed by this plugin. Currently versions `1` through `3` are defined. This should be the first call you make to make sure that your application and AnkiConnect are able to communicate properly with each other. New versions of AnkiConnect will backwards compatible; as long as you are using actions