Commit Graph

3248 Commits

Author SHA1 Message Date
Hikaru Y
a53806e24a
Indicate current occlusion type in pop-up menu (#2760)
* Simplify handling of occlusion types in editor code

- Unify updateIONoteInEditMode(), setOcclusionFieldInner() and
setOcclusionField() into updateOcclusionsField()
- Don't use `includeInactive` property of Shape class in editor code
- Drop `isEditMode`

+
Update the occlusions field every time a mask or text is updated, not
only in editing mode but also in adding mode, so that IO cards can be
previewed correctly in the card layout screen

* Indicate current occlusion type in pop-up menu

https://forums.ankiweb.net/t/anki-23-10-beta-5-6/35677/46

* Fix a11y warnings in Toolbar.svelte

* Drop `occludeInactive` parameter from `MaskEditorAPI.getShapes()`
2023-10-23 09:12:56 +10:00
Aristotelis
56f7d54900
Add APIs for IO mask editing (#2758)
* Add simple mask editor add-on API

* Signal completed mask editor image loading to Python

* Add API methods for querying mask editor state, fix formatting

* Use event forwarding to propagate image loaded event

Should fix mobile support by moving all bridgeCommand calls to `NoteEditor.svelte`

* Add shape classes to mask editor API

---------

Co-authored-by: Glutanimate <glutanimate@users.noreply.github.com>
2023-10-22 10:40:40 +10:00
kelciour
1954a28bcb
Change export notes' parent window in card browser (#2761) 2023-10-22 10:23:58 +10:00
kelciour
59d89dd9f1
Make it possible to silent uninstall with WinGet (#2757) 2023-10-21 12:23:12 +10:00
Abdo
0ce9b3f0a1
Refresh reviewer as the day rolls over (#2756) 2023-10-21 12:18:01 +10:00
Damien Elmes
1b8f5496f9 Don't automatically disable add-ons
d7a0bc0d42 (commitcomment-130467314)

Also, make the pop-up non-modal so it can be left on screen as the user
navigates to the add-on screen.
2023-10-20 11:12:56 +10:00
Damien Elmes
d7a0bc0d42 Display all startup errors at once, and automatically disable add-ons
https://forums.ankiweb.net/t/anki-23-10-beta-5/35677/48
2023-10-19 13:40:39 +10:00
Abdo
b23f17df27
Drop support for checkpoints (#2742)
* Drop support for checkpoints

* Deprecate .flush()

* Remove .begin/.commit

* Remove rollback() and deprecate save/autosave/reset()

There's no need to commit anymore, as the Rust code is handling
transactions for us.

* Add safer transact() method

This will ensure add-on authors can't accidentally leave a transaction
open, leading to data loss.

---------

Co-authored-by: Damien Elmes <gpg@ankiweb.net>
2023-10-17 12:43:34 +10:00
Abdo
01738757ef
Prevent media syncing from blocking collection tasks (#2740) 2023-10-17 09:47:50 +10:00
Abdo
bd55149846
Reduce shaking of bottom bar (#2734) 2023-10-15 10:06:28 +10:00
Damien Elmes
9f0dd4a63f Fix startup failure in macOS bundle
Closes #2731
2023-10-14 13:49:33 +10:00
Damien Elmes
76e6da6652 Switch Qt5 shims from opt-out to opt-in
If you have an add-on that hasn't been updated yet, please contact
the add-on author. You can temporarily restore functionality by defining
an ENABLE_QT5_COMPAT=1 env var.
2023-10-14 11:46:46 +10:00
Abdo
5cde4b6941
Remove v1/v2 support from the backend (#2727)
* Remove v1/v2 support from deck list

* Remove v1/v2 support from most routines and show error

* Remove scheduler_version from preferences

* Fix formatting

* Remove v1/v2 conditionals from Python code

* Fix legacy importer

* Remove legacy hooks

* Add missing scheduler checks

* Remove V2 logic from deck options screen

* Remove the review_did_undo hook

* Restore ability to open old options with shift (dae)
2023-10-14 10:50:59 +10:00
Abdo
115f2a425e
Turn edit window into a QMainWindow (#2732)
* Turn edit window into a QMainWindow

* Ensure dialog is garbage collected (dae)
2023-10-14 10:29:57 +10:00
Abdo
6c2205663e
Fix previewer geometry not being restored sometimes (#2728) 2023-10-13 08:50:40 +10:00
Aristotelis
7ce1c4439a
Propagate editor UI state transitions to add-ons (#2711)
* Propagate editor UI state transitions to add-ons

* Also set initial Python state to EditorState.INITIAL

---------

Co-authored-by: Glutanimate <glutanimate@users.noreply.github.com>
2023-10-13 08:47:50 +10:00
chandraiyengar
b35a11ffd6
Add profile name in profile deletion confirmation message (#2722)
* Add profile name in profile deletion confirmation message

* Update contributors

* leave old translation and add new one
2023-10-12 13:34:52 +10:00
virinci
d261d1e467
Fix ModuleNotFoundError: No module named 'distutils' (#2723) 2023-10-11 14:12:18 +10:00
RumovZ
23f29a6ecc
Invalid sorting (#2709)
* Rollback if toggling state fails

Previously, if the search triggered by a state toggle failed, the switch
and the model would move to the new state, while the table would remain
in the previous state.

* Fix reversed sort orders of FSRS columns

* Add sep. default sort orders for notes and cards

* Add test for consistent default sort orders

* Add launch config for debugging in VSC

* Extend launch config for macOS and Linux
2023-10-07 06:36:15 +00:00
Damien Elmes
d7ff99780e Improve Python Protobuf speed
upb was being included in the bundle, but not found at run time due
to src files being embedded in the binary.
2023-10-04 13:36:47 +10:00
Damien Elmes
259ed9c34d Show tooltip on sync completion
Closes #2695
2023-10-03 12:57:39 +10:00
Damien Elmes
0ef28853fd Fix TypeError when deck list or overview refreshes during optimal retention
Caused by legacy code blocking the main thread.

https://forums.ankiweb.net/t/anki-23-10-beta/34912/79
2023-09-30 16:10:23 +10:00
Abdo
074f452762
Allow creating an image occlusion from the clipboard (#2689)
* Allow creating an image occlusion from the clipboard

* Refactor pasted image name construction into methods

* Reduce button's top padding

* Fix capitalization

* Fix quality parameter of pasted image

* Fix lint errors

* setup_mask_editor_for_file -> setup_mask_editor

* Select -> Paste

* Extract image reading logic

* Fix inlinedImageToFilename
2023-09-29 15:51:44 +10:00
Abdo
ab7e64865e
Implement "stop timer on answer" as a preset option (#2686)
* Implement "stop timer on answer" as a preset option

* Hide timer setting on AnkiMobile (dae)
2023-09-27 16:10:14 +10:00
Damien Elmes
558c75493f Strip out v1/v2 code 2023-09-24 14:27:40 +10:00
Damien Elmes
7f56836295 Enable new exporter by default 2023-09-24 13:10:16 +10:00
Abdo
9d6e819701
Support Qt.TextFormat.MarkdownText in aqt.utils (#2675) 2023-09-23 14:04:25 +10:00
Abdo
f78c59176e
Add an option to stop the timer on answer (#2673)
* Add an option to stop the timer on answer

* Fix tab order
2023-09-23 14:01:03 +10:00
Damien Elmes
4bfa0d78dc Clear internal field after pasting
https://forums.ankiweb.net/t/copy-paste-of-screenshots-dont-work-once-i-copy-the-text-on-the-anki-app/34839
2023-09-22 13:05:52 +10:00
Abdo
c2b1ab5eb0
Skip template checks in Fields screen (#2670) 2023-09-20 16:09:54 +10:00
Abdo
9b8dfd2860
Fix error when closing Find Duplicates screen early (#2669) 2023-09-20 16:03:46 +10:00
Damien Elmes
3ed7c75468 Allow saving state on Qt 6
It seems to work normally in Qt 6.5 (which has no tab support).

Previous issue: #1538.
2023-09-20 14:16:12 +10:00
Abdo
34f329b306
Fix intermittent browser error triggered by an early resize event (#2671) 2023-09-20 13:54:40 +10:00
Damien Elmes
a7b4c90146 Use field tags instead of hard-coding occlusion fields
+ Don't protect the comments field

It's not required by our current code. We can remove the protection
from Header and Back Extra in the future too, once we no longer depend
on them.

Closes #2621
2023-09-18 10:10:11 +10:00
Damien Elmes
1e37c806e5 Add support for tagging + protecting fields 2023-09-17 14:03:42 +10:00
Damien Elmes
64e40033e0 Remove the fields_web experiment 2023-09-17 13:48:48 +10:00
Damien Elmes
59759b468f Start on a 'get params' button 2023-09-17 12:58:13 +10:00
Damien Elmes
5004cd332b
Integrate FSRS into Anki (#2654)
* Pack FSRS data into card.data

* Update FSRS card data when preset or weights change

+ Show FSRS stats in card stats

* Show a warning when there's a limited review history

* Add some translations; tweak UI

* Fix default requested retention

* Add browser columns, fix calculation of R

* Property searches

eg prop:d>0.1

* Integrate FSRS into reviewer

* Warn about long learning steps

* Hide minimum interval when FSRS is on

* Don't apply interval multiplier to FSRS intervals

* Expose memory state to Python

* Don't set memory state on new cards

* Port Jarret's new tests; add some helpers to make tests more compact

https://github.com/open-spaced-repetition/fsrs-rs/pull/64

* Fix learning cards not being given memory state

* Require update to v3 scheduler

* Don't exclude single learning step when calculating memory state

* Use relearning step when learning steps unavailable

* Update docstring

* fix single_card_revlog_to_items (#2656)

* not need check the review_kind for unique_dates

* add email address to CONTRIBUTORS

* fix last first learn & keep early review

* cargo fmt

* cargo clippy --fix

* Add Jarrett to about screen

* Fix fsrs_memory_state being initialized to default in get_card()

* Set initial memory state on graduate

* Update to latest FSRS

* Fix experiment.log being empty

* Fix broken colpkg imports

Introduced by "Update FSRS card data when preset or weights change"

* Update memory state during (re)learning; use FSRS for graduating intervals

* Reset memory state when cards are manually rescheduled as new

* Add difficulty graph; hide eases when FSRS enabled

* Add retrievability graph

* Derive memory_state from revlog when it's missing and shouldn't be

---------

Co-authored-by: Jarrett Ye <jarrett.ye@outlook.com>
2023-09-16 16:09:26 +10:00
Abdo
8b0d663fd0
Allow full screen mode on new Qt6 drivers (#2660)
* Allow full screen mode on new Qt6 drivers

* Update fulscreen warning message
2023-09-16 11:28:20 +10:00
Damien Elmes
055d663970 Serialize CollectionOp, and QueryOp by default
Closes #2628
2023-09-15 15:28:26 +10:00
Abdo
120c6e165c
Fix tooltips not reflecting configured shortcuts (#2657) 2023-09-14 11:33:42 +10:00
Damien Elmes
81a4d531e3 Don't ask when no cards would be generated
https://forums.ankiweb.net/t/when-adding-cards-to-a-note-type-dont-show-this-will-create-0-cards/34237
2023-09-14 10:44:27 +10:00
Damien Elmes
364c32fa79 Update profiling script 2023-09-14 09:23:44 +10:00
RumovZ
850043b49b
Tooltips for CSV import and import page refactoring (#2655)
* Make enum selector generic

* Refactor ImportCsvPage to support tooltips

* Improve csv import defaults

* Unify import pages

* Improve import page styling

* Fix life cycle issue with import properties

* Remove size constraints to fix scrollbar styling

* Add help strings and urls to csv import page

* Show ErrorPage on ImportPage error

* Fix escaping of import path

* Unify ImportPage and ImportLogPage

* Apply suggestions from code review (dae)

* Fix import progress

* Fix preview overflowing container

* Don't include <br> in FileIoErrors (dae)

e.g. 500: Failed to read '/home/dae/foo2.csv':<br>stream did not contain valid UTF-8

I thought about using {@html ...} here, but that's a potential security issue,
as the filename is not something we control.
2023-09-14 09:06:15 +10:00
platynowy
23823d3135
added Translator (#2653)
* added Translator

added myself to the list (translated Anki, AnkiMobile and Anki Manual to Polish

* Update CONTRIBUTORS
2023-09-12 14:13:08 +10:00
Damien Elmes
bfef908c6c
Refactor media sync handling (#2647)
* Refactor media sync handling

- The media USN is now returned in sync/meta, which avoids an extra
round-trip.
- Media syncing is now automatically started by the syncing code at
the end of a normal or full sync, which avoids it competing for bandwidth
and resources, and avoids duplicate invalid login messages when the auth
token is invalid.
- Added a new media_sync_progress() method to both check if media is
syncing, and get access to the latest progress.
- Updated the sync log screen to only show the latest line, like AnkiMobile.
- Show media sync errors in a pop-up, so they don't get missed. Use a non-modal
pop-up to avoid potential conflicts with other modals.

* Remove print statement
2023-09-10 13:22:20 +10:00
Damien Elmes
89854ac2b9 Apply some fixes from Abdo
https://github.com/ankitects/anki/pull/2612#issuecomment-1712320801
2023-09-09 09:12:46 +10:00
RumovZ
14de8451dc
Merging Notetypes on Import (#2612)
* Remember original id when importing notetype

* Reuse notetypes with matching original id

* Add field and template ids

* Enable merging imported notetypes

* Fix test

Note should be updated if the incoming note's notetype is
remapped to the existing note's notetype.
On the other hand, it should be skipped if its notetype id is mapped
to some new notetype.

* Change field and template ids to i32

* Add merge notetypes flag to proto message

* Add dialog for apkg import

* Move HelpModal into components

* Generalize import dialog

* Move SettingTitle into components

* Add help modal to ImportAnkiPackagePage

* Move SwitchRow into components

* Fix backend method import

* Make testable in browser

* Fix broken modal

* Wrap in container and fix margins

* Update commented Anki version of new proto fields

* Check ids when comparing notetype schemas

* Add tooltip for merging notetypes.

* Allow updating notes regardless of mtime

* Gitignore yarn-error.log

* Allow updating notetypes regardless of mtime

* Fix apkg help carousel

* Use i64s for template and field ids

* Add option to omit importing scheduling info

* Restore last settings in apkg import dialog

* Display error when getting metadata in webview

* Update manual links for apkg importing

* Apply suggestions from code review

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

* Omit schduling -> Import all cards as new cards

* Tweak importing-update-notes-help

* UpdateCondition → ImportAnkiPackageUpdateCondition

* Load keyboard.ftl

* Skip updating dupes in 'update alwyas' case

* Explain more when merging notetypes is required

* "omit scheduling" → "with scheduling"

* Skip updating notetype dupes if 'update always'

* Merge duplicated notetypes from previous imports

* Fix rebase aftermath

* Fix panic when merging

* Clarify 'update notetypes' help

* Mention 'merge notetypes' in the log

* Add a test which covers the previously panicking path

* Use nested ftl messages to ensure consistency

* Make order of merged fields deterministic

* Rewrite test to trigger panic

* Update version comment on new fields
2023-09-09 09:00:55 +10:00
Abdo
ba7140ddec
Expose video driver options for Qt6 (#2643)
* Expose video driver options for Qt6

* Default to d3d11/metal/vulkan on Qt6

* Remove `pass`

* Add missing word to existing translation

* Default to OpenGL on Linux

* Exclude Vulkan from macOS

* Label default drivers
2023-09-09 08:59:49 +10:00
Damien Elmes
a3d38bdad3 Fix syncStatus being called twice when auto sync disabled 2023-09-07 15:11:36 +10:00
Damien Elmes
ffd392de21
Change Anki's version scheme; bump to 23.09 (#2640)
* Accept iterables as inputs to backend methods

* Shift add-on check to backend; use new endpoint

The new endpoint will return info on a suitable branch if found,
instead of returning all branches. This simplifies the frontend code,
and means that you can now drop support for certain versions without
it also remotely disabling the add-on for people who are running one of
the excluded versions, like in

https://forums.ankiweb.net/t/prevent-add-ons-from-being-disabled-remote-stealthily-surreptitiously/33427

* Bump version to 23.09

This changes Anki's version numbering system to year.month.patch, as
previously mentioned on https://forums.ankiweb.net/t/use-a-different-versioning-system-semver-perhaps/20046/5

This is shaping up to be a big release, with the introduction of FSRS and
image occlusion, and it seems like a good time to be finally updating the
version scheme as well. AnkiWeb has been updated to understand the new
format, and add-on authors will now specify version compatibility using
the full version number, as can be seen here:

https://ankiweb.net/shared/info/3918629684

* Shift update check to backend, and tidy up update.py

* Use the shared client for sync connections too
2023-09-07 12:37:15 +10:00
Damien Elmes
0c6e3eaa93
Integrate the FSRS optimizer (#2633)
* Support searching for deck configs by name

* Integrate FSRS optimizer into Anki

* Hack in a rough implementation of evaluate_weights()

* Interrupt calculation if user closes dialog

* Fix interrupted error check

* log_loss/rmse

* Update to latest fsrs commit; add progress info to weight evaluation

* Fix progress not appearing when pretrain takes a while

* Update to latest commit
2023-09-05 18:45:05 +10:00
evandrocoan
8d3debb6d4
Implemented support to audio_did_seek_relative (#2632)
* Implemented support to audio_did_seek_relative
2023-09-05 11:15:15 +10:00
Nil Admirari
9d3f01043b
Support AVIF (#2630) 2023-08-31 08:44:10 +10:00
Monty Evans
95f7d5a941
Change “Delete Note” shortcut to cmd+backspace (#2614)
* Changed delete note shortcut during reviewing to ctrl+backspace

* Added name to contributors

* Changed Mac shortcut
2023-08-25 07:15:11 +10:00
Aristotelis
594267149d
[IO API] Create Python entry points for creating and editing IO notes (#2598)
* Create python API for adding and editing IO notes

Also: Refactor IO-related methods, tweaking their naming and moving them to a continuous section

* Ensure editor is loaded before setupMaskEditor call

---------

Co-authored-by: Glutanimate <glutanimate@users.noreply.github.com>
2023-08-24 12:35:38 +10:00
Aristotelis
538ea31387
Fix typo: notetypeId → noteId (#2615)
IOEditingMode interface expects noteId
2023-08-21 15:00:05 +10:00
Damien Elmes
70506aeb99 Temporarily turn off I/O support
Aristotelis has asked for a bit more time to work on it, and this unlocks
a new beta/stable release. Will revert this commit after the release is
out.
2023-08-20 08:41:35 +10:00
Gabriel Heinatz
72ed482133
fixed and tested issue #2608 (#2611)
* fixed issue #2608
It was indeed the tabstop order.

* added my name and mail to fulfill test requirements

* fixed and tested issue #2608
There was a wrong name in the tabstop, so it could not resolve that name and skipped the element.
2023-08-16 07:26:50 +10:00
mjuhanne
cc776bb0ca
Fix crash caused by uninitialized self._reps in class Reviewer (#2603)
* Fix crash caused by uninitialized self._reps in class Reviewer

* Do not declare _reps in reviewer.py twice
2023-08-07 15:10:47 +10:00
Abdo
98715e593a
Improve presentation of importing results (#2568)
* Implement import log screen in Svelte

* Show filename in import log screen title

* Remove unused NoteRow property

* Show number of imported notes

* Use a single nid expression

* Use 'count' as variable name for consistency

* Import from @tslib/backend instead

* Fix summary_template typing

* Fix clippy warning

* Apply suggestions from code review

* Fix imports

* Contents -> Fields

* Increase max length of browser search bar

https://github.com/ankitects/anki/pull/2568/files#r1255227035

* Fix race condition in Bootstrap tooltip destruction

https://github.com/twbs/bootstrap/issues/37474

* summary_template -> summaryTemplate

* Make show link a button

* Run import ops on Svelte side

* Fix geometry not being restored in CSV Import page

* Make VirtualTable fill available height

* Keep CSV dialog modal

* Reword importing-existing-notes-skipped

* Avoid mentioning matching based on first field

* Change tick and cross icons

* List skipped notes last

* Pure CSS spinner

* Move set_wants_abort() call to relevant dialogs

* Show number of imported cards

* Remove bold from first sentence and indent summaries

* Update UI after import operations

* Add close button to import log page

Also make virtual table react to resize event.

* Fix typing

* Make CSV dialog non-modal again

Otherwise user can't interact with browser window.

* Update window modality after import

* Commit DB and update undo actions after import op

* Split frontend proto into separate file, so backend can ignore it

Currently the automatically-generated frontend RPC methods get placed in
'backend.js' with all the backend methods; we could optionally split them
into a separate 'frontend.js' file in the future.

* Migrate import_done from a bridgecmd to a HTTP request

* Update plural form of importing-notes-added

* Move import response handling to mediasrv

* Move task callback to script section

* Avoid unnecessary :global()

* .log cannot be missing if result exists

* Move import log search handling to mediasrv

* Type common params of ImportLogDialog

* Use else if

* Remove console.log()

* Add way to test apkg imports in new log screen

* Remove unused import

* Get actual card count for CSV imports

* Use import type

* Fix typing error

* Ignore import log when checking for changes in Python layer

* Apply suggestions from code review

* Remove imported card count for now

* Avoid non-null assertion in assignment

* Change showInBrowser to take an array of notes

* Use dataclasses for import log args

* Simplify ResultWithChanges in TS

* Only abort import when window is modal

* Fix ResultWithChanges typing

* Fix Rust warnings

* Only log one duplicate per incoming note

* Update wording about note updates

* Remove caveat about found_notes

* Reduce font size

* Remove redundant map

* Give credit to loading.io

* Remove unused line

---------

Co-authored-by: RumovZ <gp5glkw78@relay.firefox.com>
2023-08-02 20:29:44 +10:00
Mani
b9da61f993
follow-up pr for io button in note editor (#2600)
* follow-up pr for io button in note editor

* Expose change event in Svelte instead of relying on timeout (dae)
2023-07-31 14:24:26 +10:00
Mani
135de7f9ed
image occlusion button in note editor (#2485)
* setup mask editor in note editor
- add image on mask button click (only one time)
- show hide add button for io on notetype change
- hide field in io notetype
- icon for toggle
and replace image

* add update io notes

* Tidy up i/o notetype check and fix error

- Make it a method on editor
- Use .get(), because the setting doesn't exist on older notetypes
- Pass the bool value into the ts code, instead of the enum

* reset io page after adding

* remove adjust function & add target for mask editor

* handle browse mode & merged sidetoolbar and toptoolbar to toolbar

* fix: shape, button click in browse, dropdown menu

* add arrow to add button

* store for handling visiblity of maskeditor
- remove update  button in edit mode, implement autoupdate

* update var name

* simplify store
2023-07-27 22:45:49 +10:00
Aristotelis
0a418e0612
Pass AddCards instance to notetype change hook (#2594)
Allows add-ons that modify AddCards to more easily react to notetype changes without needing to keep AddCards instances as state.
2023-07-27 22:29:59 +10:00
Damien Elmes
4691560522 Work around CI failure on Windows with PyQt 6.5.2 2023-07-26 21:10:19 +10:00
RumovZ
543f391096
Pass dict for locals and globals to exec() (#2590) 2023-07-25 21:21:06 +10:00
Luc Mcgrady
bceffd96c6
Add keyboard shortcut for legacy stats (#2583)
* Added: Shortcut for legacy stats

* Added: Name to contributors

* Capitalize S
2023-07-24 11:31:41 +10:00
Damien Elmes
e7ee99c5fb Catch altered translation of 'unknown error'
https://forums.ankiweb.net/t/how-to-solve-this-problem-trouble-report/32402
2023-07-24 10:29:37 +10:00
Damien Elmes
61f7c70d3c Don't throw on empty URLs in clipboard
https://forums.ankiweb.net/t/dragging-and-dropping-picture-error/32313
2023-07-24 10:28:07 +10:00
RumovZ
9430e3ddf2
Fix addon update dialog showing twice (#2580)
* Gitignore .ninja_deps

* Don't check for addon updates on profile unload

This fixes two update dialogs showing up when switching profiles.

* Only show addon update dialog once

... instead of once every time the profile is changed, when the version
doesn't match.
This is analogous to when the dialog is triggered by elapsed time.

* Manage last_run_version update in ProfileManager
2023-07-18 22:26:59 +10:00
Damien Elmes
998b728285 Update translations 2023-07-17 14:07:08 +10:00
3ter
f076fa28af
Add did-add-field-hook analogous to did-delete-field (#2574)
* Add add field hook analogous to delete field

* Add myself to contributors
2023-07-13 21:10:12 +10:00
Damien Elmes
32d6248ff1 Add nothing to undo/redo
https://forums.ankiweb.net/t/translation-of-nothing-to-undo/31735
2023-07-04 13:41:02 +10:00
Damien Elmes
04b74a56b7 Update translations 2023-07-04 13:39:00 +10:00
Damien Elmes
b73c4bfe9c Increase default size of media check screen
https://forums.ankiweb.net/t/text-does-not-fit-in-buttons-of-media-check-window/31731/2
2023-07-03 23:58:24 +10:00
Damien Elmes
a06e2335c4 Merge the separate editor index files
They're almost the same, and the extra work competes for CPU cores
with the other build steps.
2023-07-03 17:24:27 +10:00
Damien Elmes
d0798ae7e0 Store field content instead of trying to mutate clipboard data
Hopefully this will finally address the clipboard issues some users
have been experiencing.

Tentatively closes #2349
2023-07-02 22:23:31 +10:00
Damien Elmes
e63be7083c Remove dataChanged workaround on Windows
I believe this should be fixed in 6.4/6.5

https://bugreports.qt.io/browse/QTBUG-102738
2023-07-02 20:37:05 +10:00
Damien Elmes
7d2ec8ed65 Only disable specific animations/transitions/shadows
If I've missed any, follow-up PRs would be most appreciated.

Closes #2557
2023-07-02 20:02:14 +10:00
Damien Elmes
c6f429ab17 Add option to use LTO in release builds
Shrinks rslib.so from about 40MB to about 26MB, at the cost of considerably
higher build time in a release build.
2023-07-02 18:22:44 +10:00
Damien Elmes
c8458fce16
Update to Svelte 4, and update most other JS deps (#2565)
* eslint-plugin-svelte3 -> eslint-plugin-svelte

The former is deprecated, and blocks an update to Svelte 4.

Also drop unused svelte2tsx and types package.

* Drop unused symbols code for now

It may be added back in the future, but for now dropping it will save
200k from our editor bundle.

* Remove sass and caniuse-lite pins

The latter no longer seems to be required. The former was added to
suppress deprecation warnings when compiling the old bootstrap version
we have pinned. Those are hidden by the build tool now (though we really
need to address them at one point: https://github.com/ankitects/anki/issues/1385)

Also removed unused files section.

* Prevent proto compile from looking in node_modules/@types/sass

When deps are updated, tsc aborts because @types/sass is a dummy package
without an index.d.ts file.

* Filter Svelte warnings out of ./run

* Update to latest Bootstrap

This fixes the deprecation warnings we were getting during build:
bootstrap doesn't accept runtime CSS variables being set in Sass, as
it wants to apply transforms to the colors.

Closes #1385

* Start port to Svelte 4

- svelte-check tests have a bunch of failures; ./run works
- Svelte no longer exposes internals, so we can't use create_in_transition
- Also update esbuild and related components like esbuild-svelte

* Fix test failures

Had to add some more a11y warning ignores - have added
https://github.com/ankitects/anki/issues/2564 to address that in the
future.

* Remove some dependency pins

+ Remove sass, we don't need it directly

* Bump remaining JS deps that have a current semver

* Upgrade dprint/license-checker/marked

The new helper method avoids marked printing deprecation warnings to
the console.

Also remove unused lodash/long types, and move lodahs-es to devdeps

* Upgrade eslint and fluent packages

* Update @floating-ui/dom

The only dependencies remaining are currently blocked:

- Jest 29 gives some error about require vs import; may not be worth
investigating if we switch to Deno for the tests
- CodeMirror 6 is a big API change and will need work.

* Roll dprint back to an earlier version

GitHub dropped support for Ubuntu 18 runners, causing dprint's artifacts
to require a glibc version greater than what Anki CI currently has.
2023-07-01 16:21:53 +10:00
Damien Elmes
324ef330e8 Update test for changed translation 2023-06-30 17:08:36 +10:00
Abdo
df3fa5a0be
Make set_config_help_action work with submodules (#2561) 2023-06-28 11:46:02 +10:00
Abdo
0100ae7431
Fix main window geometry/state not being restored in some cases (#2558)
Introduced by 19b08eb280

Report: https://forums.ankiweb.net/t/65-the-size-of-the-main-window-is-reset-every-time-it-is-closed-again/31364
2023-06-27 16:52:34 +10:00
Damien Elmes
d5b5b861e2 Move ts-run vars into ./run 2023-06-26 15:29:14 +10:00
Damien Elmes
b2e7ab522b Remove some unused Rust dependencies 2023-06-24 19:30:29 +10:00
Damien Elmes
40e1520acb Drop workspace-hack in favor of workspace deps
Workspace deps were introduced in Rust 1.64. They don't cover all the
cases that Hakari did unfortunately, but they are simpler to maintain,
and they avoid a couple of issues that Hakari had:

- It sometimes made updating dependencies harder due to the locked versions,
so you had to disable Hakari, do the updates, and then re-generate (
e.g. 943dddf28f)
- The current Hakari config was breaking AnkiDroid's build, as it was
stopping a cross-compile from functioning correctly.
2023-06-23 17:41:31 +10:00
Damien Elmes
dac532953e
Refactor progress handling (#2549)
Previously it was Backend's responsibility to store the last progress,
and when calling routines in Collection, one had to construct and pass
in a Fn, which wasn't the most ergonomic. This PR adds the last progress
state to the collection, so that the routines no longer need a separate
progress arg, and makes some other tweaks to improve ergonomics.

ThrottlingProgressHandler has been tweaked so that it now stores the
current state, so that callers don't need to store it separately. When
a long-running routine starts, it calls col.new_progress_handler(),
which automatically initializes the data to defaults, and updates the
shared UI state, so we no longer need to manually update the state at
the start of an operation.

The backend shares the Arc<Mutex<>> with the collection, so it can get
at the current state, and so we can update the state when importing a
backup.

Other tweaks:

- The current Incrementor was awkward to use in the media check, which
uses a single incrementing value across multiple method calls, so I've
added a simpler alternative for such cases. The old incrementor method
has been kept, but implemented directly on ThrottlingProgressHandler.
- The full sync code was passing the progress handler in a complicated
way that may once have been required, but no longer is.
- On the Qt side, timers are now stopped before deletion, or they keep
running for a few seconds.
- I left the ChangeTracker using a closure, as it's used for both importing
and syncing.
2023-06-19 13:48:32 +10:00
Damien Elmes
45f5709214
Migrate to protobuf-es (#2547)
* Fix .no-reduce-motion missing from graphs spinner, and not being honored

* Begin migration from protobuf.js -> protobuf-es

Motivation:

- Protobuf-es has a nicer API: messages are represented as classes, and
fields which should exist are not marked as nullable.
- As it uses modules, only the proto messages we actually use get included
in our bundle output. Protobuf.js put everything in a namespace, which
prevented tree-shaking, and made it awkward to access inner messages.
- ./run after touching a proto file drops from about 8s to 6s on my machine. The tradeoff
is slower decoding/encoding (#2043), but that was mainly a concern for the
graphs page, and was unblocked by
37151213cd

Approach/notes:

- We generate the new protobuf-es interface in addition to existing
protobuf.js interface, so we can migrate a module at a time, starting
with the graphs module.
- rslib:proto now generates RPC methods for TS in addition to the Python
interface. The input-arg-unrolling behaviour of the Python generation is
not required here, as we declare the input arg as a PlainMessage<T>, which
marks it as requiring all fields to be provided.
- i64 is represented as bigint in protobuf-es. We were using a patch to
protobuf.js to get it to output Javascript numbers instead of long.js
types, but now that our supported browser versions support bigint, it's
probably worth biting the bullet and migrating to bigint use. Our IDs
fit comfortably within MAX_SAFE_INTEGER, but that may not hold for future
fields we add.
- Oneofs are handled differently in protobuf-es, and are going to need
some refactoring.

Other notable changes:

- Added a --mkdir arg to our build runner, so we can create a dir easily
during the build on Windows.
- Simplified the preference handling code, by wrapping the preferences
in an outer store, instead of a separate store for each individual
preference. This means a change to one preference will trigger a redraw
of all components that depend on the preference store, but the redrawing
is cheap after moving the data processing to Rust, and it makes the code
easier to follow.
- Drop async(Reactive).ts in favour of more explicit handling with await
blocks/updating.
- Renamed add_inputs_to_group() -> add_dependency(), and fixed it not adding
dependencies to parent groups. Renamed add() -> add_action() for clarity.

* Remove a couple of unused proto imports

* Migrate card info

* Migrate congrats, image occlusion, and tag editor

+ Fix imports for multi-word proto files.

* Migrate change-notetype

* Migrate deck options

* Bump target to es2020; simplify ts lib list

Have used caniuse.com to confirm Chromium 77, iOS 14.5 and the Chrome
on Android support the full es2017-es2020 features.

* Migrate import-csv

* Migrate i18n and fix missing output types in .js

* Migrate custom scheduling, and remove protobuf.js

To mostly maintain our old API contract, we make use of protobuf-es's
ability to convert to JSON, which follows the same format as protobuf.js
did. It doesn't cover all case: users who were previously changing the
variant of a type will need to update their code, as assigning to a new
variant no longer automatically removes the old one, which will cause an
error when we try to convert back from JSON. But I suspect the large majority
of users are adjusting the current variant rather than creating a new one,
and this saves us having to write proxy wrappers, so it seems like a
reasonable compromise.

One other change I made at the same time was to rename value->kind for
the oneofs in our custom study protos, as 'value' was easily confused
with the 'case/value' output that protobuf-es has.

With protobuf.js codegen removed, touching a proto file and invoking
./run drops from about 8s to 6s.

This closes #2043.

* Allow tree-shaking on protobuf types

* Display backend error messages in our ts alert()

* Make sourcemap generation opt-in for ts-run

Considerably slows down build, and not used most of the time.
2023-06-14 22:47:37 +10:00
Hikaru Y
7164723a7a
Fix two issues that can cause editor fields to behave incorrectly (#2540)
* Fix shortcut not being unregistered when Plain/RichTextBadge is detroyed

This fixes an issue where, if the "Show HTML by default" option of
fields located at the same position in two notetypes have different
values, switching between those notetypes during an editor session
would cause the keyboard shortcut (Ctrl+Shift+X) to no longer function
correctly thereafter.

* Don't restore fields' state if notetype has been modified

This fixes an issue where editor fields behave incorrectly after
opening the 'Fields' dialog and customizing the notetype. An example
of incorrect behavior is that after adding a new field and closing
the dialog, the added field would display both richtext input and
plaintext input, regardless of the options.

* Rename type, variable and function

- Apply suggestions from code review
- Also use optional chaining instead of non-null assertion
2023-06-14 09:38:06 +10:00
Damien Elmes
e9bfebe83e Make stats title translatable
https://forums.ankiweb.net/t/why-is-the-title-of-the-statistics-window-not-can-be-translated/30944
2023-06-07 16:25:35 +10:00
Damien Elmes
ea1180ffc2 Remove duplicate renderPage invocation
https://forums.ankiweb.net/t/duplicate-execution-of-the-same-operation-in-code/30943
2023-06-07 16:10:35 +10:00
Abdo
7044f0c53c
Fix "Add-ons possibly involved" message never appearing on Windows (#2536) 2023-06-07 15:09:18 +10:00
Christopher Woggon
fadeb99c99
Partially supporting 한글 (hangul, Korean characters) (#2533)
* Partially supporting 한글 (hangul, Korean characters)

* Externalized korean shortcuts to separate function

* formatting
2023-06-07 14:54:52 +10:00
Abdo
51dc5860bd
Fix toggleable editor button styles (#2531) 2023-06-05 12:43:50 +10:00
Damien Elmes
06a5ada99b Apply Latin1 fix to other platforms
While much less likely on other platforms (with no current reports and
/Applications or /usr/share folders being the norm), the issue
could still occur.
2023-05-31 16:41:12 +10:00
Damien Elmes
aa9a734f69 Workaround Ubuntu ignoring tooltip palette in dark mode
https://forums.ankiweb.net/t/tooltip-hover-appearance-looks-strange/30384
2023-05-31 15:19:10 +10:00
Abdo
3787699f8c
Disable Toggle Bury when nothing is selected (#2529) 2023-05-31 13:47:43 +10:00
Abdo
c87f62487b
Add add-on installation hooks (#2523)
* Add add-on installation hooks

* Fix GUI code run in background thread

deleteAddon() is run in the background in the update routine so it
shouldn't containg any GUI code.

* Add a hint to the docstrings (dae)
2023-05-29 19:47:49 +10:00
Damien Elmes
93e1a6be22 Only apply Wayland workaround in Wayland path
https://github.com/ankitects/anki/issues/1767#issuecomment-1562695240
2023-05-29 19:07:54 +10:00