* 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
* 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
* 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
* 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
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.
* 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
* 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
* 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>
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.
* 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.
* 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
* 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)
* 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
* 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
* 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
* 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>
* 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().
* 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)
* 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.
* 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.
* 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>
* 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.
* 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)
* 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
* 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
* 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
* 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
* 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
* 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.
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)
* 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
* 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