Closed Aquafina-water-bottle closed 1 year ago
@Aquafina-water-bottle I think that's perfect fine, and is probably in fact a better way of doing things.
Some additional notes:
modelFieldFonts
to return a dictionary format so fields can be accessed easier i.e.:
{
"field1": {
"font": "Arial",
"size": 20,
},
"field2": {
"font": "Arial",
"size": 16,
},
}
modelFieldSetDescription
, it doesn't set the description if the key doesn't exist. This appears to be safe, and is properly tested in the tests. Additionally, when I made a new profile in Anki 2.1.49 and 2.1.54, the call still works as expected and properly sets the description.This should be ready for review now! The tests that fail seem to be failing at random, so I believe it should be safe to merge if everything looks good.
This PR picks up the work from #362 and #363, and adds the following calls:
modelFieldFonts
modelFieldSetDescription
modelFieldSetFontSize
modelFieldSetFont
Additionally, some helper methods were added to prevent repeated code. So far, only the model field related calls have been changed to use the helper methods.
TODO:
modelFieldSetDescription
is used on older versions of AnkiNote:
Currently,
modelFieldFonts
returns a json of the following format:[ { "fieldName1": { "font": "fontName", "size": fontSize } }, ... ]
However, this deviates from the related
modelFieldDescriptions
call, that simply returns a list of descriptions. I was wondering if this is still fine?