Anki add-on - Help needed

SH sshhhhhh at invalid.invalid
Wed Nov 6 15:17:23 CET 2013


Is anybody here able to help me finish off an Anki add-on? If you're not
familiar with it, Anki (http://ankisrs.net/) is an open source, cross
platform flashcard learning program, in PyQT. It's extensible, with add-
ons.

Thing is, I'm not a programmer, but I've managed to make my own add-on by
trying to figure out how other people's add-ons work. I've got something
that works, but it needs finishing off.

There is a lot I don't understand, but I've got this snippet which will
retrieve a value associated with the key 'dictKey' from a dictionary held
in a file. However, it will only do it if I open the Options dialog in
Anki (I'm guessing that's what DeckConf.loadConf is about). How can I get
that value for use in another function, without having to open the dialog?

[code]
from aqt.deckconf import DeckConf
from anki.hooks import wrap

def load_dictVal(self):
    c = self.conf
    x = c.get('dictKey')
    print(x)

DeckConf.loadConf = wrap(DeckConf.loadConf, load_dictVal)
[/code]

The dictionary is in a file at (on Linux) ~/Anki/User 1/collection.anki2.
'User 1' may vary, and each user has their own collection.anki2 file. The
file's header says it's 'SQLite format 3'.


Secondly, separate from the above, I want to get a True/False value from
whether a deck is currently being studied? Maybe whether the review screen
is open, or something?

Any help would be greatly appreciated.

-- 

Stew




More information about the Python-list mailing list