Commit Graph

1598 Commits

Author SHA1 Message Date
Damien Elmes
a7ed7fa4e3 fix cutting and copying between fields
the shortcut keys are handled by webengine on platforms other than
osx, so rather than messing with an event filter we catch the cut and
copy events in js and send a signal back
2017-09-02 13:48:03 +10:00
Damien Elmes
be14703e7f strip trailing <br> tag when saving field 2017-09-02 13:26:57 +10:00
Damien Elmes
ecb683cdd1 bump version 2017-08-31 22:00:37 +10:00
Damien Elmes
3b79204924 update self.card on multiple selection
fixes
https://anki.tenderapp.com/discussions/beta-testing/713-anki-210-beta-13#comment_43315776
2017-08-31 20:38:12 +10:00
Damien Elmes
5fd9228273 handle invalid filename encodings
on Linux users can end up creating filenames that can't be encoded to utf8,
which breaks Anki when it tries to store the filename in sqlite
2017-08-31 18:55:25 +10:00
Damien Elmes
f9f8b117d9 fix formatting preservation when pasting between fields
- make sure js is passed the internal flag
- make sure we flag text after the asynchronous clipboard change
- be explicit about clipboard data update
2017-08-31 18:10:37 +10:00
Damien Elmes
598df47967 Merge pull request #204 from glutanimate/tagedit-improve-keyboard-nav
Improve keyboard navigation in TagEdit
2017-08-31 16:04:59 +10:00
Damien Elmes
2689c7cfe1 setConfigAction() and writeConfig() should work in submodules 2017-08-31 14:41:00 +10:00
Glutanimate
8d6507c062 Space-separate inserted tags
New completions now show up after hitting space again
2017-08-30 14:52:58 +02:00
Glutanimate
e237324873 Show new autosuggestions on typing space 2017-08-30 14:19:15 +02:00
Glutanimate
a7cdff6d96 Invoke autosuggestion pop-up with arrow-key up/down 2017-08-30 13:13:10 +02:00
Glutanimate
153849c01b Apply first tag autosuggestion with Enter/Return 2017-08-30 13:11:03 +02:00
Glutanimate
0c85aed04a Navigate through tag autocompletions with Ctrl+Tab 2017-08-30 12:49:04 +02:00
Damien Elmes
7b93d8423f make sure media server can handle a flood of requests
fixes intermittent failures when loading js/css files, especially during
startup
2017-08-30 16:05:39 +10:00
Damien Elmes
f58ea62aec shortcut key for add-ons dialog 2017-08-30 15:31:16 +10:00
Damien Elmes
5a11efa0e3 merge new keys from config.json into user conf 2017-08-30 15:31:03 +10:00
Damien Elmes
9fb9d9c902 Merge pull request #203 from glutanimate/previewer-both-sides-patches
Assign "both sides" toggle to hotkey, refresh preview on toggle
2017-08-30 15:03:32 +10:00
Glutanimate
fc59fab967 Assign "both sides" toggle to hotkey, refresh preview on toggle 2017-08-29 16:41:01 +02:00
Damien Elmes
fc60cfec28 fix margins in prefs screen 2017-08-29 17:33:09 +10:00
Damien Elmes
9ddaa20881 syncing media -> syncing
in the no changes case, the progress window is forced open for a while,
making it look like media syncing is to blame
2017-08-29 14:11:41 +10:00
Damien Elmes
c18bd47a6e scan media each time
Experiment with ignoring dirMod and scanning the folder for changes on
each sync. Use scandir() for better performance. Please let me know if
this causes a noticeable slowdown for you.
2017-08-29 10:52:13 +10:00
Damien Elmes
25cb6d3abe bump version 2017-08-28 22:30:05 +10:00
Damien Elmes
abc55222be add missing png 2017-08-28 22:29:47 +10:00
Damien Elmes
29d6d93881 option for showing both sides in preview screen 2017-08-28 22:16:05 +10:00
Damien Elmes
3faa82571c warn about subfolders 2017-08-28 22:01:13 +10:00
Damien Elmes
226bb2bc83 add record icon back to dialog 2017-08-28 21:46:22 +10:00
Damien Elmes
b28eb4fba6 add collection/deck shortcuts, refresh when saved changes 2017-08-28 21:43:44 +10:00
Damien Elmes
fa2e0e6428 fix clear flag text and shortcut 2017-08-28 21:17:16 +10:00
Damien Elmes
a4b45af5a9 fix scrollbar appearing in toolbar
https://anki.tenderapp.com/discussions/beta-testing/675-anki-210-beta-10/page/2#comment_43239350
2017-08-28 21:15:38 +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
b0a62838b5 profile tweaks
- handle unpickling of anki 2.0 prefs
- copy the prefs on first load, as python2 is not capable of reading the
protocol 3 pickles we write for proper bytes support
- when there's an error unpickling, write a clean copy of the
preferences instead of forgetting all profiles and starting from scratch
2017-08-28 18:35:24 +10:00
Damien Elmes
a96ddfc3fd allow templates and add-ons to hook into reviewer updated/shown
eg

