Open holocronweaver opened 7 years ago
Thanks for the PR! I don't have time to look at it right now but will try to get to it in the next two days.
I think I made all the requested changes.
I moved the card options to a new CardOptions
class. This simplifies sharing the same options among multiple cards, similar to what OptionsGroup
does for decks, so it's handy on several levels.
I also added @property
for the aliases as you suggested, while leaving the 'real' internal names consistent with the Anki DB field names.
Okydoke, removed CardOptions
and now Card
has all the attributes. I left a utility function in Note
to make the common case of setting all card options at once more concise.
Very old bump, but is this something that can be done nowadays even without these changes?
Adds options to decks and notes. This fulfills #11 and then some.
OptionsGroup
class which allows multiple decks to share options, reflecting Anki's very similar option groups.OptionsGroup
is closely modeled after the deck options window in Anki.description
andcreation_time
. The latter is important since card due dates are defined relative to deck creation time.akpg_col.py
now has field substitution by dict rather than list. This was necessary due to the large number of options being substituted. I didn't useformat
though!I tried to stick to the coding style that already existed. Hopefully my blasphemies were kept at a minimum. X-D
Edit: Currently investigating test failures. I have succesfully created and imported decks into Anki 2.0.47 and 2.1 beta 12, so curious why it is failing in test...
Edit 2: Found the problem.
OptionsGroup
requires a unique ID, which means the OptionsGroup ID must be manually set same as for the deck ID. Could generate an ID from the name of the OptionsGroup, but if users create generic option group names this could lead to conflicts. I updated tests accordingly by adding options groups to test decks. Now all tests pass.