Commit Graph

8778 Commits

Author SHA1 Message Date
Damien Elmes
c01ced6ecb remove unused moduleDir 2021-10-12 16:27:57 +10:00
Damien Elmes
d33c66e195 change setHtml() to serve content via media server
- fixes https://forums.ankiweb.net/t/deck-list-is-blank/2241/2
- fixes the security warnings on Qt 6, by ensuring our pages and
resources are coming from the same origin
2021-10-12 16:27:03 +10:00
Damien Elmes
4b5004c472 refactor mediasrv request processing
_redirectWebExports was doing more than it was originally intended for,
and it was difficult to follow.
2021-10-12 16:22:09 +10:00
Damien Elmes
70dbd06be3 add qtmajor qualification to version checks; update outdated min ver 2021-10-12 16:20:33 +10:00
Damien Elmes
46a1cc575c update a deprecated API call in clayout 2021-10-12 16:20:12 +10:00
Damien Elmes
974378f2be remove old unused build_ui.sh 2021-10-12 16:19:27 +10:00
Damien Elmes
1e8b02592d mention missing libs in linux.md 2021-10-12 16:19:27 +10:00
Damien Elmes
b85ee30c70 stop migrating from old folder locations
Closes #1390
2021-10-12 16:18:31 +10:00
Damien Elmes
c39a5e17e8 Revert "Merge pull request #610 from evandroforks/ask_confirmation_before_moving_anki_collection"
This reverts commit a53aac40f8, reversing
changes made to e323a8f902.

