Prefix gui to GUI related functions and update readme
This commit is contained in:
parent
5ec3df733e
commit
842dae9830
@ -434,7 +434,7 @@ class AnkiBridge:
|
|||||||
addCards.activateWindow()
|
addCards.activateWindow()
|
||||||
|
|
||||||
|
|
||||||
def getNextCard(self):
|
def guiGetNextCard(self):
|
||||||
if self.window().reviewer.card is None or self.window().state != 'review':
|
if self.window().reviewer.card is None or self.window().state != 'review':
|
||||||
self.window().moveToState('review')
|
self.window().moveToState('review')
|
||||||
|
|
||||||
@ -452,7 +452,7 @@ class AnkiBridge:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def showQuestion(self):
|
def guiShowQuestion(self):
|
||||||
if self.window().reviewer.card is None or self.window().state != 'review':
|
if self.window().reviewer.card is None or self.window().state != 'review':
|
||||||
self.window().moveToState('review')
|
self.window().moveToState('review')
|
||||||
|
|
||||||
@ -460,7 +460,7 @@ class AnkiBridge:
|
|||||||
return {'success': True}
|
return {'success': True}
|
||||||
|
|
||||||
|
|
||||||
def showAnswer(self):
|
def guiShowAnswer(self):
|
||||||
if self.window().reviewer.mw.state != 'review':
|
if self.window().reviewer.mw.state != 'review':
|
||||||
return {'success': False, 'message': 'Window state is not review.'}
|
return {'success': False, 'message': 'Window state is not review.'}
|
||||||
else:
|
else:
|
||||||
@ -468,7 +468,7 @@ class AnkiBridge:
|
|||||||
return {'success': True}
|
return {'success': True}
|
||||||
|
|
||||||
|
|
||||||
def answerCard(self, id, ease):
|
def guiAnswerCard(self, id, ease):
|
||||||
if self.window().reviewer.mw.state != 'review':
|
if self.window().reviewer.mw.state != 'review':
|
||||||
return {'success': False, 'message': 'Window state is not review.'}
|
return {'success': False, 'message': 'Window state is not review.'}
|
||||||
elif self.window().reviewer.state != 'answer':
|
elif self.window().reviewer.state != 'answer':
|
||||||
@ -597,20 +597,20 @@ class AnkiConnect:
|
|||||||
return self.anki.guiAddCards()
|
return self.anki.guiAddCards()
|
||||||
|
|
||||||
|
|
||||||
def api_getNextCard(self):
|
def api_guiGetNextCard(self):
|
||||||
return self.anki.getNextCard()
|
return self.anki.guiGetNextCard()
|
||||||
|
|
||||||
|
|
||||||
def api_answerCard(self, id, ease):
|
def api_guiAnswerCard(self, id, ease):
|
||||||
return self.anki.answerCard(id, ease)
|
return self.anki.guiAnswerCard(id, ease)
|
||||||
|
|
||||||
|
|
||||||
def api_showQuestion(self):
|
def api_guiShowQuestion(self):
|
||||||
return self.anki.showQuestion()
|
return self.anki.guiShowQuestion()
|
||||||
|
|
||||||
|
|
||||||
def api_showAnswer(self):
|
def api_guiShowAnswer(self):
|
||||||
return self.anki.showAnswer()
|
return self.anki.guiShowAnswer()
|
||||||
|
|
||||||
|
|
||||||
def api_checkState(self):
|
def api_checkState(self):
|
||||||
|
17
README.md
17
README.md
@ -336,7 +336,7 @@ rather than raw JSON. If you are writing raw requests be sure to send valid JSON
|
|||||||
null
|
null
|
||||||
```
|
```
|
||||||
|
|
||||||
* **getNextCard**
|
* **guiGetNextCard**
|
||||||
|
|
||||||
Returns next/current card, calling this multiple times will not skip unanswered cards.
|
Returns next/current card, calling this multiple times will not skip unanswered cards.
|
||||||
|
|
||||||
@ -353,7 +353,7 @@ rather than raw JSON. If you are writing raw requests be sure to send valid JSON
|
|||||||
{
|
{
|
||||||
'success': 'true',
|
'success': 'true',
|
||||||
'question': 'Hello',
|
'question': 'Hello',
|
||||||
'_fmap': {
|
'fieldMap': {
|
||||||
'Front': [
|
'Front': [
|
||||||
0,
|
0,
|
||||||
{
|
{
|
||||||
@ -393,15 +393,18 @@ rather than raw JSON. If you are writing raw requests be sure to send valid JSON
|
|||||||
'Easy'
|
'Easy'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'model_name': 'Basic',
|
'modelName': 'Basic',
|
||||||
'fields': '[\"Hello\", \"Hola\"]',
|
"fields": [
|
||||||
|
"Hello",
|
||||||
|
"Hola"
|
||||||
|
],
|
||||||
'answer': 'Hello\n\n<hr id=answer>\n\nHola',
|
'answer': 'Hello\n\n<hr id=answer>\n\nHola',
|
||||||
'ord': 0,
|
'ord': 0,
|
||||||
'id': 1496751176292
|
'id': 1496751176292
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
* **showQuestion**
|
* **guiShowQuestion**
|
||||||
|
|
||||||
Move Anki to the state of showing a question (window state = 'review' and reviewer state = 'question'). This is required in order to show the answer and can also be used to move from the showAnswer state back to the showQuestion state.
|
Move Anki to the state of showing a question (window state = 'review' and reviewer state = 'question'). This is required in order to show the answer and can also be used to move from the showAnswer state back to the showQuestion state.
|
||||||
|
|
||||||
@ -418,7 +421,7 @@ rather than raw JSON. If you are writing raw requests be sure to send valid JSON
|
|||||||
{'success': 'true'}
|
{'success': 'true'}
|
||||||
```
|
```
|
||||||
|
|
||||||
* **showAnswer**
|
* **guiShowAnswer**
|
||||||
|
|
||||||
Move Anki to the state of showing an answer (window state = 'review' and reviewer state = 'answer'). This is required in order to answer a card.
|
Move Anki to the state of showing an answer (window state = 'review' and reviewer state = 'answer'). This is required in order to answer a card.
|
||||||
|
|
||||||
@ -440,7 +443,7 @@ rather than raw JSON. If you are writing raw requests be sure to send valid JSON
|
|||||||
{'success': 'false', 'message': 'Window state is not review.'}
|
{'success': 'false', 'message': 'Window state is not review.'}
|
||||||
```
|
```
|
||||||
|
|
||||||
* **answerCard**
|
* **guiAnswerCard**
|
||||||
|
|
||||||
Used to answer a card that is in the showAnswer state. Valid answers for this card can be found in the getNextCard response.
|
Used to answer a card that is in the showAnswer state. Valid answers for this card can be found in the getNextCard response.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user