Commit Graph

9 Commits

Author SHA1 Message Date
Erez Volk
2f75d1758d Use jsonschema for add-on manifests 2019-04-24 23:42:49 +03:00
Damien Elmes
ef23268573 use distro in place of deprecated dist() method 2019-03-04 15:39:10 +10:00
Damien Elmes
a7ee142b7f require psutil on win32
https://github.com/dae/anki/pull/277
2019-02-16 13:03:16 +10:00
Juraj Fiala
42429fc3ee
Use beautifulsoup4 instead of bs4
bs4 is just a dummy package to prevent name squatting, it pulls in beautifulsoup4 as a dependency.

https://incolumitas.com/2016/06/08/typosquatting-package-managers/
2018-10-04 10:49:06 +02:00
Damien Elmes
012d63f882 remove unused httplib2 from requirements 2018-02-26 11:20:55 +11: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
dequis
37ba8832f8 Make hooks.wrap preserve signatures, fixes hooking some pyqt5 callbacks
It looks like pyqt5 is playing dirty and checking the number of args of
functions before calling them. When using hooks.wrap, pyqt5 thinks it
can pass any amount of arguments (because *args) and you get exceptions
like this inside the wrap function, when calling the 'old' function:

>TypeError: onFindDupes() takes 1 positional argument but 2 were given

This commit fixes it by preserving the signature of the wrapped method,
by adding an optional dependency on the "decorator" module.

Making it an optional dependency is probably not the wisest idea but
since this is a small edge case it might be smoother to start like this.

I also added functools.wraps() as a fallback, which won't help much but
is slightly more correct.

See this article for details: https://hynek.me/articles/decorators/
2017-07-16 23:25:34 -03:00
Damien Elmes
f6245cdfd1 use requests for http; add progress info back
- wrap request in AnkiRequestsClient so we can keep track of
upload/download bytes without having to monkey patch anything
- force a 64kB buffer size instead of the default 8kB
- show one decimal point in up/down so small requests still give
visual feedback
- update add-on downloading and update check to use requests
- remove the update throttling in aqt/sync.py, as it's not really
necessary anymore
2017-01-08 19:06:32 +10:00
Damien Elmes
913f22a9f0 add requirements.txt 2016-05-31 18:52:23 +10:00