Damien Elmes
19541c4a9d
fix deck tree with a day delta, and support arbitrary timestamps
2020-07-06 19:16:03 +10:00
Damien Elmes
4d23a69e9a
formatting
2020-07-01 14:01:24 +10:00
Damien Elmes
572e2d10dc
hack around future unburied date
...
We want to avoid unburied != self.today, because the unburied time
is synchronized as part of the collection at the moment, and we don't
want a client with an older unburied time that was modified more
recently to cause cards to be unburied twice - so we only unbury
if today is more than 7 days earlier than the last unbury time.
Unsure what caused these users to end up in that state in the first
place:
https://anki.tenderapp.com/discussions/ankidesktop/41335-cards-remain-buried-forever-unless-manually-unburied
2020-07-01 13:12:45 +10:00
Damien Elmes
82568a1f3e
experiment with exposing raw card/revlog data to frontend
2020-06-29 15:48:00 +10:00
Damien Elmes
3ca4a13cf2
protobuf package should be in PascalCase
2020-06-29 15:48:00 +10:00
Damien Elmes
d99ea0c7a0
fix media not working after full sync
2020-06-24 09:52:02 +10:00
Damien Elmes
83b3d3249f
drop yellow colour in "filtered" for now
...
It's difficult to read against a light background
2020-06-16 16:39:07 +10:00
Damien Elmes
b51f03085e
migrate card stats to backend
...
Currently this renders the HTML directly like the previous Python
implementation - doing it in JS would probably make more sense in the
future.
2020-06-15 17:22:16 +10:00
Damien Elmes
772c7a945c
fix lint issues with latest mypy_protobuf
2020-06-14 15:38:43 +10:00
Damien Elmes
8e895aa247
handle db errors the same way as other backend requests
2020-06-12 20:39:02 +10:00
Damien Elmes
1cb0ac3670
update unit test for leech change
2020-06-09 14:12:34 +10:00
Damien Elmes
c4ead8ad28
strip out \r on export
...
(private post)
https://anki.tenderapp.com/discussions/ankidesktop/42315-bug-report-exporting-selected-cards-in-browser-issue
2020-06-09 12:56:16 +10:00
Damien Elmes
8bac28470f
fix error when importing v2 apkg
...
https://anki.tenderapp.com/discussions/ankidesktop/42070-anki-closes-without-warning-when-importing-conflicting-shared-deck
2020-06-09 12:06:52 +10:00
Damien Elmes
b277849db1
fix audio being included in FrontSide
2020-06-09 08:16:03 +10:00
Damien Elmes
7c444b4d35
add progress to db check
2020-06-08 21:07:36 +10:00
Damien Elmes
4570ae3d12
Merge pull request #658 from BlueGreenMagick/media-type
...
add type hint for media dir
2020-06-08 11:31:01 +10:00
Damien Elmes
4df3777aed
fix legacy deckDueTree()
2020-06-08 11:12:24 +10:00
BlueGreenMagick
c6ec9e44e4
add type hint for media dir
2020-06-07 10:35:48 +09:00
Damien Elmes
1fe18718f7
add daily count updating to backend
2020-06-05 19:49:53 +10:00
Damien Elmes
fee6cdff22
support generating a due tree for a different date
2020-06-05 09:38:31 +10:00
Damien Elmes
4a69b55a90
add note/card removal to backend
2020-06-04 18:21:04 +10:00
Damien Elmes
e1b0fe1832
add .count() to hooks, and list->sequence in note deletion
2020-06-04 18:20:03 +10:00
Damien Elmes
14a5ab353e
fix duplicate/empty check
2020-06-02 17:34:34 +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
5729e9e336
"fix" v1 scheduler breaking after burySiblings change
2020-06-01 19:44:25 +10:00
Damien Elmes
90e19daec2
handle aborting normal sync
...
- Use a separate abort handle, as the media sync is running
in the background and we need to be able to target them separately.
The current progress handling is going to need a rethink if we introduce
any other background tasks in the future.
- Roll back the transaction when interrupting.
2020-06-01 13:57:10 +10:00
Damien Elmes
c6f0710ce7
report normal sync progress
...
Also:
- provide a way for the progress handler to skip the throttling so that
we can ensure progress is updated at the end of a stage
- show 'checking' at the end of full sync
2020-06-01 13:57:10 +10:00
Damien Elmes
aecce5a516
fix mtime being bumped in .reset()
2020-06-01 13:57:10 +10:00
Damien Elmes
42302b070e
fix de-auth when no media DB set up
2020-06-01 13:57:10 +10:00
Damien Elmes
0e5b7da62a
login/full up/full down plugged in
2020-06-01 13:57:10 +10:00
Damien Elmes
ee6d7f82e7
rework progress handling
...
- client now polls status instead of backend pushing it
- supports multiple threads
- update throttling happens in one place
2020-06-01 13:57:10 +10:00
Damien Elmes
6204a86879
tidy up sibling burying
...
closes #649
2020-06-01 13:48:15 +10:00
Damien Elmes
8516ed8655
handle images served from directory + svg content type
...
https://anki.tenderapp.com/discussions/ankidesktop/41974-win-linux-when-pasting-some-html-i-get-error-in-_run_command-ankirsbackendioerror-ioerror
2020-06-01 13:40:17 +10:00
Damien Elmes
8f9c6fbf95
Merge pull request #643 from evandroforks/add_repr_functions
...
Added __repr__ functions to common objects
2020-06-01 13:29:21 +10:00
evandrocoan
3318f23ff3
Say which card failed with an exception
2020-05-31 19:41:18 -03:00
evandrocoan
ef5c38dbc6
Added super().__repr__() to new __repr__() calls
2020-05-31 19:39:19 -03:00
evandrocoan
1e216e47ed
Added __repr__ functions to common objects
2020-05-31 19:39:19 -03:00
Damien Elmes
97618564f4
fix typechecking breaking with latest mypy_protobuf
...
the change that caused it:
https://github.com/dropbox/mypy-protobuf/issues/118
This is more awkward to handle now, as the types are only available
at type-checking time. Python's static typing is such a mess :-(
2020-05-27 09:14:02 +10:00
Damien Elmes
3e156911e7
avoid printing the original exception bytes
...
Prevents the "while processing this exception, another exception
occurred" message
2020-05-25 14:28:37 +10:00
Damien Elmes
015de0c51f
move generated methods into separate, gitignored file
2020-05-24 20:41:53 +10:00
Damien Elmes
c8d13209cd
move dupe check to backend
2020-05-24 19:48:56 +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
89dde3aeb0
migrate the remaining methods
2020-05-24 08:36:50 +10:00
Damien Elmes
4bf8175bcb
migrate more scheduling/media/etc
...
almost there
2020-05-23 21:34:19 +10:00
Damien Elmes
a105037ec9
migrate notetypes, update GIL list
2020-05-23 20:43:55 +10:00
Damien Elmes
6710e3d528
add some more newtypes to the RPC defs
2020-05-23 16:58:01 +10:00
Damien Elmes
95735f106a
migrate cards and notes
2020-05-23 16:19:48 +10:00
Damien Elmes
7550e6241c
migrate decks and dconf methods
2020-05-23 15:09:16 +10:00
Damien Elmes
081a61a438
more methods
2020-05-23 14:01:36 +10:00
Damien Elmes
175afa9fee
migrate more methods to service
2020-05-22 22:09:33 +10:00
Damien Elmes
9c20d9a02b
start reworking protobuf handling
...
Will allow us to cut down on boilerplate by automatically generating
code from RPC service definitions
2020-05-22 20:56:15 +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
1844cc84cc
can't use _card.note_type() in clayout
2020-05-22 09:58:58 +10:00
Damien Elmes
c52a076176
add back most of .fields() to avoid breaking add-ons
2020-05-21 12:08:51 +10:00
Damien Elmes
44ca4b32eb
use longer delay in test_timing()
...
was intermittently failing in slow Windows CI
2020-05-21 09:33:49 +10:00
evandrocoan
b388c43454
Fixed HttpClient session not being closed
2020-05-20 19:20:41 -03:00
Damien Elmes
d5e48fdf65
fix deck age being used instead of collection
...
https://anki.tenderapp.com/discussions/ankidesktop/41637-bug-in-statistics
2020-05-20 19:46:01 +10:00
Damien Elmes
e2bb5cd14a
update missed storage._Collection references
2020-05-20 19:45:46 +10:00
Damien Elmes
50fdf9b03d
storage->collection
2020-05-20 17:58:28 +10:00
Damien Elmes
c49c378296
move storage logic into collection.py; fix export bug
...
https://anki.tenderapp.com/discussions/ankidesktop/41495-using-file-export-closes-the-collection-on-mwcoldb-if-the-browser-window-is-open
2020-05-20 17:43:34 +10:00
Damien Elmes
0c85397461
fix extending limits in custom study
...
https://anki.tenderapp.com/discussions/beta-testing/1967-2126-189-g7384df8f-crash-at-note-types-fields-save
2020-05-20 14:13:40 +10:00
Damien Elmes
7384df8f19
Merge pull request #613 from evandroforks/add_missing_file_descriptors_close
...
Add missing close file descriptors using context managers
2020-05-19 14:39:07 +10:00
Damien Elmes
e17d63083c
catch protobuf error as well
...
Sad that we can't exhaustively match protobuf oneofs in
Python :-(
2020-05-19 13:10:20 +10:00
evandrocoan
083cc8ae4e
Simplified csvfile.py super call __del__ call
2020-05-18 16:20:33 -03:00
evandrocoan
200bad3714
Explicitly close the importer file descriptor
...
https://github.com/ankitects/anki/pull 613
2020-05-18 15:54:20 -03:00
evandrocoan
efb62b9528
Add missing close file descriptors using context managers
2020-05-18 15:54:20 -03:00
Damien Elmes
8bd5d756e2
bump version
2020-05-18 12:50:20 +10:00
Damien Elmes
68465ae07b
protobuf tidyups
2020-05-18 09:26:14 +10:00
Damien Elmes
7ec3f1ecc0
fix syncing
2020-05-17 20:52:02 +10:00
Damien Elmes
69537bb748
minor tidyups in decks.py
2020-05-17 20:13:29 +10:00
Damien Elmes
803aeff16e
update current note type in backend
2020-05-17 20:01:16 +10:00
Damien Elmes
7daa417dc8
fix renaming corner cases and decks.update()
...
- .update() should update a single deck and preserve usn by default,
as that's what existing code expects
- decks are automatically renamed when they conflict with an existing
name
2020-05-17 19:07:15 +10:00
Damien Elmes
df48fa8cf7
handle deletion of default deck in backend; use + instead of _
2020-05-17 15:22:19 +10:00
Damien Elmes
252eb3a444
fix shared deck conf warning
2020-05-17 14:37:59 +10:00
Damien Elmes
b9b837e7bd
update before_upload()
2020-05-17 14:13:21 +10:00
Damien Elmes
6114836484
move deck config to protobuf
2020-05-17 13:28:41 +10:00
Damien Elmes
54670580ad
add option to limit deck tree counts to a particular node
2020-05-17 08:38:49 +10:00
Damien Elmes
8b57a61746
use deck tree for new/review count calculation
...
- wins back the performance lost by the decks and dconf not being
in memory, and the overhead of serializing data for DB calls
- card counts are no longer capped to 1000
- learn counts are currently still calculated separately - can't merge
v1 counts without changing the existing behaviour
- partially rendering the tree may yield more savings
2020-05-16 20:28:03 +10:00
Damien Elmes
5590b22683
speed up children() and add deck_and_child_ids()
2020-05-16 15:40:07 +10:00
Damien Elmes
2efda14200
rework and merge updateCutoff
...
- the old "mutate but don't save" approach to resetting the "done today"
counts no longer works, and was inefficient anyway - now we just check
the day when returning the count
- remove separate implementation for v1 scheduler
This is a stop-gap solution - a bigger refactor will need to wait
until the deck/note type changes have stabilized.
2020-05-16 15:14:16 +10:00
Damien Elmes
bd1ce123af
formatting
2020-05-16 14:59:47 +10:00
Damien Elmes
1cddd6d23e
only update active when selecting deck/resetting
...
We were previously doing this every time a card was answered.
2020-05-16 14:57:46 +10:00
Damien Elmes
8eada2b57d
add find_deck_in_tree()
2020-05-16 13:05:20 +10:00
Damien Elmes
24dd116f91
update unit tests to use deck_due_tree()
2020-05-16 12:10:40 +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
4d5908dc20
remove unused default(Dynamic)Deck
2020-05-15 21:47:33 +10:00
Damien Elmes
964a69e54e
handle default deck and filtered deck suppression in the backend
2020-05-15 21:21:10 +10:00
Damien Elmes
769bf04f75
remove unused deckDueList() and associated tree code
...
The progress bar add-ons appear to be the only active users of it;
they can switch their old code from iterating over the list to
simply locating the selected deck in deckDueTree(), as its counts should
summarize all the child decks.
2020-05-15 18:37:12 +10:00
Damien Elmes
e44b3bf93c
reuse stock basic type for default field/notetype/etc
...
Could add extra methods in the backend to allocate these in the
future, but as this is not a hot path, this should do for now.
2020-05-15 17:35:00 +10:00
Damien Elmes
2ac33500eb
fetch stock notetypes from backend
2020-05-15 17:08:24 +10:00
Damien Elmes
f650e5557f
add back card deletion count
...
cheaper to look up now that there's an index on notes.mid
2020-05-15 15:28:07 +10:00
Damien Elmes
7c5980a941
<= in modified_after_begin for unit tests
2020-05-15 14:24:59 +10:00
Damien Elmes
46c363d4aa
track changes in fields dialog as well
...
And avoid bumping schema until user actually saves, but warn at
start.
2020-05-15 13:59:44 +10:00
Damien Elmes
a2b7a30841
fetch/set remaining collection properties as required
2020-05-15 13:33:37 +10:00
Damien Elmes
31480be5e7
fix exporting bug
...
can't/shouldn't pop up confirmation message on export
2020-05-15 11:03:34 +10:00
Damien Elmes
782911471b
add "fill empty" checkbox
2020-05-14 20:58:45 +10:00
Damien Elmes
5167bb57be
start reworking card layout screen
...
- front/back/css shown in tabs
- front/back preview switchable; only one webview needs to be loaded
- dropdown to select cloze number in preview
- search box to search in front/back/css
2020-05-14 15:24:29 +10:00
Damien Elmes
f23eb350e4
drop availOrds(), and use backend for getting cloze numbers
2020-05-14 12:14:00 +10:00
Damien Elmes
9f676dbe0b
remove availOrds() check in importer
...
Like adding individual cards, we now support importing material even
if it wouldn't generate any cards, and the old availOrds check can't
handle negated conditionals.
2020-05-14 10:27:54 +10:00
Damien Elmes
c601dcef24
remove obsolete preview code
2020-05-14 09:22:53 +10:00
Damien Elmes
6680cdf1d3
update the card layout screen
...
- changes are now committed in bulk when closing the dialog,
and can be canceled
- it's not necessary to save the note to the database to preview it
- duplicate fields are now shown as duplicates in the top list
- redraw preview more quickly
- use + instead of _ when deduplicating names, as the latter is a
glob character
2020-05-13 17:24:49 +10:00
Damien Elmes
12b8fe6147
don't hide static template text when card is empty
2020-05-13 11:17:44 +10:00
Damien Elmes
826cbb0108
fetch template and note fields in backend during normal card render
...
Saves having to serialize the note fields and q/a templates, which
is particularly a win when rendering question/answer in the browse
screen.
Also some work towards being able to preview notes without having to
commit them to the database.
2020-05-13 10:38:49 +10:00
Damien Elmes
9317cee9ba
handle scheduling preferences in the backend
2020-05-12 21:13:34 +10:00
Damien Elmes
ea4f150455
fetch timing_today() params in backend
2020-05-12 21:13:34 +10:00
Damien Elmes
eee0d7e92f
switch server back into a bool and rely on config
2020-05-12 21:13:34 +10:00
Damien Elmes
2c7900989c
fix default rollover
2020-05-12 21:13:34 +10:00
Damien Elmes
70cc1699a6
rewrite DB check
...
- notes with wrong field count are now recovered instead of
being deleted
- notes with missing note types are now recovered
- notes with missing cards are now recovered
- recover_missing_deck() still needs implementing
- checks required
2020-05-12 21:13:34 +10:00
Damien Elmes
2413f286b1
bulk tag add/remove/update; canonify on note save
...
also remove the tag list updated hook - we'll need a better solution in
the future than having the library code call back into the GUI code
2020-05-12 21:13:34 +10:00
Damien Elmes
7bab99d873
support disabling unicode normalization in notes
2020-05-12 21:13:34 +10:00
Damien Elmes
a7a485d550
use backend for genCards() and updateFieldCache()
2020-05-12 21:13:34 +10:00
Damien Elmes
05ca797ee6
add pep8 name for findReplace
2020-05-12 21:13:34 +10:00
Damien Elmes
2317574f02
fix tag saving in notes
2020-05-12 21:13:34 +10:00
Damien Elmes
1852e32183
update find&replace in browser
...
sadly the UI still stutters on large selections - the calls
to get the selected rows from Qt are really slow.
2020-05-12 21:13:34 +10:00
Damien Elmes
8b557ec382
move find&replace to backend
2020-05-12 21:13:34 +10:00
Damien Elmes
25f122bf5c
update fields and models diags
...
- field changes are now applied when user closes dialog with save
button, in bulk
- models diag now fetches note type and saves it as required, instead
of holding on top a copy that can grow stale as changes are made in
subdialogs
- both dialogs now perform operations in the backend
- note.model() now fetches the note type on the fly, instead of
holding on to a copy that may become stale
2020-05-12 21:13:34 +10:00
Damien Elmes
2308b136fd
add an index on notes(mid) so we can avoid the tablescan
2020-05-12 21:13:34 +10:00
Damien Elmes
1233e9de12
release GIL on notetype save/delete
2020-05-12 21:13:34 +10:00
Damien Elmes
fd4406222a
remove invalidated part of test_review_limits
...
Previously if the sum of child counts was above the parent's limit,
the deck tree would show a parent count above the parent's limit, and
clicking on the parent would show a lower count. The new deck tree
code never shows a parent count above the parent's limit, so this
part of the test is no longer valid.
2020-05-12 21:13:33 +10:00
Damien Elmes
5ce59f6559
run black
2020-05-12 21:13:33 +10:00
Damien Elmes
68fdd651e5
remove dconf cache
2020-05-12 21:13:33 +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
5fb5338d97
add missing decks in backend
...
- need to compare parents with unicode case folding
- duplicate check enforced by the DB
2020-05-12 21:13:33 +10:00
Damien Elmes
5d6581faf2
remove pybackend.py
2020-05-12 21:13:33 +10:00
Damien Elmes
a88bc1e836
speed up browser load by rendering deck tree in Rust and skipping counts
2020-05-12 21:13:33 +10:00
Damien Elmes
f592672fa9
add separate decks table, and start on moving deck handling to Rust
...
The Python tests are passing, but there are still a number of issues
to work through, and the table/protobuf schema is not yet finalized.
2020-05-12 21:13:33 +10:00
Damien Elmes
6e1d2990a0
remove unused _updateRequired and associated code
2020-05-12 21:13:33 +10:00
Damien Elmes
6e8860cafa
hook the empty cards code up to the GUI
2020-05-12 21:13:33 +10:00
Damien Elmes
f637ac957d
hook up new note and note type handling
...
- notetypes are fetched from the DB as needed, and cached in Python
- handle note type changes in the backend. Multiple operations can now
be performed in one go, but this is not currently exposed in the GUI.
- extra methods to grab sorted note type names quickly, and fetch by
name
- col.models.save() without a provided notetype is now a no-op
- note loading/saving handled in the backend
- notes with no valid cards can now be added
- templates can now be deleted even if they would previously
orphan notes
a number of fixmes have been left in notes.py and models.py
2020-05-12 21:13:33 +10:00
Damien Elmes
e0de3d6b8c
add an extra second to a unit test
2020-05-12 21:13:33 +10:00
Damien Elmes
d6646a6db5
expose stock notetypes
2020-05-12 21:13:33 +10:00
Damien Elmes
fcb8567185
drop legacy newBury option
2020-05-12 21:13:33 +10:00
Damien Elmes
540892639f
add stock note types in backend
2020-05-12 21:13:33 +10:00
Damien Elmes
74c97ad6d3
bump version
2020-05-11 19:28:17 +10:00
Damien Elmes
c02716ccd8
python formatting+lints
2020-05-08 17:30:27 +10:00
Damien Elmes
4a26e2ba77
bundle socks
...
https://anki.tenderapp.com/discussions/ankidesktop/39801-sync-error
2020-05-08 15:26:19 +10:00
Damien Elmes
a095a8bb07
fix due of preview cards being reset
...
https://anki.tenderapp.com/discussions/ankidesktop/41243-undo-function-causes-error-in-filtered-decks
2020-05-08 15:25:54 +10:00
Damien Elmes
54734ec88e
fix error undoing card in preview queue
...
https://anki.tenderapp.com/discussions/ankidesktop/41243-undo-function-causes-error-in-filtered-decks
2020-05-08 15:25:38 +10:00
Damien Elmes
e37774f0bd
fix v1 log appearing next to export
2020-05-05 16:15:49 +10:00
Damien Elmes
9bb4a02e0a
fix unnecessary spaces being added to notes with empty tags
2020-05-04 21:53:22 +10:00
Damien Elmes
b337dda8df
bump version
2020-05-02 10:22:00 +10:00
evandrocoan
b19b3a6706
Stop requiring ankirspy while running on development because
...
maturin develop hides the package from pip
https://github.com/PyO3/maturin/issues 304
2020-04-30 23:37:19 -03:00
evandrocoan
a48fa4ad87
Add missing aqt and anki modules dependency requirements
2020-04-30 17:30:22 -03:00
Damien Elmes
94d369db18
if conf points to an invalid configuration, fall back on default
2020-04-30 11:45:13 +10:00
Damien Elmes
e27d015ff9
expose clock hack via env var
...
closes #594
2020-04-30 09:33:02 +10:00
Damien Elmes
ff170bff31
fix tags with missing leading/trailing spaces in DB check
2020-04-30 08:54:17 +10:00
Damien Elmes
4e33775ed4
drop type answer requirement special case
...
While it makes no sense to have the typing box on the front without
another non-empty field, "the front of this card is empty" when
a typing box is on the template seems to be confusing some users, so
it is clearer to show them the box.
2020-04-29 21:29:16 +10:00
Damien Elmes
00cf4fc585
bump version
2020-04-28 08:57:56 +10:00
Damien Elmes
01fc958c0e
Merge pull request #587 from BlueGreenMagick/tags
...
remove unnecessary code
2020-04-27 19:25:42 +10:00
BlueGreenMagick
55eb0d1e68
remove unnecessary code
2020-04-27 10:05:38 +09:00
evandrocoan
26480fb13c
Fixed make clean rule not working on Windows
2020-04-26 03:02:02 -03:00
Damien Elmes
683f664d85
fix deleting deck configs
2020-04-20 13:23:05 +10:00
Damien Elmes
16be20e2fa
don't write log files when exporting
2020-04-15 21:45:32 +10:00
Damien Elmes
b55742509a
embed sort kind enum to avoid future namespace conflicts
2020-04-14 20:31:10 +10:00
Damien Elmes
7f2610568a
Revert "remove unused decks.count()"
...
This reverts commit c79b6835bf
.
c79b6835bf
2020-04-13 19:26:12 +10:00
Damien Elmes
351d8a309f
move autoplay() into card
2020-04-13 09:04:30 +10:00
Damien Elmes
10eb947402
fix replay audio again, and decouple the code from the reviewer
2020-04-13 08:59:36 +10:00
Damien Elmes
2f1523f82a
set db mod flag if mtime changed by backend
2020-04-11 15:41:21 +10:00
Damien Elmes
330848abe3
document ankidev and remove sync changes
...
https://github.com/ankitects/anki/pull/548
2020-04-11 14:36:05 +10:00
Damien Elmes
c79b6835bf
remove unused decks.count()
2020-04-10 10:25:31 +10:00
Damien Elmes
4c7210b430
(de)serialize decks in backend
2020-04-09 12:41:59 +10:00
Damien Elmes
ce2890ca15
fix errorsAfterMidnight
2020-04-08 10:05:19 +10:00
Damien Elmes
36ec7830a9
load/save note types in backend
...
This allows us to normalize bad data, and is the first step towards
splitting note types into separate tables.
2020-04-08 10:05:07 +10:00
Damien Elmes
6ecf2ffa2c
Merge pull request #543 from Arthur-Milchior/sort_according_to_path
...
Sort according to path
2020-04-07 14:44:53 +10:00
Damien Elmes
16ab351bf8
avoid unnecessary work in 'make build'
2020-04-07 10:59:14 +10:00
Arthur Milchior
64bb71e5bd
immediate_parent
2020-04-06 23:56:24 +02:00
Arthur Milchior
285e9280cf
immediate_parent_path
2020-04-06 23:55:17 +02:00
Arthur Milchior
bda2935de1
_basename to basename, since it's not private in use
2020-04-06 23:51:50 +02:00
Arthur Milchior
5315b717c0
_basename used where possible
2020-04-06 23:51:42 +02:00
Arthur Milchior
69a9425cd0
replace _path by path (because it's not private here)
2020-04-06 23:50:43 +02:00
Arthur Milchior
266c2022b5
uses _path where possible
2020-04-06 23:50:37 +02:00
Arthur Milchior
5d55c4cda2
Sort decks according to their paths
...
Currently it's sorted alphabetically. Because of this, "A::B" appears
between "A9" and "AA" in list of decks.
2020-04-06 22:49:25 +02:00
Arthur Milchior
77741977a1
make _path static
2020-04-06 22:45:30 +02:00
Damien Elmes
e247ac3c47
hide deprecation warning triggered by supermemo test
2020-04-06 20:24:17 +10:00
Damien Elmes
e005140909
hide warning when running tests
2020-04-06 20:24:05 +10:00
Damien Elmes
8efc09d4ef
emulate named args
2020-04-06 20:09:44 +10:00
Damien Elmes
dc62d5072c
use bytes for deck config proto
2020-04-06 15:39:47 +10:00
Damien Elmes
164bd29438
use bytes for config proto
2020-04-06 15:39:47 +10:00
Damien Elmes
991e6bdd4c
use a new file each time when testing graphs
2020-04-06 15:39:47 +10:00
Damien Elmes
676f4e74a8
store config in separate DB table
...
- mtime is tracked on each key individually, which will allow
merging of config changes when syncing in the future
- added col.(get|set|remove)_config()
- in order to support existing code that was mutating returned
values (eg col.conf["something"]["another"] = 5), the returned list/dict
will be automatically wrapped so that when the value is dropped, it
will save the mutated item back to the DB if it's changed. Code that
is fetching lists/dicts from the config like so:
col.conf["foo"]["bar"] = baz
col.setMod()
will continue to work in most case, but should be gradually updated to:
conf = col.get_config("foo")
conf["bar"] = baz
col.set_config("foo", conf)
2020-04-06 15:39:47 +10:00
Arthur Milchior
7365b93c1a
Remove useless recursion in DeckManager.rem
...
For any deck the children of it's children are its children. So
applying rem to children of children is useless and actually slightly
costly for deep subdecks
2020-04-05 11:33:23 +02:00
Damien Elmes
484377b809
downgrade when writing dummy collection
2020-04-04 18:43:26 +10:00
Damien Elmes
7375a0389a
add flag to skip downgrade on collection close
...
Disabled for now; when enabled it will allow faster collection
open and close in the normal case, while continuing to downgrade
when exporting or doing a full sync.
Also, when downgrading is disabled, the journal mode is no longer
changed back to delete.
2020-04-04 17:21:45 +10:00
Damien Elmes
ac4284b2de
update tag handling
...
- tag list stored in a separate DB table
- non-wildcard searches now do full unicode case folding
(eg tag:masse matches 'Maße')
- wildcard matches do simple unicode case folding
- some functions haven't been updated yet, so ascii folding will
continue to be used in some operations
2020-04-03 19:34:46 +10:00
Damien Elmes
333d0735ff
preserve mtime/usn when syncing deck config, and add snake_case names
2020-04-03 19:34:46 +10:00
Damien Elmes
d5f6d8b476
set col mod explicitly in decks.select()
2020-04-03 19:34:46 +10:00
Damien Elmes
ab6eeb5882
ensure pending deck/tag/note type changes flushed before searching
2020-04-03 19:34:46 +10:00
Damien Elmes
342bb64092
Merge pull request #535 from evandroforks/upload_wheels_to_pypi
...
Created the GitHub Actions step Upload to PyPi
2020-04-03 08:40:17 +10:00
evandrocoan
28bb56744d
Fixed double python version check for python_requires=">=3.7"
2020-04-02 12:31:12 -03:00
evandrocoan
069cc11a86
Created the GitHub Actions step Upload to PyPi to run only on
...
tagged releases of anki:
https://anki.tenderapp.com/discussions/ankidesktop/40025-anki-in-python-package-index
2020-04-02 02:57:34 -03:00
Damien Elmes
03f9be21e9
return the added card id instead of mutating the backend card object
2020-04-02 12:09:46 +10:00
Damien Elmes
431683aa5d
make sure None is returned in no-such-card case
2020-04-02 11:29:40 +10:00
Damien Elmes
c57801c168
tolerate string values in deck["conf"]
2020-04-01 19:36:40 +10:00
Damien Elmes
d342955830
remove defaultConf
2020-04-01 17:36:46 +10:00
Damien Elmes
c9da4bc1a6
allow aborting a media sync while http req in flight
...
The progress handling code needs a rethink, as we now have two separate
ways to flag that the media sync should abort. In the future, it may
make sense to switch to polling the backend for progress, instead of
passing a callback in.
2020-04-01 09:49:25 +10:00
Damien Elmes
fa2965d39a
add a temporary cache to bring deck list performance back
2020-03-30 20:27:53 +10:00
Damien Elmes
35c03af520
split deck config into separate SQL table
...
- on collection load, the schema is upgraded to 12
- on collection close, the changes are reversed so older clients
can continue to open the collection
- in the future, we could potentially skip the reversal except
when exporting/doing a full sync
- the same approach should work for decks, note types and tags in the
future too
- the deck list code needs updating to cache the deck confs for the
life of the call
2020-03-30 20:01:16 +10:00
Damien Elmes
004cc2b5f8
move deck conf handling to backend
2020-03-30 14:39:46 +10:00
Damien Elmes
5b26b20697
explicitly save deck conf after mutating it
2020-03-30 12:27:52 +10:00
Damien Elmes
bf83715ee0
initial work on undo support
2020-03-29 17:52:16 +10:00
Damien Elmes
158ce7bc01
add an extra second so slow CI server doesn't fail
2020-03-27 15:52:35 +10:00
Damien Elmes
f6219b59ac
Merge pull request #528 from evandroforks/create_actions_for_windows_macos
...
Create actions for Windows and Mac OS
2020-03-27 15:26:22 +10:00
Damien Elmes
84b84ae31c
use add_card()
2020-03-27 15:11:07 +10:00
evandrocoan
b07454ca0c
Merge remote-tracking branch 'danielelmes/master' into create_actions_for_windows_macos
2020-03-26 19:31:01 -03:00
Damien Elmes
7f16f436c3
handle mtime/usn bump in backend, and tweak integer sizes
2020-03-26 20:55:04 +10:00
Damien Elmes
13c7c82ae3
fix two cases where a float was being written into due
2020-03-26 19:05:18 +10:00
Damien Elmes
47504245dc
update_card()
2020-03-26 18:54:20 +10:00
Damien Elmes
1acfe7d3cc
tweak code for mypy
2020-03-26 17:47:53 +10:00
Damien Elmes
7ddaf93f7a
use backend to get card
2020-03-26 17:47:43 +10:00
Damien Elmes
8c80f96314
high due numbers shouldn't force a full sync
2020-03-26 09:09:11 +10:00
evandrocoan
721453f923
Merge remote-tracking branch 'danielelmes/master' into create_actions_for_windows_macos
...
# Conflicts:
# .github/scripts/trailing-newlines.sh
# .github/workflows/checks.yml
# Makefile
# pylib/Makefile
# qt/Makefile
# qt/tools/typecheck-setup.sh
# rspy/Makefile
2020-03-24 22:49:49 -03:00
Damien Elmes
ea3c6cad42
don't error when -l passes in language without _
2020-03-25 08:53:31 +10:00
Damien Elmes
e29d380d4c
fix sync getting stuck in a loop when changes is a multiple of 250
2020-03-24 19:30:35 +10:00
Damien Elmes
cc34157e4b
Merge pull request #510 from evandroforks/fix_tests_on_windows
...
Fix tests on windows
2020-03-24 15:33:02 +10:00
Damien Elmes
5c5d1c2af5
remove : check from dbproxy
2020-03-24 10:37:12 +10:00
evandrocoan
20c9837770
Created the .github/workflows/windows.yml
...
# Conflicts:
# .github/scripts/trailing-newlines.sh
# Makefile
# qt/tools/typecheck-setup.sh
# react/Makefile
# rspy/Makefile
# svelte/Makefile
# tslib/Makefile
2020-03-23 19:51:03 -03:00
evandrocoan
b1b3e5b87c
Merge remote-tracking branch 'danielelmes/master' into fix_tests_on_windows
...
# Conflicts:
# .github/scripts/trailing-newlines.sh
2020-03-23 18:44:11 -03:00
Damien Elmes
11a4d582b4
convert asc to desc instead of appending desc to the end of the order
...
as the latter doesn't work when sorting on more than one column
https://anki.tenderapp.com/discussions/beta-testing/1868-anki-2124-beta#comment_48174812
2020-03-23 19:53:57 +10:00
Damien Elmes
966eb666f0
fix v2 timing being returned for v1 users
2020-03-23 13:53:09 +10:00
Damien Elmes
4e2e0d1b84
fix setting of wal
2020-03-23 13:52:57 +10:00
Damien Elmes
cd9ceebd59
simplify how the local offset is passed around
...
- no need to store it in conf
- move local_minutes_west() call to collection
2020-03-23 13:52:52 +10:00
Damien Elmes
dc8cf9d554
release GIL during collection open/close
2020-03-23 09:27:42 +10:00
Damien Elmes
75b7ebb156
add back new_timezone_enabled(), as it's used in the prefs screen
2020-03-23 07:40:50 +10:00
Damien Elmes
427bf268fc
apply same list->tuple fix to v1 sched
2020-03-22 21:56:02 +10:00
zjosua
0b94eee97e
Fill _lrnQueue with tuples, not lists
2020-03-22 11:49:40 +01:00
Damien Elmes
6c6817563e
fix sync error introduced by 69d8cdd9ed
2020-03-22 17:32:34 +10:00
Damien Elmes
ac36fba90f
handle the two remaining timing issues
2020-03-22 14:43:29 +10:00
Damien Elmes
69d8cdd9ed
use backend for v1 and v2 cutoff calculations
...
this should also fix the CI failures, which were happening because
the datetime module wasn't matching the shifted time.time()
2020-03-22 14:28:26 +10:00
Damien Elmes
f28e57a367
add enum for controlling sort order
...
eg col.find_cards("", order=BuiltinSortKind.CARD_DUE)
2020-03-22 12:59:24 +10:00
Damien Elmes
9dda5cf6ca
fall back on stock json if orjson unavailable
2020-03-21 21:24:21 +10:00
Damien Elmes
9afbcd4178
remove old finder code; add search hooks to browser & remove old one
2020-03-21 16:38:46 +10:00
Damien Elmes
a5787781d7
add note searching
2020-03-21 09:00:05 +10:00
Damien Elmes
307aadfd8a
don't set deck.sched.today in test
2020-03-21 08:12:32 +10:00
Damien Elmes
daa848bb4d
update tests to reflect what now constitutes an error
2020-03-21 08:12:01 +10:00
Damien Elmes
868c463fb1
tests need to flush before searching
2020-03-21 08:10:52 +10:00
Damien Elmes
5debd3e0f8
add the ability to provide a custom sort order; use backend for find
2020-03-21 07:55:21 +10:00
Damien Elmes
bca5f2ddff
prototype of integration
...
no ordering yet, and no tests
2020-03-20 21:15:23 +10:00
Damien Elmes
d7daa63dbd
make sure we set db to None so we can tell when we've closed the DB
2020-03-20 21:15:23 +10:00
Damien Elmes
ba17567617
drop the separate i18n backend
2020-03-20 21:15:23 +10:00
Damien Elmes
874bc085fe
support opening and closing the DB while keeping backend alive
...
This is safer than just dropping the backend, as .close() will
block if something else is holding the mutex. Also means we can
drop the extra I18nBackend code.
Media syncing still needs fixing.
2020-03-20 21:15:23 +10:00
Damien Elmes
d0d6aa1433
drop usage of flushSched()
2020-03-20 21:15:23 +10:00
Damien Elmes
7986a79530
remove db.close()
2020-03-20 21:15:23 +10:00
Damien Elmes
fa12213e98
move .reopen() to mw; fix exporting
2020-03-20 21:15:23 +10:00
Damien Elmes
0f38514ad7
drop the DB progress handler code
...
This code was an awful hack to provide some semblance of UI
responsiveness while executing DB statements on the main thread.
Instead, we can just run DB statements in a background thread now,
keeping the UI responsive.
2020-03-20 21:15:23 +10:00
Damien Elmes
90de4a267d
drop lock() and setAutocommit()
...
We no longer need to worry about pysqlite implicitly beginning
transactions, and can be more explicit about beginning/ending
transactions
save() now also has a trx argument controlling whether a
transaction should be started / left open
2020-03-20 21:15:23 +10:00
Damien Elmes
63e3357068
pass weakref in from storage to fix type checking/code completion
2020-03-20 21:15:23 +10:00
Damien Elmes
db1508e27c
support first_row_only
2020-03-20 21:15:23 +10:00
Damien Elmes
e14c5e4745
proper implementation of executemany(); drop executescript()
2020-03-20 21:15:23 +10:00
Damien Elmes
ae06b9e446
add Collection struct, and get media check working again
...
- media check no longer needs collection to be closed
- use savepoints for operations initiated by Rust, so they are
atomic without forcing a commit
2020-03-20 21:15:23 +10:00
Damien Elmes
2cd7885ec0
add begin/commit/rollback, and support creating collections
...
all but one unit test is now passing
2020-03-20 21:15:23 +10:00
Damien Elmes
6db4418f05
drop log= argument from Collection
2020-03-20 21:15:23 +10:00
Damien Elmes
818401e464
remove remaining db kwargs
2020-03-20 21:15:23 +10:00
Damien Elmes
874ee80a68
add a temporary executemany()
2020-03-20 21:15:23 +10:00
Damien Elmes
b51e575a9d
drop the protobuf prototype
2020-03-20 21:15:23 +10:00
Damien Elmes
b876d97770
use (or)json for DB bridge
...
Some initial testing with orjson indicates performance varies from
slightly better than pysqlite to about 2x slower depending on the type
of query.
Performance could be improved by building the Python list in rspy
instead of sending back json that needs to be decoded, but it may make
more sense to rewrite the hotspots in Rust instead. More testing is
required in any case.
2020-03-20 21:15:23 +10:00
Damien Elmes
04ca8ec038
initial work on DB handling in Rust
...
committing the Protobuf implementation for posterity, but will replace
it with json, as Protobuf measures about 6x slower for some workloads
like 'select * from notes'
2020-03-20 21:15:23 +10:00
Damien Elmes
77cf7dd4b7
tweak db type hints
2020-03-20 21:15:23 +10:00
Damien Elmes
b5c6134d80
drop usage of pysqlite Cursor
2020-03-20 21:15:23 +10:00
Damien Elmes
0b1d96fce0
tweak layout of db methods
2020-03-20 21:15:23 +10:00
Damien Elmes
5778459d7c
drop .cursor()
2020-03-20 21:15:23 +10:00
Damien Elmes
87415c0d7f
use total_changes() sqlite func
2020-03-20 21:15:23 +10:00
Damien Elmes
5f442ae95e
drop the schema <11 upgrade code
2020-03-20 21:15:23 +10:00
Damien Elmes
527d269681
drop context manager
2020-03-20 21:15:23 +10:00
Damien Elmes
f4d4078537
drop named sql arguments
2020-03-20 21:15:23 +10:00
Damien Elmes
c8b9afac0c
drop progress handler and timeout arg
2020-03-20 21:15:23 +10:00
Damien Elmes
8ef28f8571
drop echo and text factory
2020-03-20 21:15:23 +10:00
Damien Elmes
c1252d68f0
clone db.py into dbproxy.py
2020-03-20 21:15:23 +10:00
evandrocoan
1ade1a1a0f
Fixed moved comment line on qt/aqt/main.py, long variables names on
...
pylib/Makefile and qt/Makefile, and rg --version not going to /dev/null
on .github/scripts/trailing-newlines.sh
2020-03-18 11:36:50 -03:00
evandrocoan
802c5b59cb
Fixed mypy and pylint not building on Windows
...
1. error: unused 'type: ignore' comment
2. Module 'pywintypes' has no 'error' member
3. Module 'win32pipe' has no 'SetNamedPipeHandleState' member,
but source is unavailable. Consider adding this module to
extension-pkg-whitelist if you want to perform analysis based on
run-time introspection of living objects.
2020-03-17 19:48:16 -03:00
evandrocoan
07a24c0d42
Fixed make check for pylint not working on Windows due
...
F:\Python\python.exe: can't open file '/cygdrive/f/anki/pyenv/Scripts/pylint': [Errno 2] No such file or directory
2020-03-17 19:48:16 -03:00
evandrocoan
88ea0b18bf
Fixed test_importing.py unit tests failing on windows with
...
PermissionError: [Errno 13] Permission denied
2020-03-17 12:49:36 -03:00
evandrocoan
9dd54c421b
Fixed UnicodeEncodeError: 'charmap' codec can't encode character
...
'\u2068' in position 2724: character maps to <undefined> for
pylib/tests/test_stats.py
2020-03-17 12:49:25 -03:00
evandrocoan
2e54d315e1
Fixed BeautifulSoup breaking string paths
...
https://anki.tenderapp.com/discussions/ankidesktop/39543-anki-is-replacing-the-character-by-when-i-exit-the-html-edit-mode-ctrlshiftx
2020-03-12 21:19:09 -03:00
Damien Elmes
1f26bac890
Merge pull request #501 from evandroforks/fix_beautiful_soup
...
Renamed BeautifulSoup import name for consistency with other usages of it
2020-03-11 15:55:15 +10:00
Damien Elmes
2f24e3f5e2
don't error when an add-on passes None to CardStats
...
https://anki.tenderapp.com/discussions/beta-testing/1842-syncing-message
2020-03-11 15:18:28 +10:00
Damien Elmes
5fd2eaba21
Spanish is 'es' on disk
2020-03-11 14:53:19 +10:00
Damien Elmes
25724c28b6
Revert "es-ES -> es"
...
This reverts commit eae52de71e
.
This change broke Anki:
https://anki.tenderapp.com/discussions/ankidesktop/39589-lang_to_disk_lang-startup-error
2020-03-11 14:52:35 +10:00
evandrocoan
c7bf6f3a8d
Renamed _decode_htmlescapes s variable
2020-03-10 13:57:09 -03:00
Damien Elmes
131d37dca5
add switch in prefs for new timezone handling code; bump sync version
...
AD devs: before updating the sync version to 10, please make sure
the new timezone code has been ported over. The core change to the
scheduler is in _updateCutoff():
9736e4a970/pylib/anki/schedv2.py (L1357)
with the following supporting Python functions:
9736e4a970/pylib/anki/schedv2.py (L1410)
_timing_today() is calculated in Rust (lines up to 92, the rest are
tests):
9736e4a970/rslib/src/sched/cutoff.rs (L20)
The change went through a few iterations before stabilising, so it's
probably easier to refer to the above code than the patches that got
us to that point.
2020-03-10 17:50:18 +10:00
Damien Elmes
0f4c3ab611
add restore media action
2020-03-10 13:35:09 +10:00
Damien Elmes
6ad2a1f9a3
add empty trash action in aqt
2020-03-10 12:49:40 +10:00
Damien Elmes
862e2b48f0
add col.weakref() and fix more reference cycles in pylib
2020-03-05 09:47:47 +10:00
Damien Elmes
6b204274c0
fix retain cycle caused by col.tr
...
We can't use a weakref.proxy with a method, so manually proxy the
call instead.
2020-03-05 09:45:51 +10:00
Arthur Milchior
0c9de3b19c
hooks for limit new/rev for a single deck
2020-03-04 16:11:13 +01:00
Arthur Milchior
c4b2ab96a6
single return in sched2 _deckRevLimitSingle
2020-03-04 16:07:15 +01:00
Damien Elmes
c35afd4aaa
add diffing script
2020-03-04 21:34:18 +10:00
Damien Elmes
e95eea68ec
remove a few more common methods
2020-03-04 21:33:44 +10:00
Damien Elmes
c14132332b
use _deckLimit() in a few more places
2020-03-04 21:24:09 +10:00
Damien Elmes
f054fa14d6
reuse _leftToday()
2020-03-04 12:26:57 +10:00
Damien Elmes
0e8339358b
import tidyup
2020-03-04 12:25:02 +10:00
Damien Elmes
e8bdd8616b
reuse _deckNewLimitSingle()
2020-03-04 12:23:56 +10:00
Damien Elmes
2079854d3f
reuse v2's _logRev()
2020-03-04 12:23:42 +10:00
Damien Elmes
961026b04b
remove duplicate methods from sched.py
2020-03-04 12:14:26 +10:00
Damien Elmes
1c09d80558
add some type hints that were only in the v1 scheduler
2020-03-04 12:10:38 +10:00
Damien Elmes
8c3e4a8bee
make v1 scheduler inherit from v2 so we can delete duplicate code
2020-03-04 11:41:23 +10:00
Damien Elmes
ffe6ecf44c
use weakref for backrefs so collection doesn't need to be garbage collected
2020-03-03 21:25:32 +10:00
Damien Elmes
a8e6fbd0fd
fix backend not deallocating due to circular reference
2020-03-03 21:12:38 +10:00
Damien Elmes
9f73d67b5a
Merge pull request #478 from Arthur-Milchior/missing_constant
...
countsIdx return a queue type.
2020-03-02 15:43:31 +10:00
Alan Du
6c2dda6c9c
Monkeytype qt/aqt/reviewer.py
2020-03-01 10:16:08 -05:00
Arthur Milchior
ab9999dbc9
countsIdx return a queue type.
...
I missed this constant before
2020-03-01 13:00:36 +01:00
Damien Elmes
8960d12aac
add nfd tag fix to db check
...
we already normalize in the editor and importing, so perhaps these
tags were from an old version
https://anki.tenderapp.com/discussions/ankidesktop/39120-bug-filter-do-not-work-with-tags-which-contain-german-letters-like
2020-03-01 11:21:25 +10:00
Damien Elmes
7bde0556cb
Merge pull request #473 from evandroforks/fix_docs_urllink
...
Fixed anki website docs link on pylib/anki/consts.py
2020-02-29 21:39:11 +10:00
Damien Elmes
ba4fe71eba
make logging explicit, and support logging to a file
2020-02-29 20:44:01 +10:00
evandrocoan
21b66cd86b
Fixed anki website docs link on pylib/anki/consts.py
2020-02-28 22:18:19 -03:00
Alan Du
7c971837ff
Add some more types
2020-02-27 21:27:59 -05:00
Alan Du
f8af9c509b
Monkeytype pylib/anki/importing/supermemo_xml.py
2020-02-27 19:27:32 -05:00
Alan Du
2879dc1158
Type pylib/anki/schedv2.py
2020-02-27 19:27:32 -05:00
Alan Du
b451f4e3f2
Monkeytype anki/rsbackend.py
2020-02-27 19:27:32 -05:00
Alan Du
02dd30f2a0
Monkeytype pylib/anki/sched.py
2020-02-27 19:27:32 -05:00
Alan Du
b157ee7570
Monkeytype pylib/anki/find.py
2020-02-27 19:27:32 -05:00
Damien Elmes
43f5d13ed6
migrate strings with trailing newlines to fluent
2020-02-27 20:36:40 +10:00
Alan Du
2476e120ad
Fix type warning
2020-02-27 00:07:19 -05:00
Alan Du
53b088f09a
Monkeytype pylib/anki/latex.py
2020-02-27 00:07:19 -05:00
Alan Du
b83e44b688
Monkeytype pylib/anki/stdmodels.py
2020-02-27 00:07:19 -05:00
Alan Du
ad90af3c37
Monkeytype pylib/anki/stats.py
2020-02-27 00:07:19 -05:00
Alan Du
1942d97cf5
Monkeytype pylib/anki/template.py
2020-02-27 00:07:19 -05:00
Alan Du
78a002d666
Monkeytype anki/tags.py
2020-02-27 00:07:19 -05:00
Alan Du
ac76c61a2f
Monkeytype pylib/anki/errors.py
2020-02-27 00:07:19 -05:00
Alan Du
750a3e4aed
Monkeytype pylib/anki/db.py
2020-02-27 00:07:19 -05:00
Alan Du
948c09e84b
Monkeytype pylib/anki/decks.py
2020-02-27 00:07:19 -05:00
evandrocoan
ba3a84f89a
Merge remote-tracking branch 'danielelmes/master' into fix_windows_build
...
# Conflicts:
# CONTRIBUTORS
2020-02-27 00:54:16 -03:00
Alan Du
cbeb47f8df
Improve mypy config
...
- Make mypy stricter
- Warn for unnecessary workarounds
2020-02-26 22:22:40 -05:00
evandrocoan
dc049ce26a
Merge remote-tracking branch 'danielelmes/master' into fix_windows_build
...
# Conflicts:
# Makefile
2020-02-27 00:20:34 -03:00
Damien Elmes
4d917cc65b
add self.col.tr() shortcut
2020-02-27 12:33:15 +10:00
Damien Elmes
0c49431719
FString -> TR
2020-02-27 12:25:19 +10:00
Damien Elmes
644670d0d6
return a localized error for all error kinds
...
some errors are not yet localized, but now the Python code
doesn't need to think about which property to use
2020-02-27 10:46:24 +10:00
Damien Elmes
fbbbbd6a7d
tweak rounding
...
- avoid rounding minutes
- round the seconds taken in the card info screen
- provide different precise and imprecise modes, since we need
to display seconds to multiple decimals in some areas
2020-02-25 17:29:06 +10:00
evandrocoan
ac4933faca
Merge remote-tracking branch 'danielelmes/master' into fix_windows_build
...
# Conflicts:
# Makefile
2020-02-25 03:16:57 -03:00
evandrocoan
26cdff29ec
Renamed FIND_EXEC to FIND, replaced IS_WINDOWS by specific commands
...
as PYTHON_BIN, ACTIVE_SCRIPT and INSTALL_PYAUDIO.
Fixed echo statements not using @ to suppress double message output.
Deprecated the usage of ECHOCMD := /bin/echo -e because it has no
effect: https://stackoverflow.com/questions/60387684/how-to-make-the-makefile-echos-to-use-bin-echo-e
# Conflicts:
# Makefile
2020-02-25 03:15:11 -03:00
Damien Elmes
b1a192b384
cap answer buttons to 1 decimal place
...
we can switch to NUMBER() instead in the future, but will need
to update all the translations at the same time
2020-02-25 13:24:29 +10:00
evandrocoan
19f1c98025
Fixed development compilation with Windows 10
...
1. Documented on README.development how to setup the environment
for Windows.
2. Fixed qt/ts/package.json not working due usage of ; instead
of &&
3. Fixed copy-qt-files rsync using Windows paths instead of Unix
ones
4. Fixed Makefile's using Windows Linux Subsystem bash instead of
the Cygwin one.
5. Ensured running the correct pip module by using python -m pip
instead of just pip.
6. Fixed Makefiles using Windows `find` command, instead of the
Cygwin's one (POSIX find).
7. Fixed pyenv sourcing/activate using /pyevn/bin/ instead of
/python/Scripts/ on Windows.
8. Fixed pyaudio not installing/linking with portaudio on Windows
by installing for a patched fork at evandroforks/pyaudio
9. Forked and fixed portaudio not building with Visual Studio 2017
or superior and added the reference for the patched fork on
README.development at evandroforks/portaudio.
2020-02-24 14:59:11 -03:00
Damien Elmes
2f4ee0e523
Merge pull request #456 from Arthur-Milchior/noDefaultDeckInBrowser
...
No default deck in browser
2020-02-24 19:35:49 +10:00
Damien Elmes
b9280ca31e
enable v2 apkg export
2020-02-24 18:54:55 +10:00
Damien Elmes
9f7c3a2fcf
expand clozes before rendering LaTeX
...
https://anki.tenderapp.com/discussions/ankidesktop/39071-latex-media-windows-version-2121-683b7983-fail-rendering-latex
2020-02-24 18:34:08 +10:00
Damien Elmes
e73157285e
remove old fmtTimeSpan() and associated strings
2020-02-23 18:47:16 +10:00
Damien Elmes
7230b6e390
support aqt-specific FTL files
2020-02-23 18:00:13 +10:00
Damien Elmes
0e931808c9
translations no longer require an open collection
2020-02-23 14:57:02 +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
Arthur Milchior
bb86c9dbd6
should(default)deckbedisplayed in snake case
2020-02-22 04:08:01 -08:00
Arthur Milchior
8e15ed7e13
defaultDeck to default_deck
2020-02-22 04:03:42 -08:00
Arthur Milchior
927749d7a6
Remove options for all/allNames
...
Instead, we always see default deck if it has a child
As indicated in https://github.com/ankitects/anki/pull/452
2020-02-22 04:03:42 -08:00
Arthur Milchior
1126ae293e
forceDefault to force_default
2020-02-22 04:01:42 -08:00
Damien Elmes
eae52de71e
es-ES -> es
2020-02-22 19:47:23 +10:00
Damien Elmes
bf3562841a
formatting fix
2020-02-21 21:21:36 +10:00
Damien Elmes
f4b9aff58a
reviews
2020-02-21 20:36:22 +10:00
Damien Elmes
972aee5f7a
add next learning due time + remaining count to congrats screen
...
https://anki.tenderapp.com/discussions/ankidesktop/38000-v2-scheduler-learning-cards
2020-02-21 19:54:50 +10:00
Damien Elmes
49fe080636
add studied_today(), move to statistics.ftl
2020-02-21 18:01:15 +10:00
Damien Elmes
0fbe59cd57
add average-answer-time to Fluent
...
drop the 0.1 special case; we're using two decimals now
2020-02-21 17:42:55 +10:00
Damien Elmes
2fc15d0d3a
add non-abbreviated timespan translation; update existing short=True calls
...
- drop the '5m3s' special casing done in the card stats screen, and
just use decimals
- change alignment of the review log so that the non-abbreviated
spans are easier to read
2020-02-21 15:29:38 +10:00
Damien Elmes
99c07cfdcb
move answer_button_time to the backend, split sched into separate module
2020-02-21 15:29:38 +10:00
Damien Elmes
232a8625bf
move answer button labels into fluent
2020-02-21 15:29:38 +10:00
Damien Elmes
370bb38b8b
update to latest fluent-rs and add basic locale-aware decimals
...
- git version pinned at the moment until the concurrency fix
lands in 0.10.2
- currently float values are hard-coded at 2 decimal places;
we should switch to using NUMBER() in the future
2020-02-21 15:29:38 +10:00
Damien Elmes
abe9f50c14
Revert "Merge pull request #452 from Arthur-Milchior/noDefaultDeckInBrowser"
...
This reverts commit b93d30795c
, reversing
changes made to e16d6055c1
.
More discussion required on https://github.com/ankitects/anki/pull/452
2020-02-21 12:27:39 +10:00
Damien Elmes
b93d30795c
Merge pull request #452 from Arthur-Milchior/noDefaultDeckInBrowser
...
No default deck in browser
2020-02-21 12:10:36 +10:00
Damien Elmes
e16d6055c1
fix Deck field in card templates showing filtered deck
...
https://anki.tenderapp.com/discussions/ankidesktop/38984-deck-changed
2020-02-19 20:00:06 +10:00
Arthur Milchior
bdf10d9649
method shouldBeDisplayed
2020-02-19 01:56:33 -08:00
Damien Elmes
ef7b0b1e82
don't error when fuzz is 0
...
https://anki.tenderapp.com/discussions/ankidesktop/38956-bug-report-sched2-anki2120
2020-02-18 11:00:26 +10:00
Damien Elmes
0309113b0a
fix legacy filter return values being ignored
2020-02-18 09:12:16 +10:00
Damien Elmes
1524e7dcac
split "Due" into three different contexts for translators
2020-02-17 14:41:01 +10:00
Damien Elmes
d612aa0945
localize some error messages
2020-02-17 11:38:22 +10:00
Damien Elmes
6e3f1d2e26
Revert "test out the Python Fluent implementation"
...
This reverts commit 181c17a0988cf9e57b2604746000c6072cb96206.
Reverting this to keep as a record.
2020-02-17 08:40:17 +10:00
Damien Elmes
8abb35372a
test out the Python Fluent implementation
...
The parsing step is considerably slower in Python, but if parsing
is moved out of the test function, Python wins at 45ms to Rust's 67ms
on 10,000 rounds, presumably due to the overhead of serializing to
Protobuf. Not enough of a difference to justify the inclusion of extra
dependencies and duplicating the lookup code in any case.
2020-02-17 08:40:17 +10:00
Damien Elmes
c395003def
expose translations to Python
2020-02-17 08:40:17 +10:00
Damien Elmes
f6a881f950
pass progress back as translated string(s)
2020-02-17 08:40:17 +10:00
Damien Elmes
d1e587fca9
add ftl to the build process, and a sync-git script
...
also
- ensure po files are checked when updated
- add start of sync.ftl
2020-02-17 08:40:17 +10:00
Damien Elmes
6c9e9eb330
drop unused threadLocal and noHint i18n code
2020-02-17 08:40:17 +10:00
Damien Elmes
97b9b94fc7
use new file locations for translations
...
- translation files are now stored in a separate repo, and
use a layout compatible with Pontoon
- normalize the language code in aqt, so that old config settings
and command line arguments are correctly handled
- store Qt and gettext translations in separate subfolders
- remove Crowdin scripts
2020-02-17 08:40:17 +10:00
Damien Elmes
f6ddcd81df
fix sync deauth
2020-02-17 08:40:17 +10:00
Damien Elmes
7d68da2b57
pass locale details to backend
2020-02-17 08:40:17 +10:00
Damien Elmes
fe874e9909
fix Lojban selection
2020-02-17 08:40:17 +10:00
Damien Elmes
0cc1938657
move empty card check into template code
2020-02-17 08:40:17 +10:00
Damien Elmes
33367c8edf
make template errors translatable
2020-02-17 08:40:17 +10:00
Damien Elmes
6240bd613d
update media DB when adding LaTeX images
2020-02-17 08:40:17 +10:00
Damien Elmes
d73fec3280
shorten add_file_to_media_folder
2020-02-17 08:40:17 +10:00
Damien Elmes
4c0f216df2
use media.trash for unused media deletion as well
2020-02-17 08:40:17 +10:00
Damien Elmes
0c27126817
fix latex render progress; display more frequently
2020-02-17 08:40:17 +10:00
Damien Elmes
2d0499580f
if latex fails to render in bulk, show the user the problem
2020-02-17 08:40:17 +10:00
Damien Elmes
9df2a08cb0
new render_all_latex() + gui button; remove some old code
2020-02-17 08:40:17 +10:00
Damien Elmes
7f365faf3f
add extract_latex to backend; use it for latex build
2020-02-17 08:40:17 +10:00
Damien Elmes
79c1732b00
stripLatex() does not appear to be used anywhere
2020-02-17 08:40:17 +10:00
Damien Elmes
6f158c8555
plug new media check in
2020-02-17 08:40:17 +10:00
Damien Elmes
aa832e9117
backend stores media folder/db locations; don't need to pass them in
2020-02-17 08:40:17 +10:00
Damien Elmes
5fe1bfc5b4
simplify code by accumulating stats at the source
2020-02-17 08:40:17 +10:00
Damien Elmes
6a64c8dfcc
use enums for some common errors
2020-02-17 08:40:16 +10:00
Damien Elmes
347ac80086
remove unused code
2020-02-17 08:40:16 +10:00
Damien Elmes
ea4de9a6de
connect media sync progress to Python, add a progress dialog
2020-02-17 08:40:16 +10:00
Damien Elmes
00f431d94e
use separate fn to init backend, for future pyo3 0.9 release compat
2020-02-17 08:40:16 +10:00
Damien Elmes
01470c4854
backend init can now fail, and update media db when file is added
...
- Adding files inside Anki now updates the media DB, so a full file
scan at sync time is no longer required if no other changes have been
made.
- Use a protobuf message for backend initialization, and return a
string error if initialization fails.
2020-02-17 08:40:16 +10:00
Damien Elmes
d94a86930f
drop support for vfat
2020-02-17 08:40:16 +10:00
Damien Elmes
e5f2e0df92
drop support for the early 2.0 release media db format
2020-02-17 08:40:16 +10:00
Damien Elmes
78f20d05a9
drop the clean* funcs
2020-02-17 08:40:16 +10:00
Damien Elmes
4096d21c07
add add_file() and write_data()
2020-02-17 08:40:16 +10:00
Arthur Milchior
fcfa78bba3
Hook card_is_being_flushed
...
It often arrives that I want to know when a card is going to be
flushed and in this case change it.
This could be the case if I want to change the scheduler without
implementing a whole scheduler. It simply reads the card history and
change interval and due date.
It's also the case for the "'trigger -> action' rules", which apply
some coded actions when some event occurs. E.g. suspend/unsuspend a
sibling when card become mature/is forgotten.
2020-02-14 00:59:32 -08:00
Arthur Milchior
81daad878e
Factorizing card's flush
2020-02-14 00:59:32 -08:00
Arthur Milchior
b2ef003207
hook note_is_being_flushed
...
I created multiple add-ons which want to transform a note before it is
being saved. For example, one add-on trim it, and remove useless line
break which arrived by accident.
Another add-on want to compile LaTeX as soon as the note is done, and
warn the user if LaTeX can't be compiled.
Having a hook in pre-flush would be useful here
2020-02-14 00:57:27 -08:00
Damien Elmes
f7ebb8c28f
Merge pull request #433 from Arthur-Milchior/ints
...
Constants
2020-02-14 08:37:31 +10:00
Damien Elmes
36201a5448
remove redundant declaration
2020-02-12 08:06:35 +10:00
Arthur Milchior
b5fed631d5
deckIds return deck of selected cards
2020-02-11 10:50:59 -08:00
Arthur Milchior
e70a317ac5
ofCids: returns did of all cids
2020-02-11 10:50:59 -08:00
Arthur Milchior
d48111af68
inverse if/else in deckIds
2020-02-11 10:50:59 -08:00
Arthur Milchior
c02ff8593a
cardIds return cids if it is set
2020-02-11 10:50:59 -08:00
Arthur Milchior
9fdc885d82
anki.exporter takes extra argument cids
2020-02-11 10:50:58 -08:00
Arthur Milchior
d8669835d8
aqt.exporter takes extra argument cid
2020-02-11 10:49:13 -08:00
Damien Elmes
ed4731127d
pylint fix
2020-02-08 15:49:41 +10:00
Damien Elmes
c42619efeb
formatting
2020-02-08 15:48:42 +10:00
Damien Elmes
bd96c27096
show which side the template error occurred on
2020-02-08 11:54:08 +10:00
Damien Elmes
58c643d5bf
fix rendering of question/answer column in browse screen
2020-02-08 09:29:34 +10:00
Arthur Milchior
fc5c1fd16a
correct missing french translation
2020-02-05 20:48:30 -08:00
Arthur Milchior
961c741f66
remove "typing.FOO" and import foo
...
According to grep, they were the only two instances
2020-02-04 08:49:53 -08:00
Arthur Milchior
35c8f21eb6
Reformatting through black
2020-02-04 08:47:36 -08:00
Arthur Milchior
957f0c8e8b
QUEUE and TYPE day learn, relearn
2020-02-04 08:47:36 -08:00
Arthur Milchior
7b7b71c0e1
QUEUE_TYPE_PREVIEW
2020-02-04 08:47:36 -08:00
Arthur Milchior
45bf763238
QUEUE_TYPE_REV and CARD_TYPE_REV
2020-02-04 08:47:36 -08:00
Arthur Milchior
7d4506afdb
QUEUE_TYPE_SUSPENDED
2020-02-04 08:47:36 -08:00
Arthur Milchior
9fc3f17f5c
QUEUE_TYPE_SIBLING_BURIED
2020-02-04 08:47:36 -08:00
Arthur Milchior
4a21911d74
QUEUE_USER_BURIED
2020-02-04 08:47:36 -08:00
Arthur Milchior
69436643fe
CARD_TYPE_LRN and QUEUE_TYPE_LRN
2020-02-04 08:47:35 -08:00
Damien Elmes
9cd5df4529
Merge pull request #434 from Arthur-Milchior/didInExport
...
anki.exporting.AnkiExporter.deckIds
2020-02-04 16:59:39 +10:00
Arthur Milchior
a1cc0787d2
QUEUE_TYPE_NEW and CARD_TYPE_NEW
2020-02-03 02:24:37 -08:00
Arthur Milchior
cd86fee03f
Card and queue type
2020-02-03 02:24:37 -08:00
Arthur Milchior
871de0f543
PERIOD_LIFE
2020-02-03 02:24:37 -08:00
Arthur Milchior
c6013c40c5
PERIOD_YEAR
2020-02-03 02:24:37 -08:00
Arthur Milchior
3fa0a07e2e
PERIOD_MONTH
2020-02-03 02:24:37 -08:00
Arthur Milchior
600c70edcb
REVLOG_CRAM
2020-02-03 02:24:37 -08:00
Arthur Milchior
e1a283b168
REVLOG_RELRN
2020-02-03 02:24:37 -08:00
Arthur Milchior
dd5d73f3a3
REVLOG_REV
2020-02-03 02:24:37 -08:00
Arthur Milchior
dca1cd03d1
REVLOG_LRN
2020-02-03 02:24:37 -08:00
Arthur Milchior
dd258ca62c
Add revlog constants
2020-02-03 02:24:37 -08:00
Arthur Milchior
4d088e14c7
BUTTON_FOUR
2020-02-03 02:24:37 -08:00
Arthur Milchior
e4022eeb47
BUTTON_THREE
2020-02-03 02:24:37 -08:00
Arthur Milchior
4fb0a48962
BUTTON_TWO
2020-02-03 02:24:37 -08:00
Arthur Milchior
5104cac97f
BUTTON_ONE
2020-02-03 02:24:37 -08:00
Arthur Milchior
be148ce8a1
Adding constants for buttons
...
The point being that, when we read BUTTON_ONE, we know that the type
of the element is: a button
2020-02-03 02:24:37 -08:00
Arthur Milchior
8264be1964
LEECH_TAGONLY
2020-02-03 02:24:37 -08:00
Arthur Milchior
dadf9042f7
LEECH_SUSPEND
2020-02-03 02:24:37 -08:00
Arthur Milchior
72f8ae7b33
Add leech constants
2020-02-03 02:24:37 -08:00
Arthur Milchior
8eaed49fd4
ADD_MODE
2020-02-03 02:24:37 -08:00
Arthur Milchior
cb7429c433
IGNORE_MODE
2020-02-03 02:24:37 -08:00
Arthur Milchior
a2eea7a1bb
UPDATE_MODE
2020-02-03 02:24:37 -08:00
Arthur Milchior
957dc51fca
DECK_DYN
2020-02-03 02:24:37 -08:00
Arthur Milchior
98e55e26bc
use DECK_STD
2020-02-03 02:24:37 -08:00
Arthur Milchior
a473908dca
Adding constants for decks' type
2020-02-03 02:24:37 -08:00
Arthur Milchior
14cfe57b74
anki.exporting.AnkiExporter.deckIds
...
This change would help me simplify the code of
https://ankiweb.net/shared/info/1983204951
It would allow my exporter to use the code of AnkiExporter while
selecting which decks I export, instead of exporting all decks as I
was doing until today. (I never realized I was exporting all deck
actually, until someone sent me a bug report)
2020-02-03 01:36:27 -08:00
Damien Elmes
fe493e31c4
ugly fix for suspended cards being unsuspended when filtered deck emptied
...
https://anki.tenderapp.com/discussions/ankidesktop/38247-bug-suspended-cards-automatically-included-in-the-filtered-decks
2020-02-03 08:10:20 +10:00
Damien Elmes
8752b050ce
add schedv2_did_answer_review_card hook
2020-01-31 07:30:13 +10:00
Damien Elmes
4da89eb38e
better help link for blank cards
2020-01-28 07:53:55 +10:00
Damien Elmes
c075191697
reuse reveal_cloze_text() for LaTeX cloze expansion
2020-01-28 07:40:44 +10:00
Damien Elmes
21cbb5a766
support speed control in tts tags
2020-01-26 14:31:07 +10:00
Damien Elmes
f6ef553ba5
move strip_av_refs() into anki.sound
2020-01-24 15:48:40 +10:00
Damien Elmes
f900f24f60
more changes to the template code
...
- _renderQA() has moved to template.py:render_card()
- dropped QAData in favour of a properly typed dict
- render_card() returns a TemplateRenderOutput struct instead of a dict
- card_did_render now takes that output as the first arg, and can
mutate it
- TemplateRenderContext now stores the original card, so it can return
a card even in the add screen case
The old mungeFields and mungeQA hook have been removed as part of this
change. mungeQA can be replaced with the card_did_render hook.
In the mungeFields case, please switch to using field_filter instead.
2020-01-24 13:44:13 +10:00
Damien Elmes
836213e587
renderQA() wasn't used in the codebase
2020-01-24 11:09:38 +10:00
Damien Elmes
17ebdfc099
extract and flag AV tags as part of the render process
...
We can now show replay buttons for the audio contained in {{FrontSide}}
without having to play it again when the answer is shown.
The template code now always defers FrontSide rendering, as it wasn't
a big saving, and meant the logic had to be implemented twice.
2020-01-24 11:06:11 +10:00
Damien Elmes
406c58a109
inject legacy funcs referencing aqt in GUI load
2020-01-23 18:20:19 +10:00
Damien Elmes
7bb7d5391b
fix lint
2020-01-23 18:12:57 +10:00
Damien Elmes
9548df1c0f
update reqs test to reflect new behaviour
2020-01-23 17:32:17 +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
Yngve Høiseth
82fdce32f2
Type hint RemoteServer._run
2020-01-22 23:33:37 +01:00
Damien Elmes
cc02e95049
fix pylib checks failing when aqt unavailable
2020-01-22 16:11:40 +10:00
Damien Elmes
4fb227ca4c
added flag_av_tags() for replay button support
2020-01-21 14:44:27 +10:00
Damien Elmes
c713683f63
add rank handling to TTS; parse TTS args in get_av_tags()
2020-01-21 12:41:37 +10:00
Damien Elmes
707ac587ec
rework the audio player API and add a simpler player implementation
...
- the new API operates on AVTags so it can support TTS as well as
audio files
- added a simple "run for each file" implementation for mpv and mplayer.
- will need to test handling of unicode filenames on Windows
- the old mpv and mplayer code is currently not active
2020-01-20 20:07:11 +10:00
Damien Elmes
0942ffbff6
add a simple TTS field filter
...
This simply wraps the field in extra text that the frontend will
deal with. Also added some helpers for extracting and stripping
audio and TTS tags from the rendered text.
2020-01-20 19:16:24 +10:00
Damien Elmes
17dae51b29
hasSound not used by anki code or add-ons
2020-01-20 09:31:28 +10:00
Damien Elmes
a9c93d933c
fix incorrectly logged repeat step
...
https://anki.tenderapp.com/discussions/ankidesktop/38130-anki-21-scheduler-misleads-on-hard-button-for-learning-cards
2020-01-19 15:41:58 +10:00
Damien Elmes
66714260a3
automatically disable add-ons that have been marked as incompatible
2020-01-19 13:37:55 +10:00
Damien Elmes
ef8bb61fc3
AnkiRequestsClient -> HttpClient
2020-01-19 11:33:27 +10:00
Damien Elmes
67fb3438f3
add type alias for httpclient callback
2020-01-19 10:06:54 +10:00
Damien Elmes
3287e8c057
pass in a progress callback instead of http_data_did_[send|receive]
...
If a request is happening on a background thread, the GUI code
receiving requests on that thread can lead to a crash
Add-on downloading still to do.
2020-01-18 17:49:59 +10:00
Damien Elmes
0d1a25eb5b
move AnkiRequestsClient into its own file
...
It should still be accessible via anki.sync as well.
2020-01-18 15:45:14 +10:00
Damien Elmes
bead03e858
drop plus_one test
2020-01-17 18:54:38 -07:00
Damien Elmes
12c60f20fe
_localOffsetForDate() was broken
...
It was including the elapsed time of day when calculating
the offset, leading to incorrect results
2020-01-17 18:52:36 -07:00
Damien Elmes
b1c2d271d3
comment out the unused legacy code
2020-01-17 10:51:36 +10:00
Damien Elmes
d3cc63efb0
move types.py into the files responsible for each type
2020-01-17 10:17:33 +10:00
Damien Elmes
06833f7301
remove unused legacy requirements code
2020-01-17 09:33:33 +10:00
Damien Elmes
2a0b480103
add context to card rendering, and rework related hooks
...
- the context exists for the lifecycle of one card's render,
and caches calls to things like .card() to avoid add-ons needing to
do their own cache management.
- add-ons can optionally add extra data to the context if they need
it across multiple filters
- removed card_will_render. the legacy hook is still available for
now
- card_did_render is now called only once, with both front and back
text
2020-01-17 09:30:42 +10:00
Damien Elmes
d2865235df
i18n
2020-01-16 21:05:29 +10:00
Damien Elmes
a63eccb3dd
need to strip sounds when FrontSide rendering deferred
2020-01-16 19:49:43 +10:00
Damien Elmes
912a49a2e3
fix empty cloze message not appearing
2020-01-16 18:47:21 +10:00
Damien Elmes
b56c9591c0
more useful template error message
2020-01-16 18:47:21 +10:00
Damien Elmes
81f7e634d1
Merge pull request #423 from Arthur-Milchior/fixReorder
...
Order by creation of note
2020-01-16 18:47:12 +10:00
Arthur Milchior
d9b5a1da89
Order by creation of note
...
This commit solve a problem I actually have for some strange
reason. Here is how to reproduce the problem
1. Create a note of type Basic (and reversed card) in a deck D with front "First"
and no back
2. Wait a day (or install an add-on which show hour and minutes of
creation time in browser)
3. create a second note, with front "Last" and no back
4. In first note, add in back field "First" and delete the front field
5. Use "Empty card".
6. In the setting of the deck D, set in random order, and then back in
the "order added"
7. Review deck D. You'll see card 1 of the second note. (Don't review
it)
8. Open the browser. Show the column "due" and created. You'll see
that the first card (first) have due value 2, while it was created
before according to the created date. The card "last" have due value
1.
This is due to the fact that the value "created" is linked to note
creation, while the order is linked to the card creation time, and
card may be created after other note
2020-01-15 23:42:54 -08:00
Damien Elmes
69a7ee430d
type hints
2020-01-16 09:19:53 +10:00
Damien Elmes
cc9a36c11a
simplify previewCards() and use existing card ids where possible
...
The type arg is no longer used, as neither type 0 nor 1 appears to
have been used in the codebase.
By using the existing card ids, it allows add-ons that gather
information about a card to work properly in the card template screen
without extra hacks.
2020-01-16 09:19:41 +10:00
Damien Elmes
6d9baaf052
check_untyped_defs in mypy for pylib
2020-01-16 08:10:49 +10:00
Damien Elmes
8cb980bacc
fix checkLeech hint
2020-01-16 07:59:57 +10:00
Damien Elmes
b09e7e8247
more tweaks for readability/consistency
2020-01-15 17:45:35 +10:00
Damien Elmes
237c0791f8
more hook tweaks, and merge the pre-render field and template hooks
2020-01-15 17:18:11 +10:00
Damien Elmes
cab572b63c
remove _hook/_filter suffix
2020-01-15 16:53:24 +10:00
Damien Elmes
b2f756f1b7
tweak the hook names in anki/
...
still a work in progress
2020-01-15 16:43:22 +10:00
Damien Elmes
eb6723a2ee
fix stdmodels type hint
2020-01-15 15:30:40 +10:00
Damien Elmes
26cb9851b4
idempotent hook removal
...
This matches remHook()'s behaviour
2020-01-15 13:16:43 +10:00
Damien Elmes
f021d616dd
add optional docstring to hooks
2020-01-15 12:14:32 +10:00
Damien Elmes
dbca596b41
clean stale build folders before build
...
setuptools will bundle up files from that folder even if they're
no longer in the source tree.
2020-01-15 10:07:39 +10:00
Damien Elmes
c67aefa3ea
move hook gen code out of anki/
...
It's not needed at runtime, and this allows hooks to be updated
even when the code is broken.
2020-01-15 09:11:20 +10:00
Damien Elmes
cb14963066
add _ prefix to generated classes to improve code completion
2020-01-15 08:58:27 +10:00
Damien Elmes
2fa662f7ae
add some more hooks; stringify fully qualified types
...
To avoid circular imports, types that contain a '.' are automatically
converted to strings.
2020-01-15 08:56:56 +10:00
Damien Elmes
2921037c7b
remove some comments that are no longer relevant
2020-01-14 20:45:18 +10:00
Damien Elmes
2fb5ff5d9c
fix broken answer displaying
2020-01-14 09:00:52 +10:00
Damien Elmes
662eb53e6a
switch to classes for hooks
...
This allows us to add a docstring to .append() so users can see
the names of the arguments that are being passed, and means we
don't have to remember to prepend run_ when calling a hook.
2020-01-14 08:54:07 +10:00
Damien Elmes
33bf4c204b
add hook to modify template prior to rendering
2020-01-13 21:57:15 +10:00
Damien Elmes
8946ad5483
include py.typed for mypy
...
these builds are now available on
https://github.com/ankitects/anki-typecheck
The add-on docs will be updated shortly to provide info on
using the new hooks and type checking.
2020-01-13 21:18:03 +10:00
Damien Elmes
125d6f9d1d
add license to wheels and option to skip bundling extra files
2020-01-13 20:04:23 +10:00
Damien Elmes
d266dcd076
add a flag to handle the legacy hook missing args case
...
And update a few more hooks.
2020-01-13 18:37:08 +10:00
Damien Elmes
b86ae31907
update the rest of the anki/ hooks/filters
2020-01-13 17:59:52 +10:00
Damien Elmes
f379167648
run black on generated hooks
2020-01-13 17:55:58 +10:00
Damien Elmes
402a594c7b
buildinfo required to generate hooks
2020-01-13 14:55:32 +10:00
Damien Elmes
4bb3d7a958
add separate file for gui hooks
2020-01-13 14:38:05 +10:00
Damien Elmes
dd61389319
New type-safe approach to hooks/filters
...
Still todo:
- Add separate module for GUI hooks
- Update the remaining runHook/runFilter() calls
- Document the changes, including defensive registration
2020-01-13 13:57:51 +10:00
Damien Elmes
b42912e639
mark anki and aqt modules as having typing info
...
This means once they're installed via develop or a wheel, add-ons
will be able to more easily typecheck their code against the Anki
code.
2020-01-13 13:03:37 +10:00
Damien Elmes
9bb0348fdd
more template rendering tweaks
...
- The front and back are rendered in one call now. If the front
side contains no custom filters, we can bake {{FrontSide}} into the
rear side. If it did contain custom filters, we return the partially
complete rear template instead, and the calling code can inject
the FrontSide in after it has been fully rendered.
- Instead of modifying "cloze" into something like "cq-2", the card
ordinal and whether we're rendering the question or answer are now
passed in to the rendering filters as context.
- The Rust code doesn't need to support filter names split on '-'
anymore.
- Drop the "Show" part of hint descriptions so i18n support can be
deferred.
- Ignore blank filter names caused by user using two colons instead
of one.
- Fixed hint field and text transposition.
2020-01-12 21:34:07 +10:00
Damien Elmes
a51a4e4d31
drop pystache and move legacy code into separate file
2020-01-11 19:38:30 +10:00
Damien Elmes
dc8b854ada
drop pystache comparison
2020-01-11 18:15:13 +10:00
Damien Elmes
3f724e5c98
replace fields and apply standard filters in rslib
...
The filters still need to be implemented.
2020-01-10 18:02:26 +10:00
Damien Elmes
f7ff0d1c17
flatten->render; pass field content in
...
This is paving the way to move the standard filters into Rust.
Non-empty fields are now determined in Rust, using a single regex
instead of the overkill stripHTMLMedia(). The old implementation
has been moved into the Pystache code for now.
2020-01-10 14:59:29 +10:00
Damien Elmes
a5613523ee
rework new timezone code
...
We now store the UTC offset that was in effect at creation time,
and use that to determine the starting date.
2020-01-09 16:58:27 +10:00
Damien Elmes
5a9af48178
fix type:cloze, and remove misleading comments
2020-01-09 08:05:49 +10:00
Damien Elmes
02720ec604
fix CI failing
...
unsure why this doesn't fail locally, using the same mypy version
2020-01-08 20:49:40 +10:00
Damien Elmes
c0a69587f3
fix type answer filter
2020-01-08 20:29:15 +10:00
Damien Elmes
0087eee6d9
handle conditional replacement in Rust
...
This extends the existing Rust code to handle conditional
replacement. The replacement of field names and filters to text
remains in Python, so that add-ons can still define their own
field modifiers.
The code is currently running the old Pystache rendering and the
new implementation in parallel, and will print a message to the
console if they don't match. If you notice any problems, please
let me know.
2020-01-08 20:28:04 +10:00
Damien Elmes
031c4e814f
move filter reversal into pystache
2020-01-08 18:59:05 +10:00
Damien Elmes
b014822253
use hooks for the built in filters as well
...
To support cloze deletions, we add back support for 'extra', but
using a simpler one character split instead of parens.
2020-01-08 18:08:24 +10:00
Damien Elmes
1f2e00690f
move the rest of Anki's code out of pystache
...
In the process of factoring out the field filtering, the "extra"
and "fullname" args are just passed in as a blank string now.
Extra was functionality that allowed a field modifier to be defined
as "filtername(arg1,arg2):field", and fullname was the name of the
field including any provided field modifiers. From grepping through
the add-ons on AnkiWeb, neither appears to have been used.
2020-01-08 17:15:46 +10:00
Damien Elmes
5ce964e91d
remove cloze handling in conditionals
...
As far as I can tell, this was not functional, as "{{#cloze:Text}}"
becomes cq-1:Text, which doesn't match the regex
2020-01-08 16:10:19 +10:00
Damien Elmes
83f0e15213
show stdout/stderr when running tests
2020-01-08 15:52:51 +10:00
Damien Elmes
29e476f482
no longer try fields with : in their names
...
it's not supported by the card generation code, and the card
layout screen will automatically fix note types
2020-01-08 14:42:54 +10:00
Damien Elmes
706ed225ca
move furigana/hint filters into template2
2020-01-08 12:30:08 +10:00
Damien Elmes
4bca26161b
clean up _renderQA(), and split rendering part out
2020-01-08 12:07:44 +10:00
Damien Elmes
e7ea121196
use 3.7 annotations
2020-01-07 18:43:20 +10:00
Damien Elmes
8b94d69abc
bump minimum python version from 3.6 to 3.7
2020-01-07 18:34:36 +10:00
Damien Elmes
844e90fc80
don't need to rerun checks each time buildhash changes
2020-01-06 19:30:54 +10:00
Damien Elmes
947d35dfca
add tests and setup.py to checks; fix warnings
2020-01-06 15:27:59 +10:00
Damien Elmes
fad2a66bc0
fix import order
2020-01-06 13:15:02 +10:00
Damien Elmes
99141d9dfb
add a partial Python implementation of the backend
2020-01-06 12:24:47 +10:00
Damien Elmes
88e83ddae5
wheel deps should be checked at install time, not build time
2020-01-05 07:34:36 +10:00
Damien Elmes
f8df688648
don't reference missing readme in setup.py
2020-01-04 12:21:58 +10:00
Damien Elmes
1dd1acdffe
quieten wheel build
2020-01-04 12:21:58 +10:00
Damien Elmes
0bfc90f52f
update readme, remove submodule readmes
2020-01-04 12:21:58 +10:00
Damien Elmes
1c1fbde733
move top level scripts into makefile
2020-01-04 12:21:58 +10:00
Damien Elmes
06f219ce33
add default value to ServerData
2020-01-04 07:53:20 +10:00
Erez Volk
e481cce816
Merge remote-tracking branch 'upstream/master' into add-tags-on-update
2020-01-03 08:13:04 +02:00
Damien Elmes
a898f61ddd
formatting fix
2020-01-03 15:21:36 +10:00
Damien Elmes
0aa01605d7
add buildhash to rspy and aqt, and check all three modules match
2020-01-03 15:15:18 +10:00
Damien Elmes
c25e106f88
use proper version number in build outputs
2020-01-03 14:36:14 +10:00
Damien Elmes
e2ede3af0e
output into dist/
2020-01-03 14:32:26 +10:00
Damien Elmes
253d429a8b
drop 'extra' from default cloze note type
...
Too many users get confused about where they should be placing the
cloze deletions.
2020-01-03 13:40:50 +10:00
Damien Elmes
ab6247f8d9
fix invalid escape warning
2020-01-03 13:38:23 +10:00
Damien Elmes
0f4f3ab2c1
speed up two tests
...
the regular test run is now faster than the old parallel one was
2020-01-03 09:05:04 +10:00
Damien Elmes
9abeeac73a
report slowest test
2020-01-03 09:03:39 +10:00
Damien Elmes
1070c866f3
switch from nose2 to pytest
...
pytest will show what differs in simple assert statements
concurrent mode is supported with a plugin, but like nose2, concurrent
mode hides the cause of import errors, so I've left it off for now.
2020-01-03 08:52:10 +10:00
Damien Elmes
c9da813622
don't reformat buildhash
2020-01-03 08:25:12 +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