Gustaf-C / anki-chinese-support-3

Anki add-on providing support for Chinese study
https://ankiweb.net/shared/info/1752008591
GNU General Public License v3.0
26 stars 7 forks source link

Do not require "Hanzi" fields when populating cards on bulk fill #11

Closed BorisNA closed 8 months ago

BorisNA commented 8 months ago

It would be good to fill a color-hanzi field on "Chinese/Bulk-fill/Hanzi".

I use this plugin not only for dictionary or hanzi cards, but also on sentences. That is, I bulk load sentences and then bulk-fill pinyin and color. Other fields are not relevant to full sentences IMO.

"Bulk-fill all" always adds sound which is not always needed (and just inflates collection size). "Bulk-fill hanzi" with the current implementation checks simp/trad fields and if there are none just exits. And it doesn't add colored hanzi even if the field for colored hanzi does exists in the note. (I have Expression, Translation, Notes, Focus, Color, Pinyin, Sound and English fields).

I propose to loosen this check as follows. (It looks too simple to make a PR of it :) )

file fill.py, line 371

from

    fields = config.get_fields(['traditional', 'simplified'])

to

    fields = config.get_fields(['traditional', 'simplified', 'colorHanzi'])
Gustaf-C commented 8 months ago

That sounds reasonable, thanks for the detailed info!

And I'd say an issue is never to small to create a PR, it only makes life easier :)