Commit Graph

1256 Commits

Author SHA1 Message Date
Damien Elmes
4e1d57e2d2 check formatting of .js files in aqt/data
mathjax.js did not match //ts:format output
2020-12-21 16:10:59 +10:00
Damien Elmes
65a35fef55 link .prettierrc into qt/aqt/data/web/js
So automatic formatting in VS Code matches CI format
2020-12-21 16:09:06 +10:00
Damien Elmes
0bc4ea9c4d ask users to report if PyAudio works better for them 2020-12-21 16:04:41 +10:00
Damien Elmes
019a65efc1 drop QtRecorder driver; rename existing 2020-12-21 15:02:22 +10:00
Damien Elmes
68390eccde fail gracefully in winrt voice list fails to load
If no voices are installed, get_all_voices() throws a "file not found"
error.
2020-12-21 14:29:14 +10:00
Damien Elmes
f41d523cb8
Merge pull request #857 from hgiesel/editorspan
Wrap field name in editor in a span
2020-12-21 12:16:22 +10:00
Henrik Giesel
502049025a Remove special treatment of empty fields in editor ts 2020-12-21 03:13:31 +01:00
Ryan Aird
a30064d5e9 Make RT import statement conditional, fix formatting, ignore WinRT for type checking 2020-12-20 19:43:09 -06:00
Henrik Giesel
9b2de395e1 Wrap field name in editor in span 2020-12-20 23:40:51 +01:00
Ryan Aird
9a0b112a0f Lower default rank for non-RT voices and restrict to Windows 10 October 2018 or greater 2020-12-19 20:10:23 -06:00
Ryan Aird
56703e5f3a WinRT TTS API support 2020-12-19 19:29:34 -06:00
Damien Elmes
165007180a add winrt for TTS work
https://github.com/ankitects/anki/pull/855

Also update psutil version
2020-12-20 10:54:57 +10:00
Damien Elmes
e99a7c0f90 tweak naming and move method into col.decks 2020-12-20 10:26:16 +10:00
Damien Elmes
c739b9782e
Merge pull request #854 from k12ish/master
Add method `card_count_from_did()`
2020-12-20 10:17:25 +10:00
k12ish
cc0572a385 Added type hints, renamed kwarg 2020-12-19 18:12:58 +00:00
k12ish
ef1f58c8b6 Added method 2020-12-19 17:59:07 +00:00
abdo
e92eeda040 Strip isolation characters from app link
Reported in https://forums.ankiweb.net/t/bug-link-in-about-window/5894
2020-12-18 23:53:44 +03:00
Damien Elmes
3840686241 pin pyaudio and qtmultimedia 2020-12-18 19:57:19 +10:00
Damien Elmes
038f0a10ec expose recording driver in preferences (at least for now) 2020-12-18 19:49:17 +10:00
Damien Elmes
e7d9056acd write .wav in background 2020-12-18 19:24:53 +10:00
Damien Elmes
93eccd183f leave iodevice alone after calling .stop()
Docs say it should not be accessed, and it fails on Linux.
2020-12-18 19:14:24 +10:00
Damien Elmes
dc5ce3b9a2 experiment with lower-level QAudioInput
Allows us to discard the start of the recording like PyAudio, instead
of just muting it.
2020-12-18 18:59:10 +10:00
Damien Elmes
643e875342 add back pyaudio as an optional alternative 2020-12-18 16:52:00 +10:00
Damien Elmes
af92bb5e93 exhaustiveness checks on literals are now possible with the move to py38 2020-12-18 16:50:55 +10:00
Damien Elmes
32b6e8e198 document ANKI_PROFILE_CODE and add bazel command to run snakeviz 2020-12-17 12:03:24 +10:00
Damien Elmes
cd31780668 explicitly set sample rate and channels
Windows sounds awful by default on a machine here.
2020-12-16 20:18:13 +10:00
Damien Elmes
3a250f5238 formatting & mypy fix 2020-12-16 19:51:46 +10:00
Damien Elmes
1114ca75df update recording time more frequently; remove print statement 2020-12-16 19:45:08 +10:00
Damien Elmes
ecb7c1482f use QtMultimedia for recording instead of PyAudio
The unmute-on-first-duration-change approach is to try to prevent
clicks/pops that can happen at the start of recordings. If it doesn't
solve the problem, we may need to drop down to the lower-level
QAudioInput().

