Commit Graph

59 Commits

Author SHA1 Message Date
Damien Elmes
f71446ddf5 decorator for saveNow(), mkII
Mostly @RumovZ's work from https://github.com/ankitects/anki/pull/1066,
with a workaround for the issue encountered on
6e0e17b2b9

Fix is to use pyqtSlot() to specify the slot signature, as described
on https://stackoverflow.com/questions/44371451/python-pyqt-qt-qmenu-qaction-syntax

Also renamed saveNow() for PEP8, but have not updated all the existing
calls to use the decorator yet - might be easiest to do at the same time
as perform_op() calls are added.
2021-03-19 19:45:21 +10:00
Damien Elmes
605ad1c9ee remove unnecessary setMod() calls 2021-03-10 11:47:53 +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
Damien Elmes
f434cff36f remember last input for 'set due'; add string config; nest config types 2021-02-08 14:10:05 +10:00
Damien Elmes
dfe3c457e5 use top level defs for protobuf enum cases
While mypy can understand nested references like ConfigBool.Key.COLLAPSE_RECENT,
PyCharm doesn't understand the metaclass syntax, and shows the definitions
as invalid.
2021-02-05 19:26:13 +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
5ff7944a26 add getter/setter for boolean config values 2021-01-29 21:03:19 +10:00
Henrik Giesel
ace61835de Fix formatting, use shortcut on preview before displaying 2021-01-10 01:50:00 +01:00
Henrik Giesel
097fa16783 Allow closing the Preview Dialog with Ctrl+Shift+P 2021-01-10 01:34:59 +01:00
Henrik Giesel
28278fcc40 Remove preview button from browser.py top bar 2021-01-09 23:25:56 +01: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
Damien Elmes
ffa26fe4bc fix remaining _() references; remove unused imports 2020-11-18 12:43:46 +10:00
Damien Elmes
8fcfdb57ab fix the preview shortcut references 2020-11-17 17:51:57 +10:00
Damien Elmes
6418993840 merge bulk of qt/ - designer files still to do 2020-11-17 17:42:43 +10:00
Damien Elmes
8a80ffe53a add rule to copy mathjax from node_modules 2020-11-15 20:22:28 +10:00
Henrik Giesel
6d4ff1212d Rip out MathJax 2 and setup MathJax 3 environment 2020-11-14 14:14:25 +01:00
Damien Elmes
e99c0dbe15
Merge pull request #793 from nwwt/object-audio-tags-support
Audio & object tag support
2020-11-11 10:33:31 +10:00
Andreas Reis
54f51da944 Allow <audio> to play without user interaction in accordance to autoplay setting
Since 2018, Chromium by default requires at least one user interaction with a page in order for sound to play. That's not what an Anki user expects.

So this commit undoes this by setting the policy accordingly if the deck's settings have autoplay set, so that files in <audio> tags (if they further have the autoplay attribute set / are jscripted accordingly) are treated the same as ones in [sound:…] elements. OFC, it's obviously not a good idea to mix both on one card.

