jdlorimer / chinese-support-redux

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

Bulk fill ignores enabled fields and enabled models, enabled fields changes don't survive restart #127

Open khonkhortisan opened 4 years ago

khonkhortisan commented 4 years ago

I don't trust this addon. I added a prefix to all the fields it's allowed to change, had no models enabled, but batch fill still manages to find stuff. imagen I restarted Anki and lost my config changes, except for enabledModels. imagen

jay-pee commented 4 years ago

I can reproduce the bug of not persisting settings. Steps to reproduce:

  1. Go to CSR config
  2. add a entry in the json file for bopomofo like so:
        "bopomofo": [
            "Bopomofo",
            "Zhuyin",
            "ㄅㄆㄇㄈ",
            "注音符号",
            "注音符號",
            "註音符號",
        "test"
        ],
  3. Exit Anki
  4. Open Anki again and check the config. "test" entry is gone
jay-pee commented 4 years ago

There is a dedicated config manager in CSR to blame for this mess. It is possible to remove it and use the Anki default one. You can find more information how to use this config manager here: https://addon-docs.ankiweb.net/#/more?id=configuration

Issue should be fixed with the PR

khonkhortisan commented 4 years ago

You have to manually edit C:\Users\Khonkhortisan\AppData\Roaming\Anki2\addons21\1128979221\config_saved.json when Anki isn't running for changes to be saved. You can directly copy the text from the addon config window to keep it pretty-printed.

Some combination of these files being exactly like this (minus the .txt I used to upload them here) and having data/db/chinese.db open in DB Browser for SQLite (so that it's locked) made my changes actually stay

config.json.txt config_saved.json.txt meta.json.txt

I'll leave it alone in case it breaks from me trying to manually edit it again, but I can safely add and remove models by clicking the Chinese Support button in the browser without losing other settings.

jdlorimer commented 3 years ago

From memory, there were significant limitations to the built-in Anki config manager. If I could have used it in the manner required at the time, I wouldn't have reinvented the wheel, believe it or not.

If indeed the linked PR fixes the non-persistence issues without introducing regressions, it will be merged this weekend.