Commit Graph

8805 Commits

Author SHA1 Message Date
Damien Elmes
e2c8dc92c1 fix placeholder text color on win/lin 2021-10-15 12:57:19 +10:00
Damien Elmes
58d17a51f3 fix incorrect web background color being picked up in qt6+win/lin 2021-10-15 12:57:19 +10:00
Damien Elmes
0d246c9e0b 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
36fdc607c6 add run-qt5 script to run with 5.x 2021-10-15 12:57:19 +10:00
Damien Elmes
a7812dedc0 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
b0272f0336 generate pyqt6 forms 2021-10-15 12:57:19 +10:00
Damien Elmes
dfcefaebe3 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
4d0a915610 move QtAudioInputRecorder into separate PyQt5-only file
New API required for PyQt6.
2021-10-15 10:47:53 +10:00
Damien Elmes
1701937cba expose pyqt6 packages - not yet used 2021-10-15 10:47:53 +10:00
Damien Elmes
2a3072191f avoid importing directly from PyQt5 where possible 2021-10-15 10:47:53 +10:00
Jakub Kaczmarzyk
183e45c698
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
0d354da93a, 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
7cd2e9618f.

* 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
5f19d39f15 add ready-research to about screen 2021-10-14 21:02:44 +10:00
evandrocoan
2a12d44b34
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
e8c5802a96 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
abad6c3844 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
53ce7d2759 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
3672b0fe73
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
7128de895f 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
a4db8c5c75 update translations 2021-10-13 08:44:30 +10:00
zhangsn
7c74f7805b
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
a403b957cc fix error in webview __del__ on shutdown 2021-10-12 17:07:07 +10:00
Abdo
5600d2824c
Fix invalid 'noteCards' browser column being used (#1422) 2021-10-12 17:04:20 +10:00
Yoshi
56e6778468
Stop using deprecated distro.linux_distribution() (#1421) 2021-10-12 17:00:47 +10:00
Gesa Stupperich
5d093e1142
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
4e405f1cc3 remove unused locale_dir 2021-10-12 16:27:57 +10:00
Damien Elmes
d3805620df use importlib for buildinfo.txt 2021-10-12 16:27:57 +10:00
Damien Elmes
d9bff1e8ce 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
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