Closes https://github.com/ankitects/help-wanted/issues/23

May fix https://forums.ankiweb.net/t/anki-crashes-periodically-after-clicking-record-audio-button/5824,
which I suspect was caused by processEvents()
2020-12-16 19:33:25 +10:00
Damien Elmes
9439dfb98d
Merge pull request #850 from cecini/warn
fix float to int conversion DeprecationWarning
2020-12-16 15:40:35 +10:00
Damien Elmes
a61f3bbc48 fix some warnings on startup 2020-12-16 15:38:24 +10:00
Damien Elmes
e3c9502b46 ignore pickle.dumps() warning 2020-12-16 15:38:11 +10:00
Damien Elmes
17a221dfa0 bump pickle proto to v4; change column type to blob 2020-12-16 15:38:07 +10:00
Damien Elmes
8e7e01ccfd don't catch DeprecationWarnings in the GUI 2020-12-16 14:25:11 +10:00
Damien Elmes
24e69e3803
Merge pull request #851 from hgiesel/cardtypeprobs
Remove unicode isolation from card type names
2020-12-16 13:37:44 +10:00
Henrik Giesel
f06fd23319 Remove unicode isolation from card type names 2020-12-16 03:09:33 +01:00
Damien Elmes
53276b3044 symlink generated .py/.pyi into tree to fix Python code completion 2020-12-16 11:36:42 +10:00
cecini
d2ae874d9e fix float to int conversion DeprecationWarning 2020-12-15 13:10:12 +00:00
Damien Elmes
6d596c8fc9 avoid distributing BUILD.bazel in js/vendor 2020-12-12 10:35:01 +10:00
Damien Elmes
13d66b22f4 remove unwanted leading '/' in wheel records 2020-12-10 23:02:18 +10:00
Damien Elmes
0cbb60169c simplify wheel building 2020-12-10 20:27:21 +10:00
Damien Elmes
330d13d320 set the minimum ease to 131% for now
https://forums.ankiweb.net/t/force-sync-triggers-2-1-34-ease-fixup-behaviour/5632/
2020-12-10 15:46:22 +10:00
Henrik Giesel
0ad3c062bb Switch back to fadeTo rather than fadeIn/fadeOut 2020-12-09 14:19:45 +01:00
Damien Elmes
fcdc51aace add explicit entry point to start Anki; update docs 2020-12-07 11:22:31 +10:00
L.M.Sherlock
994f423466
Update about.py 2020-12-05 14:11:47 +08:00
Henrik Giesel
112895f04f Fix fields_did_rename_field 2020-12-01 02:28:10 +01:00
Damien Elmes
e38cecd88a update sync status after profile open sync
https://forums.ankiweb.net/t/why-is-my-sync-button-blue/2078/15
2020-12-01 10:20:55 +10:00
Damien Elmes
2c38ccad98 export mathjax.js 2020-11-30 15:15:37 +10:00
Damien Elmes
2e193c3e5b update sync color at end of sync
https://forums.ankiweb.net/t/why-is-my-sync-button-blue/2078/13
2020-11-30 10:14:43 +10:00
Damien Elmes
f1fbb9d82f update about
https://forums.ankiweb.net/t/may-i-trouble-you-to-add-my-name-on-the-about-page/5433/2
2020-11-29 12:00:16 +10:00
abdo
a8e4a58139 Fix UnboundLocalError in profiler code 2020-11-25 04:54:41 +03:00
Damien Elmes
d85d0b88a1
Merge branch 'master' into init-lang 2020-11-22 16:10:49 +10:00
Damien Elmes
0b848eae56 update remaining python format strings to Fluent 2020-11-22 14:57:53 +10:00
abdo
7d7745fbb5 Set up default language before loading profile
We can make more strings translatable this way.
2020-11-21 05:29:23 +03:00
Damien Elmes
e23d40e850
Merge pull request #823 from RumovZ/rework-search-parser
Rework search parser
2020-11-20 16:22:12 +10:00
Damien Elmes
f7fcdca54c
Merge pull request #833 from abdnh/setdeflang-fix
Initialize translation system to default language on first run
2020-11-20 16:11:13 +10:00
abdo
36319f1291 Initialize translation system to default language on first run
The setlang screen was trying to use the translation system before
we initialize it.
2020-11-20 06:18:51 +03:00
abdo
e3b4802f47 Fix description of exporters
Description broke yet again with the full migration to Fluent
2020-11-19 23:52:46 +03:00
abdo
f67e319f1f Strip isolation characters from more strings 2020-11-18 18:03:04 +03:00
Damien Elmes
c1d15a8e1f quieten MathJax 2020-11-18 21:34:44 +10:00
RumovZ
c185fb966b Merge branch 'master' into rework-search-parser
Conflicts:
    rslib/src/search/sqlwriter.rs
