Commit graph

2569 commits

Author SHA1 Message Date
RumovZ
847bf3fe12 Move update logic into CardInfo.svelte 2021-10-18 09:01:24 +02:00
RumovZ
7570a0757e Make window titles more user-friendly 2021-10-18 09:01:23 +02:00
RumovZ
e328715e00 Add utility func for setting window icon 2021-10-18 09:01:23 +02:00
RumovZ
3b5f4413f8 Use updating card infos in browser and reviewer 2021-10-18 09:01:23 +02:00
RumovZ
5fae48b612 Add update handler for Card Info Dialog 2021-10-18 09:01:22 +02:00
RumovZ
cb0adbd355 Make Card Info Dialog non-modal 2021-10-18 09:01:22 +02: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
405c5b87c0 avoid pulling qt5 in unless requested 2021-10-16 16:54:34 +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
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
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
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
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
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
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
Damien Elmes
11264fdd10 remove unused locale_dir 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
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
Damien Elmes
77f7e7b3ea add trailing newline to profiles readme
closes #1407
2021-10-07 13:31:44 +10:00