Commit graph

3649 commits

Author SHA1 Message Date
Jakub Fidler
d8460d354a
fix: Task manager exception handling (#3839)
* Raise exception from closures in run_in_background using run_on_main

* Add author to CONTRIBUTORS file

* Undo taskman changes

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

* feat: match sync initial title with state

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

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

Maybe a new string should be created for that.

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

Maybe a new string should be used for that

* refactor: fix formatting

* fix: alias in CONTRIBUTORS

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

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

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

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

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

* Update _load_flags to use the default_flag_names dict

* Add name to contributors file

* Add trailing comma to pass tests

* Update to follow python style guide

* Update about.py

* Revert "Update _load_flags to use the default_flag_names dict"

This reverts commit caa8fea94b.

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

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

* Fix: Button margins

* Added: More info

* Deleted useless info

* Added: Revlog rows

* Added: cardRow

* Replaced button with shortcut

* Fix: Copying new cards info error

* ./check

* Added: Rollover

* Format outputted json

* neatened imports

* make linter happy

* revert button changes

* Value Error -> Assert

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

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

added myself

* Update about.py

added myself

* Update scheduling.ftl

timers-related string changes

* Update deck-config.ftl

timers-related string changes

* Update help-page.ts

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

* use QApplication.setActiveWindow instead

* revert current impl

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

* support editing io notes as well

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

---------

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

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

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

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

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

* add and use Note.orig_note_id instead

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

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

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

* Only stage single redraw

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

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

I lost this one during some git troubles.

* Revert unrelated change

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

* chore: code cleanup

* cleanup: Remove redundant check for presence of callback

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

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

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

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

* fix create copy for io

* revert current impl

* passthru original note id when creating copy

* add IOCloningMode

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

* Consistent with Ankidroid

* Fix: Missing newline

* Renamed variables

* ./check

* Fix: Remove ``` from templates

* Stylistic changes

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

* fix lint

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

* CONTRIBUTORS file

* Fix/menubar in fullscreen

* CONTRIBUTORS file

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

This reverts commit 111f3bd138.

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

* add tests

* add support for comments to CardLayout

* fix lints

* revert current impl

* extract parsing logic from legacy_text_token

* add support for comments to templates

* add tests

* refactor take_until_handlebar_start_or

* remove redundant rest

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

* Rework legacy template handling (dae)

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

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

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

Bumps minimum glibc to 2.35, and minimum macOS to 12

* Drop generation of Qt5 packaged build

Closes #3615

* Include qt6 requirements in aqt wheel; drop extra deps

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

Just so that I stop getting the warning

* NF: Create `deckOptionsReady`

* NF: rename _close to require_close

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

* NF: simplify slightly some code

* NF: remove bridge command from deck options

* Remove unused import

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

* revert fix

* add caller-aware versions of play_file and stop_and_clear_queue

* stop editor's audio autoplay on close

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

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

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

* Make card-info placeholder text grey

---------

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

* Fix format

* Fix ForgettingCurve's reactivity

* Props' default args aren't reactive

* Add global _updateCardId fn to card-info

* Use _updateCardId to reactively update card-info

* Fix format

* Fix type

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

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

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

* Modify CONTRIBUTORS

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

* Use hasattr for backward compatibility

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

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

* Fix mypy errors

* Enable strict_optional for utils

* Fix mypy errors

* Enable strict_optional for sync

* Fix mypy errors

---------

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

* Fix mypy errors

* Enable strict_optional for package

* Fix mypy errors

* Enable strict_optional for progress

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

* Fix mypy errors

* Enable strict_optional for about

* Fix mypy errors

* Enable strict_optional for webview

* Fix mypy errors

* Fix merge error

* Revert utils

* Add early returns

---------

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

* Fix mypy errors

* Enable strict_optional for theme

* Fix mypy errors

* Enable strict_optional for toolbar

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

* Fix mypy errors

* Enable strict_optional for emptycards

* Fix mypy errors

* Enable strict_optional for flags

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

* Fix mypy errors

* Enable strict_optional for stats

* Fix mypy errors

* Enable strict_optional for switch

* Fix mypy errors

---------

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

* Fix mypy errors

* Enable strict_optional for editcurrent

* Fix mypy errors

* Enable strict_optional for deckoptions

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

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

* Fix mypy errors

* Enable strict_optional for changenotetype

* Fix mypy errors

* Enable strict_optional for fields

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

* Fix mypy errors

* Enable strict_optional for tts

* Fix mypy errors in tts

* Enable strict_optional for mediasrv

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

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

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

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

* Fix mypy errors
2024-10-26 19:56:34 +10:00
Ben Nguyen
507050c876
Enable strict_optional for aqt/preferences.py (#3519)
* Enable strict_optional for aqt/preferences.py

* Fix mypy errors
2024-10-26 19:33:53 +10:00
Damien Elmes
fe0f5370b0
Revert "Fix ease button alignment (#3474)" (#3522)
This reverts commit 569a4705e7.
2024-10-26 18:50:02 +10:00
Damien Elmes
31fe7f2c89 Fix error when exporting from empty cards screen
https://forums.ankiweb.net/t/bug-copy-debug-info-button-crashes-anki-24-04-and-24-06-3/50852
2024-10-22 23:24:27 +10:00
Damien Elmes
6adbd922f7 Rename remaining 'weights' references to 'params' 2024-10-21 18:13:23 +10:00
Damien Elmes
c1a2b03871
Revert "NF: Improve typing of AnkiWebView action (#3475)" (#3504)
This reverts commit 18889239d2.
2024-10-16 03:02:22 +10:00
Taylor Obyen
569a4705e7
Fix ease button alignment (#3474)
* Fix ease button alignment

* Make CSS not 'hacky'
2024-10-16 01:46:55 +10:00
Ben Nguyen
a537d349b8
Enable strict_optional for aqt/editor.py (#3500)
* 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
2024-10-16 01:08:24 +10:00
Hikaru Y.
694a5089a9
Fix 'Discard changes' dialog appearing even when no changes are made (#3495)
* 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().
2024-10-16 00:47:33 +10:00
Damien Elmes
e77632d7b2 Fix UI hanging when update check stalls
https://forums.ankiweb.net/t/anki-24-10-beta/49989/222
2024-10-15 21:32:46 +10:00
Jarrett Ye
f00211df35
add get_revlogs API && fix the style of tooltipText of ReviewsGraph (#3490)
* 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)
2024-10-12 14:49:14 +10:00
Ben Nguyen
aaf4994e6f
Enable strict_optional for aqt/data, aqt/forms, aqt/import_export (#3489)
* Added spacing

* Enable strict_optional for aqt/data

* Update CONTRIBUTORS

* Enable strict_optional for aqt/forms

* Enable strict_optional for aqt/import_export

* Fix mypy errors in import_dialog.py

* Fix mypy errors in exporting.py

* Better variable name

* Stick to assert convention
2024-10-12 14:36:15 +10:00
Damien Elmes
78b9580447 Ignore mw typing error 2024-10-11 23:47:22 +10:00
Ben Nguyen
931e1d80f2
Enable strict_optional in aqt/. and aqt/browser (#3486)
* Boolean naming convention

* Rename no_strict_optional -> strict_optional

* Update CONTRIBUTORS

* Enable strict optional for aqt module

* Fix errors

* Enable strict optional for aqt browser

* Fix layout.py errors

* Fix find_duplicates.py errors

* Fix browser.py errors

* Revert a0 a1 names

* Fix tree.py errors

* Fix previewer.py errors

* Fix model.py errors

* Fix find_and_replace.py errors

* Fix item.py errors

* Fix toolbar.py errors

* Fix table/__init__.py errors

* Fix model.py errors

* Fix state.py errors

* Fix table.py errors

* Fix errors in card_info.py

* Fix searchbar.py errors

* Fix name

* Fix assert in browser.py

* Formatting

* Fix assert vh

* assert is not None instead of truthy

* Split _move_current() up to correct type signature (dae)

We want either index or direction, but not both.
2024-10-11 23:12:48 +10:00
a.r
8af63f81eb
typeanswer: NFC fix & cleanup (#3482)
* 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
2024-10-11 20:33:08 +10:00
Arthur Milchior
18889239d2
NF: Improve typing of AnkiWebView action (#3475)
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.
2024-10-11 20:16:20 +10:00
Damien Elmes
79a6a4dc53 Pretend mw is set from the start
https://github.com/ankitects/anki/pull/3476#issuecomment-2395281774

Closes #3476
2024-10-10 22:17:58 +10:00
Hikaru Y.
407e2dc43b
Fix issues with 'Discard changes' confirmation dialog (#3478)
* 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.
2024-10-06 14:21:00 +10:00
Damien Elmes
378c955905 Revert "Fix ease button alignment (#3404)"
This reverts commit a262e02f9d.

Due to regression:
https://forums.ankiweb.net/t/anki-24-10-beta/49989/119
2024-10-04 22:38:50 +10:00
user1823
de3b1754fa
Add "open image" option to editor (#3431)
* 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>
2024-10-04 20:51:55 +10:00
박현우
761fb76ba7
Allow addon page URL on AddonsDialog (#3467)
* Allow users to just copy&paste addon page URL to addon 'code' field.

https://forums.ankiweb.net/t/get-addons-allow-url-on-code-section/36370
2024-10-04 15:02:29 +10:00
Shirish Pokhrel
2ac27585b2
Fix editor loses focus when toggling list and copy selects wrong target deck for filtered decks (#3465)
* fix copy selects wrong target deck for filtered decks
2024-10-02 18:42:41 +10:00
Taylor Obyen
d6aa95950d
Fix occlusion drift again (#3443)
* Fix occlusion drift

* Fix image editor occasionally not loading fully

* Fix occlusion disassociation when browsing

* Address oversights

* Fix translucent modifier applies to newly created shapes incorrectly

* Fix i-text turns yellow upon immediate note change

* Fix image occlusion hot keys not disabled when typing

* Improve text label creation experience

* Remove redundant functions

* Fix error when adding occlusion (dae)
2024-10-02 17:19:52 +10:00
Voczi
343a304257
Fix error when closing deck options (#3454) 2024-09-30 23:44:20 +10:00
a.r
e2124cd790
typeanswer: [type:nc] – ignores combining characters (#3422)
* 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.
2024-09-30 23:11:51 +10:00
Damien Elmes
7fb261c90b Backup warning needs a new string
We need a new key, as we've introduced a variable. Missed this in
the PR review.
2024-09-27 19:36:58 +10:00
Damien Elmes
f3b0afcc62 Revert "Fix pasting from the primary selection (#3413)"
This reverts commit 0a879bd2ed.

Closes #3435
2024-09-25 20:59:10 +10:00
Taylor Obyen
df127b1af7
Add revert to backup option to file menu (#3434)
* Add revert to backup context item

* Fix contributors a new way

* Change relative time to filename

* Update ftl/qt/qt-accel.ftl (dae)
2024-09-25 20:21:59 +10:00
Damien Elmes
5dfef8aae2 Fix formatting 2024-09-22 18:36:01 +10:00
Ben Nguyen
c2f3e63b90
Bug with “A 100 day interval will become X days.” (#3432)
* add name to about page

* use two decimal retention for calculations

* Update CONTRIBUTORS

* format

* Update CONTRIBUTORS

* Update CONTRIBUTORS

* Update CONTRIBUTORS
2024-09-22 18:24:32 +10:00
Arthur Milchior
b08e454f57
If deck options are modified, ask before closing (#3410)
* 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)
2024-09-22 18:07:24 +10:00
Kris Cherven
163c10191f
Fix Qt desktop file name warning (#3419)
* Fix Qt desktop file name warning

* Update CONTRIBUTORS
2024-09-22 18:02:35 +10:00
Taylor Obyen
90661c4bfc
Track Current Deck Context from Browser (#3385)
* Update current deck from browser

* Update contributors

* Fix formatting

* Allow Add window to be opened with parameters

* Add explicit return

* Fix formatting

* Accomplish context in a more simple fashion

* Implement context menu add

* Fix contributors

* Add additional context

* Removed uneeded logic and inlined redundant funcs

* Resolve contributors conflict

* Update qt/aqt/deckbrowser.py

* Update qt/aqt/deckbrowser.py
2024-09-22 18:02:17 +10:00
user1823
02d2566998
Add an option to show image from editor in folder (#3412)
* Add "Show in folder" option to images in editor

Credits: @abdnh's Reveal in File Manager add-on (https://github.com/abdnh/anki-misc/tree/master/reveal_in_file_manager)

* Refactor
2024-09-20 21:38:44 +10:00
Abdo
5bd66db3c6
Call the profile_did_open() hook earlier (#3421) 2024-09-20 21:22:27 +10:00
Kris Cherven
0a879bd2ed
Fix pasting from the primary selection (#3413)
* Fix clipboard pasting from the primary selection

* Small renaming

* Fix submodules

* Fix pylint false positive
2024-09-20 21:00:12 +10:00
Ben Nguyen
77fb0fb708
Possible to show “last” subdeck name in Browser? (#3387)
* elide middle of deck names

* Update CONTRIBUTORS

* made elide mode enum

* add elide mode field

* fix enum number

* remove dataclass decorator

* Update CONTRIBUTORS

* format rust code

* Update CONTRIBUTORS

* formatting

* Update CONTRIBUTORS

* fix type hint

* Update CONTRIBUTORS
2024-09-20 20:33:28 +10:00
Taylor Obyen
a262e02f9d
Fix ease button alignment (#3404)
* Fix ease button alignment

* Fix contributors part 2
2024-09-11 02:44:11 +07:00
Abdo
9223b35aa0
Stop automatically adding Image Occlusion type in Add screen (#3408) 2024-09-11 02:21:37 +07:00
Gregory
f496411da8
Updated error message to provide help for import if 'Legacy Import/Export' is enabled (#3399)
* 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
2024-09-11 02:06:35 +07:00
Abdo
40bcbe44bf
Fix field focus lost when pressing alt in the editor (#3378) 2024-08-29 17:32:24 +07:00
Themis Demetriades
0f44796b36
Fix imports of decks with file paths using special URL characters (#3377) 2024-08-29 17:19:27 +07:00
David Culley
b35b69a2d3
mypy: fix type checking error (#3365)
* 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
2024-08-29 17:07:06 +07:00
Damien Elmes
be2f013cb7 Add Eros to about
A reminder that anyone who has contributed help is welcome to add themselves
in a PR.
2024-08-28 23:25:00 +07:00
Abdo
83f044491b
Ensure profile name is treated in a case-insensitive manner (#3372) 2024-08-22 17:35:48 +07:00
David Culley
a6d5c94997
python: add missing type annotations for None values (#3364)
* refactor: explicitly add NoneType to type hints

If variable can be `None`, don't be implicit. Be explicit.
2024-08-22 16:03:44 +07:00
Jarrett Ye
8ed9f49bdc
Feat/FSRS Simulator (#3257)
* 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
2024-08-22 15:34:19 +07:00
bpnguyen107
f2adf5d9ad
Hide right click copy option in deck list (#3363)
* hide copy if nothing selected

* Update CONTRIBUTORS

* type hint

* Update CONTRIBUTORS
2024-08-17 13:18:46 +07:00
bpnguyen107
c99b50c82f
Right click context menu on images not useful (#3362)
* right click and copy on image works

* renamed helper fn

* separated functionality of copy and copy image

* Update CONTRIBUTORS

* snake case

* Update CONTRIBUTORS
2024-08-17 13:18:07 +07:00
Abdo
520564da11
Integrate AnkiHub Sign-in (#3232)
* 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
2024-08-17 10:58:23 +07:00
David Culley
4fb6fa81ac
refactor: use not in and is not as recommended (#3351)
- https://docs.astral.sh/ruff/rules/not-is-test/
- https://docs.astral.sh/ruff/rules/not-in-test/
2024-08-10 17:55:26 +07:00
Voczi
1065941767
Add option for toggling update checks (#3346) 2024-08-10 17:46:49 +07:00
David Culley
70a063a3b9
Fix error if regex can't find the filename (#3285)
* fix: treat error if regex doesn't match

* refactor: use assertion to avoid error message
2024-08-07 16:17:37 +07:00
Asuka Minato
e851d0d281
Update about.py (#3330)
* Update about.py

* Update CONTRIBUTORS
2024-08-05 15:56:04 +07:00
cdonat2
b1bf1c3141
Add maximize hint for models.py (#3151) (#3328)
Co-authored-by: Christian Donat <cdonat@tu-berlin.de>
2024-08-05 15:21:18 +07:00
David Culley
bab83ffce0
fix: add proper imports (#3296)
Co-authored-by: Damien Elmes <dae@users.noreply.github.com>
2024-08-05 11:34:46 +07:00
David Culley
44380dd62a
Specify Python version for auto-formatters (#3325)
* chore(isort): specify Python version to be assumed

https://pycqa.github.io/isort/docs/configuration/options#python-version

Default is to assume _any_ Python 3 version could be the target.

* chore(black): specify Python target versions

https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html#t-target-version

* chore(ruff): specify Python version to be assumed

https://docs.astral.sh/ruff/settings/#target-version

* chore: exclude directories from auto-formatting
2024-08-04 20:54:14 +07:00
David Culley
37a3f4708a
Refactor _addButton method of editor (#3294)
* refactor: simplify f-string

* refactor: use more readable names

* style: separate if-else-clauses by empty lines

* fix: add missing import

Properly `import os`.

* refactor: simplify variable assignment

* refactor: rename variables

* refactor: use f-string

* refactor: reorder variables

* refactor: simplify if-clause with de morgan's laws

* refactor: simplify if-else-construct

* fixup! refactor: rename variables

* Revert "refactor: use f-string"

This reverts commit 1dcb58bdab.

* Revert "fixup! refactor: rename variables"

This reverts commit 813130ba6a.
2024-08-04 20:51:45 +07:00
David Culley
c0349ea9da
Improve exception handling (#3290)
* 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
2024-08-04 20:51:13 +07:00
David Culley
a5a39c9302
Fix 'NoneType object is not subscriptable' error (#3286)
* 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
2024-08-04 20:49:45 +07:00
Damien Elmes
1910b9609e Drop non-working tiff support
https://forums.ankiweb.net/t/anki-fails-to-attach-tif-images-to-cards/47609
2024-08-01 12:19:35 +07:00
David Culley
0743e6e40e
Update type annotations to use | operator (#3323)
* refactor: update to `|` operator

* refactor: add missing type hint

* refactor: enable `|` operator for older versions

* refactor: remove obsolete import
2024-07-26 18:15:39 +07:00
David Culley
363a52526e
Update type annotations (#3322)
* refactor: update Callable type hint

* refactor: update type annotations for hooks
2024-07-26 17:57:25 +07:00
Damien Elmes
5c33e5ea65
Revert "About section transparent logo (#3284)" (#3315)
This reverts commit 0b38ecdbc7.
2024-07-22 02:09:40 +07:00
David Culley
63afb0f8c6
Update type annotation syntax (#3283)
* 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
2024-07-21 14:00:52 +07:00
Ren Tatsumoto
412e67db3e
replace showWarning with show_warning (#3306)
* replace showWarning with show_warning

* run isort

* change imports
2024-07-21 13:22:47 +07:00
David Culley
af115c7fda
isort: remove settings covered by profile (#3281)
* 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`
2024-07-20 18:13:12 +07:00
Ian Samir Yep Manzano
0b38ecdbc7
About section transparent logo (#3284)
* 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
2024-07-20 17:46:12 +07:00
David Culley
9d8782c31c
Simplify the format string (#3293)
* refactor: simplify format string

* chore: add myself to CONTRIBUTORS file
2024-07-10 21:14:51 +07:00
Luc Mcgrady
fa4352f3b6
Fix profile manager used before checked for None (#3272)
* Fix: profile manager used before checked for None

* ./check
2024-07-10 20:00:15 +07:00
Rastislav Kish
e985fec9c4
A11Y: Improve the accessibility of the Preferences dialog (#3255)
* 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.
2024-07-10 19:58:47 +07:00
Damien Elmes
cd885098f7 Bump Python deps
A few tweaks were required for PyLint
2024-07-06 18:40:37 +07:00
Abdo
fa47e905c5
Restore $deckOptions (#3265)
* Restore $deckOptions

* Avoid error in logs when using ./yarn dev or mobile clients (dae)
2024-06-28 19:38:18 +07:00
Aristotelis
549cc467b6
Fix IO rendering in the previewer and template editor (#3228) 2024-06-08 13:18:58 +01:00
Damien Elmes
205068a993 Remove missed debugging statement 2024-06-08 05:29:29 +07:00
Damien Elmes
847912c5d8 Remove context check bypass when ANKI_API_PORT set
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.
2024-06-08 05:16:56 +07:00
Damien Elmes
71311f201e Fix image occlusion error during review 2024-06-08 05:06:54 +07:00
Abdo
e3c6b5bf3d
Work around RuntimeError in _update_button_label() (#3224) 2024-06-06 11:19:33 +01:00
Abdo
fbb73046e0
Avoid askUser() in sync dialogs (#3222) 2024-06-03 07:49:02 +01:00
Damien Elmes
5082d9ae5c Factor flask.make_response() calls out into helper function 2024-06-03 13:42:03 +07:00
Damien Elmes
d957cec9e0 Add missing word 2024-06-01 15:56:01 +07:00
Damien Elmes
6ef9ba0305 Switch 404 responses to plain text
Alternative fix which closes #3220
2024-06-01 15:50:27 +07:00
Abdo
8d2e8b1e4f
Pass -- to mpv/mplayer before filename (#3219)
* Pass -- to mpv/mplayer before filename

* Pass -- in as a separate argument (dae)
2024-06-01 09:44:24 +01:00
Abdo
06f7aa393d
Add a preference to toggle LaTeX generation (#3218)
* 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)
2024-06-01 09:26:28 +01:00
Abdo
d981a6e3c6
Reword sync conflict explanation (#3221)
* Reword sync conflict explanation

* Preserve old string for now (dae)
2024-06-01 09:05:19 +01:00
Xidorn Quan
f7b93a5012 Add StartupWMClass for anki.desktop
This ensures that the system can correctly assign the windows of Anki to the desktop launcher item, e.g. in Ubuntu's dock.

Update CONTRIBUTORS
2024-06-01 14:58:47 +07:00
Richard Romero Jr
81de39768c
Fixes shift click selection after programmatic selection in most cases, Issue #2469 (#3213)
* Fixes shift click selection after programmatic selection in most cases

* Attempting to resolve checks

* Adding comment for _move_current setCurrentIndex

* Update qt/aqt/browser/table/table.py (dae)
2024-06-01 08:54:44 +01:00
Damien Elmes
8229383b5c Remove empty cards shortcut
It's conflicting, and will need a new combo:
https://forums.ankiweb.net/t/anki-24-06-release-candidate/44926/44
2024-05-27 05:14:27 +07:00
Abdo
a9bf702317
Call profile_did_open hook at the end of loadProfile (#3202) 2024-05-24 09:23:29 +01:00
Damien Elmes
c8f8a9cd2f Honor night mode when switching between cards in card info 2024-05-22 17:07:01 +07:00
Damien Elmes
4a55f69e48 Revert "Use SplashScreen flag for all aqt tooltips (#3194)"
This reverts commit e50a768e44.

This appears to have caused a regression with keyboard shortcuts

https://forums.ankiweb.net/t/anki-24-06-release-candidate/44926/14
2024-05-22 17:06:37 +07:00
Damien Elmes
9a438ae87d Probable fix for crash when syncing from preferences
https://forums.ankiweb.net/t/windows-anki-24-04-1-crashes-with-self-hosted-sync-server/44849/6
2024-05-21 23:08:08 +07:00
Damien Elmes
91c877e02b Tweaks to the 'optimize all presets' progress
https://forums.ankiweb.net/t/visual-bugs-with-optimization/44873
2024-05-17 15:00:01 +07:00
Damien Elmes
bc69f689ab Fix Mnemosyne importer clobbering source file 2024-05-17 12:34:01 +07:00
Abdo
ef49e3f741
Do not show media auto sync errors (#3197)
* Do not show media auto sync errors

* is_autosync -> is_periodic_sync

* More wording improvements; fix periodic sync depending on auto sync setting (dae)
2024-05-17 06:25:10 +01:00
Damien Elmes
f639c3660a Revert "Revert "Revert "Preserve HTML formatting inside clozes (#3038)"""
This reverts commit 9c733848b8.
2024-05-17 11:51:09 +07:00
Voczi
e50a768e44
Use SplashScreen flag for all aqt tooltips (#3194)
* Set custom tooltip flag as SplashScreen

Prevents tooltip from showing when parent is out of focus

* Update CONTRIBUTORS
2024-05-15 13:13:53 +01:00
Damien Elmes
22ecab1a0e Ensure DB check tooltip appears in main window
https://forums.ankiweb.net/t/is-this-bug-or-the-new-modification-in-anki-desktop/44072
2024-04-30 23:21:41 +10:00
Pedro Schreiber
074becc0ce
Add keyboard shortcuts for empty cards and toggle mask on image occlusion (#3136)
* 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
2024-04-25 17:19:38 +10:00
Mani
f0f9535200
fix io draw in mobile client (#3160) 2024-04-23 22:39:26 +10:00
Harvey R
839fd7bc8b
Add minimalist mode tooltip (#3155)
* Add preferences-minimalist-mode-tooltip

* Update preferences.ui

* Update preferences.ui

* Add preferences_minimalist_mode_tooltip

* Update preferences.ui

* Update preferences.ui
2024-04-23 00:32:55 +10:00
Abdo
e6c7d89443
Fix auto sync not working on Windows shutdown (#3153)
* Fix auto sync not working on Windows shutdown

* Fix mypy error

* Use translated string
2024-04-23 00:32:00 +10:00
Abdo
0a706c5dd9
Ignore errors in do_window_cleanup to fix shutdown issue (#3142)
* Ignore errors in do_window_cleanup to fix shutdown issue

* Only catch RuntimeError
2024-04-17 20:50:41 +10:00
Loudwig
d8f2782c26
Feature Show Reminder before answer (#3064) (#3119)
* 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
2024-04-13 08:39:50 +01:00
Wu Yi-Wei
31439e325d
Add Margins on the Buttons on the About Page (#3137)
* Add Margins on the Buttons on the About Page

* Fix contributors

* Fix format
2024-04-12 05:21:26 +01:00
Escape0707
97efd49cd8
Ignore exception raised by pip_system_certs not found (#3114)
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.
2024-04-05 13:12:06 +01:00
Antoine Q
068f14378e
Update about.py (#3112)
Update about.py to add my name.
2024-04-03 10:22:40 +01:00
Damien Elmes
bdc9be2bbb Ensure ankihelper is rebuilt on arch change
https://forums.ankiweb.net/t/24-04-breaks-dark-mode-on-mac/43048
2024-04-03 15:07:50 +07:00
Damien Elmes
a5154635dc Possible fix for crash on first sync
https://forums.ankiweb.net/t/desktop-app-closes-itself-after-i-try-to-log-in/43132
2024-04-03 14:11:34 +07:00
Damien Elmes
9c733848b8 Revert "Revert "Preserve HTML formatting inside clozes (#3038)""
This reverts commit e911b4b69a.

Trying again now that 24.04 is out.
2024-03-31 15:55:30 +07:00
Damien Elmes
9f55cf26fc
Switch to SvelteKit (#3077)
* 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
Antoine Q
32c129656e
Improve timer interval display (#3096) (#3100)
* Improve update interval of timer display

Timer calculation frequency increased and aligned with new card apparition.

* Update CONTRIBUTORS

* Update timer interval to 0.333 sec

* Restore timer to 1 sec

- Restoring timer to 1sec value as it is not necessary to increase the frequency.

- Adding a time update directy after new card is displayed so that the timer display immediatly restarts to 0.
2024-03-31 07:49:16 +01:00
kelciour
111f3bd138
Fix mpv loadfile syntax change (#3105) 2024-03-31 07:46:59 +01:00
Damien Elmes
67062da924 Possible workaround for toolbar height issue
https://forums.ankiweb.net/t/anki-24-04-beta-rc/41792/125
2024-03-28 15:37:49 +07:00
Damien Elmes
e911b4b69a Revert "Preserve HTML formatting inside clozes (#3038)"
This reverts commit 58b2475f42.

Rolling this back for now, as it may cause regressions. We can give it
another try at the start of the next beta-testing period.
2024-03-25 16:47:54 +07:00
Abdo
58b2475f42
Preserve HTML formatting inside clozes (#3038)
* Preserve HTML formatting inside clozes

* Place caret after/inside cloze

To match the old behavior

* Fix clozing in mathjax

* Formatting

* Avoid .extractContents() and handle partially covered tags

* Exclude range end if endOffset == 0

* Remove unnecessary branches

* Use nodeIsElement

* Let extractContents() handle partially selected nodes
2024-03-18 13:44:19 +00:00
Pedro Schreiber
6ff42155ad
Display deck names when deleting (#3058)
* -  update remove decks function to return names of all deleted decks
- update protobuf message to display deck names
- update python files to receive message in the frontend.
- add message template to ftl

* update CONTRIBUTORS

* format

* refactor: move up deck names concatenation to tooltip api call
to fix type expectations

* restore core behavior and get deck name from view

* fix type specs

* remove new type and use str instead
restore incorrectly removed lines
2024-03-13 12:29:06 +07:00
Kai Knoblich
057733d02e
qt/aqt/__init__.py: Skip GL library workaround for FreeBSD (#3071)
* qt/aqt/__init__.py: Skip GL library workaround for FreeBSD

The workaround to load explicitly "libGL.so.1" isn't required for
FreeBSD and leads to segmentation faults if used in environments that
have nVidia drivers loaded.

See also FreeBSD bug 270778 for further details. [1]

[1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270778

* Update CONTRIBUTORS
2024-03-12 15:50:21 +07:00