Commit Graph

134 Commits

Author SHA1 Message Date
Damien Elmes
2a3072191f avoid importing directly from PyQt5 where possible 2021-10-15 10:47:53 +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
evandrocoan
7e32e4efd5 Fix previous card attribute not initialized 2021-09-13 23:16:25 -03:00
evandrocoan
23891918cb Use Alt+i for previous/last card info because Ctrl+i could
easily confuse a user that Ctrl+i is for the current card.
Ctrl was first added because it is easier to press,
at least for me, then, I press first using Ctrl and if
not available go to Alt.
2021-09-08 21:26:48 -03:00
evandrocoan
e295c4ccfb Fix #1355 2021-09-07 23:53:47 -03:00
Damien Elmes
5296bf0a00 shift timebox check to post-answer
- should prevent non-review actions from triggering display
- should prevent next card's audio from playing before diag. dismissed
- the timer hack should no longer be required, as the webview will
have already been loaded

https://forums.ankiweb.net/t/timebox-pop-up-suddenly-appears-when-daily-cutoff-hour-rolls-over-even-when-not-in-the-reviewer/12385
2021-08-18 16:25:23 +10:00
Damien Elmes
03e76d522a reload card if there are registered hooks
https://forums.ankiweb.net/t/2-1-45-release-candidate/11362/54
2021-07-26 20:48:30 +10:00
Damien Elmes
ce5f9bb9b0
Merge pull request #1292 from hgiesel/reviewerplus
Move reviewer to ts/reviewer v2
2021-07-17 09:10:14 +10:00
hikaru-y
16a1eb05a2 Revert "Follow-up to #1271 (Preload answer images)" 2021-07-16 23:57:49 +09: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
afa8f8a6f0 Export getTypedAnswer 2021-07-16 16:56:56 +02:00
Henrik Giesel
af12756980 Move reviewer to ts/reviewer 2021-07-16 16:56:55 +02:00
Damien Elmes
1d4b58419e add workaround for protobufjs requiring uppercase package names
I mourn the time lost trying to track this down :-(

https://github.com/protobufjs/protobuf.js/issues/1014

We can't patch the minified file in dist without essentially duplicating
it, so this change also switches from the external file to including
the src file as part of the bundle.
2021-07-10 15:24:01 +10:00
hikaru-y
09d1cc08c6 Follow-up to #1271
- remove no-longer-required 'escape_media_filenames()' 14110add
- clean up previewer.py
2021-07-05 01:13:17 +09:00
Damien Elmes
209a646d63
Merge pull request #1271 from hikaru-y/preload-images
Preload answer images
2021-07-04 15:50:55 +10:00
hikaru-y
9782d39ced Preload images to be displayed on answer side 2021-07-03 21:33:00 +09:00
RumovZ
a5dacf0d0a Add flag manager and hook
'FlagManager' allows cached access to the flag objects, takes care of
renaming flags and notifies GUI components with the hook
'flag_label_did_change'.
2021-07-02 11:16:10 +02:00
Damien Elmes
2a93355824 PEP8 cards.py 2021-06-27 12:12:23 +10:00
Damien Elmes
5bd2dc65ed add card info action to reviewer; move note actions together 2021-06-08 14:23:23 +10:00
Damien Elmes
1479957538 fix note changes triggering a queue rebuild 2021-06-08 12:09:35 +10:00
Damien Elmes
5d477d7e11 another workaround for timeboxing issue 2021-06-04 15:25:30 +10:00
Damien Elmes
f26c7ed99e ask user to confirm which deck they want when opening options in reviewer
Also fixes https://forums.ankiweb.net/t/anki-2-1-45-alpha/10061/57
2021-05-27 13:15:28 +10:00
Damien Elmes
57ec4cc7b5 change get_queued_cards() to no longer return congrats info 2021-05-26 12:59:45 +10:00
Damien Elmes
99b7da49a9 report changed cards when changing deck/flag
+ fix repeated flag shortcut not toggling
2021-05-21 16:03:05 +10:00
RumovZ
5a6ba1b0b9 Move flags into separate module 2021-05-20 10:26:18 +02:00
RumovZ
f960299345 Prefer looping over flags over exhaustive listing 2021-05-19 19:26:39 +02:00
RumovZ
b5fa7923e6 Use custom flag labels in reviewer 2021-05-19 19:18:49 +02:00
Damien Elmes
63f1a363af use literal for ease type 2021-05-19 16:05:12 +10:00
Damien Elmes
9edac805ad support card state mutator in test scheduler
Documentation to come
2021-05-17 16:59:02 +10:00
Damien Elmes
99081e422b re-enable leech notification for test scheduler 2021-05-13 15:51:02 +10:00
Damien Elmes
49a1580566 use new API for test scheduler
Avoids duplicate work, and is a step towards allowing the next
states to be modified by third-party code.

Also:

- fixed incorrect underlined count, due to reviews being labeled as
learning cards
- fixed reviewer not refreshing when undoing a test review, by splitting
up backend queue rebuilding from frontend reviewer refresh
- moved answering into a CollectionOp
2021-05-11 13:06:03 +10:00
Damien Elmes
a1ce048ed5 fix error when user cancels out of set due date/reposition 2021-04-25 19:33:25 +10:00
Henrik Giesel
7dd12a523d Remove jquery from reviewer.py
- we no longer actually need to focus the default ease button
2021-04-13 20:11:18 +02:00
Damien Elmes
18f03d5cb1
Merge pull request #1119 from hgiesel/reviewerdropjquery
Remove last jQuery from reviewer.ts / Remove fadeTime
2021-04-13 23:12:13 +10:00
Damien Elmes
948fc5f777 add missing copyright headers to *.py 2021-04-13 18:45:35 +10:00
Henrik Giesel
c9fcf955f4 Remove display:none from mark and flag, and preset hidden attribute instead 2021-04-13 01:00:09 +02:00
Damien Elmes
84fe309583 update scheduling ops
- migrate to CollectionOp()
- return actual change count when suspending/burying
- add helper to convert vec to vec of newtype
2021-04-06 16:38:42 +10:00
Damien Elmes
2de8cc1a94 update note ops
remove_note() now returns the count of removed cards, allowing us
to unify the tooltip between browser and review screen

I've left the old translation in - we'll need to write a script at
one point that gathers all references to translations in the code,
and shows ones that are unused.
2021-04-06 14:56:36 +10:00
Damien Elmes
bc78b6ef17 migrate more ops to CollectionOp 2021-04-06 14:36:13 +10:00
Damien Elmes
b8fc195cdf start migrating perform_op() into builder in separate file
By passing back the builder to the calling code to run, we don't need
to plumb extra arguments like success= and handler= through each
operation, and the ability to override the default tooltip behaviour
comes free on all operations
2021-04-06 12:47:55 +10:00
Damien Elmes
3f62f54f14 more perform_op() tweaks
- pass the handler directly
- reviewer special-cases for flags and notes are now applied at
call site
- drop the kind attribute on OpChanges which is not needed
2021-04-06 10:14:11 +10:00
Damien Elmes
3a6f2a993e move operations into submodule 2021-04-03 16:26:10 +10:00
Damien Elmes
9c1dc2b62e tweak the wording of some of the tag ops 2021-04-01 15:12:13 +10:00
Damien Elmes
9f4a06abee ID -> Id in protobuf and Python
follow-up to dc81a7fed0
2021-03-27 21:38:20 +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
64bb526008 fix incorrect camelCase 2021-03-26 11:28:51 +10:00