2020-11-18 09:04:04 +01:00
Damien Elmes
98a4a1927a formatting fix 2020-11-18 13:48:23 +10:00
Damien Elmes
c1e6149a1b fix browser updateTitle() 2020-11-18 13:40:21 +10:00
Damien Elmes
1c5f94d46f strip out unused gettext refs 2020-11-18 13:22:51 +10:00
Damien Elmes
ffa26fe4bc fix remaining _() references; remove unused imports 2020-11-18 12:43:46 +10:00
Damien Elmes
ba336d5de3 update multi-line _() references 2020-11-18 11:32:22 +10:00
Damien Elmes
b49805fef5 more ngettext references 2020-11-18 10:52:13 +10:00
Damien Elmes
1255e7530c update some qt ngettext references 2020-11-18 09:22:27 +10:00
Damien Elmes
e527d31dfc begin plural string migration 2020-11-17 23:29:08 +10:00
Damien Elmes
2453e5c488 update temporary val="%s" references to standard ftl 2020-11-17 22:00:44 +10:00
Damien Elmes
11dca54471 update designer references 2020-11-17 19:55:18 +10:00
Damien Elmes
9d1b6231d7 merge pylib references 2020-11-17 19:23:06 +10:00
Damien Elmes
8fcfdb57ab fix the preview shortcut references 2020-11-17 17:51:57 +10:00
Damien Elmes
6418993840 merge bulk of qt/ - designer files still to do 2020-11-17 17:42:43 +10:00
Damien Elmes
f65f101a16
Merge pull request #825 from hgiesel/mathjax3plus2
Switch from jQuery pre 3.0.0 pseudo promises to ES6 promises for ts hooks
2020-11-16 11:44:21 +10:00
Damien Elmes
ed3583b6fe
Merge pull request #826 from abdnh/write-dupes-fix
Make dupe search operate on non-stripped text
2020-11-16 11:43:33 +10:00
abdo
358d0f957e Make dupe search operate on non-stripped text
See https://github.com/ankitects/anki/pull/822/
2020-11-16 04:01:04 +03:00
Henrik Giesel
07c183d2c2 Switch from jQuery pre 3.0.0 pseudo promises to ES6 promises 2020-11-16 01:09:59 +01:00
Henrik Giesel
435ecc3ae8 Satisfy formatter 2020-11-15 21:40:59 +01:00
Henrik Giesel
a7b5a7efe1 Improve ts hooks to allow for asynchronous actions
* reviewer ts hooks may now return a promise, which are then waited upon with Promise.all
* this does not break old ts hooks, as Promise.all allows for non-Promises in its array
2020-11-15 21:16:06 +01:00
Henrik Giesel
4229f21084 Include default MathJax packages
* by default load all the default tex-chtml packages, which additionally include:
  * require: using \require{package-name} to load a package
  * autoload: using a command from a different package automatically loads it
  * configmacros: allows for definition of predefined macros
