Commit graph

76 commits

Author SHA1 Message Date
Damien Elmes
8095ad8e4b use isort to tidy up imports 2019-12-20 19:19:29 +10:00
Damien Elmes
1f11b72341 add aqt/ 2019-12-16 08:51:38 +10:00
lovac42
50cb5a5d50 doubleclick addman list
doubleclick on addon manager list opens conf editor.
2019-05-13 17:27:27 -04:00
Damien Elmes
c8775d4161 catch add-on deletion failure due to locked files in add-on folder
https://anki.tenderapp.com/discussions/add-ons/32676-2112
2019-04-29 18:43:10 +10:00
Erez Volk
a2c6a5b27e Use jsonschema for add-on manifests 2019-04-24 23:42:49 +03:00
Damien Elmes
49d60a8519 support conflicts when downloading from AnkiWeb
users can now upload .ankiaddon files as well - package/name remains
defined by the add-on listing as before
2019-04-16 17:44:00 +10:00
Damien Elmes
2c7463a808 don't confirm conflict disabling
we don't want to be showing dialog boxes while a progress window
is active
2019-04-16 17:43:02 +10:00
Damien Elmes
9bc1bc4976 need rich text in install error, as err msgs have html 2019-04-16 17:39:08 +10:00
Damien Elmes
0c0e8a9ff0 use dialog instead of tooltip if there's more than one log line 2019-04-16 17:38:38 +10:00
Glutanimate
4aff1a80fb Disable add-on config button when no config present
https://anki.tenderapp.com/discussions/ankidesktop/33602-disable-the-config-button-when-an-add-on-is-highlighted-that-does-not-have-any-config
2019-04-15 14:53:18 +02:00
Glutanimate
14fbc90b4f Fix timestamp comparison failing when update API returns null
Addresses a rare instance of update checks failing when locally
installed packages point to a shared ID that has yet to be updated
to 2.1. In those instances Anki's update API returns null, which
causes a ValueError downstream when comparing the timestamps
against each other.
2019-04-08 17:51:15 +02:00
Damien Elmes
442600daf8 Merge pull request #288 from glutanimate/mediasrv-addon-support
Extend mediasrv to also serve media files in addons directory
2019-03-04 18:03:48 +10:00
Damien Elmes
e6d75207af explicitly import _ and ngettext 2019-03-04 11:58:34 +10:00
Glutanimate
a01679266b Allow add-on authors to set a whitelist of webview-accessible files
Extends the AddonManager API with two new methods, setWebExports and
getWebExports. setWebExports expects an add-on module name and a
valid RegEx pattern to match subpaths in the add-on folder against.

Any matching subpaths will be accessible in Anki's web views by
referencing them with /_addons/{addon_id}/{subpath}.

For instance, to allow access to .css and .png files in your add-on's
user_files directory you would call:

> mw.addonManager.setWebExports(__name__, r"user_files/.+(\.png|\.css)")

You could then reference these files in web views as such:

> <img src="/_addons/{addon_id}/user_files/test.png">

Please note that this bypasses the default security policies used
in Anki webviews. You should take care to construct your RegEx
patterns specific enough so that they do not match any sensitive
files of our add-on.
2019-03-02 18:57:51 +01:00
Damien Elmes
b1bd76f2dc avoid traceback when network offline in add-on check 2019-02-27 14:18:16 +10:00
Damien Elmes
5142bb012f ensure progress window cleared if error on add-on import 2019-02-27 14:08:20 +10:00
Damien Elmes
2587850a07 be explicit about text format when showing add-on errors
fixes br codes showing in error messages
2019-02-26 09:36:02 +10:00
Glutanimate
9281e66b52 Move annotatedName to AddonManager to allow outside access 2019-02-24 14:51:19 +01:00
Damien Elmes
245845487d clear selection when deleting add-on(s)
fixes error when deleting last, and wrong selection
otherwise
2019-02-24 15:24:31 +10:00
Glutanimate
67774db8ad Preserve selected add-ons 2019-02-23 10:10:05 +01:00
Glutanimate
4d5fe3a721 Colour disabled add-ons gray 2019-02-23 10:04:45 +01:00
Glutanimate
585532d356 Add tooltip feedback for restoring defaults
Changes might not always be apparent, so a tooltip might help.
2019-02-23 09:39:49 +01:00
Glutanimate
dbb4067a7e Store addonconf geom and splitter. Tweak font sizes and margins. 2019-02-23 09:39:49 +01:00
Aristotelis
15b72dcd07 Merge branch 'master' into install-local-addons 2019-02-23 09:27:17 +01:00
Glutanimate
007a5a0fa8 Implement add-on conflict handling via manifests "conflicts" value
Only enabled for locally installed packages for now
2019-02-22 21:14:42 +01:00
Glutanimate
7f2fd3c840 Refactor: Add manifest schema, unify install paths, use context manager
Sets the foundation for more elaborate additions to the manifest.

