Creating the guiExitAnki endpoint to allow closing Anki programmatically.
This commit is contained in:
parent
daf5c96c0a
commit
a35313922d
@ -850,6 +850,13 @@ class AnkiBridge:
|
|||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def guiExitAnki(self):
|
||||||
|
timer = QTimer()
|
||||||
|
def exitAnki():
|
||||||
|
timer.stop()
|
||||||
|
self.window().close()
|
||||||
|
timer.timeout.connect(exitAnki)
|
||||||
|
timer.start(1000) # 1s should be enough to allow the response to be sent.
|
||||||
|
|
||||||
#
|
#
|
||||||
# AnkiConnect
|
# AnkiConnect
|
||||||
@ -1149,6 +1156,10 @@ class AnkiConnect:
|
|||||||
def guiDeckReview(self, name):
|
def guiDeckReview(self, name):
|
||||||
return self.anki.guiDeckReview(name)
|
return self.anki.guiDeckReview(name)
|
||||||
|
|
||||||
|
@webApi
|
||||||
|
def guiExitAnki(self):
|
||||||
|
return self.anki.guiExitAnki()
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Entry
|
# Entry
|
||||||
|
15
README.md
15
README.md
@ -1119,6 +1119,21 @@ Categories:
|
|||||||
```
|
```
|
||||||
true
|
true
|
||||||
```
|
```
|
||||||
|
* **guiExitAnki**
|
||||||
|
|
||||||
|
Schedules a request to close Anki after 1s. This operation is asynchronous, so it will return immediately.
|
||||||
|
|
||||||
|
*Sample request*:
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"action": "guiExitAnki"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
*Sample response*:
|
||||||
|
```
|
||||||
|
null
|
||||||
|
```
|
||||||
|
|
||||||
## License ##
|
## License ##
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user