- add-ons can ship default config in a config.json file
- users can edit the config in the add-ons dialog, easily syntax-check
the json, and restore it to the defaults
- an optional config.md contains instructions to the user in markdown
format
- config will be preserved when add-on is updated, instead of being
overwritten as is the case when users are required to edit the source
files
A simple example: in config.json:
{"myvar": 5}
In your add-on's code:
from aqt import mw
config = mw.addonManager.getConfig(__name__)
print("var is", config['myvar'])
Add-ons that manage options in their own GUI can have that GUI
displayed when the config button is clicked:
mw.addonManager.setConfigAction(__name__, myOptionsFunc)
- separate dialog for managing add-ons
- only add-ons compatible with Anki 2.1 will be shown on AnkiWeb
- can delete or toggle disabled on multiple add-ons at once
- check for updates button
- button to view add-on's AnkiWeb page
The new handling drops support for single file .py add-ons, and requires
add-ons to store all files in a single folder. This ensures all files
are cleaned up properly when updating or deleting an add-on, and
prevents file conflicts between separate add-ons. See the updated
add-on docs for more:
https://apps.ankiweb.net/docs/addons21.html#add-on-foldershttps://apps.ankiweb.net/docs/addons21.html#sharing-add-ons
README.addons has been moved to the above page
- a few issues to work out still, and editor changes not done yet
- for communication between webengine and python code, we set window
.location to 'http://anki/<something>' - the leading http is
necessary for qt to call the link handler, which was introduced
in qt5.5
- the designer files now use a promoted qobject to create instances
of AnkiWebView
- we use the css zoom property to alter webengine font size based on
system dpi
- prefs and addons folder stored in new location (at least for now)
with addons that are large and e.g. use git, it is very inconvenient to
have any files that is outside the addon directory. This patch makes it
possible to create an executable dir that is loaded as an addon.
- keep track of size and position for a number of dialogs
- make sure addons dialog opens at an appropriate size for the system
font size
- add optional argument to showText to restore geom on creation and save
on reject (other buttons, if used, need to be programmed to save
individually)