Commit graph

3666 commits

Author SHA1 Message Date
Damien Elmes
4abc0eb8b8 Use same version for anki-release; publish to main index 2025-06-20 16:13:50 +07:00
Damien Elmes
a60a955c61 Handle beta/rc tags, bump beta, add exact version pin to aqt 2025-06-20 16:13:50 +07:00
Damien Elmes
a41c60c016 Trigger uv sync if user approves update 2025-06-20 16:13:50 +07:00
Damien Elmes
8e20973c52 Drop remaining qt5 code 2025-06-20 16:13:50 +07:00
Damien Elmes
cd411927cc Split libankihelper into a separate module
It's rarely updated, and the old approach resulted in a 'proper' aqt
build only being done on a Mac.
2025-06-20 16:13:49 +07:00
Damien Elmes
f98f620116 Avoid committing release deps
These will only get bumped on a new publish, and keeping the file
around leads to spurious security alerts.
2025-06-19 14:14:57 +07:00
Damien Elmes
04996c77f3
Migrate build system to uv (#4074)
* Migrate build system to uv

Closes #3787, and is a step towards #3081 and #4022

This change breaks our PyOxidizer bundling process. While we probably
could update it to work with the new venvs & lockfile, my intention
is to use this as a base to try out a uv-based packager/installer.

Some notes about the changes:

- Use uv for python download + venv installation
- Drop python/requirements* in favour of pyproject files / uv.lock
- Bumped to latest Python 3.9 version. The move to 3.13 should be
a fairly trivial change when we're ready.
- Dropped the old write_wheel.py in favour of uv/hatchling. This has
the unfortunate side-effect of dropping leading zeros in our wheels,
which we could try hack around in the future.
- Switch to Qt 6.7 for the dev repo, as it's the first PyQt version
with a Linux/ARM WebEngine wheel.
- Unified our macOS deployment target with minimum required for ARM.
- Dropped unused fluent python files
- Dropped unused python license generation
- Dropped helpers to run under Qt 5, as our wheels were already
requiring Qt 6 to install.

* Build action to create universal uv binary

* Drop some PyOxidizer-related files

* Use Windows ARM64 cargo/node binaries during build

We can't provide ARM64 wheels to users yet due to #4079, but we can
at least speed up the build.

The rustls -> native-tls change on Windows is because ring requires
clang to compile for ARM64, and I figured it's best to keep our Windows
deps consistent. We already built the wheels with native-tls.

* Make libankihelper a universal library

We were shipping a single arch library in a purelib, leading to
breakages when running on a different platform.

* Use Python wheel for mpv/lame on Windows/Mac

This is convenient, but suboptimal on a Mac at the moment. The first
run of mpv will take a number of seconds for security checks to run,
and our mpv code ends up timing out, repeating the process each time.
Our installer stub will need to invoke mpv once first to get it validated.

We could address this by distributing the audio with the installer/stub,
or perhaps by putting the binaries in a .pkg file that's notarized+stapled
and then included in the wheel.

* Add some helper scripts to build a fully-locked wheel

* Initial macOS launcher prototype

* Add a hidden env var to preload our libs and audio helpers on macOS

* qt/bundle -> qt/launcher

- remove more of the old bundling code
- handle app icon

* Fat binary, notarization & dmg

* Publish wheels on testpypi for testing

* Use our Python pin for the launcher too

* Python cleanups

* Extend launcher to other platforms + more

- Switch to Qt 6.8 for repo default, as 6.7 depends on an older
libwebp/tiff which is unavailable on newer installs
- Drop tools/mac-x86, as we no longer need to test against Qt 5
- Add flags to cross compile wheels on Mac and Linux
- Bump glibc target to 2_36, building on Debian Stable
- Increase mpv timeout on macOS to allow for initial gatekeeper checks
- Ship both arm64 and amd64 uv on Linux, with a bash stub to pick
the appropriate arch.

* Fix pylint on Linux

* Fix failure to run from /usr/local/bin

* Remove remaining pyoxidizer refs, and clean up duplicate release folder

* Rust dep updates

- Rust 1.87 for now (1.88 due out in around a week)
- Nom looks involved, so I left it for now
- prost-reflect depends on a new prost version that got yanked

* Python 3.13 + dep updates

Updated protoc binaries + add helper in order to try fix build breakage.
Ended up being due to an AI-generated update to pip-system-certs that
was not reviewed carefully enough:
https://gitlab.com/alelec/pip-system-certs/-/issues/36

The updated mypy/black needed some tweaks to our files.

* Windows compilation fixes

* Automatically run Anki after installing on Windows

* Touch pyproject.toml upon install, so we check for updates

* Update Python deps

- urllib3 for CVE
- pip-system-certs got fixed
- markdown/pytest also updated
2025-06-19 14:03:16 +07:00
Damien Elmes
a63e4ef1c8 Revert "Ignore TaskManager's on_done callback if collection unloaded (#4076)"
This reverts commit ccc42227d8.

Closes #4094
2025-06-19 13:17:30 +07:00
llama
669312d5eb
Fix unescaped deck names potentially missing from overview (#4084)
* html-escape deck name in overview

* move escaping past hook
2025-06-18 11:35:02 +07:00
Abdo
ccc42227d8
Ignore TaskManager's on_done callback if collection unloaded (#4076)
* Ignore TaskManager's on_done callback if collection unloaded

* Check col.db
2025-06-13 10:45:41 +07:00
Damien Elmes
50b7588231
Treat play_file() and co as internal routines without protection (#4059)
* Treat play_file() and co as internal routines without protection

Our code and add-ons need a way to play audio from arbitrary locations. I propose we treat the _tag API as suitable for user input, and the _file API for internal use.

* Mention basename in the *_file() paths
2025-06-06 12:55:04 +07:00
Ren Tatsumoto
29e3146e1f
trim file to basename before creating SoundOrVideoTag (#4057)
* trim file to basename before creating SoundOrVideoTag

* add import
2025-06-04 18:03:14 +07:00
llama
996fa8bcb0
add answer key shortcuts to grade now dialog (#4055) 2025-06-04 12:15:33 +07:00
Damien Elmes
37984233cc Restore cert error check
https://forums.ankiweb.net/t/bug-unknown-error-on-startup-anki-25-02/61232/3
2025-06-02 16:52:09 +07:00
Damien Elmes
f81a9bfdfb
Fix mpv being left around on abrupt termination (#4042)
Closes #4015
2025-06-01 13:16:28 +07:00
Damien Elmes
96ff27d1fb
Ensure media files are passed relative to the media folder (#4041)
We were (partially) doing this for MpvManager, but not for
Windows' SimpleMpvPlayer. By passing a media file starting
with a special scheme, a malicious actor could have caused a file to
be written to the filesystem on Windows.

Thanks once again to Michael Lappas for the report.
2025-06-01 13:16:04 +07:00
Damien Elmes
757247d424 Use more secure API key
https://github.com/ankitects/anki/pull/3925#discussion_r2051494659
2025-05-31 16:01:03 +07:00
Damien Elmes
6cdebd7638 Fix inverted margin logic
https://github.com/ankitects/anki/pull/4040#issuecomment-2921626962
2025-05-30 22:48:31 +07:00
llama
f9f0894162
Add left margin to browser when sidebar is closed (#4040)
* add left margin to browser when sidebar is closed

* listen for event instead of explicit user action

* refresh sidebar on visibility change

* Add a margin on macOS even when not collapsed

---------

Co-authored-by: Damien Elmes <gpg@ankiweb.net>
2025-05-30 13:35:06 +07:00
Marvin Kopf
7a8b4a193f
offload mpv callback registration to background thread to avoid UI blocking (#4038)
Instantiating `MPV(MPVBase)` triggers multiple synchronous `command()` calls to the mpv process during callback registration. These calls block the main thread and degrade startup performance. This change defers registration via `taskman.run_in_background`.
2025-05-30 13:05:06 +07:00
Luc Mcgrady
f29bcb743b
Feat/Desired retention warning improvements (#3995)
* Feat/90% desired retention warning

* Update ftl/core/deck-config.ftl

* show on newly enabled

* Show warning on focus

* Never hide warning

* Display relative change

* Add: Separate warning for too long and short

* Revert unchanged text changes

* interval -> workload

* Remove dead code

* fsrs-rs/@L-M-Sherlock's workload calculation

* Added: delay

* CONSTANT_CASE

* Fix: optimized state

* Removed "Processing"

* Remove dead code

* 1 digit precision

* bump fsrs-rs

* typo

* Apply suggestions from code review

Co-authored-by: Damien Elmes <dae@users.noreply.github.com>

* Improve rounding

* improve comment

* rounding <1%

* decrease rounding precision

* bump ts-fsrs

* use actual cost values

* ./check

* typo

* include relearning

* change factor wording

* simplify sql

* ./check

* Apply suggestions from code review

Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>

* Fix: missing search_cids

* @dae's style patch

* Fix: Doesn't update on arrow keys change

* force two lines

* center two lines

---------

Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>
2025-05-27 13:07:21 +10:00
GithubAnon0000
6a1d55ae75
ADD myself to about.py (#4026) 2025-05-22 22:55:37 +10:00
Luc Mcgrady
8694b3b410
Use non breaking spaces for names on about page (#4025)
* use non breaking spaces for names on about page

* Update qt/aqt/about.py

Co-authored-by: llama <gh@siid.sh>

---------

Co-authored-by: llama <gh@siid.sh>
2025-05-22 22:55:15 +10:00
GithubAnon0000
e989564be2
FIX borken support link (#4019)
https://github.com/ankitects/anki/issues/4017
2025-05-22 21:40:13 +10:00
Emmanuel Ferdman
8a61a5470c
Resolve Python regex library warnings (#4012)
* Resolve Python regex library warnings

Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>

* Add CONTRIBUTORS

Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com>
2025-05-19 13:29:54 +10:00
Damien Elmes
d3d6bd8ce0 Skip ytdl flag on macOS ARM
Fixes sounds failing to play in the packaged build on macOS.
2025-05-15 19:04:26 +10:00
llama
413b73d9f4
fix onNote potentially discarding editor field changes (#4001) 2025-05-15 16:48:56 +10:00
Adnane Taghi
f96c8c2ac8 Make URL schemes dialog more ergonomic (#4002)
(originally merged into a PR branch)

* Make URL schemes dialog more ergonomic

* add name to contributors list

* Title Case

* Tweak build instructions so Cursor picks them up

* Use a warning icon for the URL scheme pop-up

* Default to cancelling
2025-05-15 16:17:33 +10:00
Damien Elmes
86c89907e7
Add URL scheme whitelist (#3994)
* Add experimental Cursor rules

* Add the ability to customize URL schemes

Closes #3965
2025-05-15 15:37:49 +10:00
Luc Mcgrady
f7cdf4eb9e
Fix/Leech suspended tooltip (#3992)
* Fix/Leech suspended popup

* extra check

* Fix: None check

* move comment
2025-05-15 15:14:10 +10:00
Damien Elmes
5080451829 Disable YouTube DL in mpv
mpv looks for ytdl on the path, which includes the CWD on Windows.
A malicious shared deck could place an executable called yt-dlp.exe in the
media folder, which mpv would then helpfully invoke the first time
a YouTube link was encountered.

A big thank you to Michael Lappas for the report.
2025-05-10 19:31:06 +10:00
llama
9025202204
properly construct file url when opening image/folder on linux (#3986) 2025-05-08 23:29:46 +10:00
Abdo
80618cad85
Clear notetypes cache on import (#3969)
* Clear notetypes cache on import

* Clear cache in AnkiQt.on_operation_did_execute() instead
2025-05-08 23:11:47 +10:00
Damien Elmes
d1bb69aaec Remove unused import 2025-05-05 18:08:31 +10:00
Abdo
b84f2d7873
Use correct debug scripts folder (#3973) 2025-05-05 17:26:04 +10:00
Jarrett Ye
92cfb7340e
add ellipsis to Grade Now (#3970)
* add ellipsis to Grade Now

* Revert "add ellipsis to Grade Now"

This reverts commit 8a3cf51c9e.

* add ellipsis to Grade Now
2025-04-29 16:43:14 +10:00
llama
51b5086b01
Fix unescaped deck names missing from tooltips when deleted (#3960) 2025-04-29 02:18:56 +03:00
Evgeny Kulikov
2acdc8c30a
Close only "child" window (e.g. Preview) inside Browser on Cmd+W (#3913)
Currently, if a user tries to close Preview which was opened inside Browse, the "parent" Browse window itself gets closed

Co-authored-by: beyondcompute <beyondcompute@users.noreply.github.com>
2025-04-27 18:25:20 +10:00
JL710
62bad44eed
add toggle for browser sidebar (#3953)
* add toggle for browser sidebar

* Update CONTRIBUTORS
2025-04-27 18:22:56 +10:00
Damien Elmes
365d50012c Add another contributor to the about screen as requested 2025-04-25 18:42:54 +10:00
Jonathan Schoreels
863fe3cd50
Add a way to pass information from browser_will_search to browser_did_search without having it going to the backend (#3945)
* Add a way to pass information from browser_will_search to browser_did_search without having it going to the backend

* Allow None for SearchContext.properties

* Adding myself in CONTRIBUTORS

* Rename SearchContext.properties to SearchContext.addon_metadata

* Revert "Adding myself in CONTRIBUTORS"

This reverts commit a993577279.

* Reapply "Adding myself in CONTRIBUTORS"

This reverts commit f3ce51c83d.
2025-04-25 18:40:24 +10:00
Evgeny Kulikov
fe2c1510ca
Add Cmd+W close shortcut (on Mac) to more dialogs (#3905)
* Enable Cmd+W shortcut in "Edit Current" on Mac

* Enable Cmd+W shortcut in "Fields" editor on Mac

* Enable Cmd+W shortcut in "Cards" editing on Mac

* Enable Cmd+W shortcut in "Sync" tab modal on Mac

* Enable Cmd+W shortcut in "Custom Study" tab modal on Mac

* Enable Cmd+W shortcut in Settings view on Mac

* Enable Cmd+W shortcut in Export dialogs on Mac

* Enable Cmd+W shortcut for getText dialog on Mac

* Enable Cmd+W shortcut in "Change Deck" on Mac

* Enable Cmd+W shortcut in Reposition dialog on Mac

* Enable Cmd+W shortcut in "Grade Now" dialog on Mac

* Enable Cmd+W shortcut in "Reset…" dialog on Mac

* Remove duplicate camelCase variant of add_close_shortcut (dae)

- The camelCase variant will remain accessible with a warning.
- The removed setattr line is legacy cruft, and wasn't doing anything.
2025-04-24 18:53:01 +10:00
Arthur Milchior
efaaae8ce4
Cloze button get disabled outside of cloze field (#3879)
* NF: replace `disabled` by `enabled`

This allows to remove the negations and, in my opinion, make the code
easier to understand and edit.

* Cloze button get disabled outside of cloze field

More specifically, if the user focus in a field that is not a cloze
field, the button are still there but appear as disabled. The shortcut
instead of adding the cloze context shows an alert explaining why this
can't be done.

While this message is already displayed when the user tries to add a
note with cloze in non-cloze field, I suspect it will save time to
stop the user as soon as possible from making mistake. This should
make very clear what is authorized and what is not.

It'll also be a reminder of whether the current field is a cloze or
not.

In order to do this, I added a back-end method (that I expect we may
reuse in ankidroid) to get the index of the fields used in cloze. This
set is sent to the note editor, which propagates it where needed.

In mathjax, the cloze symbol is removed when the selected field is not
a cloze field.
2025-04-24 18:37:41 +10:00
Damien Elmes
b23a6af63e Restore ability to check pages externally on other devices
Broken by the recent security changes
2025-04-24 18:33:09 +10:00
Aristotelis
79b19a17a3
Add add-on scripts to editor CSP (#3942) 2025-04-24 15:28:25 +10:00
Damien Elmes
1e74e8e86e
Fix add-on buttons not working in the editor (#3941)
* Fix add-on buttons not working in the editor

* Ensure old listeners are cleaned up

Thanks to iamllama: https://github.com/ankitects/anki/pull/3941#discussion_r2057066283
2025-04-24 15:26:46 +10:00
Damien Elmes
ddb8573e8d
Use CSP to block inline JS content in editor (#3939)
* Revert "Sanitize field content in editor"

This reverts commit 1c156905f8.

* Use CSP to block inline JS content in editor

This blocks inline scripts, scripts in the media folder, and
handlers like onclick in the editor. This is nicer than the previous
solution - it doesn't make any permanent changes, and leaves other
content like SVGs alone. Thanks to Nil Admirari for the suggestion.
2025-04-23 16:21:48 +10:00
Aristotelis
5b0f371791
Fix AnkiWebPage not being initialized for default web view kinds (e.g. in add-ons) (#3933)
* add AnkiWebView subclasses for stats, empty cards and find dupes ui

* update ui files to use subclassed webviews instead

* remove superfluous calls to AnkiWebView.set_kind

* Avoid set_kind() race condition in legacy stats webview

Replacing the web view is a hacky workaround, but likely a reasonable compromise for a legacy view that we do not want to maintain a separate Qt form for.

* Slightly refactor AnkiWebView subclass creation and tweak inline comment

+ Extend create_ankiwebview_subclass() with the ability to set any
  init time AnkiWebView argument
+ Introduce some nice-to-haves in terms of static type checking support
  and IDE autocompletion
+ Mark helper function as private to discourage add-on use

* Drop `AnkiWebView.set_kind` completely

There no longer is an Anki-internal use case for changing the web view kind after initializing a web view, and add-ons almost certainly do not have any use for it either.

Given that setting the kind after web view construction can lead  to known race conditions with `domDone` signals, we should remove this method to discourage uses like this in both Anki code and add-on consumers.

There currenty only seems to be one add-on calling `set_kind()`, so this seem like a justifiable API change.

---------

Co-authored-by: llama <100429699+iamllama@users.noreply.github.com>
2025-04-22 21:22:40 +10:00
llama
a74fd74631
Fix flashing when opening the stats, empty cards or find dupes dialogs (#3928)
* add AnkiWebView subclasses for stats, empty cards and find dupes ui

* update ui files to use subclassed webviews instead

* remove superfluous calls to AnkiWebView.set_kind

* revert impl

* set page background colour after setPage in AnkiWebView.set_kind
2025-04-17 15:18:55 +03:00
Damien Elmes
1a68c9f5d5
Harden access to internal API (#3925)
* Sanitize field content in editor

The editor already strips script tags from fields, but was allowing
through Javascript in things like onclick handlers. We block this now,
as the editor context has access to internal APIs that we don't want to
expose to untrusted third-party code.

* Require an auth token for API access

We were previously inspecting the referrer, but that is spoofable,
and doesn't guard against other processes on the machine.

To accomplish this, we use a request interceptor to automatically
add an auth token to webviews with the right context. Some related
changes were required:

- We avoid storing _page, which was leading to leaks & warning on exit
- At webview creation (or set_kind() invocation), we assign either
an authenticated or unauthenticated web profile.
- Some of our screens initialize the AnkiWebView when calling, e.g.,
aqt.forms.stats.Ui_Dialog(). They then immediately call .set_kind().
This reveals a race condition in our DOM handling code: the webview
initialization creates an empty page with the injected script, which
causes a domDone signal to be sent back. This signal arrives after
we've created another page with .set_kind(), causing our code to think
the DOM is ready when it's not. Then when we try to inject the dynamic
styling, we get an error, as the DOM is not ready yet. In the absence
of better solutions, I've added a hack to set_kind() to deal with this
for now.

* Provide AnkiWebPage init defaults for existing add-on callers

* Inject bridge script when profile set-up skipped

Some add-ons fully override AnkiWebPage.__init__ and thus depend on _setupBridge injecting the JS bridge script.

With this change we account for these cases, while giving add-ons the opportunity to look for solutions that do not require overriding AnkiWebPage.__init__ completely.

* Add some missed pages/endpoints (thanks to iamllama)

* Avoid sending API key for remote resources

Thanks to Abdo for the report

---------

Co-authored-by: Aristotelis P <201596065+aps-amboss@users.noreply.github.com>
2025-04-17 11:15:10 +10:00
llama
1d2d6e51b9
Fix error when middle clicking in editor on systems w/o global mouse selection (#3923)
* fix potential error when middle clicking in editor

* update about.py
2025-04-15 20:26:18 +10:00
Luc Mcgrady
781a23c6c4
Feat/Ignored before card count (#3910)
* GetIgnoredBeforeCount

* get_card_count_with_ignore_before

* Included / total

* Respect search

* Get frontend hooked up

* Fix: Malformed sql and search

* Variable names

* Added: Alert colours

* i18n

* ./check

* Remove console.log

* Fix: Tooltip showing for default value

* Update ftl/core/deck-config.ftl

Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>

* Fix: Multiple backend calls

* Message: (Approximately)

* Fix: Bouncing info message

* Added: Change delay

* Added: ignore_before_updated

* ./check

* Fix typing, camelCase and improve wording

* Temporarily enable the check on startup

---------

Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>
2025-04-15 20:21:54 +10:00
(x⋅ln(7))⁻¹
369dec9319
Add an option to disable middle click to paste on Linux (#3904)
* Add checkbox

* Working in editor

* Toolbar webview

* Other webviews

* Even more webviews

* Move to profile settings

* Add to contributors [skip ci]

* Fix checks

* Fix checks

* Better?

* Remove unneded

* Remove checkbox and a few other things

* How the hell did that happen

* Undo FTL changes (dae)

* Remove superfluous config entry (dae)

* Add comment about profile keys (dae)
2025-04-15 19:51:00 +10:00
babofitos
066f5fd281
Fix: correct typo and adjust indentation in docstring (#3920)
* fix: correct typo and adjust indentation in docstring

Fixed a small typo in the webview_did_inject_style_into_page docstring and adjusted indentation for consistency.

* Update CONTRIBUTORS
2025-04-13 17:00:19 +10:00
llama
8b2a64852b
fix drag/drop breaking when editor is zoomed (#3916) 2025-04-13 14:44:28 +10:00
llama
4f6dcb0b5b
Fix autoplay not being stopped on editor close if it interrupted another (#3915)
* fix autoplay not stopped on editor close if it interrupted another

* Update qt/aqt/sound.py
2025-04-13 14:43:25 +10:00
Yuki
acdf486b29
Refactor: Make Load Balancer Optional Throughout Codebase (#3860)
* Refactoring: load balancer

* Update about.py

* Refactoring: load balancer

* Update about.py

* Clean the code

* Remove config check from get_scheduling_states

* Backend method for the load balancer

* Refactor backend method for the load balancer
2025-03-26 23:19:28 +10:00
Kris Cherven
ab8692a91e
Show "and others" at the end of the contributor list in the About dialog (#3863)
* Show "and others" at the end of the contributor list in the about dialog

* Make about addendum translatable

* Fix CONTRIBUTORS

* Fix CONTRIBUTORS

* Update ftl/qt/about.ftl (dae)
2025-03-19 18:16:51 +07:00
Kris Cherven
938c55ca01
Fix broken window decorations on unpackaged GNOME instances (#3858)
* Fix broken window decorations on unpackaged GNOME instances

* Fix CONTRIBUTORS detection

* Fix CONTRIBUTORS
2025-03-19 17:58:42 +07:00
Evgeny Kulikov
ffcc7612ab
Add-ons Dialog: disable View Config/Page/Files buttons when clicking them would not lead to useful result (#3869)
* Remove unused import

* Nit-pick on code comment

* Enable View Page/Config buttons only when 1 add-on selected

* Enable Cmd+W shortcut (on Mac only) to close Add-ons dialog
2025-03-19 04:27:34 +03:00
Damien Elmes
83d0f5dae9 Add ES translator as requested 2025-03-17 22:11:29 +07:00
Jarrett Ye
0e31efac08
Feat/grade now (#3840)
* Feat/grade now

* pass ci

* fix from_queue

* Refactor card answering to support from_queue flag

- Add `from_queue` field to `CardAnswer` struct and proto message
- Modify `answer_card_inner` to handle queue updates based on `from_queue`
- Remove `grade_card` method and consolidate card answering logic
- Update related test cases to set `from_queue` flag

* fix current_changes() called when no op set

* Optimize queue updates for batch card processing

- Refactor `grade_now` to collect processed card IDs first
- Add new `update_queues_for_processed_cards` method for efficient batch queue updates
- Improve queue management by removing entries and updating counts in a single pass
- Remove individual queue update method in favor of batch processing

* pass ci

* keep the same style

* remove ineffective code

* remove unused imports
2025-03-15 17:30:40 +07:00
chel-ou
122980e06b
Add hooks for comparing answers (#3855)
* Add hooks associated to compare answer feature

* Update CONTRIBUTORS

* Add type pattern to compare answer related hooks
2025-03-15 12:12:01 +07:00
Val Enfys
d0ed54a768
Update my name in Anki's credits (#3852)
* Update my name in about.py

* Add name to CONTRIBUTORS
2025-03-14 17:00:48 +07:00
Evgeny Kulikov
339bf436d1
Prevent accidental dragging of audio playback buttons and hint links (#3844)
* Add myself to CONTRIBUTORS

* Set draggable="false" attribute on .replay-button

Because currently if a user drags slightly (even unintentionally) upon clicking a play button, play does not happen

* Prevent dragging hint links

Because if a user moves cursor a little after `mousedown`, action (expanding the hint) does not occur. Which might cause issues from accessibility standpoint
2025-03-14 16:47:03 +07:00
Luc Mcgrady
cad6e0b0bf
Added: Max interval too low warning. (#3847)
* Added: Max interval too low warning.

* Lower threshold to 180

* Add self to about.py
2025-03-10 16:14:35 +07:00
Brayan Oliveira
94e90dbf85
Add title for some dialogs and avoid hardcoding the text of the discard changes dialog (#3846)
* feat: add title to rename dialog

* fix: localize hardcoded message

* feat: add title to create deck dialog

* refactor: formatting fixes

* add name to about screen

adding my name to contributors for the third time
2025-03-10 15:53:43 +07:00
Jakub Fidler
d8460d354a
fix: Task manager exception handling (#3839)
* Raise exception from closures in run_in_background using run_on_main

* Add author to CONTRIBUTORS file

* Undo taskman changes

* Raise exceptions from _on_closures_pending using singleShot
2025-03-10 14:17:50 +07:00
Brayan Oliveira
63c2a09ef6
feat: add title to some of the sync dialogs (#3838)
* refactor: accept window title in some dialog methods

* feat: match sync initial title with state

Sync iniates in the `Checked` state, so the initial title is changed to match it instead of using the generic `Anki` title

* feat: use `Sync` as the tile of login screen

Maybe a new string should be created for that.

* feat: Use `Sync` as title of the sync conflict dialog

Maybe a new string should be used for that

* refactor: fix formatting

* fix: alias in CONTRIBUTORS

Even in 2025, the script isn't smart enough to handle different casing or use just the GitHub ID
2025-03-03 15:03:28 +03:00
GithubAnon0000
42620c4e60
Update uninstall.sh to give feedback to the user (#3834)
The uninstall script runs `xdg-mime uninstall` which takes >5 seconds to process.

There is no indication to the user though that the script is actually running. Adding an `echo` info message solves that.

Additionally we could `rm -rfv` to make it more verbose (the install script is verbose too). But the main thing that needs time to process is the `xdg-mime uninstall` part of the script.

The reason why I didn't make `rm -rf` verbose, too, is that the output text is greater than the buffer that the terminal provides – meaning you cannot view it from the beginning. And since `rm` is very fast even on old systems with slow hardware I didn't really see a reason to make it verbose here.
2025-02-26 10:24:52 +03:00
mumtazrifai
e373b0ed9b
Use default flag name when flag is renamed to empty string (#3826)
* Add function to restore the default name of a flag

* Call function to restore default flag name if flag renamed to empty string

* Update _load_flags to use the default_flag_names dict

* Add name to contributors file

* Add trailing comma to pass tests

* Update to follow python style guide

* Update about.py

* Revert "Update _load_flags to use the default_flag_names dict"

This reverts commit caa8fea94b.

* Use require_refresh() instead of storing default flag names
2025-02-21 16:38:04 +07:00
Jake Probst
5552fc6e97
add hook for day rollover (#3817)
* add hook for day rollover

* rollover -> day_did_change
2025-02-18 13:46:15 +07:00
llama
70b6cc9682
set editor's card when reopening (#3814) 2025-02-16 16:11:28 +07:00
Luc Mcgrady
5d07eca327
Fix: Close cards missing "copy card info" button (#3811) 2025-02-16 16:10:04 +07:00
Luc Mcgrady
4459e06f74
Copy card debug info (#3801)
* Added: Copy card debug info button

* Fix: Button margins

* Added: More info

* Deleted useless info

* Added: Revlog rows

* Added: cardRow

* Replaced button with shortcut

* Fix: Copying new cards info error

* ./check

* Added: Rollover

* Format outputted json

* neatened imports

* make linter happy

* revert button changes

* Value Error -> Assert

* preserve normal copy functionality
2025-02-16 16:06:12 +07:00
Danika-Dakika
c8e4c366c1
Update about.py
Added translation contributor
2025-02-15 11:27:34 -08:00
GithubAnon0000
44e01ea063
Update reviewer.py to prevent custom scheduler js from commenting out py code (#3795)
* Update reviewer.py to prevent custom scheduler js from commenting out py code

* Do not use custom code, but move {js} instead
2025-02-09 16:06:49 +03:00
llama
01c4b48c7d
only change notetype/deck when reopening if no changes to discard (#3798) 2025-02-09 15:58:21 +03:00
Damien Elmes
f893ec63af Prompt user to apply Windows updates when SSL connection fails
See #3793
2025-02-06 22:57:15 +07:00
Damien Elmes
50c1155eb7 Give editcurrent its own menubar too
Closes #3785
2025-02-06 18:57:59 +07:00
Danika-Dakika
6e7dcad542
Update Deck Options strings to clarify Timers (#3792)
* Update CONTRIBUTORS

added myself

* Update about.py

added myself

* Update scheduling.ftl

timers-related string changes

* Update deck-config.ftl

timers-related string changes

* Update help-page.ts

timers-related string changes
2025-02-06 15:17:30 +07:00
llama
009a683e62
Fix discard changes randomly being a noop on certain linux systems (#3781)
* fix discard changes randomly being a noop on certain linux systems

* use QApplication.setActiveWindow instead

* revert current impl

* wait for the next event loop iter before calling activeWindow
2025-02-02 23:31:36 +07:00
llama
fab939e0e1
add image context menu actions for io mask editor (#3779) 2025-01-31 00:06:29 +11:00
llama
3641030b35
fix error when right-clicking empty space in update addons dialog (#3780) 2025-01-30 23:42:27 +11:00
llama
56dd93b5be
Add drag/drop support when adding IO images (#3776)
* allow adding images via drag/drop when adding io

* support editing io notes as well

Co-authored-by: Abdo <abdo@abdnh.net>

---------

Co-authored-by: Abdo <abdo@abdnh.net>
2025-01-27 18:58:58 +03:00
llama
00501c267c
fix copying images with filenames containing reserved chars (#3775) 2025-01-27 16:57:31 +03:00
Damien Elmes
5ccc6304e3 Fix drag&drop on some Linux systems
Thanks to Ab_Bc:
https://forums.ankiweb.net/t/image-occlusion-not-working-jan-2025/54523/17

Closes #3767
2025-01-26 17:31:54 +11:00
Damien Elmes
71ae5a6b67 Use a simple menubar for addcards on macOS
This makes initial-open and reopen behaviour consistent.

Closes #3659
2025-01-26 17:05:09 +11:00
Damien Elmes
cd1824165f Revert "Qt 6.8.1"
This reverts commit 04228de666.

Anki 25.01 Beta 1 revealed a bunch of regressions with the latest
Qt, and zero reports of improvements from it, so we'll be better off
holding off on it for now, and perhaps reporting the deadkeys issue
to Qt once we've got a proper reproduction process.
2025-01-25 21:41:33 +11:00
llama
d463f11d07
Allow reopening the add cards window (#3756)
* allow reopening the add cards window

* deck needs to be changed after notetype
since changing notetype potentially changes deck
2025-01-25 09:54:10 +03:00
kelciour
760ce162fb
Cleanup avplayer on profile close (#3754) 2025-01-25 09:44:15 +03:00
Damien Elmes
bc48eb4595 Log Anki version at startup
Useful for confirming running version when debugging startup problems
2025-01-24 14:33:34 +11:00
Damien Elmes
5974f5df7e Mention how about is not intended to mirror CONTRIBUTORS
https://github.com/ankitects/anki/pull/3750
https://github.com/ankitects/anki/pull/3575
2025-01-24 14:07:01 +11:00
Damien Elmes
46310612ae Add camera to entitlements
https://forums.ankiweb.net/t/are-there-any-plans-to-allow-the-use-of-the-webcam-in-anki-for-mac/53851
2025-01-24 12:47:20 +11:00
user1823
64ca90934b
Increase font size in debug console (#3743) 2025-01-20 06:47:33 +03:00
Gregory
1be94a8b04
Update about.py (#3738)
add contributor
2025-01-18 17:19:09 +11:00
llama
430d5f5639
Revert Editor.set_note's signature change with an alternative approach for #3730 (#3736)
* remove orig_note_id param

* add and use Note.orig_note_id instead

* add and use Editor.orig_note_id instead
2025-01-18 17:14:09 +11:00
llama
86c2887e56
Add support for copied image files when adding IO notes (#3733)
* unhardcode allowed_suffixes

* support pasting urls from clipboard when adding io notes
2025-01-18 15:59:36 +11:00
Luca Auer
899cb89990
Prevent stale frames from being drawn / always ensure up-to-date contents in webview (#3668)
* Prevent stale frames being drawn.

At key points where external changes enter the webview, stale images might get rendered. This ensures that a frame showing current state is always shown.

* Only stage single redraw

* Remove potentially superfluous calls to `self.update()`

* Remove potentially superfluous calls to `self.update()`.

I lost this one during some git troubles.

* Revert unrelated change

The function is supposed to take a boolean telling it whether or not the loading succeeded, which it doesn't as is. However, this is unrelated and works either way so I also reverted it again.

* chore: code cleanup

* cleanup: Remove redundant check for presence of callback

A callback will be used either way for this call, so it can be simplified. The check happens inside the handler.

* Add comment explaining why this change is necessary, referencing the relevant PR.

* Clarify comment to answer the why, not the what.

One can see what is being done, why is probably more important.
2025-01-18 15:54:20 +11:00
llama
9c0911891d
Fix "Create copy" for IO notes (#3730)
* expose get_image_occlusion_fields

* fix create copy for io

* revert current impl

* passthru original note id when creating copy

* add IOCloningMode

* fix create copy for io
2025-01-17 16:03:00 +11:00
Luc Mcgrady
146a0b2dcf
"Copy template as markdown" button. (#3719)
* Added: Copy template info button

* Consistent with Ankidroid

* Fix: Missing newline

* Renamed variables

* ./check

* Fix: Remove ``` from templates

* Stylistic changes

* ./check
2025-01-15 20:29:35 +11:00
llama
38821372dd
Use platform-native button layout in dialogs and messageboxes (#3725)
* set button-layout prop in stylesheet

* fix lint

* check for and use non-default layout on linux before falling back
2025-01-13 14:24:21 +11:00
Yuki
db30685b9a
Refactoring and comments (#3721) 2025-01-12 15:46:20 +11:00
Ross Brown
d0a4fbb7aa
Fix "Note Types" dialog moving down each time it is opened (#3718) 2025-01-12 15:33:37 +11:00
Damien Elmes
a83df635f7 Add camera usage description
https://forums.ankiweb.net/t/are-there-any-plans-to-allow-the-use-of-the-webcam-in-anki-for-mac/53851/10
2025-01-12 13:00:04 +11:00
Yuki
9460911d90
Fix menubar in fullscreen (#3710)
* Fix/menubar in fullscreen

* CONTRIBUTORS file

* Fix/menubar in fullscreen

* CONTRIBUTORS file

* Fix and add Type hints
2025-01-10 20:18:32 +11:00
kelciour
53be365678
Fix mpv loadfile syntax change 2 (#3711)
* Revert "Fix mpv loadfile syntax change (#3105)"

This reverts commit 111f3bd138.

* Fix mpv loadfile syntax change 2
2025-01-10 19:16:08 +11:00
Damien Elmes
4c34a2d133 Fix Windows bundling
Missed in the Qt6.8 changes
2025-01-10 18:10:36 +11:00
llama
ef94bf1cb0
Add support for html comments to template syntax (#3662)
* add support for comments to templates

* add tests

* add support for comments to CardLayout

* fix lints

* revert current impl

* extract parsing logic from legacy_text_token

* add support for comments to templates

* add tests

* refactor take_until_handlebar_start_or

* remove redundant rest

* Require full subclause match when locating next token (dae)

* Rework legacy template handling (dae)

The handlebar parser is now an instance method of a TemplateMode
enum, allowing us to avoid duplicate code for the legacy code path,
and the necessity to box up the iterator.

This does result in a change in behaviour: when the user has specified
the alternate syntax, the standard syntax will no longer be accepted.

* Remove stale comment (dae)
2025-01-09 23:35:48 +11:00
Damien Elmes
5d150c74a4
Qt 6.8.1 (#3633)
* Qt 6.8.1

Bumps minimum glibc to 2.35, and minimum macOS to 12

* Drop generation of Qt5 packaged build

Closes #3615

* Include qt6 requirements in aqt wheel; drop extra deps

* Fix aqt wheels growing over time
2025-01-09 20:07:12 +11:00
Arthur Milchior
d7fc98d4d8
Deck options without bridge (#3571)
* NF: Modify CONTRIBUTORS

Just so that I stop getting the warning

* NF: Create `deckOptionsReady`

* NF: rename _close to require_close

The method will have to be used outside of this class, so can't be private

* NF: simplify slightly some code

* NF: remove bridge command from deck options

* Remove unused import

* Remove superfluous comment with a typo
2025-01-08 21:30:30 +11:00
llama
ca6002fd58
remove image menu feature when on qt5 (#3685) 2025-01-07 15:30:51 +03:00
llama
91b3740554
Stop audio playback on editor close (#3666)
* stop audio playback on browser close

* revert fix

* add caller-aware versions of play_file and stop_and_clear_queue

* stop editor's audio autoplay on close

* remove superfluous stop_and_clear_queue from addcards
2025-01-04 18:55:40 +03:00
llama
5a7a9090b6
Allow choosing filtered decks in stats (#3687)
* add optional passthru param dyn to DeckChooser

* include filtered decks when choosing decks in stats
2025-01-04 17:39:16 +03:00
llama
53a2e34a3f
Fix missing buttons on bottom bar when window is narrow (#3653)
* Delay offsetHeight query to account for reflow

* Handle invalid value if webview page was deleted
2024-12-22 11:29:54 +10:00
Ben Nguyen
3a7a1c7346
Don't parse TTS text as XML (#3651) 2024-12-22 11:09:00 +10:00
llama
b061da73d3
Replace use of window.postMessage in card info (#3646)
* Use anki.updateCard instead of window.onmessage in card-info

* Make card-info placeholder text grey

---------

Co-authored-by: Abdo <abdo@abdnh.net>
2024-12-18 11:32:07 +03:00
llama
a0712b04e1
Split off path into its own arg (#3641) 2024-12-16 14:15:05 +03:00
llama
b726e28229
Remove use of window.location.href in CardInfoDialog (#3621)
* Replace window.location in CardInfoDialog with load_sveltekit_page

* Fix format

* Fix ForgettingCurve's reactivity

* Props' default args aren't reactive

* Add global _updateCardId fn to card-info

* Use _updateCardId to reactively update card-info

* Fix format

* Fix type

* Use dummy form instead of window global for client-side nav

* Fallback to window.location in case form hasn't been rendered

* Use window.postMessage instead of dummy <form>
2024-12-14 22:45:54 +11:00
llama
2d207ff5ba
Remove hardcoded note/card colours from switch.py (#3629)
* Remove hardcoded note/card colours in switch.py

* Modify CONTRIBUTORS

* Switch to None as a safe default value
2024-12-14 21:30:28 +11:00
Bart Louwers
36d0fddd38
[Qt 6.7] Set ForceDarkMode attribute in AnkiWebView (#3622)
* Set ForceDarkMode attribute in AnkiWebView

* Use hasattr for backward compatibility

* Make mypy happy
2024-12-14 21:29:30 +11:00
Ross Brown
d1032d86a7
Make sure Anki resets the QtMessageHandler as it is exiting (#3620) 2024-12-09 15:39:45 +11:00
Ben Nguyen
128f54ed90
Fix reuse internal clipboard for primary selection pasting (#3613)
* Pass down clipboard mode

* Add type annotation
2024-12-09 15:38:52 +11:00
hideo aoyama
039c7fc0a9
Snap: keep LD_LIBRARY_PATH when in snap environment (#3618) 2024-12-07 00:42:03 +11:00
user1823
f345517dcc
Change font of debug console to Consolas (#3606) 2024-12-07 00:37:43 +11:00
sorata
d897b4588e
update error message (#3612)
Co-authored-by: Abdo <abdo@abdnh.net>
2024-12-06 03:05:49 +03:00
Damien Elmes
69ac450098 "Fields for ..."
https://forums.ankiweb.net/t/add-note-type-name-to-the-fields-editor/52263
2024-11-23 22:45:19 +11:00
Damien Elmes
4486227178 Bump mimalloc for CVE 2024-11-19 15:27:39 +10:00
Ben Nguyen
9d09c32ece
Enable strict_optional for aqt/tagedit, utils, sync (#3578)
* Enable strict_optional for tagedit

* Fix mypy errors

* Enable strict_optional for utils

* Fix mypy errors

* Enable strict_optional for sync

* Fix mypy errors

---------

Co-authored-by: Abdo <abdo@abdnh.net>
2024-11-15 16:29:19 +03:00
Ben Nguyen
29f714d973
Enable strict_optional for aqt/mediasync, package, progress (#3577)
* Enable strict_optional for mediasync

* Fix mypy errors

* Enable strict_optional for package

* Fix mypy errors

* Enable strict_optional for progress

* Fix mypy errors
2024-11-15 16:24:50 +03:00
Ben Nguyen
edf59c2bb2
Enable strict_optional for aqt/deckchooser, about, webview (#3573)
* Enable strict_optional for deckchooser

* Fix mypy errors

* Enable strict_optional for about

* Fix mypy errors

* Enable strict_optional for webview

* Fix mypy errors

* Fix merge error

* Revert utils

* Add early returns

---------

Co-authored-by: Abdo <abdo@abdnh.net>
2024-11-13 12:06:55 +03:00
Ben Nguyen
db7f128b83
Enable strict_optional for aqt/mediacheck, theme, toolbar (#3569)
* Enable strict_optional for mediacheck

* Fix mypy errors

* Enable strict_optional for theme

* Fix mypy errors

* Enable strict_optional for toolbar

* Fix mypy errors
2024-11-12 19:47:04 +03:00
Abdo
763712c696
Remove outdated TODO (#3567) 2024-11-09 18:42:49 +03:00
Ben Nguyen
fdaad7150e
Enable strict_optional for aqt/debug_console, emptycards, flags (#3565)
* Enable strict_optional for debug_console

* Fix mypy errors

* Enable strict_optional for emptycards

* Fix mypy errors

* Enable strict_optional for flags

* Fix mypy errors
2024-11-09 13:43:51 +03:00
Ben Nguyen
a150eda287
Enable strict_optional for aqt/notetypechooser, stats, switch (#3558)
* Enable strict_optional for notetypechooser

* Fix mypy errors

* Enable strict_optional for stats

* Fix mypy errors

* Enable strict_optional for switch

* Fix mypy errors

---------

Co-authored-by: Abdo <abdo@abdnh.net>
2024-11-08 13:42:42 +03:00
Ben Nguyen
ac731624e1
Enable strict_optional for aqt/deckoptions, editcurrent, filtered_deck (#3556)
* Enable strict_optional for filtered_deck

* Fix mypy errors

* Enable strict_optional for editcurrent

* Fix mypy errors

* Enable strict_optional for deckoptions

* Fix mypy errors
2024-11-07 08:33:41 +10:00
Abdo
11d2b91268
Fix target deck reset to notetype-specific setting (#3555) 2024-11-07 08:32:42 +10:00
Abdo
442ddb085a
Fix UI hanging with empty context menu (#3553) 2024-11-05 17:49:48 +03:00
Abdo
43d9b00b85
Remove legacy import option (#3536)
* Remove legacy import option

* Always return False in legacy_import_export()
2024-11-05 18:25:06 +10:00
Ben Nguyen
8b84583433
Enable strict_optional for aqt/clayout, changenotetype, fields (#3544)
* Enable strict_optional for clayout

* Fix mypy errors

* Enable strict_optional for changenotetype

* Fix mypy errors

* Enable strict_optional for fields

* Fix mypy errors
2024-10-30 13:40:40 +03:00
Ben Nguyen
a25edecc88
Enable strict_optional for aqt/studydeck, tts, mediasrv (#3542)
* Enable strict_optional for studydeck

* Fix mypy errors

* Enable strict_optional for tts

* Fix mypy errors in tts

* Enable strict_optional for mediasrv

* Fix mypy errors in mediasrv
2024-10-29 12:05:54 +03:00
Ben Nguyen
7f58ca213c
Enable strict_optional for aqt/modelchooser.py (#3539)
* Enable strict_optional

* Fix mypy errors
2024-10-28 14:19:31 +10:00
Ben Nguyen
fbd53726cc
Enable strict_optional for aqt/deckdescription.py (#3538)
* Enable strict_optional

* Fix mypy errors
2024-10-28 14:18:16 +10:00
Ben Nguyen
2889299670
Enable strict_optional for aqt/deckbrowser.py (#3537)
* Enable strict_optional

* Fix mypy errors
2024-10-28 14:16:42 +10:00
Abdo
a240de2652
Merge branch 'main' into aqt-strict-optional-taglimit 2024-10-27 17:10:21 +03:00
Abdo
677664dea3
Merge branch 'main' into aqt-strict-optional-overview 2024-10-27 17:06:58 +03:00
bpnguyen107
d7ed0fee16 Fix mypy errors 2024-10-26 19:33:04 -07:00
bpnguyen107
c02f234ce0 Fix mypy errors 2024-10-26 19:19:20 -07:00
bpnguyen107
364a1ada00 Fix mypy errors 2024-10-26 19:07:43 -07:00
Ben Nguyen
e4eaaa57ab
Enable strict_optional for aqt/importing.py (#3527)
* Enable strict_optional

* Fix mypy errors
2024-10-26 19:56:34 +10:00