Closed introt closed 1 year ago
Related: createModel
returns the editing font, direction (rtl) and stickyness, but setting nor querying them is not supported:
"flds":[
{
"name":"Field1",
"ord":0,
"sticky":false,
"rtl":false,
"font":"Arial",
"size":20,
"media":[
]
},
{
"name":"Field2",
"ord":1,
"sticky":false,
"rtl":false,
"font":"Arial",
"size":20,
"media":[
]
}
A modelFieldNames
based modelFieldDescriptions
is implemented as follows: (pr #363)
@util.api()
def modelFieldDescriptions(self, modelName):
model = self.collection().models.byName(modelName)
if model is None:
raise Exception('model was not found: {}'.format(modelName))
else:
return [field['description'] for field in model['flds']]
The path forward seems rather simple implementation wise - just need to figure out the appropriate level of support.
I'm personally unable to follow through on the rest for some time; others are free to continue working on these in the meantime.
Thanks @Aquafina-water-bottle!
Note field descriptions are the "Text to show inside the field when it's empty". They're useful for in-app note template documentation which in turn reduces the cognitive barrier to systematic note creation (eg. "does this factoid belong in the note field named "etiology" or "pathology"?).
Relevant
anki
source files:(introduced in ankitects/anki#1476)
Adding support requires certain considerations, as currently fields are mainly treated as ordered lists (only).
My suggestion is to start with
modelFieldDescriptions
similar tomodelFieldNames
on the querying side (implementation here). Besides that, addinginOrderFieldDescriptions
tocreateModel
would be one way to proceed in the other direction, followed bymodelFieldDescriptionRename
akin tomodelFieldRename
.