Commit graph

8783 commits

Author SHA1 Message Date
Yoshi
2fe067bd32 Stop using deprecated distro.linux_distribution() (#1421) 2021-10-12 17:00:47 +10:00
Gesa Stupperich
a4a0e79dc5 Mac bazelrc build tip (#1418)
* Copy build tip from Linux to Mac instructions

* Update build tip

* Accept BSD 3 clause license
2021-10-12 16:58:42 +10:00
Damien Elmes
11264fdd10 remove unused locale_dir 2021-10-12 16:27:57 +10:00
Damien Elmes
9f7b7c8ddd use importlib for buildinfo.txt 2021-10-12 16:27:57 +10:00
Damien Elmes
63b658e276 provide root_path to flask
Flask tries to look up root_path using __file__, which may not be
available. It's used for static file hosting and templates, neither
of which we use.
2021-10-12 16:27:57 +10:00
Damien Elmes
280daee4d3 remove unused moduleDir 2021-10-12 16:27:57 +10:00
Damien Elmes
abecbadb71 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
f0a049eb83 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
98a161cec6 add qtmajor qualification to version checks; update outdated min ver 2021-10-12 16:20:33 +10:00
Damien Elmes
5028ddedbe update a deprecated API call in clayout 2021-10-12 16:20:12 +10:00
Damien Elmes
b193a4dd4a remove old unused build_ui.sh 2021-10-12 16:19:27 +10:00
Damien Elmes
b9032d9165 mention missing libs in linux.md 2021-10-12 16:19:27 +10:00
Damien Elmes
94eb2178c0 stop migrating from old folder locations
Closes #1390
2021-10-12 16:18:31 +10:00
Damien Elmes
ee01e94074 Revert "Merge pull request #610 from evandroforks/ask_confirmation_before_moving_anki_collection"
This reverts commit bcb71bbf2d, reversing
changes made to b7489cdb75.

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
6bdefe5b47 Revert "Allow copying of images using context menu"
This reverts commit b20e022097.

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
3c40b9a71f Revert "Allow <audio> to play without user interaction in accordance to autoplay setting"
This reverts commit 776c46e23b.

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
32df40216e .exec_() -> .exec()
The former is not supported in PyQt6
2021-10-12 16:17:37 +10:00
Damien Elmes
6378da4e8e update runtime Python version check 2021-10-12 16:17:23 +10:00
Damien Elmes
1db83ba066 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
06946e2ed8 Fix deck change after toggling sticky fields (#1415) 2021-10-09 10:26:10 +10:00
Henrik Giesel
ac92155a8e Put sass into repo directory (#1409)
Fix Sass build
2021-10-09 10:25:03 +10:00
Henrik Giesel
2680d1bad8 Fix prettier after moving node_modules to repo dir (#1413) 2021-10-09 10:13:14 +10:00
Henrik Giesel
f0b61782be 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 e1d4292ce3.

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 0a96776a47.

* move withCollapsedWhitespace back to i18n/utils

* Add back /ts as in rootDirs
2021-10-07 23:31:49 +10:00
Damien Elmes
90f74c1f6a 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
0982956bdc 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
13ffa43d7e 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
7cc3b1816c fix invalid arg to ButtonGroup revealed by typing fix 2021-10-07 21:33:15 +10:00
Damien Elmes
77f7e7b3ea add trailing newline to profiles readme
closes #1407
2021-10-07 13:31:44 +10:00
Ren Tatsumoto
3e2bd3d772 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
f209a72b7c 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
3c1729e91b 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
a074903975 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
fb6e1a73f5 bump minimum Python to 3.9 2021-10-04 15:05:15 +10:00
Damien Elmes
142b13c146 fix pylinthome warning 2021-10-03 12:23:52 +10:00
Damien Elmes
63eb673f60 fix profile save not working on Python 3.10 2021-10-03 12:23:37 +10:00
Damien Elmes
00c68b44e0 update Python deps 2021-10-02 23:52:23 +10:00
Damien Elmes
98ff2102b7 apply some f-string updates via flynt 2021-10-02 23:52:02 +10:00
Damien Elmes
95605f9024 convert some range(len()) calls for pylint 2021-10-02 23:51:59 +10:00
Damien Elmes
676d043011 add missing encoding argument to open calls 2021-10-02 23:51:50 +10:00
Damien Elmes
51ac8d7813 use extra variable in stdHtml() to work around a pylint crash 2021-10-02 22:47:13 +10:00
Damien Elmes
79aa52c082 update Rust deps 2021-10-02 20:42:03 +10:00
Damien Elmes
3f1a3b7e09 update cargo-raze instructions 2021-10-02 16:24:44 +10:00
Damien Elmes
8ee0276f04 update to the latest rules_rust 2021-10-02 15:13:37 +10:00
Damien Elmes
4a0d242266 fix a clippy lint in latest Rust 2021-10-02 14:13:49 +10:00
Damien Elmes
8960017554 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
db3cda588f Add legacy alias browser.onRowChanged() 2021-10-01 18:36:12 +02:00
RumovZ
287acfe017 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
9025985505 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
098bdc1771 fix broken links_pb2.pyi link 2021-10-01 22:52:15 +10:00
Damien Elmes
8b4030a1b5 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