2020-11-15 20:56:50 +01:00
Henrik Giesel
80232f4d33 Load require package in Mathjax 2020-11-15 13:58:51 +01:00
Damien Elmes
9f97baa3e2 Merge branch 'mathjax3' 2020-11-15 20:24:50 +10:00
Damien Elmes
8a80ffe53a add rule to copy mathjax from node_modules 2020-11-15 20:22:28 +10:00
Damien Elmes
9feccc785f ignore incorrect clock in dev mode 2020-11-15 18:29:16 +10:00
RumovZ
8d24fb89bf Update frontend search escapes to new parsing 2020-11-14 20:37:40 +01:00
Henrik Giesel
6104ea26fb Remove @types/mathjax as it is for MathJax 2 2020-11-14 14:14:25 +01:00
Henrik Giesel
aa44d64513 Add moving MathJax3 into mathjax directory to build process 2020-11-14 14:14:25 +01:00
Henrik Giesel
6d4ff1212d Rip out MathJax 2 and setup MathJax 3 environment 2020-11-14 14:14:25 +01:00
Henrik Giesel
c5cfbfa1ab Update MathJax2 config to MathJax3 config
Used: https://mathjax.github.io/MathJax-demos-web/convert-configuration/convert-configuration.html
2020-11-14 14:14:25 +01:00
Damien Elmes
5bb3d7c114 format_fix -> format; rename svelte-check for consistency 2020-11-12 20:19:32 +10:00
Damien Elmes
81b9a3194e fix some unwanted leading space in i18n keys 2020-11-12 08:55:26 +10:00
Damien Elmes
8d4df820cc update i18n scripts
- export updated .po files for consumption
- add a script to pull and push translations
2020-11-11 21:08:06 +10:00
Damien Elmes
f8f2839b55 add pyqtwebengine to wheel deps and bump minimum required pyqt 2020-11-11 10:33:49 +10:00
Damien Elmes
6e3f971ae1 handle packaged pylib buildinfo.txt; drop aqt buildinfo 2020-11-11 10:33:49 +10:00
Damien Elmes
e99c0dbe15
Merge pull request #793 from nwwt/object-audio-tags-support
Audio & object tag support
2020-11-11 10:33:31 +10:00
Andreas Reis
54f51da944 Allow <audio> to play without user interaction in accordance to autoplay setting
Since 2018, Chromium by default requires at least one user interaction with a page in order for sound to play. That's not what an Anki user expects.

So this commit undoes this by setting the policy accordingly if the deck's settings have autoplay set, so that files in <audio> tags (if they further have the autoplay attribute set / are jscripted accordingly) are treated the same as ones in [sound:…] elements. OFC, it's obviously not a good idea to mix both on one card.

