Commit Graph

33 Commits

Author SHA1 Message Date
Glutanimate
ee3357a943 Only update config if actually modified 2018-07-28 09:09:17 +02:00
Glutanimate
8935b99188 Extend add-on API with setConfigUpdatedAction
Allows add-on authors to define an action to be performed upon
manual editing of the add-on configuration through the ConfigEditor
2018-07-28 09:00:49 +02:00
Damien Elmes
9b5ee4ba44 change wording to differentiate from 'browse' in toolbar 2018-06-21 15:23:41 +10:00
Liam Cooke
0c1136e379 Read config.md as UTF-8 2018-04-05 22:11:44 +10:00
Damien Elmes
9a23f0958d load add-ons in consistent order
if ANKIREVADDONS env var is defined, reverse order for debugging

partially addresses pull req #225
2018-02-24 13:23:15 +11:00
Damien Elmes
118326df1e remove format literals so we can support python 3.5 2018-01-16 16:07:30 +10:00
Damien Elmes
81d4b77ee1 more open() and regex strings 2017-12-11 17:25:51 +10:00
Piotr Kubowicz
674d45a606 Allow to better translate add-ons dialog 2017-11-19 10:28:04 +01:00
Damien Elmes
5deb75f5c4 preserve user_files folder in add-ons 2017-09-10 18:53:47 +10:00
Damien Elmes
0bc4a1a220 replace _ with space in add-on names 2017-09-10 17:02:32 +10:00
Damien Elmes
2689c7cfe1 setConfigAction() and writeConfig() should work in submodules 2017-08-31 14:41:00 +10:00
Damien Elmes
5a11efa0e3 merge new keys from config.json into user conf 2017-08-30 15:31:03 +10:00
Damien Elmes
737a8d934e persistent add-on configuration
- 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)
2017-08-28 20:51:43 +10:00
Damien Elmes
76b4343c5e fix browse link 2017-08-26 22:40:11 +10:00
Damien Elmes
7288a9b063 new add-on handling
- 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-folders
https://apps.ankiweb.net/docs/addons21.html#sharing-add-ons

README.addons has been moved to the above page
2017-08-26 15:14:20 +10:00
luoliyan
c7e5a618a5 Fix NameError caused by missing import 2017-02-15 23:08:37 +09:30
Damien Elmes
b58c082e29 tweaks to add-on downloading
- avoid opening and closing multiple progress dialogs
- report errors at the end; download what we can
- update dialog text
2017-02-15 15:55:31 +10:00
Dmitry Mikheev
94894d3750 Install addons by spaced list; showInfo -> tooltip
Allow users to install multiple addons simultaneously listed by white spaces
without asking user to hit the key after installation.
2017-02-14 09:48:46 +05:00
Illia Volochii
13b7e01044 Stop inheriting from object
It is not needed in Python 3.
2017-02-07 00:21:33 +02:00
Damien Elmes
54ea891564 another fix for add-on downloading 2016-08-02 11:51:44 +10:00
Damien Elmes
00111e4182 re-enable add-on downloading 2016-07-08 13:17:33 +10:00
Damien Elmes
3afef3edb0 fix edit & delete bugs in add-ons section 2016-07-08 13:10:19 +10:00
Damien Elmes
d025fddfb4 Merge pull request #109 from subfusc/master
[Addons] Make it possible to distribute addons in a directory.
2016-07-04 16:35:49 +10:00
Damien Elmes
de7e40537d port majority of code to qt5.5+
- 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)
2016-05-31 18:51:40 +10:00
Damien Elmes
15b349e3a8 start port to python 3
unit tests pass and main screens of GUI load
2016-05-12 14:45:35 +10:00
Damien Elmes
ed04b4ce3d BadZipFile -> BadZipfile 2016-02-18 18:49:44 +10:00
Sindre Wetjen
69a0110422 [Addons] Make it possible to distribute addons in a directory.
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.
2015-09-27 01:14:57 +02:00
Damien Elmes
0262da2700 catch corrupt add-on downloads 2015-01-05 11:49:29 +10:00
Damien Elmes
1d6eff36b1 make sure we write addon .py files as they've been uploaded 2014-08-09 13:28:48 +09:00
Soren I. Bjornstad
436f257e36 dialog box size and position improvements
- 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)
2014-06-20 10:31:52 -05:00
Damien Elmes
205c6d4c38 add a 'safe mode' (#797) 2013-05-17 15:32:22 +09:00
Damien Elmes
b2457811a2 optimize imports 2012-12-22 09:17:10 +09:00
Damien Elmes
d477df8c28 merged libanki and ankiqt into single distro 2012-12-21 16:51:59 +09:00