jdlorimer / chinese-support-redux

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

Cantonese Jyutping was not working #176

Open ahj10 opened 3 years ago

ahj10 commented 3 years ago

The Cantonese Jyutping was not working when I downloaded it. I ended up adding code to the database.py file in the main folder of this anki addon. I also had to erase the ~100 Jyutping entries in the Jyutping column in the cidian section of the database.db (this is not essential, but helps). I don't use the Jyutping option in Anki--> Chinese --> phonetics --> Jyutping. I continue to use the "Pinyin" option.

Here is my database.py edited file: https://github.com/luoliyan/chinese-support-redux/pull/175/commits/9e19d81fccb0ebe05431e9d1def665ce2d88fbef

For reference, this is the error I get if I use the Jyutping option (even after my edit to database.py). This was not important for me to fix, since it is working with my database.py file now. It will auto fill the Cantonese field in my card with the color I want. So all is well.

Error An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed. If the issue only occurs when add-ons are enabled, please use the Tools>Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem. When you've discovered the add-on that is causing the problem, please report the issue on the add-ons section of our support site. Debug info: Anki 2.1.15 (442df9d6) Python 3.6.7 Qt 5.12.1 PyQt 5.11.3 Platform: Mac 10.13.3 Flags: frz=True ao=True sv=1 Add-ons possibly involved: Chinese Support Redux v0140

Caught exception: File "aqt/webview.py", line 27, in cmd File "aqt/webview.py", line 87, in _onCmd File "aqt/webview.py", line 368, in _onBridgeCmd File "aqt/editor.py", line 273, in onBridgeCmd File "anki/hooks.py", line 39, in runFilter File "/Users/ajorge/Library/Application Support/Anki2/addons21/1128979221/edit.py", line 74, in onFocusLost if update_fields(note, field, allFields): File "/Users/ajorge/Library/Application Support/Anki2/addons21/1128979221/behavior.py", line 269, in update_fields fill_color(hanzi, copy) File "/Users/ajorge/Library/Application Support/Anki2/addons21/1128979221/behavior.py", line 156, in fill_color field = get_first(config['fields'][field_group], note) <class 'KeyError'>: 'jyutping'

jdlorimer commented 3 years ago

Jyutping has never worked particularly well and hasn't been a priority (since most users seem to be learning Mandarin exclusively).

I'll try to incorporate your changes in the next revision.

exrulez commented 2 years ago

OMG I've been looking like a madman for this! Thank you. I replaced the database.py file, selected "Pinyin" and tried it. It filled the Cantonese field with jyutping, but it's color is incorrect. It's also not filling the colorCantonese fields. Were these ones not part of the change?

Thank you again, and I'm so happy to find this!