Migration is about to be dropped (#1390), and the references to modules
like QtGui complicate a PyQt5/6 shim.
2021-10-12 16:18:24 +10:00
Damien Elmes
aaceeec25a Revert "Allow copying of images using context menu"
This reverts commit d5b3927d0b.

This approach no longer appears to work in Qt6. There is a
QWebEngineView.lastContextMenuRequest() that may work, though whether
onCopy() qualifies as "during contextMenuEvent" is not clear.

https://doc.qt.io/qt-6/qwebengineview.html#lastContextMenuRequest
2021-10-12 16:18:24 +10:00
Damien Elmes
aabf693bb8 Revert "Allow <audio> to play without user interaction in accordance to autoplay setting"
This reverts commit 54f51da944.

This breaks in the PyQt6 upgrade. There are no globals anymore, only
page profiles - but the code should probably be modifying a specific
webview instead of globals anyway.
2021-10-12 16:18:24 +10:00
Damien Elmes
69c196b409 .exec_() -> .exec()
The former is not supported in PyQt6
2021-10-12 16:17:37 +10:00
Damien Elmes
e9d0e672cf update runtime Python version check 2021-10-12 16:17:23 +10:00
Damien Elmes
e357dbf6b3 use Qt search path instead of resource system
Means URLs like :/icons/foo.jpg should become icons:foo.jpg

This is part of the prep work for a PyQt6 update. PyQt6 has dropped
pyrcc, so we can longer generate the icons_qrc.py file we did previously.

Qt Designer expects us to use the resource system, so we continue to
generate the icons.qrc file to make editing the UI files easier. But at
runtime, we no longer use that file.
2021-10-12 16:17:08 +10:00
Abdo
ebe7125e81
Fix deck change after toggling sticky fields (#1415) 2021-10-09 10:26:10 +10:00
Henrik Giesel
c64bac57a6
Put sass into repo directory (#1409)
Fix Sass build
2021-10-09 10:25:03 +10:00
Henrik Giesel
c63e0abd68
Fix prettier after moving node_modules to repo dir (#1413) 2021-10-09 10:13:14 +10:00
Henrik Giesel
dec0fbe845
Refactor i18n (#1405)
Merging note: the typing changes were fixed in a separate PR.

* Put rootDirs into subprojects

- typings do not work for any ts or svelte files
- if we set the 'rootDirs' in ts/tsconfig.json to '../bazel-bin/ts' and then inherit
  them from e.g. editor, the root will be changed to '../../bazel-bin/ts',
  however editor needs look in '../../bazel-bin/ts/editor' instead.

* Rename i18n and i18n_helpers to i18n-generated and i18n

- This way, we can restrict the awkwardness of importing files outside
  the ts directory within lib

* Fix missing typing of i18n and backend_proto by adding back symlinks

* Split up i18n-generated into i18n-{translate,modules}

* Change i18n from singleton to functions

* Revert "Put rootDirs into subprojects"

This partially reverts commit e1d4292ce3979e7b7ee21bf3951b8a462d45c29c.

It seems like this might not be necessary after all.
However some other change made on this branch seems to have fixed
the .svelte.d.ts imports

* Introduce i18n-bundles to remove circular import

There was a circular import i18n.ts <-> i18n-translate.ts

* Create own directory for i18n

* Move lib/i18n/translate to lib/translate

* This restores tree shaking

* Update tsconfig libs and module

* es2018-2020 have wide support on all modern browsers including

* Switch bundles and langs inside i18n to variables again

* Add missing copyright header

* Rename translate.ts to ftl.ts

* Remove the symlinks again

I added them to fix to have completion for tr, however this would have
also have meant to abandon the tree shaking.
As we want to have tree shaking, it's also not necessary to have the
symlinks anymore

* Revert "Update tsconfig libs and module"

This reverts commit 0a96776a475e9901c1f9f3407c726d1d002fb9ef.

* move withCollapsedWhitespace back to i18n/utils

* Add back /ts as in rootDirs
2021-10-07 23:31:49 +10:00
Damien Elmes
26e2941950
Merge pull request #1408 from ankitects/root-node
move node_modules into root folder [action required]
2021-10-07 23:21:39 +10:00
Damien Elmes
ca32a46594 handle AnkiDroid's two element new intervals
https://github.com/ankidroid/Anki-Android/issues/8889
2021-10-07 23:15:51 +10:00
Damien Elmes
79ceb89637 svelte needs its shims to generate prop typing
I erroneously removed them near the end of the ts_project work, and
didn't realise the properties had broken.
2021-10-07 21:33:21 +10:00
Damien Elmes
1aaf8fce1e fix invalid arg to ButtonGroup revealed by typing fix 2021-10-07 21:33:15 +10:00
Damien Elmes
3814385e41 add trailing newline to profiles readme
closes #1407
2021-10-07 13:31:44 +10:00
Ren Tatsumoto
48f8427592
Keep the list of duplicates up-to-date before tagging (#1404)
* keep the list of dupes up-to-date before tagging

* get rid of a redundant parameter

* unnecessary lambda
2021-10-07 12:49:41 +10:00
Damien Elmes
46b80ca773 move node_modules into root folder [action required]
Recommend removing ts/node_modules folder before attempting to
build after this update.

This moves ts/node_modules into the root of the project to work around
https://github.com/ankitects/anki/pull/1405#issuecomment-936213861

Also fixes the sass errors shown when running scripts/svelte-check
2021-10-07 11:42:27 +10:00
Damien Elmes
b9251290ca run pyupgrade over codebase [python upgrade required]
This adds Python 3.9 and 3.10 typing syntax to files that import
attributions from __future___. Python 3.9 should be able to cope with
the 3.10 syntax, but Python 3.8 will no longer work.

On Windows/Mac, install the latest Python 3.9 version from python.org.
There are currently no orjson wheels for Python 3.10 on Windows/Mac,
which will break the build unless you have Rust installed separately.

On Linux, modern distros should have Python 3.9 available already. If
you're on an older distro, you'll need to build Python from source first.
2021-10-04 15:05:48 +10:00
Damien Elmes
8833175bb4 strip extras from requirements.txt
The extra was preventing use as a pip constraints file.
2021-10-04 15:05:48 +10:00
Damien Elmes
e9c7b2287f bump minimum Python to 3.9 2021-10-04 15:05:15 +10:00
Damien Elmes
5dc385c9b7 fix pylinthome warning 2021-10-03 12:23:52 +10:00
Damien Elmes
daf2e0a78f fix profile save not working on Python 3.10 2021-10-03 12:23:37 +10:00
Damien Elmes
7c70d26fe7 update Python deps 2021-10-02 23:52:23 +10:00
Damien Elmes
5801da13b3 apply some f-string updates via flynt 2021-10-02 23:52:02 +10:00
Damien Elmes
fe576a865d convert some range(len()) calls for pylint 2021-10-02 23:51:59 +10:00
Damien Elmes
553ce808e5 add missing encoding argument to open calls 2021-10-02 23:51:50 +10:00
Damien Elmes
9a103b3716 use extra variable in stdHtml() to work around a pylint crash 2021-10-02 22:47:13 +10:00
Damien Elmes
944b064e54 update Rust deps 2021-10-02 20:42:03 +10:00
Damien Elmes
faec7f8e3d update cargo-raze instructions 2021-10-02 16:24:44 +10:00
Damien Elmes
86572f09fd update to the latest rules_rust 2021-10-02 15:13:37 +10:00
Damien Elmes
8e56853c50 fix a clippy lint in latest Rust 2021-10-02 14:13:49 +10:00
Damien Elmes
0000a3b302
Merge pull request #1402 from RumovZ/row-changed
Connect `currentChanged()` and add legacy alias for `onRowChanged()`
2021-10-02 09:06:05 +10:00
RumovZ
c146f33faa Add legacy alias browser.onRowChanged() 2021-10-01 18:36:12 +02:00
RumovZ
3a5d86c344 React to currentChanged() signal
Decouples changes of the current element and changes of the selection.
Introduces `browser.current_card` which has previously been amalgamated
with the previewer card `browser.card`.
2021-10-01 16:40:25 +02:00
Damien Elmes
0bb273a0ed replace the old stripHTML() methods with the backend implementation
Python's regex engine performs pathologically on regexes like
'<!--.*?-->' when fed a large string of repeating '<!--' clauses.
Thanks to JaimeSlome / security@huntr.dev for the report; closes #1380.

Solved by switching to the Rust implementation, which does not suffer
from this issue.

entsToText(), minimizeHTML(), and the old regex constants have been
removed; they do not appear to be used by any add-ons.
2021-10-01 23:15:45 +10:00
Damien Elmes
a28df026b8 fix broken links_pb2.pyi link 2021-10-01 22:52:15 +10:00
Damien Elmes
812bf76b96
Merge pull request #1399 from abdnh/addon-homepage-manifest-prop
Add the homepage property to manifest.json
2021-10-01 21:52:00 +10:00
Abdo
3822568667 Add the homepage property to manifest.json 2021-10-01 14:40:36 +03:00
Damien Elmes
8d4a623dae update Bazel version 2021-10-01 20:54:48 +10:00
Damien Elmes
60aa75226b update translations 2021-10-01 20:48:20 +10:00
Damien Elmes
a174c41801
Merge pull request #1397 from RumovZ/column-tooltips
Add tooltips for some browser columns
2021-10-01 19:12:59 +10:00
Damien Elmes
c413a0d9f2
"number of cards a note has" 2021-10-01 19:12:49 +10:00