Arthur Milchior
35cfbc2bae
For some reason, add_note were assigned to a unused variable
...
I remove it for clarity
2020-07-19 10:58:40 +02:00
Arthur Milchior
bff784dc9a
replace "note" by "field"
...
My bad. In one case `f` did represent "field" and not "fact"
2020-07-19 08:24:43 +02:00
Arthur Milchior
23eeb84556
Uses constant in tests
2020-07-19 05:34:22 +02:00
Arthur Milchior
1b4a180fb9
d2->col2
2020-07-17 17:55:57 +02:00
Arthur Milchior
e7d75c2c8d
tmp->col in tests
2020-07-17 17:37:17 +02:00
Arthur Milchior
e7378734d2
f4->note4
2020-07-17 17:34:39 +02:00
Arthur Milchior
0db941ed98
f3->note3
2020-07-17 17:33:58 +02:00
Arthur Milchior
9c5bb199d0
f->n in id
2020-07-17 17:30:29 +02:00
Arthur Milchior
93ad194862
NF: deck2->col2
2020-07-17 17:27:40 +02:00
Arthur Milchior
452daf8d80
Remove useless variables
2020-07-17 08:38:48 +02:00
Arthur Milchior
1af59545bd
gn->deckn in test
...
Obtained by
```
sed -i "s/\bg1\b/deck1/g" pylib/tests/*py qt/tests/*py
sed -i "s/\bg2\b/deck2/g" pylib/tests/*py qt/tests/*py
```
2020-07-17 06:58:32 +02:00
Arthur Milchior
2c73dcb2e5
d->col in tests
...
obtained by
```
sed -i "s/\bd\b/col/g" pylib/tests/*py qt/tests/*py
```
2020-07-17 06:58:32 +02:00
Arthur Milchior
c376714a9b
deck->col in tests
...
Obtained by
```
sed -i "s/\bdeck\b/col/g" pylib/tests/*py qt/tests/*py
```
2020-07-17 06:50:46 +02:00
Arthur Milchior
425b82e6e7
f2->note2 in test
...
Obtained by
```
sed -i "s/\bf2\b/note2/g" pylib/tests/*py qt/tests/*py
```
2020-07-17 06:47:44 +02:00
Arthur Milchior
4c25835d27
f->note in test
...
Obtained by sed -i "s/\bf\b/note/g" pylib/tests/*py qt/tests/*py
2020-07-17 06:47:44 +02:00
Arthur Milchior
6a529e51cc
note->n
...
Next commit will transform f into note, and this lead to a variable clash here
2020-07-17 06:08:33 +02:00
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