from anki.hooks import addHook

def prepare(q):
    return q + """
<script>
onUpdateHook.push(function () {
    window.scrollTo(0, 2000);
})
</script>"""

addHook('prepareQuestion', prepare)
2017-08-28 14:54:22 +10:00
Damien Elmes
76b4343c5e fix browse link 2017-08-26 22:40:11 +10:00
Damien Elmes
92fe869653 fix error on add-on download
suspect this was the cause of the mystery enclosing scope errors as well
2017-08-26 19:55:39 +10:00
Damien Elmes
02a3e14c13 setupEditorShortcuts is a hook, not a filter
add-ons can modify cuts in place
2017-08-26 18:47:45 +10:00
Damien Elmes
ca37b15aa7 bump version 2017-08-26 15:25:10 +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
Damien Elmes
f824db2143 drop 3.5 from travis 2017-08-25 16:43:01 +10:00
Damien Elmes
595ac321d0 Merge branch 'master' of github.com:dae/anki 2017-08-25 16:39:50 +10:00
Damien Elmes
2c9f286026 update python ver dep 2017-08-25 16:39:21 +10:00
Damien Elmes
4f9afcea94 Merge pull request #202 from glutanimate/patch-1
Update required python version to 3.6+
2017-08-25 16:37:12 +10:00
Aristotelis
b176af79e9 Update required python version to 3.6+ 2017-08-25 08:24:38 +02:00
Damien Elmes
7b1747d650 don't throw an error when closing with tooltip or debug window open 2017-08-25 12:14:59 +10:00
Damien Elmes
3b9ac82a32 Merge pull request #201 from glutanimate/editor-addbutton-convenience-function
Convenience function to assign function a button, bridge cmd & shortcut
2017-08-24 18:28:00 +10:00
Damien Elmes
5b0d740948 Merge branch 'master' into editor-addbutton-convenience-function 2017-08-24 18:26:51 +10:00
Damien Elmes
ec27ca52b2 Merge pull request #200 from glutanimate/editor-button-labels
Reintroduce button labels for the Editor
2017-08-24 18:20:55 +10:00
Damien Elmes
5d05264f86 Merge pull request #199 from glutanimate/pass-editor-instance
Pass on Editor instance when running "setupEditorShortcuts" filter
2017-08-24 18:19:28 +10:00
Damien Elmes
77bbc14c59 remember export folder location 2017-08-24 14:38:05 +10:00
Glutanimate
e0038f8003 No need to assign QShortcut to variable 2017-08-24 00:17:28 +02:00
Glutanimate
2d0e74ee5f Convenience function to assign function a button, bridge cmd & shortcut
This is meant to more closely replicate Anki 2.0.x`s _addButton method
than the current one does. Its primary purpose is to reduce the
boilerplate code needed for add-on authors to implement a new button
alongside its hotkey.
2017-08-23 23:55:24 +02:00