Manifest files are still only being read for local imports, but with
this commit that could be easily changed in the future.
2019-02-22 17:04:07 +01:00
Glutanimate
79cf6c089a Rename .apkx to .ankiaddon 2019-02-22 10:17:56 +01:00
Damien Elmes
78d76346ae remember add-ons window geometry 2019-02-20 14:38:22 +10:00
Arthur-Milchior
f3a3c5c7a6 Correct a bug during add-on update
If an add-on folder contains only number, but does not contains a
meta.json file, or if this file does not contains a "mod" value, then
the following uninformative message error occur:
```Python
  File "aqt/addons.py", line 387, in onCheckForUpdates
  File "aqt/addons.py", line 183, in checkForUpdates
  File "aqt/addons.py", line 199, in _updatedIds
<class 'TypeError'>: '<' not supported between instances of 'NoneType' and 'int'
```

This is because there is a .get in a code while the None value makes
no sens. Thus, I replaced None by a 0 value. Which ensure that, if the
last modification time is missing, the update will be done. Three case
may occur:
* either the addon is already up to date, and it's only a waste of
  bandwidth
* either the add-on is not up to date, and updating was the initial
  goal anyway
* Or some change did occur in the add-on folder (which is actually
  probably, since it would explain the "missing mod problem"; in this
  case this change may be lost, but thout would be the same problem
  if the mod number was still there.

Other solutions which I could implement would be:
* asking for the user whether they want to update
* considering that it's not an ankiweb related add-on anymore, and
  ignore it.
2019-02-18 12:29:08 +01:00
Glutanimate
20237c5f2b Fix linebreaks in add-on installation tooltips and warnings 2019-02-18 07:18:14 +01:00
Glutanimate
ba807c775f Implement drag-and-drop support for installing APKX-packaged add-ons 2019-02-18 07:17:53 +01:00
Glutanimate
5b147bb51a Ability to install add-ons from local add-on packages
Adds a new button to the add-on dialog that allows users to select
and install add-ons from local files.
Introduces APKX, a zip-based and manifest-backed filetype for
Anki add-on packages.
2019-02-18 07:17:14 +01:00
Glutanimate
e7d6dc4777 Switch to the system default monospaced font for the config editor area 2019-02-15 14:15:54 +01:00
Damien Elmes
d9cf08f883 make sure add-on list updates when toggling on qt 5.12/mac 2019-02-06 09:19:20 +10:00
Damien Elmes
a7eb6bb357 update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
Damien Elmes
451934741c fix the other json.dumps call
previous change was in the wrong place
1ae2a08900
2018-12-15 09:15:43 +10:00
Damien Elmes
1ae2a08900 don't escape unicode characters in add-on json
https://anki.tenderapp.com/discussions/ankidesktop/31423-configuration-module-of-addons-is-not-allowing-pt-br-accent
2018-12-13 21:34:55 +10:00
Damien Elmes
975edd0d56 catch wrong objects in add-on conf
based on patch from Arthur: https://github.com/dae/anki/pull/261/files
2018-11-18 15:22:31 +10:00
Damien Elmes
7df86c22f9 add missing translation line 2018-09-24 14:48:08 +10:00
Damien Elmes
dab1b06e27 Merge pull request #251 from upday7/master
disable form.viewPage button when add-on was not downloaded from AnkiWeb
2018-09-02 18:03:14 +10:00
root
190522c8a5 specify exception; convert match result to None 2018-08-31 15:13:06 +08:00
root
8533f9498a disable form.viewPage button when add-on was not downloaded from AnkiWeb 2018-08-31 14:56:16 +08:00
Glutanimate
335406641a Pass new config on to add-on 2018-07-28 09:25:38 +02:00
Glutanimate
adab94e0ec Only update config if actually modified 2018-07-28 09:09:17 +02:00
Glutanimate
880a1d80d0 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
616e59bacc change wording to differentiate from 'browse' in toolbar 2018-06-21 15:23:41 +10:00
Liam Cooke
8eb6490dfd Read config.md as UTF-8 2018-04-05 22:11:44 +10:00
Damien Elmes
4d6d5034a9 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
07dcacf09b remove format literals so we can support python 3.5 2018-01-16 16:07:30 +10:00
Damien Elmes
83b220f931 more open() and regex strings 2017-12-11 17:25:51 +10:00