(AnkiDroid's WebView has already been unconditionally ignoring the requirement since forever.)
2020-11-10 14:53:45 +01:00
Damien Elmes
aea0a6fcc6 initial Bazel conversion
Running and testing should be working on the three platforms, but
there's still a fair bit that needs to be done:

- Wheel building + testing in a venv still needs to be implemented.
- Python requirements still need to be compiled with piptool and pinned;
need to compile on all platforms then merge
- Cargo deps in cargo/ and rslib/ need to be cleaned up, and ideally
unified into one place
- Currently using rustls to work around openssl compilation issues
on Linux, but this will break corporate proxies with custom SSL
authorities; need to conditionally use openssl or use
https://github.com/seanmonstar/reqwest/pull/1058
- Makefiles and docs still need cleaning up
- It may make sense to reparent ts/* to the top level, as we don't
nest the other modules under a specific language.
- rspy and pylib must always be updated in lock-step, so merging
rspy into pylib as a private module would simplify things.
- Merging desktop-ftl and mobile-ftl into the core ftl would make
managing and updating translations easier.
- Obsolete scripts need removing.
- And probably more.
2020-11-01 14:26:58 +10:00
abdo
b22b104119 'Show Both Sides' -> 'Back Side Only' 2020-09-20 19:31:00 +03:00
Damien Elmes
a517accee3 update to latest black 2020-08-31 13:29:28 +10:00
Damien Elmes
61e8611b7b fix lint issue in previewer, and drop unused code
No add-ons appear to be using the removed code, and Anki wasn't
using it either.
2020-07-24 12:18:37 +10:00
Damien Elmes
26426cb11e fix preview not updating on edit
https://forums.ankiweb.net/t/modification-and-preview/1331
2020-07-24 11:57:22 +10:00
Damien Elmes
9876c30d89 tidy up Qt import 2020-05-20 13:38:55 +10:00
Damien Elmes
1d4fd50d8b
Merge pull request #626 from evandroforks/fix_previewer_button
Fixed previewer button not resetting the state when the preview
2020-05-20 12:48:17 +10:00
evandrocoan
3ea6f685b2 Added missing Anki icon to qt/aqt/previewer.py 2020-05-19 19:43:18 -03:00
evandrocoan
3dcfd57b07 Fixed previewer button not resetting the state when the preview
window is closed by its X button
2020-05-19 19:24:54 -03:00
Damien Elmes
351d8a309f move autoplay() into card 2020-04-13 09:04:30 +10:00
Damien Elmes
10eb947402 fix replay audio again, and decouple the code from the reviewer 2020-04-13 08:59:36 +10:00
Damien Elmes
61793f92b8 fix preview closing
https://anki.tenderapp.com/discussions/beta-testing/1868-anki-2124-beta#comment_48228480
2020-04-08 16:21:20 +10:00
Damien Elmes
6cf3b0ca18 add type checking to previewer 2020-04-03 09:13:33 +10:00
Damien Elmes
6049e15dac add missing license header 2020-04-03 09:05:32 +10:00
Damien Elmes
5f9c126caa fix some errors in the previewing code 2020-04-03 09:00:08 +10:00
Damien Elmes
4790fec881 render() conflicts with Qt method 2020-04-03 08:29:35 +10:00
Damien Elmes
de79087620 be explicit that the method is a no-op 2020-04-03 08:27:56 +10:00
Damien Elmes
f5e0ad8fad tweak wording 2020-04-03 08:27:26 +10:00
Arthur Milchior
cd1fd6f9a2 snake case 2020-04-02 17:44:06 +02:00
Arthur Milchior
00d04cd6c9 Previewer is a QDialog
As suggested by Glutanimate in https://github.com/ankitects/anki/pull/532#discussion_r401256921
2020-04-02 17:44:06 +02:00
Arthur Milchior
6564f00748 Previewer: parent become private
It seems parent is a method of QDialog, so it creates a typing problem
2020-04-02 17:44:06 +02:00
Arthur Milchior
31f2f60757 Methods used by browser are not public
As suggested by Glutanimate on https://github.com/ankitects/anki/pull/532#discussion_r401254100
2020-04-02 17:44:06 +02:00
Arthur Milchior
0e21978577 remove the word preview from previewer variable
As suggested by glutanimate https://github.com/ankitects/anki/pull/532#discussion_r401255290
2020-04-02 17:44:06 +02:00
Arthur Milchior
92cec5c327 removing PreviewDialog dataclass
It can be replaced by the previewer itself. As suggested by
Glutanimate https://github.com/ankitects/anki/pull/532#discussion_r401252970
2020-04-02 17:44:06 +02:00
Arthur Milchior
c722b5bd2c PreviewerListCards can take cids and class
This allow to avoid recomputing a card if it is known, while allowing
to compute it until it's actually displayed
2020-04-02 17:44:06 +02:00
Arthur Milchior
b76ee6f8e5 ListCardsPreviewer 2020-04-02 17:44:06 +02:00
Arthur Milchior
c4a38c5e36 Split PreviewerBrowser into a hierarchy
A part in common to see multiple cards. And a part specific for the browser
2020-04-02 17:44:06 +02:00