Commit Graph

2502 Commits

Author SHA1 Message Date
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
133e22dbe4 Fix ResourceWarning: unclosed file <_io.BufferedWriter name=5>
https://forums.ankiweb.net/t/aqt-sound-py-resourcewarning-unclosed-file-io-bufferedwriter-name-5/13070
2021-09-08 21:02:12 -03:00
evandrocoan
e295c4ccfb Fix #1355 2021-09-07 23:53:47 -03:00
Ren Tatsumoto
de974f94db avoid possible performance hit 2021-09-05 16:10:34 +03:00
Ren Tatsumoto
7451ad68b1 fix test complaints 2021-09-05 15:04:24 +03:00
Ren Tatsumoto
9ff37d9baa Add a hook for modifiying pasted MIME data 2021-09-05 13:52:54 +03:00
Damien Elmes
1ae45c5445 quote fonts added via the Add Field dialog 2021-09-02 21:05:16 +10:00
Damien Elmes
ab20f215b1
Merge pull request #1349 from RumovZ/rename-with-parents
Disable 'Rename with Parents' for top-level items
2021-08-30 22:27:44 +10:00
RumovZ
d044360ff9 Disable 'Rename with Parents' for top-level items 2021-08-30 11:10:14 +02:00
RumovZ
3c53a961a3 Reset flags when loading a profile...
... not only on startup.
2021-08-30 11:07:40 +02:00
Damien Elmes
dc156f3471
Merge pull request #1344 from glutanimate/add-dialog-manager-hooks
Add a hook for subscribing to dialog creation / opening
2021-08-29 11:36:11 +10:00
Damien Elmes
395119bafe
Merge pull request #1345 from hgiesel/windowsfocus
Use different artificial reviewer button highlight for Windows
2021-08-29 11:35:32 +10:00
Damien Elmes
e4f8ba000e more checks for package name
Follows up #1343
2021-08-29 11:23:47 +10:00
Henrik Giesel
3b90b27095 Use different artificial reviewer button highlight for Windows 2021-08-28 21:30:07 +02:00
Glutanimate
5eac3b9061 Add a hook for subscribing to dialog creation / opening 2021-08-28 20:37:31 +02:00
bluegreenmagick
20424a7ef7 Fix bug when add-on package string is ""
which deleted the entire add-on folder
2021-08-27 21:49:55 +09:00
Damien Elmes
94a0355389 avoid spurious warning in addcards startup 2021-08-20 11:37:23 +10:00
Damien Elmes
886ce15f27 mark old editing code as deprecated
https://forums.ankiweb.net/t/emacs-style-shortcuts-with-ctrl-t-in-the-editor-in-45/12280/6
2021-08-20 11:37:11 +10:00
Damien Elmes
f6ae0b73be show v3 scheduler in error info 2021-08-20 10:47:41 +10:00
Damien Elmes
79cf49f38d fix default deck being shown in deck options deck prompt 2021-08-19 12:33:36 +10:00
Damien Elmes
d92913eb8c preferences update needs to be a collection op
- fixes https://forums.ankiweb.net/t/v3-bug-card-modified-without-updating-queue/12418
- fixes undo menu not updating after closing preferences screen
2021-08-19 10:47:55 +10:00
Damien Elmes
b9d42af423 add a small .wait() after terminating player process
Avoids python3.8/subprocess.py:942:
ResourceWarning: subprocess 90387 is still running
  _warn("subprocess %s is still running" % self.pid,
2021-08-19 10:33:56 +10:00
Damien Elmes
79fbf9ad3e
Merge pull request #1333 from kelciour/mpv-property-list-timeout
A possible fix for "mpv timed out, restarting"
2021-08-18 16:39:50 +10:00
Damien Elmes
273be14fd3
Merge pull request #1331 from hikaru-y/fix-fragment-autoplay
Fix <audio>/<video> with 'autoplay' issue
2021-08-18 16:37:14 +10: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
546d32cfda ctrl+alt+n for forget
https://forums.ankiweb.net/t/anki-2-1-44-make-cards-new/12247/7
2021-08-18 15:32:45 +10:00
Damien Elmes
40c1a86a25 add symlink to generated icons.qrc
Otherwise Qt Designer tries to remove the reference.
2021-08-18 15:32:45 +10:00
kelciour
fae816e68e A possible fix for "mpv timed out, restarting"
https://forums.ankiweb.net/t/anki-wont-open-mpv-timed-out/7579/6
2021-08-18 00:47:04 +03:00
hikaru-y
dd9528aa73 Silence 'link preload' warning on the first card
Due to 207e425, a harmless warning about 'link preload' will be output
to the console on the first card.
2021-08-18 02:25:51 +09:00
Arthur Milchior
7568eda031 Add Card history: keep & instead of replacing them by underline 2021-08-15 06:32:03 +02:00
Damien Elmes
57f3d300bb fix deprecation warning in modelchooser.py 2021-08-04 12:05:11 +10:00
Damien Elmes
5de3918dbf fix notetype selection in import screen
Accidental rename in "PEP8 cards.py"
2021-08-04 12:01:28 +10:00
Damien Elmes
fc931c3edb fix redo menu item showing undo text 2021-08-04 10:28:45 +10:00
Henrik Giesel
357a6c5cc6 Add toggle sticky shortcuts F9 and Shift+F9 2021-08-03 05:52:07 +02:00
Damien Elmes
87f9bd8021
Merge pull request #1320 from hgiesel/colorpickerplus
Remember last text and highlight color again
2021-08-03 09:07:46 +10:00
Henrik Giesel
4db7cebf62 Remember last text and highlight color again 2021-08-02 23:12:00 +02:00
Damien Elmes
528343b417
Merge pull request #1319 from abdnh/sidebar-scroll-center
Use PositionAtCenter for sidebar scrolling
2021-08-02 18:35:38 +10:00
Damien Elmes
f0b8b10314
Merge pull request #1311 from hikaru-y/flag-mark-icons-in-previewer
Show flag and mark icons in previewer
2021-08-02 18:33:36 +10:00
abdo
ad6f5c7404 Use PositionAtCenter for sidebar scrolling 2021-08-02 10:57:54 +03:00
Damien Elmes
c6c9721c53 update congrats screen periodically; automatically move back to study 2021-08-02 16:05:18 +10:00
Damien Elmes
d077d9509a fix study deck->add deck->cancel 2021-07-30 11:35:55 +10:00
Damien Elmes
68dddfe93b prevent hiding of sidebar
https://forums.ankiweb.net/t/browser-format-issues/11504/10
2021-07-28 11:14:09 +10:00
hikaru-y
80e15ff6aa Show flag and mark icons in previewer 2021-07-26 20:13:42 +09: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
4e133e7d8a
Merge pull request #1303 from Arthur-Milchior/paste_post_hook
Add a hook to execute after pasting in a field
2021-07-26 11:01:29 +10:00
RumovZ
a7315732f6 Prevent DeckChooser from setting filtered deck 2021-07-25 08:54:39 +02:00
Arthur Milchior
3dbe44217b Add a hook to execute after pasting in a field
I expect to use it to ensure that images are resizable after they get pasted in a field
2021-07-25 01:53:25 +02:00
Damien Elmes
e7189f4af5 fix ugly js confirm box
https://forums.ankiweb.net/t/2-1-45-release-candidate/11362/2
2021-07-24 22:04:06 +10:00
Damien Elmes
cd9f8d883c clarify deck description message
+ drop the reference to overview screen
2021-07-24 21:45:09 +10:00
Damien Elmes
7043e6f6f3 drop traceback in importing error message 2021-07-24 20:05:32 +10:00
Damien Elmes
e1f9d0fc1b fix Python lints 2021-07-23 20:22:32 +10:00
RumovZ
f2f19e8b45 Remove native HelpPage enum
Also remove oneof from pb enum and handle strs in Python.
2021-07-22 16:32:49 +02:00
RumovZ
d8d69a3810 Switch frontend to use backend links 2021-07-22 10:07:13 +02:00
RumovZ
0d45df8551 Fix browser search completer
Adding an empty entry at the top fixes
https://forums.ankiweb.net/t/anki-2-1-45-beta/10664/45
and allows for scrolling back to an empty line.
2021-07-17 12:23:19 +02:00
Damien Elmes
cba0735c59
Merge pull request #1297 from hgiesel/browsershortcuts
Allow Using Ctrl+Shift+P from Browser when focusing Qt components
2021-07-17 15:18:36 +10:00
Henrik Giesel
22e735266e Remove unnecessary lambda 2021-07-17 04:17:28 +02:00
Henrik Giesel
fb56576e36 Allow Using Ctrl+Shift+P from Browser when focusing Qt components 2021-07-17 03:39:27 +02: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
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
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
87185d5365
Merge pull request #1288 from evandroforks/clayout_next_card_shortcut
Created shortcut to switch between card types on clayout.py
2021-07-16 10:51:40 +10:00
Damien Elmes
96e6e216a7
Merge pull request #1293 from RumovZ/find-and-replace
Find & Replace
2021-07-16 10:47:16 +10:00
Damien Elmes
e97c381a6f Revert "stop (un)escaping media filenames"
This was flawed - while non-Latin text is now acceptable
in an IRI, we still need to be concerned with reserved characters
such as spaces, and Anki unfortunately has been storing the filenames
in unencoded form in the DB, meaning we must encode them at display
time. We won't be able to move away from this until existing notes
are rewritten, and it will probably require breaking compatibility with
older clients.

https://en.wikipedia.org/wiki/Internationalized_Resource_Identifier

This reverts commit 14110add55.
2021-07-16 10:37:59 +10: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
RumovZ
9f777ad009 Remove redundant QueryOp in rename_deck() 2021-07-15 08:56:47 +02:00
Damien Elmes
33afe8aa32 support numpad enter in type answer
https://forums.ankiweb.net/t/anki-2-1-45-beta/10664/149

regression introduced in f4f0298378
2021-07-15 14:46:39 +10:00
RumovZ
3a1f8d4241 Remove unused name prefix of sidebar templates 2021-07-13 16:41:50 +02:00
RumovZ
eab51dce40 Add sidebar actions
- Find & Replace for notetype fields
- Rename with Parents for decks and tags
2021-07-13 16:34:02 +02:00
RumovZ
a5193339e7 Rework Find & Replace dialog:
- Add option to affect whole collection
- Allow to open without selection
- Add parameter for presetting field
2021-07-13 16:33:45 +02:00
Damien Elmes
780a254ac8
Merge pull request #1291 from RumovZ/addon-cols
Show key of unknown browser columns
2021-07-13 13:35:54 +10:00
RumovZ
51af0ba7d4 Show key of unknown browser columns 2021-07-12 19:03:51 +02:00
RumovZ
e24f562f8c Add mock browser model to support legacy resetting 2021-07-12 12:36:26 +02:00
Damien Elmes
e61a611af7 rename Config in protobuf to avoid conflict with module name
+ use the enum directly, instead of wrapping it in an object

Python code retains the old "Config" name.
2021-07-11 19:27:08 +10:00
Damien Elmes
7ac1fa17e6 move proto files into separate py_library in same namespace
Will allow importing the Protobuf without pulling in the rest of
the library. This is not a full PEP420 namespace, and the wheel still
bundles everything - it just makes things easier in a Bazel workspace.
I originally tried with PEP420, but it required more invasive changes,
and I ran into issues with mypy.
2021-07-11 14:51:25 +10:00
Damien Elmes
616db33c0e refactor protobuf handling for split/import
In order to split backend.proto into a more manageable size, the protobuf
handling needed to be updated. This took more time than I would have
liked, as each language handles protobuf differently:

- The Python Protobuf code ignores "package" directives, and relies
solely on how the files are laid out on disk. While it would have been
nice to keep the generated files in a private subpackage, Protobuf gets
confused if the files are located in a location that does not match
their original .proto layout, so the old approach of storing them in
_backend/ will not work. They now clutter up pylib/anki instead. I'm
rather annoyed by that, but alternatives seem to be having to add an extra
level to the Protobuf path, making the other languages suffer, or trying
to hack around the issue by munging sys.modules.
- Protobufjs fails to expose packages if they don't start with a capital
letter, despite the fact that lowercase packages are the norm in most
languages :-( This required a patch to fix.
- Rust was the easiest, as Prost is relatively straightforward compared
to Google's tools.

The Protobuf files are now stored in /proto/anki, with a separate package
for each file. I've split backend.proto into a few files as a test, but
the majority of that work is still to come.

The Python Protobuf building is a bit of a hack at the moment, hard-coding
"proto" as the top level folder, but it seems to get the job done for now.

Also changed the workspace name, as there seems to be a number of Bazel
repos moving away from the more awkward reverse DNS naming style.
2021-07-10 19:17:05 +10: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
Damien Elmes
c322f68ab8 more friendly message for v2 import into v1 2021-07-08 10:32:27 +10:00
Damien Elmes
44ef810f67
Merge pull request #1277 from RumovZ/config-keys
Add constants for literal config keys
2021-07-07 09:14:40 +10:00
RumovZ
5067622751 Add pylib/browser.py for literal config keys
Also, remove config bools for sort order.
2021-07-05 12:44:48 +02: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
581c3e2486
Merge pull request #1273 from hgiesel/macshortcuts
Execute Ctrl+C/V/X/A via execCommand in editor
2021-07-04 16:02:52 +10:00
Damien Elmes
a54f181ae0 remove old Mac shortcut code completely
The shortcuts seem to work correctly without it on Qt 5.14, so this
code seems to have only been required for older Qt releases.
2021-07-04 16:00:23 +10:00
Damien Elmes
209a646d63
Merge pull request #1271 from hikaru-y/preload-images
Preload answer images
2021-07-04 15:50:55 +10:00
Damien Elmes
1e57693b36
Merge pull request #1270 from RumovZ/flag-manager
Add flag manager and hook
2021-07-04 15:45:11 +10:00
Damien Elmes
14110add55 stop (un)escaping media filenames
Back in the WebKit days, images with Unicode filenames would fail to
appear if they weren't percent-escaped. This no longer seems to be the
case - with this patch, images appear correctly on the Mac and Windows
platforms I tested with.

Fixes https://forums.ankiweb.net/t/anki-2-1-45-beta/10664/96
Fixes #1219
2021-07-04 15:27:29 +10:00
hikaru-y
9782d39ced Preload images to be displayed on answer side 2021-07-03 21:33:00 +09:00
Henrik Giesel
5989fb8ef6 Satisfy qt formatter 2021-07-03 01:54:10 +02:00
Henrik Giesel
7f7e5c2702 Execute Ctrl+C/V/X/A through execCommand in editor (so we can customize it) 2021-07-03 01:48:49 +02: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
Henrik Giesel
24af5bada3 More uniform file naming
kebap-case for .ts, .scss, .html, and directories
2021-07-01 12:24:16 +02:00
Henrik Giesel
8edcc54aae Add flag icons from mdi after all
- This way, we can also use their modifier versions with little pluses/minuses
2021-07-01 01:16:50 +02:00
Henrik Giesel
bcfbd2f680 Remove multiple icons, new notetype/cardtype icons 2021-07-01 01:12:11 +02:00
Henrik Giesel
fe7057b3f2 Remove name_prefix from field sidebar item 2021-06-30 21:02:23 +02:00