Commit graph

59 commits

Author SHA1 Message Date
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
Piotr Kubowicz
a9a406c860 Allow to better translate add-ons dialog 2017-11-19 10:28:04 +01:00
Damien Elmes
55ace773cf preserve user_files folder in add-ons 2017-09-10 18:53:47 +10:00
Damien Elmes
db5a1f6a5d 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