Commit graph

8826 commits

Author SHA1 Message Date
Damien Elmes
9fd0c4aa55 add aarch64-apple to Rust targets 2021-10-16 18:07:39 +10:00
Damien Elmes
abb695bdeb use x86 binaries for clang format/protobuf on Mac 2021-10-16 18:07:39 +10:00
Damien Elmes
45dc83a79b switch to node 16.x for macOS aarch64 support 2021-10-16 18:07:39 +10:00
Damien Elmes
57ee53d41e get PyQt working directly with ./run on macOS
It's no longer necessary to copy everything into bazel-copy, and you
can safely remove that folder.
2021-10-16 18:07:29 +10:00
Damien Elmes
27a4e7e957 remove unneeded namespace code from install_pyqt5/6.py 2021-10-16 18:07:29 +10:00
Damien Elmes
19cddac8a8 remove duplicate clang format file 2021-10-16 16:54:35 +10:00
Damien Elmes
beaf9153f6 drop rules_pip
Our vendored Python includes a recent pip, so we no longer need rules_pip's
dependencies for our PyQt scripts.
2021-10-16 16:54:35 +10:00
Damien Elmes
405c5b87c0 avoid pulling qt5 in unless requested 2021-10-16 16:54:34 +10:00
Damien Elmes
f949ef63b5 update Python deps 2021-10-16 09:29:11 +10:00
Damien Elmes
8fc77ff294 build all the UI files in one go
On macOS, the overhead of importing PyQt for each file far exceeds
any gains we get from incremental recompilation.
2021-10-16 09:20:20 +10:00
Damien Elmes
3f51bd3cff use string replacements to generate Qt5 forms
They are mostly compatible, and this means a Qt5 install is not required
as part of the build process.
2021-10-16 08:59:09 +10:00
Damien Elmes
f01b52a244 default to a vendored copy of Python
Brings Python in line with our other dependencies, and means users
no longer need to install it prior to building, or deal with
issues caused by having the wrong version available.
2021-10-15 22:14:05 +10:00
Damien Elmes
484de62e72 download wheels using rules_python 2021-10-15 16:02:26 +10:00
Damien Elmes
11b2f74882 update rules_python 2021-10-15 15:07:31 +10:00
Damien Elmes
f3269a379a Merge pull request #1406 from ankitects/qt6
PyQt6 support
2021-10-15 13:38:56 +10:00
Damien Elmes
cabdd125b6 use separate header state for each Qt version
https://forums.ankiweb.net/t/new-toolkit-and-packaging-test-windows/14081/15
2021-10-15 13:15:38 +10:00
Damien Elmes
dac8e547a8 drop PyAudio support
I do not recall anyone reporting that it worked better than the Qt
implementation for them, and the lack of recent wheels on PyPI is a pain.
We can always add it back in the future if enough people come out of
the woodwork to report they were using it.
2021-10-15 13:15:16 +10:00
Damien Elmes
b52451501d update macOS wheel minimum to 10.13
The coarsetime crate already had us limited to 10.12+, and the wheel
had just not been updated to reflect that. Increased to 10.13, as that's
the minimum the Qt 5.14 libraries support.
2021-10-15 12:57:19 +10:00
Damien Elmes
35ef449503 update manylinux version for new build env 2021-10-15 12:57:19 +10:00
Damien Elmes
a7768ed05d qt recording support for qt6
+ fix inefficient bytes concatenation
2021-10-15 12:57:19 +10:00
Damien Elmes
5587bebc16 hide the video driver selection in qt6 2021-10-15 12:57:19 +10:00
Damien Elmes
8dbf6f74f8 fix placeholder text color on win/lin 2021-10-15 12:57:19 +10:00
Damien Elmes
6b4b13f58e fix incorrect web background color being picked up in qt6+win/lin 2021-10-15 12:57:19 +10:00
Damien Elmes
08dabf0a92 update wheel definitions to require Python 3.9; make PyQt optional
While we do require PyQt, it's not possible to declare that we require
either 5 or 6, and so we need to mark it as optional. Instead, we
provide optional dependencies, so the user can e.g. 'pip install aqt[qt6]'
2021-10-15 12:57:19 +10:00
Damien Elmes
3907fa12d2 add run-qt5 script to run with 5.x 2021-10-15 12:57:19 +10:00
Damien Elmes
631c345ef0 switch to new-style PyQt scoped enums and Qt6
The enum changes should work on PyQt 5.x, and are required in PyQt 6.x.
They are not supported by the PyQt5 typings however, so we need to run
our tests with PyQt6.
2021-10-15 12:57:19 +10:00
Damien Elmes
7dc33ad4fe generate pyqt6 forms 2021-10-15 12:57:19 +10:00
Damien Elmes
fab95b190d miscellaneous pyqt6 compat fixes
- add a few gates for qt5-specific behaviour
- prepare for some changes to the typings in qt6
- map pickled Qt5 ByteArrays to Qt6 when running Qt6
2021-10-15 12:57:19 +10:00
Damien Elmes
42dcf2e57d move QtAudioInputRecorder into separate PyQt5-only file
New API required for PyQt6.
2021-10-15 10:47:53 +10:00
Damien Elmes
32cf761e7b expose pyqt6 packages - not yet used 2021-10-15 10:47:53 +10:00
Damien Elmes
b711d63aff avoid importing directly from PyQt5 where possible 2021-10-15 10:47:53 +10:00
Jakub Kaczmarzyk
8afa54630b replace dockerfile (#1410)
* replaces Dockerfile using bazel-based build system

This commit updates the Dockerfile to work with anki's bazel-based build
system.

The anki Dockerfile was originally added in
https://github.com/ankitects/anki/pull/753 back in September 2020. The
file was moved to `docs/Dockerfile` in
e4ba941cf1, with a note that the file had
to be updated to work with anki's updated build system. The file
`docs/Dockerfile` was removed in
f2e2ef6fc0.

* install setuptools and wheel + xkb libraries

* install anki virtual env in fresh base image

* move Dockerfile out of root directory

* add readme file for dockerized anki
2021-10-15 10:41:15 +10:00
Damien Elmes
440464c0a4 add ready-research to about screen 2021-10-14 21:02:44 +10:00
evandrocoan
061f854b82 Increased max visible items from clayout_top.ui (#1425)
10 is too small for big decks.
2021-10-14 19:36:04 +10:00
Damien Elmes
276d8cc5a5 pass sole arg to cardStats as a dictionary
Easier to extend in the future, or (de)serialize in a strongly-typed
language.
2021-10-14 19:28:51 +10:00
Damien Elmes
dde0ef372f layout tweaks to card info
- negative margins result in truncated text when the window size
is reduced, so avoid them
- having a 100% table inside a flexbox is not responsive - the table
does not adjust its size as the width is increased or decreased
- in order to look decent on narrow screens (eg phones), we allow
margin collapsing
- in order to look decent on wide screens, we limit the maximum
width to something that is readable
- hide some columns in portrait mode on narrow screens

I tried preserving the centering with margin-left/right: auto, but
could not get it looking right, so have had to move things back to
left alignment.
2021-10-14 19:28:33 +10:00
Damien Elmes
084384c2b0 support #test in card-info.html
allows us to use scripts/ts-run and ts-watch to test the page
in Chrome by surfing to http://127.0.0.1:40000/_anki/pages/card-info.html#testXXX
2021-10-14 19:23:33 +10:00
RumovZ
ea9fc3730e Switch CardInfoDialog to ts page (#1414)
* Only collect card stats on the backend ...

... instead of rendering an HTML string using askama.

* Add ts page Card Info

* Update test for new `col.card_stats()`

* Remove obsolete CardStats code

* Use new ts page in `CardInfoDialog`

* Align start and end instead of left and right

Curiously, `text-align: start` does not work for `th` tags if assigned
via classes.

* Adopt ts refactorings after rebase

#1405 and #1409

* Clean up `ts/card-info/BUILD.bazel`

* Port card info logic from Rust to TS

* Move repeated field to the top

https://github.com/ankitects/anki/pull/1414#discussion_r725402730

* Convert pseudo classes to interfaces

* CardInfoPage -> CardInfo

* Make revlog in card info optional

* Add legacy support for old card stats

* Check for undefined instead of falsy

* Make Revlog separate component

* drop askama dependency (dae)

* Fix nightmode for legacy card stats
2021-10-14 19:22:47 +10:00
Damien Elmes
3a795aae22 declare bootstrap prereq in Svelte compile
Mistakenly stripped this out when removing the typescript dependencies
2021-10-13 11:48:22 +10:00
Damien Elmes
215ab90be8 update translations 2021-10-13 08:44:30 +10:00
zhangsn
1301c3b653 add new hook: add_cards_did_change_deck (#1420)
* add new hook which will be executed after the user selects a new different deck when adding cards.

* Update qt/aqt/deckchooser.py
2021-10-12 17:55:21 +10:00
Damien Elmes
eacf9d4445 fix error in webview __del__ on shutdown 2021-10-12 17:07:07 +10:00
Abdo
72861b3c16 Fix invalid 'noteCards' browser column being used (#1422) 2021-10-12 17:04:20 +10:00
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