Commit Graph

116 Commits

Author SHA1 Message Date
Damien Elmes
13f5ee1ddc tweak update message
- Since we need to show this to new users until AnkiDroid is updated,
use a wording that doesn't seem so out of place to new users.
- Avoid mentioning syncing, since the user may not sync, and the
modSchema() call will allow the user to confirm anyway.
- Let the user know they can change their mind about AnkiDroid by
visiting the preferences.
2021-02-21 19:47:26 +10:00
Damien Elmes
5ae66af5d2 rework v2 scheduler upgrade; drop downgrade
- Rework V2 upgrade so that it no longer resets cards in learning,
or empties filtered decks.
- V1 users will receive a message at the top of the deck list
encouraging them to upgrade, and they can upgrade directly from that
screen.
- The setting in the preferences screen has been removed, so users
will need to use an older Anki version if they wish to switch back to
V1.
- Prevent V2 exports with scheduling from being importable into a V1
collection - the code was previously allowing this when it shouldn't
have been.
- New collections still default to v1 at the moment.

Also add helper to get map of decks and deck configs, as there were
a few places in the codebase where that was required.
2021-02-21 15:50:41 +10:00
Damien Elmes
88c002f4eb convert qt strings to f-strings with flynt
Also revealed an incorrect type def in editor.py that mypy wasn't
noticing before :-(
2021-02-11 10:09:06 +10:00
Damien Elmes
bb29ce88f3 minor code cleanups with pyupgrade
- pyupgrade --py38-plus --keep-runtime-typing --keep-percent-format
- third-party mpv and winpaths excluded
2021-02-11 09:43:40 +10:00
Damien Elmes
4a5ef69068 add remaining types and disable missing types on (almost) all aqt 2021-02-03 00:00:29 +10:00
Damien Elmes
a56b09b987 add a bunch of return types 2021-02-01 23:53:23 +10:00
Damien Elmes
84f8d7f604 add some types to main.py 2021-02-01 20:59:18 +10:00
Damien Elmes
98f4b3db81 add types to utils.py
The function signatures for things like getFile() are awful, but
sadly are used by a bunch of add-ons.
2021-02-01 20:23:48 +10:00
Damien Elmes
9d853bbb03 start work on more clearly defining backend/protobuf boundaries
- anki._backend stores the protobuf files and rsbackend.py code
- pylib modules import protobuf messages directly from the
_pb2 files, and explicitly export any will be returned or consumed
by public pylib functions, so that calling code can import from pylib
- the "rsbackend" no longer imports and re-exports protobuf messages
- pylib can just consume them directly.
- move errors to errors.py

Still todo:

- rsbridge
- finishing the work on rsbackend, and check what we need to add
back to the original file location to avoid breaking add-ons
2021-01-31 18:55:45 +10:00
Damien Elmes
8410330f94 move drag/drop deck logic to backend 2021-01-31 13:46:31 +10:00
Henrik Giesel
759ed17963 Move dispatch logic from Histogram to individual graphs 2021-01-25 16:34:44 +01:00
Damien Elmes
b30b7c3073 fix qt/ pylints 2021-01-07 16:21:50 +10:00
BlueGreenMagick
adb8be92a0 format ask_delete_deck method more readable 2021-01-05 21:33:59 +09:00
BlueGreenMagick
95a62b20d3 delete deck in background 2021-01-05 21:33:59 +09:00
BlueGreenMagick
f6f06986d0 seperate ask_delete_deck and _delete method 2021-01-05 20:09:47 +09:00
Henrik Giesel
0a121077de Wrap studied_today in div and span in deckbrowser 2021-01-03 14:54:44 +01:00
Henrik Giesel
173da02b2f Change include name for jquery ui in deckbrowser 2020-12-30 12:07:02 +01:00
Henrik Giesel
98407c3fea Avoid building jquery to its own directory 2020-12-28 14:18:07 +01:00
Henrik Giesel
37dcdcc4c0 Rename references from vendor/jquery.js to vendor/jquery/jquery.min.js 2020-12-28 13:16:12 +01:00
Damien Elmes
e99a7c0f90 tweak naming and move method into col.decks 2020-12-20 10:26:16 +10:00
k12ish
cc0572a385 Added type hints, renamed kwarg 2020-12-19 18:12:58 +00:00
k12ish
ef1f58c8b6 Added method 2020-12-19 17:59:07 +00:00
Damien Elmes
ba336d5de3 update multi-line _() references 2020-11-18 11:32:22 +10:00
Damien Elmes
1255e7530c update some qt ngettext references 2020-11-18 09:22:27 +10:00
Damien Elmes
2453e5c488 update temporary val="%s" references to standard ftl 2020-11-17 22:00:44 +10:00
Damien Elmes
6418993840 merge bulk of qt/ - designer files still to do 2020-11-17 17:42:43 +10:00
Damien Elmes
aea0a6fcc6 initial Bazel conversion
Running and testing should be working on the three platforms, but
there's still a fair bit that needs to be done:

- Wheel building + testing in a venv still needs to be implemented.
- Python requirements still need to be compiled with piptool and pinned;
need to compile on all platforms then merge
- Cargo deps in cargo/ and rslib/ need to be cleaned up, and ideally
unified into one place
- Currently using rustls to work around openssl compilation issues
on Linux, but this will break corporate proxies with custom SSL
authorities; need to conditionally use openssl or use
https://github.com/seanmonstar/reqwest/pull/1058
- Makefiles and docs still need cleaning up
- It may make sense to reparent ts/* to the top level, as we don't
nest the other modules under a specific language.
- rspy and pylib must always be updated in lock-step, so merging
rspy into pylib as a private module would simplify things.
- Merging desktop-ftl and mobile-ftl into the core ftl would make
managing and updating translations easier.
- Obsolete scripts need removing.
- And probably more.
2020-11-01 14:26:58 +10:00
Damien Elmes
1827063e4f fix import shortcut
https://forums.ankiweb.net/t/anki-2-1-34-35-beta/3569/21
2020-09-27 11:57:12 +10:00
Damien Elmes
ce49ca9401 log manual reschedule, but ignore the log entry in the stats 2020-09-02 17:56:23 +10:00
Damien Elmes
a517accee3 update to latest black 2020-08-31 13:29:28 +10:00
Damien Elmes
2ff1a27b04 fix misaligned deck heading in RTL languages
https://forums.ankiweb.net/t/anki-2-1-29-beta/1220/2?u=dae
2020-07-22 11:00:39 +10:00
Damien Elmes
4c6bd7b037 lint fixes 2020-06-02 17:58:14 +10:00
Damien Elmes
4d7e23111e change sync label to indicate sync state
- blue for normal sync, red for full sync required
- refactor status fetching code so we don't hold a collection lock
during the network request, which slows things down
- fix sync spinner restarting when returning to deck list
2020-06-02 13:23:01 +10:00
Damien Elmes
a8ad4abf37 add "immediate" progress back
on ops which we know are going to take time, it makes the interface
look more responsive to pop up the progress more quickly
2020-06-01 13:57:10 +10:00
Damien Elmes
38508c3ad7 use keyword args for calls with more than one argument 2020-05-24 09:12:47 +10:00
Damien Elmes
6144317736 hook expected an int, not a str 2020-05-22 11:27:40 +10:00
Damien Elmes
0bf4fe400a fix deletion of decks; allow deleting cards from default
https://anki.tenderapp.com/discussions/beta-testing/1967-2126-189-g7384df8f-crash-at-note-types-fields-save#comment_48353232
2020-05-22 11:24:56 +10:00
Damien Elmes
9baa8530d5 move deck/notetype update hooks to gui
We need to migrate away from firing hooks in libanki, since libanki
methods may be running on a background thread, and hook consumers
typically expect the code to run in the main thread. We could document
it, but it would frequently be forgotten about, and could lead to
crashes.

https://anki.tenderapp.com/discussions/ankidesktop/41748-qobject-cannot-create-children-for-a-parent-that-is-in-a-different-thread-when-hitting-the-save-button-on-clayoutpy-window
2020-05-22 10:47:14 +10:00
Damien Elmes
8eada2b57d add find_deck_in_tree() 2020-05-16 13:05:20 +10:00
Damien Elmes
f2086fc2e3 switch to new deck tree in deck browser
Saves us having to look up collapsed/filtered as we render, and gives
us type completion.
2020-05-16 10:52:14 +10:00
Damien Elmes
75d3eebafe drop usage of nameMap in deckbrowser
It was unnecessary, and being called multiple times as we recursed
downwards, slowing things down.
2020-05-16 10:02:08 +10:00
Damien Elmes
238441f2d9 use the backend for the deck due tree
- approx 3x faster on a large test deck
- counts are no longer capped to 1000 in the tree
2020-05-12 21:13:33 +10:00
Damien Elmes
eff1b39e9f fix deck_browser_did_render hook 2020-04-09 13:40:19 +10:00
Damien Elmes
e7452300a2 imports 2020-03-14 22:10:27 +10:00
Damien Elmes
522ee8fca7 drop the deck count warning 2020-03-14 19:41:33 +10:00
Damien Elmes
0c49431719 FString -> TR 2020-02-27 12:25:19 +10:00
Damien Elmes
4430c67069 rework Fluent handling
- all .ftl files for a language are concatenated into a single file
at build time
- all languages are included in the binary
- external ftl files placed in the ftl folder can override the
built-in definitions
- constants are automatically generated for each string key
- dropped the separate StringsGroup enum
2020-02-23 13:22:50 +10:00
Damien Elmes
42939fe0e4 remove unused import 2020-02-21 19:58:54 +10:00
Damien Elmes
49fe080636 add studied_today(), move to statistics.ftl 2020-02-21 18:01:15 +10:00
Damien Elmes
c5156a0f6b
Merge pull request #449 from glutanimate/html-content-section-hooks
Add hooks for modifying HTML body sections in the deck browser and overview screens
2020-02-18 08:20:01 +10:00
Glutanimate
8ff1a2e770 Bundle individual section hooks together into one
Uses new dataclass 'DeckBrowserContent'
2020-02-17 16:26:21 +01:00
Damien Elmes
1524e7dcac split "Due" into three different contexts for translators 2020-02-17 14:41:01 +10:00
Glutanimate
d02de28f21 Add deck_browser_will_render_section hook
Allows add-on authors to specifcally target and modify individual
sections of the deck browser HTML body at string composition time.
2020-02-16 19:29:01 +01:00
Glutanimate
0e5dea4c9f Assume that web assets without a specified subpath are under /_anki
Maintains compatibility with existing add-ons
2020-02-15 15:03:43 +01:00
Glutanimate
bbd667b0ff Add webview_will_set_content hook & update supporting code accordingly 2020-02-12 22:00:13 +01:00
Damien Elmes
7fcb6b5672 pass instance to webview_did_receive_js_message instead of string 2020-02-09 08:59:29 +10:00
Arthur Milchior
75a8ef832b Allow to change main window when overview/deckbrowser is shown 2020-02-08 08:09:12 -08:00
Damien Elmes
b8ad45c4e4 redraw top toolbar when deck list refreshed
Just a hack that allows users to click on Decks to adjust the colour
after a macOS theme change.
2020-01-31 13:31:31 +10:00
Damien Elmes
7dcbc7efec basic night mode support
Forces the Fusion theme when running night mode, so we don't need
to work around platform themes that don't respond to the defined
palette.

Feedback/suggestions on the chosen colours welcome - _vars.scss is the
file to change if you want to experiment with adjustments.
2020-01-23 17:27:07 +10:00
Damien Elmes
d54f719558 add a webview_did_receive_js_message hook 2020-01-22 11:06:12 +10:00
Damien Elmes
02ec3f149c update qt/ to use the new API 2020-01-20 20:10:38 +10:00
Damien Elmes
8310cb7a0e add qconnect helper and some type hints
The type hints allow mypy to check the gui_hook calls, revealing a
bunch of places that are broken as they expect no arguments like the
legacy hooks.

To make mypy happy about PyQt's signal.connect(func), a qconnect()
helper has been added.
2020-01-16 07:41:23 +10:00
Damien Elmes
b09e7e8247 more tweaks for readability/consistency 2020-01-15 17:45:35 +10:00
Damien Elmes
cab572b63c remove _hook/_filter suffix 2020-01-15 16:53:24 +10:00
Damien Elmes
660685375f migrate most of the remaining runHook() calls 2020-01-15 12:46:53 +10:00
Damien Elmes
5876866565 tweaking the folder names again
hopefully that's the last of it
2020-01-03 07:48:38 +10:00