Commit Graph

123 Commits

Author SHA1 Message Date
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
46a1cc575c update a deprecated API call in clayout 2021-10-12 16:20:12 +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
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
1ae45c5445 quote fonts added via the Add Field dialog 2021-09-02 21:05:16 +10:00
Henrik Giesel
272f2f7d1a Revert to MathJax through script tag 2021-07-16 16:56:57 +02:00
Henrik Giesel
ddf3adfc8e Remove protobuf important from reiewer (no longer necessary (?)) 2021-07-16 16:56:56 +02:00
Henrik Giesel
05771b7598 Include MathJax over ts/reviewer 2021-07-16 16:56:56 +02:00
Henrik Giesel
5cbb582d0b Export jquery via ts/reviewer 2021-07-16 16:56:56 +02:00
Henrik Giesel
68ac505d81 Include css-browser-selector via ts/reviewer 2021-07-16 16:56:56 +02:00
Henrik Giesel
f203562c58 Include protobuf in clayout and browser (p)reviewer 2021-07-16 16:56:56 +02:00
evandrocoan
85c236a417 Created shortcut to switch between card types on clayout.py
editor window (F3 and F4) because it should be simple to use them
single hand and together with Ctrl+1, 2 and 3 combos.
2021-07-15 20:51:08 -03:00
Damien Elmes
17533e6a78 PEP8 models.py 2021-06-27 14:30:00 +10:00
Damien Elmes
2a93355824 PEP8 cards.py 2021-06-27 12:12:23 +10:00
hikaru-y
342f75f0f6 Toggle night-mode class of documentElement when action triggered 2021-06-24 23:47:06 +09:00
Damien Elmes
d0ca61a608 show correct card count when removing multiple templates
https://forums.ankiweb.net/t/error-in-card-type-deletion/10868
2021-06-17 15:51:21 +10:00
RumovZ
935fbb6289 Use implicit failure handling and self as parent 2021-05-27 16:51:03 +02:00
RumovZ
db9594818a Handle failure in CardLayout/accept() 2021-05-25 20:58:43 +02:00
Damien Elmes
4be5d08559 remove some unnecessary checkpoints 2021-05-08 17:04:05 +10:00
Damien Elmes
248373ef30 undoing of notetype templates 2021-04-30 17:30:48 +10:00
Damien Elmes
8cc6758eb1 declare variables with some common names as int instead of a union 2021-03-26 16:33:53 +10:00
Damien Elmes
e687552aeb update TR references that crossed multiple lines 2021-03-26 14:38:15 +10:00
Damien Elmes
b7587cb8d2 update TR references that contain arguments 2021-03-26 14:21:04 +10:00
Damien Elmes
0c338bfd53 update no-arg tr references in qt/ 2021-03-26 13:48:26 +10:00
Damien Elmes
0c59c8b591 fix a bunch of qt typing issues uncovered by the following commit 2021-03-19 19:45:21 +10:00
Damien Elmes
57d7e3e2ab commit immediately when there's no active checkpoint
Reviews and operations on the backend that support undoing can now be
committed immediately, so they will not be lost in the event of a crash.

This required tweaks to a few places:

- don't set collection mtime on save() unless changes were made in
Python, as otherwise we end up accidentally clearing the backend undo
queue
- autosave() is now run on every reset()
- garbage collection now runs in a timer, instead of relying on
autosave() to be run periodically
2021-03-10 11:47:53 +10:00
Damien Elmes
d666b7e5b0 fix browser appearance defaults
https://forums.ankiweb.net/t/small-bug-in-the-browser-appearance-window/7806
2021-02-26 18:46:09 +10:00
abdo
39f3b6ce93 Shortcuts to preview clozes in card layout screen
Assign Alt+{number} to select cloze cards.
2021-02-21 14:46:53 +03:00
Henrik Giesel
adb002f05f Remove unused imports 2021-02-12 02:16:05 +01:00
Henrik Giesel
87febe489e Allow for passing in custom note type and template 2021-02-12 02:12:03 +01:00
Henrik Giesel
270cef63f4 Allow for passing in custom note types for rendering ephemeral cards 2021-02-12 01:53:03 +01:00
Damien Elmes
6e9dfefb24 Revert "Use new note.ephemeral_card method in clayout"
This partially reverts commit 2483ef4517.
2021-02-12 10:05:46 +10:00
Damien Elmes
88c002f4eb convert qt strings to f-strings with flynt
Also revealed an incorrect type def in editor.py that mypy wasn't
noticing before :-(
2021-02-11 10:09:06 +10:00
Henrik Giesel
22a5db8ace Remove unused imports 2021-02-02 17:13:35 +01:00
Henrik Giesel
2483ef4517 Use new note.ephemeral_card method in clayout 2021-02-02 16:47:25 +01:00
Damien Elmes
4a5ef69068 add remaining types and disable missing types on (almost) all aqt 2021-02-03 00:00:29 +10:00
Damien Elmes
6426edb0ac more typing updates 2021-02-02 23:31:55 +10:00
Damien Elmes
a56b09b987 add a bunch of return types 2021-02-01 23:53:23 +10:00
Damien Elmes
f15715fb07 add types to various other files
Mainly automated with MonkeyType
2021-02-01 22:08:56 +10:00
Damien Elmes
98f4b3db81 add types to utils.py
The function signatures for things like getFile() are awful, but
sadly are used by a bunch of add-ons.
2021-02-01 20:23:48 +10:00
Damien Elmes
9d853bbb03 start work on more clearly defining backend/protobuf boundaries
- anki._backend stores the protobuf files and rsbackend.py code
- pylib modules import protobuf messages directly from the
_pb2 files, and explicitly export any will be returned or consumed
by public pylib functions, so that calling code can import from pylib
- the "rsbackend" no longer imports and re-exports protobuf messages
- pylib can just consume them directly.
- move errors to errors.py

Still todo:

- rsbridge
- finishing the work on rsbackend, and check what we need to add
back to the original file location to avoid breaking add-ons
2021-01-31 18:55:45 +10:00
Arthur Milchior
e0a2d90a68 NF: HelpPage in an enum
Hopefully, this can help with updating on next manual update and maybe even linking to manual translation
2021-01-26 02:16:37 +01:00
Damien Elmes
a57e326906 skip the schema warning on template rename
https://forums.ankiweb.net/t/unnecessary-full-upload-notification/6611
2021-01-18 12:03:07 +10:00
Damien Elmes
94064b8230 convert setWindowFlags call into helper, and fix invalid variables
"type: ignore" was masking the invalid references to self in places
like showText()
2021-01-07 14:24:49 +10:00
BlueGreenMagick
6224658c0d remove context help button 2021-01-06 22:15:48 +09:00
Henrik Giesel
ffc40d8959 Replace browsersel with css-browser-selector in aqt files and add redirect 2020-12-31 16:47:20 +01:00
Henrik Giesel
98407c3fea Avoid building jquery to its own directory 2020-12-28 14:18:07 +01:00
Henrik Giesel
37dcdcc4c0 Rename references from vendor/jquery.js to vendor/jquery/jquery.min.js 2020-12-28 13:16:12 +01:00
Henrik Giesel
f06fd23319 Remove unicode isolation from card type names 2020-12-16 03:09:33 +01:00