* add SaveCustomColours rpc method
* restore custom colour palette on editor init
* save custom colour palette on colour picker open and input
there doesn't seem to be an event fired when the picker is
cancelled/closed, so it's still possible for work to be lost
* save colours on `change` instead of `input`
`input` is supposed to be fired on every adjustment to the picker
whereas `change` is only fired when the picker is accepted, but qt
seems to treat both as the latter, so this is currently a no-op
* Store colors in the collection
One minor tweak to the logic while I was there: an invalid color no
longer invalidates all the rest.
---------
Co-authored-by: Damien Elmes <gpg@ankiweb.net>
* Improved margins in Card Browser's "Preview" pane
* Alternate approach that looks good on Mac too
---------
Co-authored-by: Damien Elmes <gpg@ankiweb.net>
Co-authored-by: Damien Elmes <dae@users.noreply.github.com>
* Make timebox message translatable with flexible variable order
Currently, the timebox dialog message is built from two separate strings,
each containing one variable:
"{ $count } cards studied in" + "{ $count } minutes."
As a result, translators cannot freely reorder the variables in their translations.
This change introduces a single string with both variables, allowing translators
to adjust the order for more natural expressions in their languages.
* Preserve old string for now
* Ensure message doesn't display over two lines
---------
Co-authored-by: Damien Elmes <gpg@ankiweb.net>
With all the recent supply chain attacks, this seems prudent. There are
three in our current package list. esbuild's is just a performance
optimization (https://github.com/evanw/esbuild/issues/4085), and
dprint's gets done when we invoke .bin/dprint anyway. svelte-preprocess
simply prints something to the screen.
* Enable nc: to only search in a specific field
* Add FieldSearchMode enum to replace boolean fields
* Avoid magic numbers in enum
* Use standard naming so Prost can remove redundant text
---------
Co-authored-by: Damien Elmes <gpg@ankiweb.net>
rust commit 8296ad0 changes the output of std::any::type_name to include
regions such as lifetime and generic arguments, which results in invalid
Ninja rule names being generated, such as `CargoBuild<_>`.
* Increase randomness in random sorting of new cards
Currently, the new cards appear roughly in the same order on consecutive days (if they are skipped by burying). This change aims to increase randomness by spreading out the salt across the hash space.
* Fix errors
* Make simulator fill missing values of DR and decay too
If a card has missing memory states, it will likely have missing DR and decay too. So, it makes sense to simultaneously update them as well.
* Fix error
* Avoid causing sync conflicts when filling in missing memory in sim
https://github.com/ankitects/anki/pull/4269#issuecomment-3201450124
---------
Co-authored-by: Damien Elmes <gpg@ankiweb.net>
* Replace media-record.png with SVG icon
- Added SVG version of the microphone icon (from Font Awesome Free v7.0.0)
- Updated sound.py to use QIcon for proper SVG support
- Icon now displays at 60x60 pixels
* Remove obsolete media-record.png icon
The PNG icon has been replaced with an SVG version
* Update CONTRIBUTORS
* Replace icon with AnkiMobile's record icon
CC-BY requires attribution, and we don't currently have a way to describe
those attributions in a way the mobile clients can also include automatically.
For now, I've switched it to an icon I authored myself to avoid the issue.
---------
Co-authored-by: Damien Elmes <gpg@ankiweb.net>
Co-authored-by: Damien Elmes <dae@users.noreply.github.com>
* Fix Cards with Missing Last Review Time During Database Check
* clippy
* Apply suggestions from code review
Co-authored-by: Luc Mcgrady <lucmcgrady@gmail.com>
* Apply suggestions from code review
Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>
* Add is_reset method to RevlogEntry and update scheduling logic
This commit introduces the `is_reset` method to the `RevlogEntry` struct, which identifies entries representing reset operations. Additionally, the scheduling logic in `memory_state.rs` and `params.rs` has been updated to utilize this new method, ensuring that reset entries are handled correctly during review scheduling.
* Implement is_cramming method in RevlogEntry and update scheduling logic
This commit adds the `is_cramming` method to the `RevlogEntry` struct, which identifies entries representing cramming operations. The scheduling logic in `params.rs` has been updated to utilize this new method, improving the clarity and maintainability of the code.
* Refactor rating logic in RevlogEntry and update related scheduling functions
This commit introduces a new `has_rating` method in the `RevlogEntry` struct to encapsulate the logic for checking if an entry has a rating. The scheduling logic in `params.rs` and the calculation of normal answer counts in `card.rs` have been updated to use this new method, enhancing code clarity and maintainability.
* update revlog test helper function to assign button_chosen correctly
* Refactor card property fixing logic to use CardFixStats struct
* Add one-way sync trigger for last review time updates in dbcheck
* Update documentation for is_reset method in RevlogEntry to clarify ease_factor condition
* Apply suggestions from code review
Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>
* Minor wording tweak
---------
Co-authored-by: Luc Mcgrady <lucmcgrady@gmail.com>
Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>
* fix show_exception's messagebox always formatting as plaintext
* Revert "fix show_exception's messagebox always formatting as plaintext"
This reverts commit aec6dd9be8.
* convert SearchError msg to markdown when in browser
While testing the previous PR, I noticed that if stdout is set to None,
the same behaviour is shown as in the following report:
https://forums.ankiweb.net/t/cannot-switch-versions/64565
This leads me to wonder whether IsTerminal is behaving differently
on that user's system, and the use of an env var may be more reliable.
* Feat/use current_retrievability_seconds in SQL
* replace `days_since_last_review` with `seconds_since_last_review`
* Update is_due_in_days logic to include original or current due date check
* backend part
* split memorised and cost
* slapdash frontend
* extract some simulator logic
* Add zoomed version of graph
* ./check
* Fix: Tooltip
* Fix: Simulator/workload transition
* remove "time"
* Update ts/routes/graphs/simulator.ts
Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>
* Added: Mode toggle
* Disable Dr in workload mode
* keep button order consistant between modes
* dont clear points on mode swap
* add review count graph
* Revert "dont clear points on mode swap"
This reverts commit fc89efb1d9.
* "Help me pick" button
* unrelated title case change
* Add translation strings
* fix: missing translation string
* Fix: Layout shift
* Add: Experimental
* Fix Time / Memorized
* per day values
* set review limit to 9999 on open
* keep default at currently set value
* Do DR calculation in parallel (dae)
Approx 5x faster on my machine
---------
Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>
Co-authored-by: Damien Elmes <gpg@ankiweb.net>
* Feat/per-deck desired retention
* Refactor desired retention logic in Collection implementation
Updated the logic for retrieving deck-specific desired retention in both `memory_state.rs` and `mod.rs` to handle cases where the deck's normal state may not be available. This change ensures that the default configuration is used when necessary, improving the robustness of the retention handling.
* Refactor desired retention handling in FsrsOptions.svelte
Updated the logic for effective desired retention to use the configuration default instead of the deck-specific value. This change improves consistency in the retention value used throughout the component, ensuring that the correct value is bound to the UI elements.
* refactor the logic for obtaining deck-specific desired retention by using method chaining
* support deck-specific desired retention when rescheduling
* Refactor desired retention logic to use a dedicated method for improved clarity and maintainability.
- The pyproject copy change broke the initial run case
- Avoid calling 'uv pip show' before venv created, as it causes
a pop-up prompting the user to install developer tools on macOS (#4227)
- Add a tip to the user about the unwanted install_name_tool pop-up
(Also tracked in #4227)
- Print 'Checking for updates...' prior to the potentially slow network
request
The 'latest' and 'choose version' paths always read from the the
dist file these days, so the file doesn't need to be copied in advance.
The other reason for the current behaviour was so that when the user
manually installs a new launcher, it opens into the launcher on next
run, as that's probably what the user wanted. But this causes problems
when the launcher is updated automatically by things like homebrew.
https://forums.ankiweb.net/t/anki-homebrew-issues-terminal-and-crash-on-exit/64413/4
- include stdout/stderr when utf8_output() fails
- don't swallow the error returned by handle_Version_install_or_update
- skip codesigning when NODMG set
Closes#4224
Motivated by https://forums.ankiweb.net/t/python-anki-sync-server-broken/64069
From https://protobuf.dev/support/cross-version-runtime-guarantee/:
"Python-specific Guarantees
Since the 3.20.0 release, the Protobuf Python generated code became a thin wrapper around an embedded FileDescriptorProto. Because these protos are supported on extremely long timeframes, our usual major version compatibility windows aren’t typically necessary.
Python may break generated code compatibility in specific future major version releases, but it will be coupled with poison pill warnings and errors in advance. As of 6.32.0, all generated code since 3.20.0 will be supported until at least 8.x.y."
This changes 'keep existing version' to 'sync project changes'
when changes to the pyproject.toml file have been detected that
are newer than the installer's version.
Also adds a way to temporarily enable the launcher, as we needed some
other trigger than the pyproject.toml file anyway, and this approach
also solves #4165.
And removes the 'quit' option, since it's an uncommon operation, and
the user can just close the window instead.
Short-term caveat: users with older launchers/addon will trigger the old
pyproject.toml mtime bump, leading to a 'sync project changes' message
that will not make much sense to a typical user.
* set UV_PYTHON_DOWNLOADS=auto when doing `uv sync`
* Clear env vars prior to invoking uv, and add --no-config
---------
Co-authored-by: Damien Elmes <gpg@ankiweb.net>
* Fix/FSRS simulator fallback to memory_state_from_sm2 for after setting “Ignore cards reviewed before”
* add comment to fsrs_item_for_memory_state
* Add historical retention field to FSRS review request and update related logic
- Added `historical_retention` field to `SimulateFsrsReviewRequest` in `scheduler.proto`.
- Updated `simulator.rs` to use `req.historical_retention` instead of the removed `desired_retention`.
- Modified `FsrsOptions.svelte` to include `historicalRetention` in the options passed to the component.
* Update rslib/src/scheduler/fsrs/memory_state.rs
Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>
* Update rslib/src/scheduler/fsrs/simulator.rs
Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>
* pass ci
* Update rslib/src/scheduler/fsrs/simulator.rs
Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>
* format
* Update rslib/src/scheduler/fsrs/simulator.rs
Co-authored-by: Luc Mcgrady <lucmcgrady@gmail.com>
* format
* Fix condition in is_included_card function to check CardType instead of CardQueue
---------
Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>
Co-authored-by: Luc Mcgrady <lucmcgrady@gmail.com>
* Only get_deck_config when load balancer is enabled
* Refactor load balancer card addition logic to use pre-fetched deckconfig_id
* Refactor get_scheduling_states to use context for deck configuration
It had some downsides:
- the lockfile was discarded when switching between beta/non-beta
- it could result in beta versions of transitory dependencies
By adding 'anki' and 'aqt' as first-party packages with explicit
version numbers (validated by the version list we get from PyPi),
we can allow them to be installed without breaking other deps.
https://forums.ankiweb.net/t/bundling-numpy-in-an-add-on/62669/15
* add deck name field to metadata protobuf msg
* fallback to creating new deck specified in `#deck:...`
* update tests
* create deck if it doesn't exist
* plumbing
* allow creating deck via `#deck:...`
* apply suggestion for protobuf
* Add `last_review_time` to card data
* cargo clippy
* Calculate days elapsed since last review time in add_extract_fsrs_relative_retrievability
* expose last_review_time to Card in Python
* Fix last_review_time assignment in Card class to use last_review_time_secs
* format
* Update last_review_time assignment to exclude filtered preview state in Card class
The inclusion of files under qt/aqt is handled by qt/pyproject.toml,
not qt/hatch_build.py, which works with the files under out/qt/_aqt.
Excluding qt/aqt/data and all files ending in .ui in qt/pyproject.toml
fixes the issue, since the other unwanted files (**/*.scss, **/*.ts, and
**/tsconfig*) all reside under qt/aqt/data.
Fixes: 04996c77f3
* Statically link MSVC runtime, removing the need to install the redistributable.
* CONTRIBUTORS I've already contributed and added my email, but the last commit got mangled.
We can't show an AnkiWeb page for a locally-installed add-on, and
having a custom config action is the only way we can easily expose
this for older clients as well.
Re: #4158
* Launcher: Run `uv python install` before running `uv sync`
* Less copy/paste.
* Minor readability improvements
* Make sure we check file presence before attempting to read
---------
Co-authored-by: Damien Elmes <gpg@ankiweb.net>
I'd normally do an RC before a stable release, but this is going to
be a "soft release", and with beta updates off by default in the launcher,
jumping straight to a stable release avoids the initial install problems.
* Feat/Add legacy evaluate config bool
* Minor tweaks based on PR suggestions (dae)
New enabling command:
from anki.config import Config
mw.col.set_config_bool(Config.Bool.FSRS_LEGACY_EVALUATE, True)
While something we probably don't want to encourage much of, this
may enable some previously-unshared add-ons.
https://forums.ankiweb.net/t/bundling-numpy-in-an-add-on/62669/5
The 'uv add' command is transaction, so if an add-on tries to inject
incompatible dependencies into the environment, the venv will be
left as-is. And each Anki upgrade/downgrade resets the requirements,
so the requested packages shouldn't cause errors down the line.
Sample add-on:
import subprocess
from aqt import mw
from aqt.operations import QueryOp
from aqt.qt import QAction
from aqt.utils import showInfo
def ensure_spacy(col):
print("trying to import spacy")
try:
import spacy
print("successful import")
return
except Exception as e:
print("error importing:", e)
print("attempting add")
try:
from aqt.package import add_python_requirements as add
except Exception as e:
raise Exception(f"package unavailable, can't install: {e}")
# be explicit about version, or Anki beta users will get
# a beta wheel that may break
(success, output) = add(["spacy==3.8.7", "https://github.com/explosion/spacy-models/releases/download/ko_core_news_sm-3.8.0/ko_core_news_sm-3.8.0-py3-none-any.whl"])
if not success:
raise Exception(f"adding failed: {output}")
print("success")
# alterantively:
# from aqt.package import venv_binary
# subprocess.run([venv_binary("spacy"), "download", "ko_core_news_sm"], check=True)
# print("model added")
# large packages will freeze for a while on first import on macOS
import spacy
print("spacy import successful")
def activate_spacy():
def on_success(res):
mw.progress.single_shot(1000, lambda: showInfo("Spacy installed"))
QueryOp(parent=mw, op=ensure_spacy, success=on_success).with_progress("Installing spacy...").run_in_background()
action = QAction("Activate Spacy", mw)
action.triggered.connect(activate_spacy)
mw.form.menuTools.addAction(action)
We need to exec() Python from a GUI context so that the app name and
icon are inherited from our launcher bundle. And we need to munge
sys.argv[0] prior to main window instantiation so that we don't get
app menu entries like "Hide -c". We do that in the launcher instead
of __init__.py so that older versions display correctly too.
* CHANGE right-click in the editor to show option to open folder in linux
* FIX checks
* Use heuristics
* ./ninja format
* Use fallback from main instead of xdg-open
- Launcher can now be accessed via Tools>Upgrade/Downgrade
- Anki closes automatically on update
- When launcher not available, show update link like in the past
- It appears that access to the modern console host requires an app
to be built with the windows console subsystem, so we introduce an
extra anki-console.exe binary to relaunch ourselves with. Solves
https://forums.ankiweb.net/t/new-online-installer-launcher/62745/50
- Windows now requires you to close the terminal like on a Mac,
as I couldn't figure out how to have it automatically close. Suggestions
welcome!
- Reduce the amount of duplicate/near-duplicate code in the various
platform files, and improve readability
- Add a helper to install the current code into the launcher env
- Fix cargo test failing to build on ARM64 Windows
The legacy importer has only been kept around to support some add-ons,
and these are so infrequently used that they're better off shifted
to add-ons (even they even still work)
- Use --locked to assert that the lockfile won't change, so we need
to explicitly 'uv lock' when making changes. Still trying to get to
the bottom of why the lockfile sometimes has editable entries, which
break things when switching between platforms.
- Exclude __pycache__ from wheels
- Move the typing stubs to our dev deps
(https://github.com/ankitects/anki/pull/4074#pullrequestreview-2948088436)
Extracted repeated logic for clearing FSRS-related fields into a new Card::clear_fsrs_data() method. Updated set_deck and FSRS disabling code paths to use this method for improved code reuse and maintainability.
* Document the purpose of storing dr and decay in card
* Format
* Fix type mismatch errors
* Update memory_state.rs
* Save dr and decay in card even if item is None
* Format
* Fix mismatched types
* Update memory_state.rs
- Introduced `next_day_start` parameter to `set_due_date` for improved due date handling.
- Updated logic to account for Unix epoch timestamps when calculating due dates.
* bump nom to 8.0.0
* update cloze.rs
* update template.rs
* update imageocclusion.rs
* update search/parser.rs
* update card_rendering/parser.rs
* replace use of fold_many0 with many0
in nom 8, `many0` doesn't accumulate when used within `recognize`
* include decay in ComputeMemoryStateResponse
* Add decay attribute to ComputedMemoryState and update Collection methods
* Refactor decay calculation into a helper function for improved readability and maintainability in memory state management
* format & clippy
- Update nextest (not required)
- Build nextest without self-update, which pulls in ring
- Disable running of tests in rsbridge, as it has no tests, and
requires host arch's python.lib to execute
- A double \ in CARGO_TARGET_DIR was breaking update_* tests
- Handle beta/rc tags in .version when launching Anki
- Update pyproject.toml/.python_version if distributed version newer
- Support prerelease marker to opt in to betas
- Check for updates when using uv sync
- Avoid system Python by default, as it can cause breakages
(e.g. ARM Python installed on Windows)
* 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
* Update FsrsOptions.svelte
* Update CONTRIBUTORS
* Make it full width too, so it doesn't resize when transitioning past 90
* Make sure the Warning appears after the alert
* Update FsrsOptions.svelte
* Update FsrsOptions.svelte
* Update FsrsOptions.svelte
* Fix/remove the lower limit of interval when set due date
* don't affect SM-2
* Apply patch from user1823
* Fix build
* More suggestions from user1823
* 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
* improve the accuracy of the expected workload calculation
* ./ninja fix:minilints
* implement smoothing & a separate struct for return value
* set TERMINATION_PROB to 0.001
* fix#4053
* check if file exist
AJT Japanese needs to play files stored in all possible locations on disk
* check absolute path
* add comment
* check if passed name is basename
* Add a security note to reduce the chance of a regression
* Tweak comment in the non-add-on case
* add fill tool
* add fill tool logic
* open colour picker on fill tool activation
* refactor/add fill attr to io clozes
* fill masks in editor
* fill text and inactive masks in reviewer
* fix lint
* remove debug option
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.
* 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>
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`.
* 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>
(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
* CHANGE collection size too large error to add MB values and info about compressed vs. uncompressed
* Round f64 to 2 decimals
* Remove line breaks from ftl/core
* Remove string 'uncompressed' from code
* Add string 'uncompressed' to ftl/core
* Remove if statement change introduced to test changes locally
* Run ./check
* ADD name of the button after button number (1 → again...)
* ADD info string to explain what 'correct' means
* Run ./check and make it happy
* Apply suggestion from @dae to make text shorter
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.
* fix polygons closing when clicking existing masks while editing io
* disallow selecting new polygons
* update CONTRIBUTORS
* preserve ids when pushing canvas state to undo stack
* rehandle tool changes after undoing/redoing
the polygon tool makes all objects unselectable, which isn't
preserved when restoring the canvas state after an undo/redo
* make polygon markers centred and transparent
* centre active line
* set perPixelTargetFind per object, and not on the canvas
otherwise it can't be overridden for a specific object
see 4c305baae6/src/canvas.class.js (L786)
* Allow linebreak between kind and percentage in answer buttons graph. This is BROKEN!
* FIX: percentage is not below kind
* FIX: y-axis wrongly had percentages
* REMOVE debugging console
* run ./check and fix errors
* REMOVE unused comment (commented out code)
* FIX: Percentage Text is cutoff (this removes transition as well)
* FIX: incorrect alignment
* UPDATE variable names to make them more meaningful
* UNDO removing transition
* REMOVE percentage from x-axis
* Revert "UNDO removing transition"
This reverts commit 2652b16bd7.
* RESTORE transition in x-axis
* Check if self.card.reps>0 before substracing 1
* Fix formatting
* Use a more rust-y way to avoid the Panic for underflow, especially wé're talking seed value
Co-Authored-By: jake <jake@sharnoth.com>
---------
Co-authored-by: jake <jake@sharnoth.com>
* Clarify logic in reviews_for_fsrs
Prior to this change, the second check of `first_of_last_learn_entries`
was dead code because the first check would always break out of the loop
before it could succeed. Re-order the code for clarity and add a
comment to explain the logic.
* Update CONTRIBUTORS
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>
* 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.
* Feat/FSRS-6
* update comment
* add decay to Card
* ./ninja fix:minilints
* pass check
* fix NaN in evaluation
* remove console
* decay should fallback to 0.5 when it's None.
* Update SimulatorModal.svelte
* Update a few comments
* Update FSRS decay defaults to use constants for better maintainability and clarity
* Update rslib/src/storage/card/data.rs
* Fix: Recalculate memory states on simulate
* Fix: Wrong cards included
* Save states to cards
* ./check
* Update rslib/src/scheduler/fsrs/simulator.rs
* NF: document that cloze number are kept as they are in the field
I needed to know because {{c1 generate card 0 for example. And storing
the card ordinal would have been another consistent choice.
* NF: introduce method that return the cloze number in fields
This slightly reduce code duplication.
* Apply suggestions from code review
* 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.
* 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.
* Update TrueRetention.svelte adding description
* Update statistics.ftl to add additional info
* Swap TR with DR
* Change string to 'Is expected to'
* Add help modal to TR table
* Add tooltip slot to Graph.svelte (thanks @Luc-Mcgrady)
* Fix lint warning and failing test
* Remove unused code
* removedd on:mount to make eslint happy
* ADD back on:mount
* ADD back code needed for on:mount
* REMOVE openHelpModal() as I couldn't figure out how to make the title clickable
* attempt to ADD clickable title (BROKEN\!)
* Update ts/lib/components/TitledContainer.svelte
Co-authored-by: Luc Mcgrady <lucmcgrady@gmail.com>
* Update ts/routes/graphs/Graph.svelte
Co-authored-by: Luc Mcgrady <lucmcgrady@gmail.com>
* Update ts/routes/graphs/TrueRetention.svelte
Co-authored-by: Luc Mcgrady <lucmcgrady@gmail.com>
* ADD exported onTitleClick as @Luc-Mcgrady suggested
* REMOVE vite.config.ts file
---------
Co-authored-by: Luc Mcgrady <lucmcgrady@gmail.com>
venv as things like black depended on it. When running in a packaged
build, it wasn't being included, and Anki was failing to start.
I've added it to the anki module instead of aqt, even though only
the latter is currently using it, so that we don't accidentally introduce
the same bug in the future when using typing_extensions from within
libanki.
* 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.
* 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>
* 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
* 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>
* add min-height to fields
* 30px → 1.5em
This works with different font sizes too. Now there are no size jumps between empty field / field with string / field with empty html.
* 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)
* 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
* replace use of deprecated createClassComponent with mount
* bump esbuild-svelte from 0.8.1 to 0.9.2
* mathjax-element.ts -> mathjax-element.svelte.ts
* move caret after tick
* Improve natural unit conversion for a time b/w 360 to 365 days
Previously, 363 days would be converted to 12.1 months, which is quite confusing because
- a user would think that if the value is more than 12 months, why it isn't displayed in years
- the value is actually less than a year, which is counterintuitive as 12.1 m suggests a value more than a year.
* precise
* Update time.ts to match timespan.rs
* Add another test
* Use average duration of a month instead
* Update time.ts
* Update test_schedv3.py
* Update time.test.ts
* Display median interval in Stats instead of mean
Median is better suited than mean for reporting skewed data.
* Display median ease in Stats instead of mean
* Update difficulty.ts
* Update ease.ts
* Update statistics.ftl
* Format eases.rs
* Remove unused import
* Change Median back to Average in UI
* Revert "Change Median back to Average in UI"
This reverts commit e0c1e3f8e4.
* Preserve the old translations for now (dae)
This commit explains how to calls a method implemented in a language
from a different language.
This explains how to declare the RPCs, how to call them and how to
implement them. This is based on examples of code at main at the time
of writting. I used permalink to ensure that the links remains
relevant even if the specific examples change later.
The last section is about the special case of calling TypeScript from
Python, which does not use RPC but is still relevant in a bridge
document.
This commit also add a paragraph explaining what protobuf is in the
protobuf documentation, so that new contributors who don't know what
protobuf is can understand why we use it.
* modify render_card to return whether card was empty
* plumbing
* add flag to proto message
* plumbing: pass flag along to PartiallyRenderedCard
* add tests
* Use a custom return type for clarity (dae)
* Move the solution to the Rust layer
* CONTRIBUTORS fix (1)
* CONTRIBUTORS fix (2)
* Fix CI issues
* Simplify reparenting solution
* Fix reparenting message with tags
* Revert "Fix reparenting message with tags"
This reverts commit 199958c1c5.
* tags: Return None in reparented_name when the name is unchanged
* Return a copy of note type in ModelManager.get()
* Update tests
* Revert "Return a copy of note type in ModelManager.get()"
This reverts commit 04ef186336.
* Add note to .get()
* add qsv-sniffer crate
* use qsv-sniffer before falling back to old delimiter heuristic
* update test metadata macro
* revert impl
* trim potential suffixed delimiters from non-freeform meta lines
* add test
* 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)
* 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
* 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
* Added: Leech suspend to simulator
* Added: leech threshold spin box
* Update git rev
* Added: Save to preset options
* ./check
* Added: "Advanced settings" dropdown
* Removed: Indent
* Added: Easy days
* Added: Sticky header
* Removed: Easy Day updating without saving
* un-nest disclosure
* bump fsrs
* Update a VSCode setting to match recent releases
* Move Easy Days above the Advanced settings
I think it's a bit more logical to have Advanced come last.
* Ensure graph fits inside screen height
* Bump fsrs version
* pass --locked to cargo invocation
* update Dockerfile.distroless as well
Co-authored-by: Simon <8466614+SimonBaars@users.noreply.github.com>
---------
Co-authored-by: Simon <8466614+SimonBaars@users.noreply.github.com>
* 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
* Don't recalculate remaining steps, conditionally
Bug report reproduction steps:
Create a new profile so that everything is set to default.
Create a new card.
Click Good.
Open deck options and empty learning steps. Save.
No go back and put 1m 10m as LS.
Go back to the card and it should show 10m on the Good button.
Check if old_steps is empty and if it is just use remaining
steps for the new_remaining steps. Add test.
* Update contributers
* Format code
* Fix clippy error
* Use more idiomatic imports
Currently we only check the size on a one-way sync, allowing users
to bypass the limits by incrementally syncing a lot of material.
To prevent this:
- The server now checks if the collection is already oversize,
and forces a one-way sync if it is
- The client checks if the local collection is oversize and refuses
to proceed, so they don't waste time uploading material that will
likely trigger the limit the next time they sync.
* 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
* 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
* 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
* Feat/support load balance and easy days in FSRS simulator
* format
* consider LoadBalancerEnabled
* use fsrs::PostSchedulingFn
* add load balance and easy days to compute_optimal_retention
* move simulator to a pop-over
* fix incorrect simulationNumber when error 500
* Feat: Save to Preset Options
* update tabs when update newPerDay & reviewsPerDay
* don't reset deckSize & daysToSimulate when save options
* fix missing easy days
* plan to support review priority
* Fix graph line rendering with non-scaling stroke
* simplify review priority function with helper wrapper
* fallback to default ReviewPriority for Added & ReverseAdded
* Update ts/routes/deck-options/SimulatorModal.svelte
Co-authored-by: Luc Mcgrady <lucmcgrady@gmail.com>
* Wrap review priority function in Arc for thread-safe sharing
* more granularity for R sorting
* Add graph smoothing option to FSRS simulator
* Improve graph resize handling in FSRS simulator
* simplify review priority calculation
* Add review order selection to FSRS simulator modal
* Refactor review priority function using macro for conciseness
* Add copyright and license header to SimulatorModal.svelte
* cargo clippy
* ./ninja fix:eslint
* update fsrs-rs
* Update FSRS dependencies and refactor load balancing functions
- Update fsrs-rs dependency to latest commit
- Modify retention and simulator modules to use Arc instead of Box
- Update function signatures and imports in simulator module
- Simplify review card order handling with direct enum usage
* resolve reviewed changes
* replace .unwrap() with ?
* move simulating into SimulatorModal
* add (crate) to interval_to_weekday
* Update FsrsOptions.svelte
* format
---------
Co-authored-by: Luc Mcgrady <lucmcgrady@gmail.com>
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.
Apparently no font size should be lower than 12px, see https://www.boia.org/blog/accessibility-tips-let-users-control-font-size.
With the current 55%, I get a computed font size of 8.25px though. Considering the text shows the helpful message "Press Enter to accept, Shift+Enter for new line.", I think we should add a minimum font size.
* 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
Make sure to run tools/install-n2 after updating to this commit.
n2 have merged in some changes we were previously hosting in a fork,
but the parsing of the flags was altered.
The previous commit added word-wrap, but it was not working after I'd
removed some other tweaks I'd made in testing, that I thought were not
required. I ended up switching to standard table columns and a fixed
layout, so that both the column and row headers will wrap properly.
* cap csv import preview table at 1000 columns
* add fluent message
* show warning when preview table columns have been truncated
* simplify fluent message ($count will almost always be a big num)
* _tr -> tr
* 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
I think this one really calls for a poll. Dae, I highly suggest you to ask multiple users whether "Optimize current" and "Optimize all" are clear enough or need "preset". I'm pretty sure most people will find it confusing without "preset".
* 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>
* fix: specify canvas npm optional dep ignore workaround more cleanly
this should allow it to work with yarn classic and yarn modern
* chore: add self to CONTRIBUTORS
* Fix/re-optimize FSRS if short-term param is weird
* Reset progress when another run is required (dae)
* only count the same-day steps
* Fix flicker when optimizing again (dae)
Prior to this change, ./run fails out of the box on ARM systems, as Qt
wasn't available on PyPI until the 6.8 release.
Also added a script in tools/ for testing Qt6.8 issues on other platforms.
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.
* Subtract introduced:1 count from learn count of first day of simulator.
* Fix: Cards filtered
* Tidy up
* Fix: Cards filtered (2)
* ./check
* Removed unnecessary filter
* Fix: Doesn't work for real new cards
* ./check
* Fix: .is_none()
* Limit to 1 day
* Removed "days_to_simulate" argument from convert
* Match calc of relative overdueness in SM2 and FSRS
* Fix calculation of FSRS relative overdueness
* Improve readability by avoiding double negative
* Move comment line
Hardcode them to:
SYNC_PORT=8080
SYNC_BASE=/anki_data
If these env variables are passed into the container with different values,
they are ignored.
The reasons is if the user modifies SYNC_BASE they risk data loss since
anki-sync-server will no longer write data into the volume. If they change
SYNC_PORT they need to also change it when mapping this internal port to the
external port of the container, which could be confusing plus it has no benefit
to allow this since it's always possible to change the external port even if
the internal port is fixed to 8080 (e.g. `-p 1234:8080`).
In both cases there is no benefit to making these values configurable and there
are risks associated.
Unfortunately there is no easy way of implementing this for the
Dockerfile.distroless so it's up to the user not to modify these values.
* FIX lang selection resetting to en_US for some langs
Fixes https://forums.ankiweb.net/t/anki-25-01-beta/54490/17?u=anon_0000.
# Issue
Set a hand full of certain languages in the preferences screen and see that the translations have been applied after reboot. The language selection in preferences wrongly shows en_US though, not the current active language. If you wanted to switch to `en_US` in this case, then you'd have to first switch to a working language (like de_DE) and then switch to en_US.
# Solution
`anki/qt/aqt/preferences.py` has the functions `setup_language()` and `current_lang_index()`. I noticed that it defaults to en_US, if the language is not in `compatMap` and it couldn’t return the index of the current language. No idea if this code is faulty but I headed over to `anki/pylib/anki/lang.py` afterwards.
Here, in `compatMap`, I added e.g. `"la": "la_LA"`. I knew the code since I could get it with `print("––– lang is ", lang)` in `preferences.py` (`current_lang_index()` retrieves `la` for latin).
After adding those code changes from my PR, the problem for those selected languages had gone away.
No idea if that's best practices though or if something else should be fixed instead.
* UPDATE CONTRIBUTORS adding myself to the list
PUID and PGID are optional env variables to specify the user and group id of
the user that the anki-sync-server process should run with.
This gives more flexibility for solving permission problems with volumes and is
a common pattern for Docker images (e.g. see here:
https://docs.linuxserver.io/general/understanding-puid-and-pgid/)
The anki-sync-server process will write any files with the permissions of the
user it's running with, which can be a problem when you need to access those
files from outside the container or when they are being written into a bind
mount that is owned by a particular user on the host system.
To be able to implement this the entrypoint.sh needs to run as root (since it
needs to create a user and change file permissions). anki-sync-server then
needs to be started with the user 'anki', which is why the new dependency
'su-exec' is required. The user 'anki' and group 'anki-group' can no longer be
created at image build time because then their ids would be fixed.
Also update the build instructions to require building the Docker image inside
the directory where the Dockerfile resides since the build now needs to copy
the entrypoint.sh and it seems wrong the specify the path
docs/syncserver/entrypoint.sh inside the Dockerfile.
* Add percentage to FSRS spinner
This commit add a percentage option in SpinBox and SpinBoxFloatRow, set to False
by default.
If it's true, a percent symbol is added at the end of the line before
the increase/decrease button.
While the value is represented as a percentage without decimal places,
the internal representation is not changed. Which mean that a
multiplier must used to compute the string value, indicate to the
input field the min, max and step, and when updating the result.
* Remove unsightly percentage sign, and update historical retention too
https://github.com/ankitects/anki/pull/3679#issuecomment-2579636981
---------
Co-authored-by: Damien Elmes <gpg@ankiweb.net>
* make removeUnfinishedPolygon return whether a polygon was removed
* treat removing an unfinished polygon as a discrete undo step
* has to be handled when redoing as well, but not as a discrete step
The move to Sveltekit broke the 'card info during review' add-on and
its descendants. This didn't get noticed in 24.11 due to the old
card-info.js file still being shipped.
I considered adding back the card-info.js generation, but it ended up
being simpler to move parts of the add-on into a separate page instead.
This is a stop-gap solution - in the future I'd like to get us to a
point where such component compositions can be done by add-ons,
and don't need to be done as part of Anki's build process.
Related: #3187
* 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.
+ Initial groundwork for AMD64 builds on ARM/Rosetta. Not currently
viable due to bugs in either Linux or Rosetta which results in a
Sveltekit build hanging indefinitely.
* 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
Making it configurable would be complicated, so this just restores
the limit to close to the protobuf limit we were butting up against
for now.
Related: #3637
* add Note::set_modified_with_mtime
* add struct for Collection::update_note_inner_without_cards's args
* refactor Collection::update_note_inner_without_cards to use the arg struct
* add Collection::update_note_inner_without_cards_using_mtime
* use incoming note's mtime when updating notes during import
Now that an ARM wheel is on PyPI, we no longer need to rely on a
system PyQt to build on ARM. The install is skipped when PYTHONPATH
is set, so older distros with glibc <2.39 can continue to use the
system packages instead.
Otherwise data would be lost by default when removing (or re-creating) a
container.
It would be possible to expose the default directory (e.g.
/home/anki/.syncserver) but it would be different for the two Dockerfiles and
less convenient for users of the Docker container to specify such a long path
when naming their volumes.
Setting the permissions is necessary since anki will be running with 'anki'
user permissions inside the container.
* 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)
* Feat/support new cards ignore review limit in simulator
* ./ninja fix:minilints & ./ninja format
* use published crate
* make newCardsIgnoreReviewLimit reactive
* format
---------
Co-authored-by: Damien Elmes <gpg@ankiweb.net>
* 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
* new easy days algorithm
* take easy day percent totals in account when determining reduced scheduling
* Use variant method to avoid repeated mapping to a constant (dae)
It was probably not worth the time I took to change this ^_^;
* 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
* Add myself to CONTRIBUTORS file
* replace localhost with 127.0.0.1 in syncserver Dockerfile
The healthcheck was failing, presumably because localhost was resolving to ::1
(IPv6), as detailed in this issue: https://github.com/maildev/maildev/pull/500
* Tweak how the True Retention stats table displays numbers
- Always show fractional parts of numbers even if they are 0 (91.0% not 91%).
- Show "N/A" for percentages instead of 0% when there are 0 total reviews.
* Localise percentages correctly
* 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
* docs(docker): Change suggested version numbre
* deps(docker): Bump rust to 1.83.0 and alpine to 3.21.0
* deps(docker): Bump rust to 1.83.0
* CONTRIBUTORS: Add my name
* Add myself to CONTRIBUTORS file
* avoid warning by setting SYNC_PORT as ARG in Dockerfile
1 warning found (use docker --debug to expand):
- UndefinedVar: Usage of undefined variable '$SYNC_PORT'
* Add some unit tests
Covers most of the cases encountered in https://github.com/ankitects/anki/pull/3639
* Format
* Update params.rs
Makes the test more robust.
* Update params.rs
When training, the first FSRS item is removed. That's why none of the other tests includes it.
Co-authored-by: Jarrett Ye <jarrett.ye@outlook.com>
* Improve naming
* Fix typo
---------
Co-authored-by: Jarrett Ye <jarrett.ye@outlook.com>
* Make the True Retention table pretty
* Hide absolute pass/fail table for 'all'
* Run './ninja format'
* Manually run prettier on Svelte 5 components
* Refactor to not use {#snippet}
* Fix lint to pass check:eslint
* Fix lint to pass check:svelte
* Rename t9n -> tr to follow code style
* Replace hard-coded string with a translation string
* Use assertUnreachable(...) for exhaustively matching enum
* Fix: min value for Additional new cards not 0
* Fix: New cards/day default value not starting value
* Preset defaults for review intervals and per day.
* Fix: "Additional new cards to simulate" localisation
* Revert "Fix: "Additional new cards to simulate" localisation"
This reverts commit 9be61d9f93.
* Fix/fallback to non-manual entry when first_of_last_learn_entries non found
* refactor single_card_revlog_to_item(s)
* update unit test of bypassed_learning_is_handled
* move comment line
* remove first_relearn_entries
* skip cram entry
* only pick non_manual_entries after ignore date
* fallback to non_manual_entries if the first learning step is before the ignore date
* pass ci
* update ignore_before_date_between_learning_steps_when_reviewing
* shorten the comment
* Minor refactoring
- fsrs_items_for_memory_state - fsrs_items_for_memory_states
- single_card_revlog_to_item -> fsrs_item_for_memory_state
(to match fsrs_items_for_training)
- single_card_revlog_to_items -> reviews_for_fsrs
- Use struct instead of tuple for reviews_for_fsrs output
- Don't return count, since we're already returning the filtered list
* More renaming/comment tweaks
- non_manual_entries -> first_user_grade_idx
- change comments to reflect the fact that we're working backwards
- Use "user-graded" rather than "non-manual"
* Add extra unit test
* Some wording tweaks
* 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>
* Improve i18n and multi-platform display of FSRS Simulator
* Tweak the graph bounds to avoid overlapping of the y-axis tick values and the y-axis title
* Update CONTRIBUTORS
* I18n for 4 more strings
* Reduce TitledContainer wrapper of fsrs simulator graph to maximize content display area
* Clean unused variables
* Update ftl/core/deck-config.ftl
* Update ftl/core/deck-config.ftl
* Add gradient color for forgetting curve
* Add desiredRetention prop for CardInfo
* update CONTRIBUTORS
* Formatting
* Tweak range of gradient
* Tweak: salmon -> tomato
* Get desired retention of the card from backend
* Add a reference line for desired retention
* Fix: Corrected the steel blue's height & Hide desired retention line when yMin is higher than desiredRetentionY
* Add y axis title
* Show desired retention in the tooltip
* I18n: improve translation and vertical text display
* Revert rotatation&writing-mode of vertical title
* Tweak font-size of y axis title
* Fix: delete old desired retention line when changing duration
* Update ftl/core/card-stats.ftl
---------
Co-authored-by: Damien Elmes <dae@users.noreply.github.com>
* Separate failed message from optimal
* No reviews only
* Fix: Can't block optimize if not optimal
* Wording change
* Update ftl/core/deck-config.ftl
* Simplify code (dae)
Because of the `entry.button_chosen == 0` part, it also filters out reschedule entries. Frankly, we don't need the `(entry.review_kind == RevlogReviewKind::Rescheduled)` part, but I didn't remove it yet.
Co-authored-by: Abdo <abdo@abdnh.net>
* include backlog cards in today in future due graph
when backlog option is not checked
* Don't add the backlog to today when backlog disabled
---------
Co-authored-by: Damien Elmes <gpg@ankiweb.net>
Make Anki treat {{type:unknown:field}} field replacements as {{type:field}} instead of {{field}}.
The previous behavior was seriously inconvenient for several reasons, including:
* Updated client aren't all released at the same time, causing an unavoidable mismatch period. Now it causes the least friction.
* Devs couldn't readily test new in-dev variants without breaking/inconveniencing their own mobile experience.
* Some users will have (potentially perpetually) outdated Anki clients and likely complain, wasting both dev & deck creator time.
This way users always get to type and especially: The front side will always render as intended.
* Update to stable Svelte 5 release
This causes a bunch of warnings to be omitted:
ts/routes/graphs/RangeBox.svelte:52:18
Warn: Properties of objects and arrays are not reactive unless in runes mode. Changes to this property will not cause the reactive statement to update (svelte)
break;
case RevlogRange.All:
$days = 0;
They are triggered on enum references, and it appears to be a bug.
May need to report it to Svelte?
* Deps update
* Silence spurious errors + fix a real one
https://github.com/sveltejs/svelte/issues/13811
* Update to FSRS-rs v1.3.2
* add fsrs_short_term_with_steps_enabled to config
* ./ninja fix:minilints
* fix defaults_for_testing
* if current parameters are invalid, skip comparison
fix#3498
* fix redundant_field_names
* cargo clippy --fix
* Update to FSRS-rs v1.3.3
* Update to FSRS-rs v1.3.4
* Avoid an extra config lookup on each card answer (dae)
* Feat/export dataset for research
* add comment
Co-authored-by: Damien Elmes <dae@users.noreply.github.com>
* target_path is required
* format
* improve efficiency to look up parent_id
* move `use` down
* Fully switch to File::set_times() from utime crate
* Switch to open_file()
Future me will end up wondering why we're explicitly declaring read=true
* Fix failing on windows
* Minor tidy-up (dae)
* Fix comment typo
* Enable strict_optional for aqt/editor.py
* Fix mypy errors in EditorWebView class
* Fix mypy errors in Editor class
* DRY
* Match same short circuiting behavior
* Convention
* Fix 'Discard changes' dialog appearing even when no changes are made
https://forums.ankiweb.net/t/anki-24-10-beta/49989/166
* Fix geometry of deck options window not being saved
evt.accept() does not seem to trigger reject().
* Fully switch to File::set_times() from utime crate
* Switch to open_file() (dae)
Future me will end up wondering why we're explicitly declaring read=true
- Primarily for the latest RUSTSEC on pyo3
- utime has been pinned, as they've introduced a deprecation warning
without a solution being available for folder mtimes
* add get_revlogs API
* fix tooltipText of ReviewsGraph
the style of true-retention shouldn't affect the style of tooltipText of ReviewsGraph
* More verbose wording (dae)
* Fix temporary disappearance of a tag
https://forums.ankiweb.net/t/anki-24-10-beta/49989/47
* Fix incorrect behavior after tag deletion
* Fix tag addition/selection buttons becoming invisible
Once tags were selected, subsequent deselection or selection did not
mount 'TagAddButton' or 'TagsSelectedButton' components.
* typeanswer: cleanup
* DiffNonCombining's new() used String where plain Vec is appropriate
* get rid of normalize_typed for DiffTrait again by pulling code into DiffNonCombining's new()
* two DiffNonCombining testcases
* typeanswer: return to NFC & typos
There are only two types of actions. The code does not seems to
consider this to be extandable, and the changed variable is private,
so I would expect it relatively acceptable to change the way it
work. This would improve the typing.
If this is rejected, at least, the callback should be noted as
optional, so that the IDE does not complain that `if cb` can not be
false.
* Expose original position to columns and card info
* Fix contributors
* Change routine name and return, fix SQL file, utilize coalesce inline
* Handle cards without original position
* Remove unecessary conversion
* Feat/Easy Days
* format
* add easy_days_percentages to deck_config
* configure Easy Days via table
* remove unused code
* add translatable strings & add default of easy days
* don't check easy_days_percentages when deserialize
* pass test::all_reserved_fields_are_removed
* consider next_day_at when interval_to_weekday
* remove y-axis-title created in last simulation
* EstimatedTotalKnowledge should be integer
* Reorder deck option sections (dae)
- Move FSRS to bottom left, to move it closer to the top, and so
the left and right columns appear roughly balanced when FSRS is
enabled.
- Move Easy Days above Advanced
* Don't crash if wrong number of days (dae)
* Use lower field number (dae)
Repeated fields are more compactly stored in the first 15 fields.
* Prevent memory leak
* Fix deck option changes not detected until focus is lost
* Accurately determine if there are any pending changes
This makes it so that the confirmation dialog appears when it should,
and not when it shouldn't.
* graduate card when user press hard and has 0 learning steps
* fix error: useless conversion to the same type
* do the same thing to again
* fix expected `Option<u32>`, found integer
* ./ninja format
* let FSRS control short term schedule
* Update to FSRS-rs v1.3.0
* ./ninja check:clippy
* Update to FSRS-rs v1.3.1
* Pin FSRS version (dae)
https://github.com/ankidroid/Anki-Android-Backend/pull/417
* Remove redundant parens (dae)
* Add "open image" option to editor
* Update qt/aqt/editor.py
Co-authored-by: Ben Nguyen <105088397+bpnguyen107@users.noreply.github.com>
* Update editor.py
* Remove unused import
* Fix "show in folder"
* Fix 'show in folder' on macOS
* Revert "Fix "show in folder""
This reverts commit cf2b33ee9422bcaf8d9e20bd4cce74e5061c13cf.
* Reimplement show_in_folder for Windows (dae)
- Avoid reusing call(), as the startupinfo we were passing in was
breaking the explorer invocation
- Attempt to bring explorer to the front after the window has been show,
as it otherwise appears under Anki (at least when running from source)
---------
Co-authored-by: Ben Nguyen <105088397+bpnguyen107@users.noreply.github.com>
Co-authored-by: Damien Elmes <gpg@ankiweb.net>
* polish graphs of simulator and forgetting curve
* True Retention: decrease precision of percentages
* apply uniform sampling rate to forgetting curve
* don't display time, only date when maxDays >= 365
* don't floor the totalDaysSinceLastReview
* correct cramming condition
* improve code-style
* polish ticks & tooltip of simulator
* remove unused import
* fix minor error of daysSinceFirstLearn
* filter out revlog entries from before the reset
https://forums.ankiweb.net/t/anki-24-10-beta/49989/63?u=l.m.sherlock
* use Math.ceil for windowSize
* fill currentColor for legend text
* remove mix-blend-mode: multiply
* tune the position of legend
* keep the same-day reviews in feature
* Update to FSRS-rs v1.2.3
* format
* don't remove short-term reviews if not training
* Update to FSRS-rs v1.2.4
* typeanswer: fix cleanup
Fix: Add prepare_expected back in for the 'nothing typed' & 'correctly typed' cases. This also makes expected_original redundant again.
Style: %s/provided/typed/g
Style: rename one ch → c
Testcase: whitespace_is_trimmed: added a check for the "correctly typed" path and renamed it to tags_removed (there's no whitespace?)
Testcase: empty_input_shows_as_code: changed to also check that tags get trimmed
* [type:nc] – ignores combining characters
Adds a comparison variant to [type] which ignores when combining characters of the expected field are missing from the provided input. It still shows these characters in the 'expected' line for reference.
It's useful for languages with e.g. diacritics that are required for reference (such as in dictionaries), but rarely actually learned or used in everyday writing. Among these languages: Arabic, Hebrew, Persian, Urdu.
The bool 'combining' controls it as new final parameter of both relevant compare_answer functions. On the Python side, it's set to true by default.
Use on the note templates: [type:nc:field] (only the front needs to include :nc)
This also removes the need to have both variants of words/sentences present as separate fields, to show them redundantly, etc.
* typeanswer: simplify by using nfkd throughout
Requires adjusting two testcases, but both render exactly the same in Anki itself.
On NFC vs. NKFD: https://stackoverflow.com/a/77432079
* typeanswer: 'simplify' by removing normalize_typed (requiring a bool parameter)
I'd prefer to keep this extra method.
* typeanswer: micro-optimize vectors
Should get rid of most relocations, at the expense of over-allocating.
On Vec's (String's) behavior: https://stackoverflow.com/a/72787776
* Mark `combining` as private
typeCorrect is not marked as private either, but we can at least do
the right thing for newly-added code.
* Revert "typeanswer: micro-optimize vectors"
This reverts commit 9fbacbfd19.
* Revert "typeanswer: 'simplify' by removing normalize_typed (requiring a bool parameter)"
This reverts commit df2dd3394e.
Newer versions break 'import pkg_resources' from a bundled build,
due to Pyoxidizer.
https://forums.ankiweb.net/t/anki-24-10-beta/49989/66
I've had to jiggle around the requirements files so that our dev
environment continues to use the latest setuptools, as there have
been security issues with old versions.
* typeanswer: cleanups
no functional change
* typeanswer: disambiguate
no functional change
* typeanswer: reorder
* typeanswer: skip DiffContext if nothing typed
No use to run all that code without input.
* typeanswer: skip tokenization if input is correct
No use in this case.
* typeanswer: make repo check happy (.map → .fold)
Either a new check or the call was too complex previously for it to trigger?
* Add to contributors
* typeanswer: remove slice_* functions
They're used only once in to_tokens. Easier to read this way IMHO, anyway.
This reverts commit 96ff4f1a4a.
This change broke adding of new occlusions on desktop:
JS error /_anki/js/editor.js:100016 Uncaught TypeError: Cannot read properties of undefined (reading 'getBoundingRect')
* Update to Svelte 5
* Fix `<tr> is invalid inside <table>`
* Update sveltekit-svg to match svelte version
Fixes deck options failing to load, and a bunch of warnings with
./yarn dev
* Fix graph tooltips
* Fix editor loading
* Fix MathJax editor not loading
* Formatting
* Fix new formatting errors
* Merge remote-tracking branch 'origin/main' into svelte5
* Remove slot inside EditorToolbar
I think this is just stray code left over from a refactor, but I'm
not 100% sure.
Fixes
Error: Object literal may only specify known properties, and 'children' does not exist in type '{ size: number; wrap: boolean; api?: Partial<EditorToolbarAPI> | undefined; }'. (ts)
<div class="note-editor">
<EditorToolbar {size} {wrap} api={toolbar}>
<slot slot="notetypeButtons" name="notetypeButtons" />
* Fix component typing error
* Comment out svelte/internal exports, so editor loads
* Fix image occlusions in editor
* Revert "Remove slot inside EditorToolbar"
This reverts commit b3095e07ac,
which prevented the Preview button from showing in the browser.
This will break our tests again.
* Update vite
* Disable routes/tmp for now
* Fix references issue in routes/tmp
* add name to about page
* use two decimal retention for calculations
* Update CONTRIBUTORS
* format
* Update CONTRIBUTORS
* Update CONTRIBUTORS
* Update CONTRIBUTORS
* If deck options are modified, ask before closing
This imitates the way the note editor behaves. If a user assumes by
error that chanhges are automatically saved, it ensures they won't
lose them.
Also, this will eventually allows to have the same feature on
AnkiDroid. While, currently, we always ask the user whether they want
to close the deck options, even when there are no modification, which
seems to regularly frustate users (including myself).
I'm new to Svelte, please let me know whether there is a better way to
obtain the information from Svelte state that I missed.
Note that I ensured that only a boolean can be obtained. I didn't
cause the whole state to be accessible. May be useful for some
add-ons, I guess, but risks breaking too much things.
Regarding the deckoptions.py, I tried to imitate addcards.py way to
check whether the add card view can be closed. Reusing the same
function and variable name when possible.
* Update qt/aqt/deckoptions.py (dae)
* Add comment about the usage of the input field in the statistics page (#3394)
* Fix formatting issues (#3394)
* Update ts/routes/graphs/RangeBox.svelte
Co-authored-by: Mike Hardy <github@mikehardy.net>
* Update ts/routes/graphs/RangeBox.svelte
Co-authored-by: Mike Hardy <github@mikehardy.net>
---------
Co-authored-by: Damien Elmes <dae@users.noreply.github.com>
Co-authored-by: Mike Hardy <github@mikehardy.net>
* Updated error message to provide additional guidance for file import issues if Legacy Import/Export is enabled
Enhanced the error message from "Unable to read file. It probably requires a newer version of Anki to import."
to include a suggestion for users to try unchecking 'Legacy import/export Handling' under Preferences > Editing >
Import/Export if they encounter the issue.
* Update CONTRIBUTORS
* Bump Python deps
Primarily for flask-cors CVE
* Bump TS deps; pin license checker
Current checker is missing the binary
https://github.com/RSeidelsohn/license-checker-rseidelsohn/issues/118
* Update Rust deps
Hyper and axum are held back as we currently make use of the older
http library that reqwest pulls in
* graduate card when user press hard and has 0 learning steps
* fix error: useless conversion to the same type
* do the same thing to again
* fix expected `Option<u32>`, found integer
* ./ninja format
* Update to FSRS-rs v1.2.0
* if else -> match
* Weight length check has been moved into FSRS (dae)
* Don't mention the number of FSRS parameters (dae)
It has changed, and may change again.
* Empty cards is undoable
If there was a reason for this operation not to be undoable, I can't easily guess it. My main hyposhesis was that the number of deleted card may be too big. But I realized that deleting a deck is undoable and may delete as many note.
As you may know, I realized that only the undoable operations triggered notification in AnkiDroid that we may have to update the UI. And while I just wanted to trigger more notifications, some reviewers thought it would be nicer if the operation were returning a OpChanges. So here it's done. If you would please consider merging it.
I decided to introduce a new string because the closest strings I could find currently are "Empty cards..." and the trailing commas don't seem nice in "undo". And the title, which we may not be able to reuse in all language
* Don't count cards that have already been removed (dae)
* moved ignore setting to advanced
* Update CONTRIBUTORS
* Match width of other text inputs (dae)
The width was inconsistent before as well, but moving it next to
text inputs made it more obvious.
* refactor: fix type checking error
error: Argument 1 to "_answerCard" of "Reviewer" has incompatible type "int"; expected "Literal[1, 2, 3, 4]" [arg-type]
* refactor: remove check that `ease` is correct number
* refactor: rename variable
* refactor: add type hint for generator function
* refactor: revise import of `functools.partial`
* refactor: invert logic of if-construct
to avoid nesting.
* refactor: properly check for `None`
* Update qt/aqt/reviewer.py
- rslib(http_server): add `is_running()` method
- rslib(sync): introduce `--healthcheck` argument for health probe in distroless
- doc(syncserver): add table comparing Dockerfile and Dockerfile.distroless
- Expand cross-platform support with distroless
- add `Dockerfile.distroless`
- Dockerfile: bump rust `1.79` to `1.80.1`
- Dockerfile: bump alpine `3.20` to `3.20.2`
Note: Implemented an internal health check because distroless images do not include curl, which is used to reduce image size and attack surface. For more details, see https://blog.sixeyed.com/docker-healthchecks-why-not-to-use-curl-or-iwr/https://github.com/GoogleContainerTools/distroless
fix: failed: check:format:rust
typo
remove extra space
fix failed:check:format:rust
update doc
fetch `host` and `port` using envy
fix: failed: check:format:rust
Update doc + add dockerignore
- dockerignore: This helps avoid sending unwanted files and directories to the builder
- add new line
- I am still experimenting cross platform compilation, I am getting
4.337 From https://github.com/ankitects/rust-url
4.337 * [new ref] bb930b8d089f4d30d7d19c12e54e66191de47b88 -> refs/commit/bb930b8d089f4d30d7d19c12e54e66191de47b88
4.397 error: failed to get `percent-encoding-iri` as a dependency of package `anki v0.0.0 (/app/rslib)`
still checking what could be the issue
fix: failed: check:format:dprint
* Update amd64 docker container to Debian 11
This bumps the minimum required glibc to 2.29, which is 2019
Ubuntu/Fedora, and 2021 Debian.
Also remove the unused download of ninja
* Update to latest dprint
Unblocked by the glibc upgrade
* test using existed cards
* plot new and review
* convert learning cards & use line chart
* allow draw multiple simulations in the same chart
* support hide simulation
* convert x axis to Date
* convert y from second to minute
* support clear last simulation
* remove unused import
* rename
* add hover/tooltip
* fallback to default parameters
* update default value and maximum of deckSize
* add "processing..."
* fix mistake
* right click and copy on image works
* renamed helper fn
* separated functionality of copy and copy image
* Update CONTRIBUTORS
* snake case
* Update CONTRIBUTORS
If you don't use Visual Studio Code as your text editor, and therefore
can't use the Pylance extension, but nonetheless use `pyright` as a CLI
application.
* start of load balancer
* add configuration options; option to load balance per deck
* formatting
* clippy
* add myself to contributors
* cleanup
* cargo fmt
* copyright header on load_balancer.rs
* remove extra space
* more formatting
* python formatting
* ignore this being None
only doing this cause python has awful lambdas and can't
loop in a meaningful way without doing this
* only calculate notes on each day if we are trying to avoid siblings
* don't fuzz intervals if the load balancer is enabled
* force generator to eval so this actually happens
* load balance instead of fuzzing, rather than in addition to
* use builtin fuzz_bounds rather than reinvent something new
* print some debug info on how its load balancing
* clippy
* more accurately load balance only when we want to fuzz
* incorrectly doublechecking the presence of the load balancer
* more printfs for debugging
* avoid siblings -> disperse siblings
* load balance learning graduating intervals
* load balancer: respect min/max intervals; graduating easy should be at least +1 good
* filter out after-days under minimum interval
* this is an inclusive check
* switch load balancer to caching instead of on the fly calculation
* handle case where load balancer would balance outside of its bounds
* disable lb when unselecting it in preferences
* call load_balancer in StateContext::with_review_fuzz instead of next to
* rebuild load balancer when card queue is rebuilt
* remove now-unused configuration options
* add note option to notetype to enable/disable sibling dispersion
* add options to exclude decks from load balancing
* theres a lint checking that the link actually exists so I guess I'll add the anchor back in later?
* how did I even update this
* move load balancer to cardqueue
* remove per-deck balancing options
* improve determining whether to disperse siblings when load balancing
* don't recalculate notes on days every time
* remove debug code
* remove all configuration; load balancer enabled by default; disperse siblings if bury_reviews is set
* didn't fully remove caring about decks from load balancer sql query
* load balancer should only count cards in the same preset
* fuzz interval if its outside of load balancer's range
* also check minimum when bailing out of load balancer
* cleanup; make tests happy
* experimental weight-based load balance fuzzing
* take into account interval when weighting as it seems to help
* if theres no cards the interval weight is just 1.0
* make load balancer disableable through debug console
* remove debug prints
* typo
* remove debugging print
* explain a bit how load balancer works
* properly balance per preset
* use inclusive range rather than +1
* -1 type cast
* move type hint somewhere less ugly; fix comment typo
* Reuse existing deck list from parent function (dae)
Minor optimisation
* Add AnkiHub section to preferences screen
* Add short intro for AnkiWeb and AnkiHub to syncing section
* Add AnkiHub login screen
* Implement login methods in backend
* Set minimum dialog width
* Add missing colon
* Respect the ANKIHUB_APP_URL env var
This is used by the add-on.
* Simplify login error reporting
* Fix from_prefs_screen not passed to subcall
* Add missing ankihub_pb2 import
* Install AnkiHub add-on after sign-in
* Avoid .exec()
* Update ftl/core/sync.ftl
Co-authored-by: Damien Elmes <dae@users.noreply.github.com>
* Split translation string
* Support login by username/email
* Fix entered username/email not being passed back to on_done
* Remove unused import
* Move to 'Third-party services' section
* Tweak login dialog's heading
* Remove 'third-party' from intro text
* Tweak copy
* Prefix profile keys
* Tweak strings
* Remove description from login dialog
* Remove signup links
* Clear credentials in ankihub_logout()
* Call .adjustSize()
* Title Case
* Add padding to third-party services, and fix tab order from other PR
* fix: except only non-system-exiting exceptions
see https://youtu.be/zrVfY9SuO64
* chore: add myself to CONTRIBUTORS file
* refactor: explicitly specify possible exceptions
If an exception is not an Exception, there are only three options left.
see https://docs.python.org/3/library/exceptions.html#exception-hierarchy
* refactor: use BaseException for fallback
Co-authored-by: Damien Elmes <dae@users.noreply.github.com>
* chore: add myself to contributors
* fix: ensure none of the returned values is None
Fixes TypeError 'NoneType' object is not subscriptable
* refactor: reduce code duplication using a function
* refactor: prefer KeyError over None for dicts
If the key is not in the dictionary, we want to raise a KeyError rather
than returning None. That way, we can distinguish between whether the
value was None or the key was not found.
* chore: add myself to CONTRIBUTORS file
* refactor: simplify the code
* refactor: rename variables of tuple
* refactor: rename function argument
* refactor: use function to get index of language
* refactor: replace for-loop
* refactor: use variable
* refactor: assert values are not None
To satisfy the type checker.
* refactor: change generator expression to for-loop
* Feat/FSRS-5
* adapt the SimulatorConfig of FSRS-5
* update parameters from FSRS-4.5
* udpate to FSRS-rs v1.1.0
* ./ninja fix:minilints
* pass ci
* update cargo-deny to 0.14.24
* udpate to FSRS-rs v1.1.1
* update to fsrs-rs v1.1.2
* refactor: fix type annotation
* fix: properly check if argument is None
Don't use Boolean expressions to implement a default value.
* fix: ensure that 'model' is not None
Don't use exceptions to control the flow.
* refactor: simplify if-else construct
* chore: add myself to CONTRIBUTORS file
* refactor: use newer type hints for Union/Optional
* refactor: fix deprecated type annotations
use collections.abc rather than typing
* refactor: use lower letter type annotations
* style: reformat with black
* refactor: remove unused imports
* refactor: add missing imports for type hints
* fixup! refactor: use newer type hints for Union/Optional
* fix: add missing imports for type annotations
* fixup! refactor: use newer type hints for Union/Optional
* fixup! style: reformat with black
* refactor: fix remaining imports re: type hints
* chore: remove isort settings covered by profile
https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#custom-configuration
* chore: add myself to CONTRIBUTORS file
* chore: use black profile for isort
* chore(isort): fix configuration to skip directories
When overwriting `skip`, `.git` and others would no longer be skipped.
`extend_skip` is the correct option.
* chore(isort): skip directory `qt/bundle`
* changed anki-logo-thin.png to version with transparent background
* Revert "changed anki-logo-thin.png to version with transparent background"
This reverts commit 4c7e826a73.
* changed anki-logo-thin.png to version with transparent background
* added name to contributors as per contribution guidelines for first PR
* fixed contributors file rather than directly modifying about file
* Update base images and introduce health endpoint
sync-server: introduce `/health` endpoint to check if the service is reachable.
bump(alpine): bump alpine base image from `3.19` to `3.20`
bump(rust): bump rust-alpine build image from `1.76` to `1.79`
* fix cargo fmt
* add allow clippy::extra_unused_type_parameters
* Remove unused type param (dae)
* Route /health directly (dae)
* Fix for latest axum (dae)
* Apply fuzz to SM2 lapse interval and respect max ivl
Imo, there is no reason for not applying fuzz to SM2 lapse intervals
* Update review.rs
* Format
* Update review.rs
* Update review.rs
* Update review.rs
* Update review.rs
* Configure buddy widgets for labels in the Preferences dialog
Labels are often used to describe the purpose of a different widget like a combobox, edit field or a spinbox by providing a textual name for their functionality. The relation between a label and a widget is typically expressed by placing the label next to the relevant object. In addition to this visual linking intended for human users, frameworks usually also offer semantic way to link labels with other widgets, so the relation can be noticed by programs like screenreaders, which can figure out the correct textual description for the focused widgets based on this information.
By default, labels on their own are not focusable elements, so users dependend on keyboard navigation and speech get to notice only the widget types (textbox, spinbox, etc.) while moving around without any contextual information if labels are not linked. When the linking is done, the component names get included as well.
QT provides the "buddy" property for QLabel, which creates a semantic link between the label and its buddy widget.
This commit configures the buddy properties on labels of the Anki Preferences dialog.
* Configure spinbox suffixes in Preferrences dialog
QSpinBox provides a suffix property. This property makes it possible to display a measurement unit next to the component value, which is linked to it both visually and semantically for the GUI framework without affecting the spinbox value itself. For purposes of accessibility, it's better to use this property than simply place a label next to the component, since it can be directly accessed by screenreaders and other assistive technology.
This commit configures suffix properties for spinboxes in the Anki Preferences dialog. Note: Removal of the original unit labels may have altered the UI a little bit.
* Assign buddy widgets in the ID and password retrieval dialog
Set buddy widgets of the labels in the Get ID and password for synchronization dialog.
* Fix positioning/size of text boxes
* Style the suffixes of Preferences' QSpinBoxes
Style QSpinBox suffixes (for those that have one) in the Preferences dialog by prepending them by a space character.
* Fix FSRS easy interval being same as good interval in relearning cards
https://github.com/ankitects/anki/pull/3236#issuecomment-2187787774
* Update relearning.rs
* Update relearning.rs
* Set min interval of easy to Good + 1
* Ensure minimum doesn't exceed maximum (dae)
With a maximum interval set, it would be possible to confuse with_review_fuzz()
by passing min > max.
* Added methods to parse browser templates
* Added method to get parsed browser templates
* Make field rename check browser templates for field updates
* Update tests
* Updated CONTRIBUTORS
* Formatting
* Refactored cloze field logic for question template into closure
* Refactored cloze field logic for answer template into closure
This resulted in the I/O regression in #3223 not being caught with ./run,
and puts devs ast risk. It also does not currently seem to be required
(pages like graphs and deck options work correctly with ./yarn dev).
I suspect the change was made to support running of pages/*.html, which
we no longer build.
* Add a preference to toggle LaTeX generation
* Fix test
* Remove LaTeX security restrictions
* Show existing LaTeX images regardless of preference
* Lift config check out of loop (dae)
* Shift option to review settings; display warning when disabled (dae)
* Do not show media auto sync errors
* is_autosync -> is_periodic_sync
* More wording improvements; fix periodic sync depending on auto sync setting (dae)
* Revert changes to ButtonToolbar from #3167
Flex gap is still not fully supported.
Keeps a small margin increase.
* Add margin to deck config header
* Move StickyHeader into import-page
* Rework ChangeNotetypePage with existing components
* Use disabled Select instead of LabelButton
* Don't use button for unclickable arrow
* Rework ImportLogPage with existing components
* Improve deck options styling
* Align spacing in ChangeNotetypePage further
* Use StickyContainer on ImportPage
* Format
* Add keyboard shortcuts for empty cards and toggle mask on image occlusion
- add shortcut for empty cards
- add shortcut for toggle mask
- set tooltips with shortcuts
use unused shortcut for empty cards
* remove unnecessary shortcut added in main.py
* change empty cards shortcut and try to fix CI error in CONTRIBUTORS
* change shortcut for empty cards for universal support
* Add number-truncation before backend translation
* Round instead of truncate (conform to testcases)
* Add test-case for plural rounding-to-one corner-case
* Move rounding into generated translation code
* Change unit test to test generated function
* Round any number in generation, ignore (int vs float)
(it seems that that type distinction is frequently inaccurate)
* Update formatting
* Add sveltekit-svg plugin to fix svg icon styling
Closes#3127.
* Unify svg icon usage
Moves all icons into ts/lib/components/icons.ts and uses a single component to render
them both with eslint and svelte-kit.
* Fix spinning revert icon not being centered
* Use svg earth icon for global label
* Add tooltip to global label icon
* Remove eslint-plugin-simple-import-sort
Imports are already sorted by dprint with conflicting rules.
* Enable hot module reloading on Windows
* Update VSC launch.json and tasks.json
* Bind vite server to 127.0.0.1 (dae)
Our frontend connects via IP, and on Windows, this fails if the server
is bound to 'localhost' instead.
* return current weights if fsrs_items is zero
* handle error of evaluation if items.is_empty()
* TODO: handle error of optimal retention
* Revert "TODO: handle error of optimal retention"
This reverts commit 80a5b3803e.
* Revert "handle error of evaluation if items.is_empty()"
This reverts commit 7f0a5570e7.
* Feature Question Action Show Reminder (#3064)
Added a option in the deck config that allow the user to choose in
Autoupdate mode between showing a reminder or revealing the card.
Also added my name to the contributors
* Update ftl/core/deck-config.ftl
* fix select all and change ordinal in edit mode in io
* make ordinal undefined for all shapes in group/ungroup
* fix group shapes and some ui fixes
* Don't add node_modules/* to dprint deps
* use minimum ordinal when shape merged, use max ordinal++ when ungrouped, in add mode no ordinal preset so NaN
* use state for ungroup shape
* maintain existing ordinal in editing mode
* fix order of ordinal in ungroup shape
* refactor: remove for loop, use forEach
This dependency usually doesn't benefit Linux distros with requests library configured to use system certificate already. And is not packaged by most distros. Making it optional will make most Linux users' installation much easier.
* Update to latest Node LTS
* Add sveltekit
* Split tslib into separate @generated and @tslib components
SvelteKit's path aliases don't support multiple locations, so our old
approach of using @tslib to refer to both ts/lib and out/ts/lib will no
longer work. Instead, all generated sources and their includes are
placed in a separate out/ts/generated folder, and imported via @generated
instead. This also allows us to generate .ts files, instead of needing
to output separate .d.ts and .js files.
* Switch package.json to module type
* Avoid usage of baseUrl
Incompatible with SvelteKit
* Move sass into ts; use relative links
SvelteKit's default sass support doesn't allow overriding loadPaths
* jest->vitest, graphs example working with yarn dev
* most pages working in dev mode
* Some fixes after rebasing
* Fix/silence some svelte-check errors
* Get image-occlusion working with Fabric types
* Post-rebase lock changes
* Editor is now checked
* SvelteKit build integrated into ninja
* Use the new SvelteKit entrypoint for pages like congrats/deck options/etc
* Run eslint once for ts/**; fix some tests
* Fix a bunch of issues introduced when rebasing over latest main
* Run eslint fix
* Fix remaining eslint+pylint issues; tests now all pass
* Fix some issues with a clean build
* Latest bufbuild no longer requires @__PURE__ hack
* Add a few missed dependencies
* Add yarn.bat to fix Windows build
* Fix pages failing to show when ANKI_API_PORT not defined
* Fix svelte-check and vitest on Windows
* Set node path in ./yarn
* Move svelte-kit output to ts/.svelte-kit
Sadly, I couldn't figure out a way to store it in out/ if out/ is
a symlink, as it breaks module resolution when SvelteKit is run.
* Allow HMR inside Anki
* Skip SvelteKit build when HMR is defined
* Fix some post-rebase issues
I should have done a normal merge instead.
2024-03-31 09:16:31 +01:00
1212 changed files with 41554 additions and 26771 deletions
- We use the fluent system+code generation for translation.
- New strings should be added to rslib/core/. Ask for the appropriate file if you're not sure.
- Assuming a string addons-you-have-count has been added to addons.ftl, that string is accessible in our different languages as follows:
- Python: from aqt.utils import tr; msg = tr.addons_you_have_count(count=3)
- TypeScript: import * as tr from "@generated/ftl"; tr.addonsYouHaveCount({count: 3})
- Rust: collection.tr.addons_you_have_count(3)
- In Qt .ui files, strings that are marked as translatable will automatically use the registered ftl strings. So a QLabel with a title 'addons_you_have_count' that is marked as translatable will automatically use the translation defined in our addons.ftl file.
Anki is a spaced repetition flashcard program with a multi-layered architecture. Main components:
- Web frontend: Svelte/TypeScript in ts/
- PyQt GUI, which embeds the web components in aqt/
- Python library which wraps our rust Layer (pylib/, with Rust module in pylib/rsbridge)
- Core Rust layer in rslib/
- Protobuf definitions in proto/ that are used by the different layers to
talk to each other.
## Building/checking
./check (check.bat) will format the code and run the main build & checks.
Please do this as a final step before marking a task as completed.
## Quick iteration
During development, you can build/check subsections of our code:
- Rust: 'cargo check'
- Python: './tools/dmypy', and if wheel-related, './ninja wheels'
- TypeScript/Svelte: './ninja check:svelte'
Be mindful that some changes (such as modifications to .proto files) may
need a full build with './check' first.
## Build tooling
'./check' and './ninja' invoke our build system, which is implemented in build/. It takes care of downloading required deps and invoking our build
steps.
## Translations
ftl/ contains our Fluent translation files. We have scripts in rslib/i18n
to auto-generate an API for Rust, TypeScript and Python so that our code can
access the translations in a type-safe manner. Changes should be made to
ftl/core or ftl/qt. Except for features specific to our Qt interface, prefer
the core module. When adding new strings, confirm the appropriate ftl file
first, and try to match the existing style.
## Protobuf and IPC
Our build scripts use the .proto files to define our Rust library's
non-Rust API. pylib/rsbridge exposes that API, and _backend.py exposes
snake_case methods for each protobuf RPC that call into the API.
Similar tooling creates a @generated/backend TypeScript module for
communicating with the Rust backend (which happens over POST requests).
## Fixing errors
When dealing with build errors or failing tests, invoke 'check' or one
of the quick iteration commands regularly. This helps verify your changes
are correct. To locate other instances of a problem, run the check again -
don't attempt to grep the codebase.
## Ignores
The files in out/ are auto-generated. Mostly you should ignore that folder,
though you may sometimes find it useful to view out/{pylib/anki,qt/_aqt,ts/lib/generated} when dealing with cross-language communication or our other generated sourcecode.
## Launcher/installer
The code for our launcher is in qt/launcher, with separate code for each
platform.
## Rust dependencies
Prefer adding to the root workspace, and using dep.workspace = true in the individual Rust project.
## Rust utilities
rslib/{process,io} contain some helpers for file and process operations,
which provide better error messages/context and some ergonomics. Use them
when possible.
## Rust error handling
in rslib, use error/mod.rs's AnkiError/Result and snafu. In our other Rust modules, prefer anyhow + additional context where appropriate. Unwrapping
1. The web frontend, created in Svelte and typescript,
2. The Python layer and
3. The core Rust layer.
Each layer can can makes RPC (Remote Procedure Call) to the layers below it. While it should be avoided, Python can also invoke Typescript functions. The Rust layers never make calls to the other layers. Note that it can make RPC to AnkiWeb and other servers, which is out of scope of this document.
In this document we'll provide examples of bridge between languages, explaining:
- where the RPC is declared,
- where it is called (with the appropriate imports) and
- where it is implemented.
Imitating those examples should allow you to make call and create new RPCs.
## Declaring RPCs
Let's consider the method `NewDeck` of `DecksServices`. It's declared in [decks.proto](https://github.com/ankitects/anki/blob/acaeee91fa853e4a7a78dcddbb832d009ec3529a/proto/anki/decks.proto#L14) as `rpc NewDeck(generic.Empty) returns (Deck);`. This means this methods takes no argument (technically, an argument containing no information), and returns a [`Deck`](https://github.com/ankitects/anki/blob/acaeee91fa853e4a7a78dcddbb832d009ec3529a/proto/anki/decks.proto#L54).
Read [protobuf](./protobuf.md) to learn more about how those input and output types are defined.
If the RPC implementation is in Python, it should be declared in the service [frontend.proto](https://github.com/ankitects/anki/blob/acaeee91fa853e4a7a78dcddbb832d009ec3529a/proto/anki/frontend.proto#L24C3-L24C66)'s `FrontendService`. RPCs declared in any other services are implemented in Rust.
## Making a Remote Procedure Call
In this section we'll consider how to make Remote Procedure Call (RPC) from languages used in Anki. Languages used for AnkiDroid and AnkiMobile are out of scope of this document.
### Making a RPC from Python
Python can invoke the `NewDeck` method with [`col._backend.new_deck()`](https://github.com/ankitects/anki/blob/acaeee91fa853e4a7a78dcddbb832d009ec3529a/pylib/anki/decks.py#L168). This python method takes no argument and returns a `Deck` value.
However, most Python code should not call this method directly. Instead it should call [`col.decks.new_deck()`](https://github.com/ankitects/anki/blob/acaeee91fa853e4a7a78dcddbb832d009ec3529a/pylib/anki/decks.py#L166). Generally speaking, all back-end functions called from Python should be called through a helper method defined in `pylib/anki/`. The `_backend` part is an implementation detail that most callers should ignore. This is especially important because add-ons should expect a relatively stable API independent of the implementation details of the RPC.
### Invoking method from TypeScript
Let's consider the method [`rpc GetCsvMetadata(CsvMetadataRequest) returns (CsvMetadata);`](https://github.com/ankitects/anki/blob/acaeee91fa853e4a7a78dcddbb832d009ec3529a/proto/anki/import_export.proto#L20) from `ImportExportService`..
It's used in the TypeScript class [`ImportCsvState`](https://github.com/ankitects/anki/blob/acaeee91fa853e4a7a78dcddbb832d009ec3529a/ts/routes/import-csv/lib.ts#L102), as an asynchronous function. It's argument is a single javascript object, whose keys are as in [`CsvMetadataRequest`](https://github.com/ankitects/anki/blob/acaeee91fa853e4a7a78dcddbb832d009ec3529a/proto/anki/import_export.proto#L138) and it returns a `CsvMetadata`.
The method was imported with `import { getCsvMetadata } from "@generated/backend";` and the types were imported with `import type { CsvMetadata } from "@generated/anki/import_export_pb";`. Note that it was not necessary to import the input type given that it's simply an untyped javascript object.
## Implementation
Let's now look at implementations of those RPCs.
### Implementation in Rust
The method NewDeck is implemented in Rust's [DecksService](https://github.com/ankitects/anki/blob/acaeee91fa853e4a7a78dcddbb832d009ec3529a/rslib/src/decks/service.rs#L21) as `fn new_deck(&mut self) -> error::Result<anki_proto::decks::Deck>`. It should be noted that the method name was changed from Pascal case to snake case, and the rps's argument of type `generic.Empty` is ignored.
### Implementation in Python
Let's consider the implementation of the method [DeckOptionsRequireClose](https://github.com/ankitects/anki/blob/acaeee91fa853e4a7a78dcddbb832d009ec3529a/qt/aqt/mediasrv.py#L578). It's defined as `def deck_options_require_close() -> bytes:`. In this case, there should be a returned value. However, it'll be ignored, so returning `b""` is perfectly fine.
Note that the incoming HTTP request is not processed on the main thread. In order to do any work with the GUI, we should call `aqt.mw.taskman.run_on_main`.
## Invoking a TypeScript method from Python
This case should be avoided if possible, as we generally should avoid
calls to the upper layer. Contrary to the previous cases, we don't use
protobuf.
### Calling a TS function.
Let's take as Example [`export function getTypedAnswer(): string | null`](https://github.com/ankitects/anki/blob/acaeee91fa853e4a7a78dcddbb832d009ec3529a/ts/reviewer/index.ts#L35). It's an exported function, and its return type can be encoded in JSON.
It's called in the Reviewer class through [`self.web.evalWithCallback("getTypedAnswer();", self._onTypedAnswer)`](https://github.com/ankitects/anki/blob/acaeee91fa853e4a7a78dcddbb832d009ec3529a/qt/aqt/reviewer.py#L785). The result is then sent to [`_onTypedAnswer`](https://github.com/ankitects/anki/blob/acaeee91fa853e4a7a78dcddbb832d009ec3529a/qt/aqt/reviewer.py#L787).
If no return value is needed, `web.eval` would have been sufficient.
### Calling a Svelte method
Let's now consider the case where the method we want to call is implemented in a Svelte library. Let's take as example [`deckOptionsPendingChanges`](https://github.com/ankitects/anki/blob/acaeee91fa853e4a7a78dcddbb832d009ec3529a/ts/routes/deck-options/%5BdeckId%5D/%2Bpage.svelte#L17). We define it with:
Note that if the function is asynchronous, you can't directly send the
result to a callback. Instead your function will have to call a post
method that will be sent to Python or Rust.
This method is called in [deckoptions.py](https://github.com/ankitects/anki/blob/acaeee91fa853e4a7a78dcddbb832d009ec3529a/qt/aqt/deckoptions.py#L68) with `self.web.eval("anki.deckOptionsPendingChanges();"`.
ProtoBuf is a format used both to save data in storage and transmit
data between services. You can think of it as similar to JSON with
schemas, given that you can use basic types, list and records. Except
that it's usually transmitted and saved in an efficient byteform and
not in a human readable way.
# Protocol Buffers
Anki uses [different implementations of Protocol Buffers](./architecture.md#protobuf)
@ -92,12 +98,6 @@ should preferably be assigned a number between 1 and 15. If a message contains
Protobuf has an official Python implementation with an extensive [reference](https://developers.google.com/protocol-buffers/docs/reference/python-generated).
- Every message used in aqt or pylib must be added to the respective `.pylintrc`
to avoid failing type checks. The unqualified protobuf message's name must be
used, not an alias from `collection.py` for example. This should be taken into
account when choosing a message name in order to prevent skipping typechecking
a Python class of the same name.
### Typescript
Anki uses [protobuf-es](https://github.com/bufbuild/protobuf-es), which offers
| **Customization** | ✅ Easier to customize with additional packages | ❌ Limited customization options |
| **Attack Surface** | ❌ Larger attack surface due to more installed packages | ✅ Reduced attack surface |
| **Libraries** | ✅ More libraries available | ❌ Limited libraries |
| **Start-up Time** | ❌ Slower start-up time due to larger image size | ✅ Faster start-up time |
| **Tool Compatibility** | ✅ Compatible with more tools and libraries | ❌ Compatibility limitations with certain tools |
| **Maintenance** | ❌ Higher maintenance due to larger image and dependencies | ✅ Lower maintenance with minimal base image |
| **Custom uid/gid** | ✅ It's possible to pass in PUID and PGID | ❌ PUID and PGID are not supported |
# Building image
To proceed with building, you must specify the Anki version you want, by replacing `<version>` with something like `23.12.1`.
To proceed with building, you must specify the Anki version you want, by replacing `<version>` with something like `24.11` and `<Dockerfile>` with the chosen Dockerfile (e.g., `Dockerfile` or `Dockerfile.distroless`)
```bash
# Ensure you are running this command inside /docs/syncserver
@ -57,10 +72,12 @@ actions-previous-card-info = Previous Card Info
# input is required before it can be performed. E.g. "Export..." vs. "Delete".
actions-with-ellipsis = { $action }...
actions-fullscreen-unsupported = Full screen mode is not supported for your video driver. Try switching to a different one from the preferences screen.
## Flags
actions-flag-number = Flag { $number }
## The same translation may used for two independent actions:
## searching for cards with a flag of the specified color, and
## toggling the flag of the specified color on a card.
actions-flag-red = Red
actions-flag-orange = Orange
actions-flag-green = Green
@ -68,9 +85,13 @@ actions-flag-blue = Blue
actions-flag-pink = Pink
actions-flag-turquoise = Turquoise
actions-flag-purple = Purple
##
actions-set-flag = Set Flag
actions-nothing-to-undo = Nothing to undo
actions-nothing-to-redo = Nothing to redo
actions-auto-advance = Auto Advance
actions-auto-advance-activated = Auto Advance enabled
actions-auto-advance-deactivated = Auto Advance disabled
card-templates-type-boxes-warning = Only one typing box per card template is supported.
card-templates-restore-to-default = Restore to Default
card-templates-restore-to-default-confirmation = This will reset all fields and templates in this notetype to their default
values, removing any extra fields/templates and their content, and any custom styling. Do you wish to proceed?
card-templates-restored-to-default = Notetype has been restored to its original state.
card-templates-restore-to-default-confirmation = This will reset all fields and templates in this note type to their default values, removing any extra fields/templates and their content, and any custom styling. Do you wish to proceed?
card-templates-restored-to-default = Note type has been restored to its original state.
*[other] Fixed { $count } objects with timestamps in the future.
}
# "db-check" is always in English
database-check-notetypes-recovered = One or more notetypes were missing. The notes that used them have been given new notetypes starting with "db-check", but field names and card design have been lost, so you may be better off restoring from an automatic backup.
database-check-notetypes-recovered = One or more notetypes were missing. The notes that used them have been given new notetypes starting with "db-check", but field names and card design have been lost, so you may be better off restoring from an automatic backup.
deck-config-apply-all-parent-limits = Limits start from top
deck-config-apply-all-parent-limits-tooltip =
By default, limits start from the deck you select. If this option is enabled, the limits will
By default, the daily limits of a higher-level deck do not apply if you're studying from its subdeck.
If this option is enabled, the limits will
start from the top-level deck instead, which can be useful if you wish to study individual
sub-decks, while enforcing a total limit on cards/day.
subdecks, while enforcing a total limit on cards for the deck tree.
deck-config-affects-entire-collection = Affects the entire collection.
## Daily limit tabs: please try to keep these as short as the English version,
@ -61,7 +62,7 @@ deck-config-today-only = Today only
deck-config-learning-steps = Learning steps
# Please don't translate `1m`, `2d`
-deck-config-delay-hint = Delays are typically minutes (eg `1m`) or days (eg `2d`), but hours (eg `1h`) and seconds (eg `30s`) are also supported.
-deck-config-delay-hint = Delays are typically minutes (e.g. `1m`) or days (e.g. `2d`), but hours (e.g. `1h`) and seconds (e.g. `30s`) are also supported.
deck-config-learning-steps-tooltip =
One or more delays, separated by spaces. The first delay will be used
when you press the `Again` button on a new card, and is 1 minute by default.
select to study, and not any subdecks it may have.
## Gather order and sort order of cards – Combobox entries
# Gather new cards ordered by deck.
deck-config-new-gather-priority-deck = Deck
# Gather new cards ordered by deck, then ordered by random notes, ensuring all cards of the same note are grouped together.
deck-config-new-gather-priority-deck-then-random-notes = Deck, then random notes
# Gather new cards ordered by position number, ascending (lowest to highest).
deck-config-new-gather-priority-position-lowest-first = Ascending position
# Gather new cards ordered by position number, descending (highest to lowest).
deck-config-new-gather-priority-position-highest-first = Descending position
# Gather the cards ordered by random notes, ensuring all cards of the same note are grouped together.
deck-config-new-gather-priority-random-notes = Random notes
# Gather new cards randomly.
deck-config-new-gather-priority-random-cards = Random cards
# Sort the cards first by their type, in ascending order (alphabetically), then randomized within each type.
deck-config-sort-order-card-template-then-random = Card type, then random
# Sort the notes first randomly, then the cards by their type, in ascending order (alphabetically), within each note.
deck-config-sort-order-random-note-then-template = Random note, then card type
# Sort the cards randomly.
deck-config-sort-order-random = Random
# Sort the cards first by their type, in ascending order (alphabetically), then by the order they were gathered, in ascending order (oldest to newest).
deck-config-sort-order-template-then-gather = Card type, then order gathered
# Sort the cards by the order they were gathered, in ascending order (oldest to newest).
deck-config-sort-order-gather = Order gathered
# How new cards or interday learning cards are mixed with review cards.
deck-config-review-mix-mix-with-reviews = Mix with reviews
# How new cards or interday learning cards are mixed with review cards.
deck-config-review-mix-show-after-reviews = Show after reviews
# How new cards or interday learning cards are mixed with review cards.
deck-config-review-mix-show-before-reviews = Show before reviews
# Sort the cards first by due date, in ascending order (oldest due date to newest), then randomly within the same due date.
deck-config-sort-order-due-date-then-random = Due date, then random
# Sort the cards first by due date, in ascending order (oldest due date to newest), then by deck within the same due date.
deck-config-sort-order-due-date-then-deck = Due date, then deck
# Sort the cards first by deck, then by due date in ascending order (oldest due date to newest) within the same deck.
deck-config-sort-order-deck-then-due-date = Deck, then due date
# Sort the cards by the interval, in ascending order (shortest to longest).
deck-config-maximum-answer-secs = Maximum answer seconds
deck-config-maximum-answer-secs-tooltip =
The maximum number of seconds to record for a single review. If an answer
exceeds this time (because you stepped away from the screen for example),
the time taken will be recorded as the limit you have set.
deck-config-show-answer-timer-tooltip =
In the review screen, show a timer that counts the number of seconds you're
taking to review each card.
deck-config-stop-timer-on-answer = Stop timer on answer
On the Study screen, show a timer that counts the time you're
taking to study each card.
deck-config-stop-timer-on-answer = Stop on-screen timer on answer
deck-config-stop-timer-on-answer-tooltip =
Whether to stop the timer when the answer is revealed.
Whether to stop the on-screen timer when the answer is revealed.
This doesn't affect statistics.
## Auto Advance section
deck-config-seconds-to-show-question = Seconds to show question for
deck-config-seconds-to-show-question-tooltip-2 = When auto advance is activated, the number of seconds to wait before revealing the answer. Set to 0 to disable.
deck-config-seconds-to-show-question-tooltip-3 = When auto advance is activated, the number of seconds to wait before applying the question action. Set to 0 to disable.
deck-config-seconds-to-show-answer = Seconds to show answer for
deck-config-seconds-to-show-answer-tooltip-2 = When auto advance is activated, the number of seconds to wait before applying the answer action. Set to 0 to disable.
deck-config-question-action-show-answer = Show Answer
deck-config-question-action-show-reminder = Show Reminder
deck-config-question-action = Question action
deck-config-question-action-tool-tip = The action to perform after the question is shown, and time has elapsed.
deck-config-answer-action = Answer action
deck-config-answer-action-tooltip = The action to perform on the current card before automatically advancing to the next one.
deck-config-wait-for-audio-tooltip = Wait for audio to finish before automatically revealing answer or next question
deck-config-answer-action-tooltip-2 = The action to perform after the answer is shown, and time has elapsed.
deck-config-wait-for-audio-tooltip-2 = Wait for audio to finish before automatically applying the question action or answer action.
Whether the question audio should be included when the Replay action is
@ -275,6 +308,22 @@ deck-config-minimum-interval-tooltip = The minimum interval given to a review ca
deck-config-custom-scheduling = Custom scheduling
deck-config-custom-scheduling-tooltip = Affects the entire collection. Use at your own risk!
## Easy Days section.
deck-config-easy-days-title = Easy Days
deck-config-easy-days-monday = Mon
deck-config-easy-days-tuesday = Tue
deck-config-easy-days-wednesday = Wed
deck-config-easy-days-thursday = Thu
deck-config-easy-days-friday = Fri
deck-config-easy-days-saturday = Sat
deck-config-easy-days-sunday = Sun
deck-config-easy-days-normal = Normal
deck-config-easy-days-reduced = Reduced
deck-config-easy-days-minimum = Minimum
deck-config-easy-days-no-normal-days = At least one day should be set to '{ deck-config-easy-days-normal }'.
deck-config-easy-days-change = Existing reviews will not be rescheduled unless '{ deck-config-reschedule-cards-on-change }' is enabled in the FSRS options.
deck-config-fsrs-must-be-enabled = FSRS must be enabled first.
deck-config-fsrs-params-optimal = The FSRS parameters currently appear to be optimal.
deck-config-fsrs-params-no-reviews = No reviews found. Make sure this preset is assigned to all decks (including subdecks) that you want to optimize, and try again.
deck-config-wait-for-audio = Wait for audio
deck-config-show-reminder = Show Reminder
deck-config-answer-again = Answer Again
@ -448,9 +493,69 @@ deck-config-answer-hard = Answer Hard
deck-config-answer-good = Answer Good
deck-config-days-to-simulate = Days to simulate
deck-config-desired-retention-below-optimal = Your desired retention is below optimal. Increasing it is recommended.
# Description of the y axis in the FSRS simulation
# diagram (Deck options -> FSRS) showing the total number of
# cards that can be recalled or retrieved on a specific date.
deck-config-fsrs-simulator-radio-ratio = Time / Memorized Ratio
# $time here is pre-formatted e.g. "10 Seconds"
deck-config-fsrs-simulator-ratio-tooltip = { $time } per memorized card
## Messages related to the FSRS scheduler’s health check. The health check determines whether the correlation between FSRS predictions and your memory is good or bad. It can be optionally triggered as part of the "Optimize" function.
# Checkbox
deck-config-health-check = Check health when optimizing
# Message box showing the result of the health check
deck-config-fsrs-bad-fit-warning = Health Check:
Your memory is difficult for FSRS to predict. Recommendations:
- Suspend or reformulate any cards you constantly forget.
- Use the answer buttons consistently. Keep in mind that "Hard" is a passing grade, not a failing grade.
- Understand before you memorize.
If you follow these suggestions, performance will usually improve over the next few months.
# Message box showing the result of the health check
deck-config-fsrs-good-fit = Health Check:
FSRS can adapt to your memory well.
## NO NEED TO TRANSLATE. This text is no longer used by Anki, and will be removed in the future.
deck-config-fsrs-simulator-y-axis-title-memorized = Memorized Total
deck-config-bury-siblings = Bury siblings
deck-config-do-not-bury = Do not bury siblings
deck-config-bury-if-new = Bury if new
@ -467,9 +572,53 @@ deck-config-bury-tooltip =
When using the V3 scheduler, interday learning cards can also be buried. Interday
learning cards are cards with a current learning step of one or more days.
deck-config-seconds-to-show-question-tooltip = When auto advance is activated, the number of seconds to wait before revealing the answer. Set to 0 to disable.
deck-config-answer-action-tooltip = The action to perform on the current card before automatically advancing to the next one.
deck-config-wait-for-audio-tooltip = Wait for audio to finish before automatically revealing answer or next question.
deck-config-ignore-before-tooltip =
If set, reviews before the provided date will be ignored when optimizing & evaluating FSRS parameters.
This can be useful if you imported someone else's scheduling data, or have changed the way you use the answer buttons.
deck-config-compute-optimal-retention-tooltip =
This tool assumes you're starting with 0 cards, and will attempt to calculate the amount of material you'll
be able to retain in the given time frame. The estimated retention will greatly depend on your inputs, and
if it significantly differs from 0.9, it's a sign that the time you've allocated each day is either too low
or too high for the amount of cards you're trying to learn. This number can be useful as a reference, but it
is not recommended to copy it into the desired retention field.
deck-config-health-check-tooltip1 = This will show a warning if FSRS struggles to adapt to your memory.
deck-config-health-check-tooltip2 = Health check is performed only when using Optimize Current Preset.
FSRS parameters affect how cards are scheduled. Anki will start with default parameters. Once
you've accumulated 1000+ reviews, you can use the option below to optimize the parameters to best
match your performance in decks using this preset.
deck-config-compute-optimal-weights-tooltip =
Once you've done 1000+ reviews in Anki, you can use the Optimize button to analyze your review history,
and automatically generate parameters that are optimal for your memory and the content you're studying.
If you have decks that vary wildly in difficulty, it is recommended to assign them separate presets, as
the parameters for easy decks and hard decks will be different. There is no need to optimize your parameters
frequently - once every few months is sufficient.
By default, parameters will be calculated from the review history of all decks using the current preset. You can
optionally adjust the search before calculating the parameters, if you'd like to alter which cards are used for
optimizing the parameters.
deck-config-compute-optimal-retention-tooltip2 =
This tool assumes that you’re starting with 0 learned cards, and will attempt to find the desired retention
value that will lead to the most material learnt, in the least amount of time. This number can be used as a
reference when deciding what to set your desired retention to. You may wish to choose a higher desired retention,
if you’re willing to trade more study time for a greater recall rate. Setting your desired retention lower than
the minimum is not recommended, as it will lead to more work without benefit.
deck-config-compute-optimal-retention-tooltip3 =
This tool assumes that you’re starting with 0 learned cards, and will attempt to find the desired retention value
that will lead to the most material learnt, in the least amount of time. To accurately simulate your learning process,
this feature requires a minimum of 400+ reviews. The calculated number can serve as a reference when deciding what to
set your desired retention to. You may wish to choose a higher desired retention, if you’re willing to trade more study
time for a greater recall rate. Setting your desired retention lower than the minimum is not recommended, as it will
lead to a higher workload, because of the high forgetting rate.
deck-config-seconds-to-show-question-tooltip-2 = When auto advance is activated, the number of seconds to wait before revealing the answer. Set to 0 to disable.
deck-config-invalid-weights = Parameters must be either left blank to use the defaults, or must be 17 comma-separated numbers.
deck-config-fsrs-on-all-clients =
Please ensure all of your Anki clients are Anki(Mobile) 23.10+ or AnkiDroid 2.17+. FSRS will
not work correctly if one of your clients is older.
deck-config-optimize-all-tip = You can optimize all presets at once by using the dropdown button next to "Save".
@ -8,13 +8,14 @@ importing-anki2-files-are-not-directly-importable = .anki2 files are not directl
importing-appeared-twice-in-file = Appeared twice in file: { $val }
importing-by-default-anki-will-detect-the = By default, Anki will detect the character between fields, such as a tab, comma, and so on. If Anki is detecting the character incorrectly, you can enter it here. Use \t to represent tab.
importing-existing-note-skipped = Note skipped, as an up-to-date copy is already in your collection
importing-note-skipped-update-due-to-notetype = Note not updated, as notetype has been modified since you first imported the note
importing-note-skipped-update-due-to-notetype2 = Note not updated, as notetype has been modified since you first imported the note, and '{ importing-merge-notetypes }' was not enabled
importing-note-skipped-update-due-to-notetype = Note not updated, as notetype has been modified since you first imported the note
importing-note-skipped-update-due-to-notetype2 = Note not updated, as notetype has been modified since you first imported the note, and '{ importing-merge-notetypes }' was not enabled
importing-note-updated-as-file-had-newer = Note updated, as file had newer version
importing-note-skipped-due-to-missing-notetype = Note skipped, as its notetype was missing
importing-note-skipped-due-to-missing-deck = Note skipped, as its deck was missing
preferences-ankihub-not-logged-in = Not currently logged in to AnkiHub.
preferences-ankiweb-intro = AnkiWeb is a free service that lets you keep your flashcard data in sync across your devices, and provides a way to recover the data if your device breaks or is lost.
preferences-ankihub-intro = AnkiHub provides collaborative deck editing and additional study tools. A paid subscription is required to access certain features.
preferences-third-party-description = Third-party services are unaffiliated with and not endorsed by Anki. Use of these services may require payment.
statistics-counts-separate-suspended-buried-cards = Separate suspended/buried cards
## Retention represents your actual retention from past reviews, in
## comparison to the "desired retention" setting of FSRS, which forecasts
## future retention. Retention is the percentage of all reviewed cards
## that were marked as "Hard," "Good," or "Easy" within a specific time period.
##
## Most of these strings are used as column / row headings in a table.
## (Excluding -title and -subtitle)
## It is important to keep these translations short so that they do not make
## the table too large to display on a single stats card.
##
## N.B. Stats cards may be very small on mobile devices and when the Stats
## window is certain sizes.
statistics-true-retention-title = Retention
statistics-true-retention-subtitle = Pass rate of cards with an interval ≥ 1 day.
statistics-true-retention-tooltip = If you are using FSRS, your retention is expected to be close to your desired retention. Please keep in mind that data for a single day is noisy, so it's better to look at monthly data.
statistics-true-retention-range = Range
statistics-true-retention-pass = Pass
statistics-true-retention-fail = Fail
# This will usually be the same as statistics-counts-total-cards
statistics-true-retention-total = Total
statistics-true-retention-count = Count
statistics-true-retention-retention = Retention
# This will usually be the same as statistics-counts-young-cards
statistics-true-retention-young = Young
# This will usually be the same as statistics-counts-mature-cards
statistics-true-retention-mature = Mature
statistics-true-retention-all = All
statistics-true-retention-today = Today
statistics-true-retention-yesterday = Yesterday
statistics-true-retention-week = Last week
statistics-true-retention-month = Last month
statistics-true-retention-year = Last year
statistics-true-retention-all-time = All time
# If there are no reviews within a specific time period, the retention
# percentage cannot be calculated and is displayed as "N/A."