jdlorimer / incremental-reading

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

moving _ir.json from mediafolder to addonfolder as config.json #42

Closed levodopa closed 6 years ago

levodopa commented 6 years ago

If there is no config.json in addonfolder it will be tried to readout _ir.json from mediafolder. after that it will be deleted and the settings will be stored to config.json on next closing of anki. If there is no config.json and no _ir.json it self.defaults will be loaded and saved to to config.json on next closing of anki. To catch up an exception default settings will also be loaded if the json file is corrupt somehow.

This is just to get the plugin to meet new standards of the Anki 2.1 addons. It is not important, but was one of the things I played around.

jdlorimer commented 6 years ago

This is clever. But there are two advantages to storing the settings in collection.media:

  1. Settings are synchronised between devices
  2. Settings can be different between profiles

What are the advantages of storing in the add-on folder? (I really think Damien didn't consider these issues.)

levodopa commented 6 years ago

Ok thats stuff I did not consider.. So just drop it..

levodopa commented 6 years ago

Some days ago I found out how Anki works with config.json and config.md in addons menu, after having a look to the "Add note id" addon. I was playing around with your settings menu and used the access to the config.json for checking quickly if changes were stored without a failure. I did not know you could also make anki to access your plugin settingsmenu via the addonmanager as you implemented it today. So my ideas was almost obsolete.

At least the try and except block would also work for the _ir.json in collection.media and adding a adding a media.json would make it possible to show a plugin name in the addonmanager. But this are changes with minor importance I would say.

jdlorimer commented 6 years ago

All good. I'm interested in your formatting and highlighting changes, though. I would implement those differently (in particular, I would add the shortcuts in the UI), but we can cross that bridge when we come to it.

Later today, I'll play around with the formatting stuff. Your idea for an overlay that can be toggled on/off is really good.