jdlorimer / incremental-reading

Anki add-on providing incremental reading features
https://ankiweb.net/shared/info/935264945
ISC License
216 stars 38 forks source link

2 kinds of defaults + remove outdated settings #67

Closed ghost closed 6 years ago

ghost commented 6 years ago

Changing the value of an item in self.defaults (e.g. changing the model name to 'IR4', or adding a bad tag) wouldn't be saved by people who already have the add-on installed: the values in _ir.json would take precedence.

jdlorimer commented 6 years ago

That's intentional. If there is a setting that a user might want to change, my preference is to expose it in the UI, and have the add-on update _ir.json.

My plan was always to add a "Restore Defaults" button to the options dialog. This button will simply dump settingsManager.defaults to _ir.json. If the user is encouraged to mess around with the defaults, then the "Restore Defaults" function won't behave as expected.

If you give me a list of settings you think should be exposed, I'll take care of that.

ghost commented 6 years ago

I wasn't thinking about the user changing values, but about the developer: when you update the add-on with a new bad tag for example, the change is only going to be effective for people who don't have a _ir.json file, isn't it?

settingsManager.defaults are settings that appear in the UI and in _ir.json (and thus that the user may change from the UI), while settingsManager.invDefaults appear nowhere (because the user isn't supposed to change them, and because a change to them by the developer is automatically implemented).

jdlorimer commented 6 years ago

Oh dear, I hadn't thought about that.

In that case, I have a different idea:

Sound reasonable?

ghost commented 6 years ago

This looks more flexible indeed. Can you do it in the next few days? Because I'm going to need this feature for the next pull request (and the last of this streak): the one about priorities. Otherwise I can do it myself.

jdlorimer commented 6 years ago

I can probably finish it up tomorrow night.

jdlorimer commented 6 years ago

Everything apart from "Restore Defaults" is done. I'll get to that one day...