(AnkiDroid's WebView has already been unconditionally ignoring the requirement since forever.)
2020-11-10 14:53:45 +01:00
Andreas Reis
e68a40f13e cleanup / renames
・ soundRegexps →  sound_regexps

・ htmlRegexps →  html_media_regexps

・ HTML_TAGS →  HTML_MEDIA_TAGS

・ escapeImages →  escape_media_filenames + alias

・ strip_html_preserving_image_filenames →  strip_html_preserving_media_filenames
2020-11-10 14:53:04 +01:00
ianki
c2901e4859 Add hooks for filtering media. 2020-11-09 02:12:23 -08:00
Damien Elmes
20f0c887eb
Merge pull request #814 from k12ish/master
Improve compatibility with graphics pad/touchscreen
2020-11-09 19:42:41 +10:00
Damien Elmes
b38218f7c6
Merge pull request #813 from RumovZ/fix-search-combos
Fix clicking filters with keyboard modifiers
2020-11-09 19:42:13 +10:00
k12ish
b592e20a3c Improve compatibility with graphics pad/touchscreen
When using anki with a graphics pad, text is often selected on accident. This snippet of CSS will fix that issue
2020-11-08 18:14:37 +00:00
RumovZ
557616f36a Fix clicking filters with keyboard modifiers 2020-11-08 11:05:11 +01:00
Damien Elmes
37695da713 fix missing QAudioDeviceInfo on macOS 2020-11-06 12:01:37 +10:00
Damien Elmes
ecab88d8c5
Merge pull request #808 from sobjornstad/reposition-highlight
Start with default value in reposition spinbox selected
2020-11-06 11:09:15 +10:00
Damien Elmes
c42325cb49 fix aqt version requirement; use py3 instead of cp38 tag 2020-11-05 20:25:08 +10:00
Damien Elmes
29ae7480f2 cleanups 2020-11-05 11:21:13 +10:00
Damien Elmes
ecfeb71195 fix tests on Linux 2020-11-04 21:39:41 +10:00
Damien Elmes
0d354da93a move aqt_data into source folder; implement wheel building 2020-11-04 12:14:03 +10:00
Soren Bjornstad
7277e9485a start with default value in reposition text box highlighted
This saves a keystroke if you want to replace the default value. It's
hard to imagine a situation in which you would want to *prepend*
characters to the default value, as is the current behavior. If you want
to accept the default value, you can still hit enter or tab immediately.
2020-11-02 19:07:53 -06:00
Damien Elmes
45ed97c56c rspy -> pylib/rsbridge 2020-11-02 15:21:12 +10:00
Damien Elmes
99140f6023 always return str in aqt_data_folder() 2020-11-01 14:38:13 +10:00
Damien Elmes
aea0a6fcc6 initial Bazel conversion
Running and testing should be working on the three platforms, but
there's still a fair bit that needs to be done:

- Wheel building + testing in a venv still needs to be implemented.
- Python requirements still need to be compiled with piptool and pinned;
need to compile on all platforms then merge
- Cargo deps in cargo/ and rslib/ need to be cleaned up, and ideally
unified into one place
- Currently using rustls to work around openssl compilation issues
on Linux, but this will break corporate proxies with custom SSL
authorities; need to conditionally use openssl or use
https://github.com/seanmonstar/reqwest/pull/1058
- Makefiles and docs still need cleaning up
- It may make sense to reparent ts/* to the top level, as we don't
nest the other modules under a specific language.
- rspy and pylib must always be updated in lock-step, so merging
rspy into pylib as a private module would simplify things.
- Merging desktop-ftl and mobile-ftl into the core ftl would make
managing and updating translations easier.
- Obsolete scripts need removing.
- And probably more.
2020-11-01 14:26:58 +10:00
Damien Elmes
6b0b3fcd6a
Merge pull request #803 from RumovZ/fix-completer-focus
Work around Qt's focus bug (fix help-wanted#22)
2020-10-29 21:44:13 +10:00
Damien Elmes
8ef6420cdb
Merge pull request #804 from hgiesel/mime
Set MIME type for javascript files
2020-10-29 20:54:03 +10:00
Henrik Giesel
70aed820da Set MIME type for javascript files 2020-10-26 23:32:38 +01:00
RumovZ
aaf5770db9 Work around Qt's focus bug (fix help-wanted#22)
Manually hide the editor's completer popup before accepting a short cut which changes the focus widget. Thus, work around the bug in PyQt 5.15 where a QLineEdit with open QCompleter popup won't get notified about focus changes handled by the Main Window, leading to inconsistent focus.
2020-10-24 10:47:25 +02:00
abdo
6d68bfa594 Use replace instead of strip
https://github.com/ankitects/anki/pull/801
2020-10-22 15:21:30 +03:00
abdo
55f1d3773f Strip double quotes from names
Strip double quotes from all kinds of names

https://github.com/ankitects/anki/pull/798
2020-10-21 21:48:49 +03:00
Damien Elmes
3d95d9e3c6
Merge pull request #799 from hgiesel/cal
Introduce Browser.search_for and Browser.update_search
2020-10-21 21:31:21 +10:00
Damien Elmes
fe5c4a2593
Merge pull request #798 from abdnh/escape-quotes-in-search
Escape double quotes in search
2020-10-21 21:28:51 +10:00
Damien Elmes
930c264399
Merge pull request #797 from abdnh/importing-fix
Fix notes being imported to the wrong deck in some cases
2020-10-21 21:22:33 +10:00
Damien Elmes
669769a5a2
Merge pull request #795 from abdnh/reviewer-cleanup
Set card to None in reviewer cleanup
2020-10-21 21:19:43 +10:00
Damien Elmes
f947a65ac5
Merge pull request #794 from abdnh/tagedit-enter-fix
Don't apply suggestion when no suggestion list is shown in tagedit
2020-10-21 21:19:05 +10:00
Damien Elmes
5fc841de85
Merge pull request #791 from abdnh/sidebar-context-menu
help-wanted#6: continue work on new browser sidebar (based on #590)
2020-10-21 21:13:32 +10:00
Henrik Giesel
9e44b2be7f Turn update_search into its own method 2020-10-19 21:07:29 +02:00
Henrik Giesel
450e85d36d Add search prompt for setupSearch 2020-10-19 20:57:19 +02:00
Henrik Giesel
54dc97825e Add uses of search_for 2020-10-19 20:51:36 +02:00
Henrik Giesel
2d65e81b13 Add search_for method 2020-10-19 20:37:17 +02:00
abdo
5677a67025 Escape double quotes in search 2020-10-19 01:06:41 +03:00
abdo
d91f2a27b2 Remove unused code 2020-10-15 16:14:14 +03:00
abdo
236a6071d4 Save importing model in any case
https://forums.ankiweb.net/t/bug-notes-are-imported-to-the-wrong-deck-in-certain-cases/4318
2020-10-15 15:14:55 +03:00
abdo
3531ae089a Set card to None in reviewer cleanup 2020-10-14 12:56:47 +03:00
abdo
44e3ef690f Don't apply suggestion when no suggestion list is shown 2020-10-14 05:00:24 +03:00
Damien Elmes
06292a45f3 formatting fix
formatting fix
2020-10-14 10:35:57 +10:00
Damien Elmes
02ceab55c0
Update __init__.py 2020-10-14 09:45:34 +10:00
Andreas Reis
21f072a666 Add command-line argument to skip addons
Shift doesn't work for me occasionally, for whatever reason. So just add an -s to skip it that way.

(Also, update my github nick)
2020-10-14 01:31:07 +02:00
abdo
cd0523712f Fix typing warning 2020-10-12 11:01:15 +03:00
abdo
7c1b855709 Do sidebar switch check in browser init
https://github.com/ankitects/help-wanted/issues/6#issuecomment-706880794
2020-10-12 10:28:21 +03:00
abdo
82993d16fd Merge branch 'sidebar-context-menu' of https://github.com/abdnh/anki into sidebar-context-menu 2020-10-12 10:15:23 +03:00
Damien Elmes
f75e3e6486
Merge pull request #790 from hgiesel/fields
Add fields_did_rename_field and fields_did_remove_field hooks
2020-10-12 12:36:39 +10:00
Damien Elmes
1aa29f2e79
Merge pull request #789 from abdnh/editor-decode-urls
Decode pasted URLs for nicer display
2020-10-12 12:33:52 +10:00
Damien Elmes
aad6785bab
Merge branch 'master' into opus-audio 2020-10-12 12:32:43 +10:00
Damien Elmes
153c8aed27 formatting fixes 2020-10-12 12:17:02 +10:00
Damien Elmes
a4a461c17b
Merge pull request #782 from johan456789/patch-1
fix outdated help site
2020-10-12 12:15:46 +10:00
Henrik Giesel
591d3738d1 Add fields_did_rename_field and fields_did_remove_field hooks 2020-10-11 19:16:30 +02:00
abdo
709e789ade Decode pasted URLs 2020-10-11 16:46:46 +03:00
Piotr Kubowicz
ed11f8e9d6 Add .opus as an audio extension
Wikimedia Commons has pronunciation recordings with .opus extension.
Anki is able to play such files, but until now adding them required
changing the extension to .ogg or some other supported one.

Also sort the audio extensions list.
2020-10-10 16:28:40 +02:00
Damien Elmes
727ddd74b6 fixes for latest mypy 2020-10-10 19:02:59 +10:00
abdo
4f5fdc192a Move new sidebar code to a separate file
- Move the new sidebar code and SidebarTreeView implementation to a
  new file. Old sidebar can be accessed with the shift key. The "new" sidebar
  doesn't add much for now.
- Make rename_deck work with subdecks
- Fix an issue when trying to open context menu over areas not populated
  with sidebar items
2020-10-10 04:42:49 +03:00