* Added guiCheckDatabase action This action initiates a check database action in Anki but doesn’t wait for the action to complete before returning. * Fixed #202 no dconf attribute in saveDeckConfig Anki manages access to deck configuration differently now. This adapts saveDeckConfig to new style of access.
This commit is contained in:
parent
2150940c7e
commit
8404bd782d
20
README.md
20
README.md
@ -1230,6 +1230,26 @@ corresponding to when the API was available for use.
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* **guiCheckDatabase**
|
||||||
|
|
||||||
|
Requests a database check, but returns immediately without waiting for the check to complete. Therefore, the action will always return `true` even if errors are detected during the database check.
|
||||||
|
|
||||||
|
*Sample request*:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"action": "guiCheckDatabase",
|
||||||
|
"version": 6
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
*Sample result*:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"result": true,
|
||||||
|
"error": null
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
#### Media Actions
|
#### Media Actions
|
||||||
|
|
||||||
* **storeMediaFile**
|
* **storeMediaFile**
|
||||||
|
@ -550,12 +550,13 @@ class AnkiConnect:
|
|||||||
config['id'] = str(config['id'])
|
config['id'] = str(config['id'])
|
||||||
config['mod'] = anki.utils.intTime()
|
config['mod'] = anki.utils.intTime()
|
||||||
config['usn'] = collection.usn()
|
config['usn'] = collection.usn()
|
||||||
|
if int(config['id']) not in [c['id'] for c in collection.decks.all_config()]:
|
||||||
if config['id'] not in collection.decks.dconf:
|
return False
|
||||||
|
try:
|
||||||
|
collection.decks.save(config)
|
||||||
|
collection.decks.updateConf(config)
|
||||||
|
except:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
collection.decks.dconf[config['id']] = config
|
|
||||||
collection.decks.changed = True
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@ -1595,6 +1596,12 @@ class AnkiConnect:
|
|||||||
timer.start(1000) # 1s should be enough to allow the response to be sent.
|
timer.start(1000) # 1s should be enough to allow the response to be sent.
|
||||||
|
|
||||||
|
|
||||||
|
@util.api()
|
||||||
|
def guiCheckDatabase(self):
|
||||||
|
self.window().onCheckDB()
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
@util.api()
|
@util.api()
|
||||||
def addNotes(self, notes):
|
def addNotes(self, notes):
|
||||||
results = []
|
results = []
|
||||||
|
@ -62,6 +62,9 @@ class TestGui(unittest.TestCase):
|
|||||||
# guiDeckBrowser
|
# guiDeckBrowser
|
||||||
util.invoke('guiDeckBrowser')
|
util.invoke('guiDeckBrowser')
|
||||||
|
|
||||||
|
# guiDatabaseCheck
|
||||||
|
util.invoke('guiDatabaseCheck')
|
||||||
|
|
||||||
# guiExitAnki
|
# guiExitAnki
|
||||||
# util.invoke('guiExitAnki')
|
# util.invoke('guiExitAnki')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user