Commit graph

4196 commits

Author SHA1 Message Date
Damien Elmes
85528cabc5 use backend for genCards() and updateFieldCache() 2020-05-12 21:13:34 +10:00
Damien Elmes
866231f661 add pep8 name for findReplace 2020-05-12 21:13:34 +10:00
Damien Elmes
70e404b517 update extract-po-string to handle plurals again 2020-05-12 21:13:34 +10:00
Damien Elmes
2268a9c241 fix tag saving in notes 2020-05-12 21:13:34 +10:00
Damien Elmes
8c04718541 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
ad1c519d1c move find&replace to backend 2020-05-12 21:13:34 +10:00
Damien Elmes
6b4a40f774 catch schema mod in background
If the schema confirmation dialog is shown on a background thread it
will crash the app, so we convert this to an assertion error that gets
caught by the error handler. Code still needs to be updated to modify
the schema prior to moving to the background, but at least this way
it doesn't crash.
2020-05-12 21:13:34 +10:00
Damien Elmes
b757d3db65 check untyped in clayout 2020-05-12 21:13:34 +10:00
Damien Elmes
2e971da79e properly handle negated conditionals outside of req generation 2020-05-12 21:13:34 +10:00
Damien Elmes
1a6e28a05d remove an unused import 2020-05-12 21:13:34 +10:00
Damien Elmes
2641862b56 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
2d0a6283e4 add an index on notes(mid) so we can avoid the tablescan 2020-05-12 21:13:34 +10:00
Damien Elmes
a21e2abca0 add helper to run background task with progress 2020-05-12 21:13:34 +10:00
Damien Elmes
ee97637cab release GIL on notetype save/delete 2020-05-12 21:13:34 +10:00
Damien Elmes
3abd72564a fix sort field check on save 2020-05-12 21:13:33 +10:00
Damien Elmes
e32be05451 catch attempts to overwrite notetype with older version 2020-05-12 21:13:33 +10:00
Damien Elmes
2b937acf29 reuse existing use count in note types screen 2020-05-12 21:13:33 +10:00
Damien Elmes
0bab292ff5 mypy/isort fixes 2020-05-12 21:13:33 +10:00
Damien Elmes
0c4eb401f7 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
02ea986f19 run black 2020-05-12 21:13:33 +10:00
Damien Elmes
7d14008216 remove dconf cache 2020-05-12 21:13:33 +10:00
Damien Elmes
7ef72aba04 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
267be1b050 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
97e857a41c add browserCollapsed as part of tree build 2020-05-12 21:13:33 +10:00
Damien Elmes
1d01418b21 fix mypy issues 2020-05-12 21:13:33 +10:00
Damien Elmes
e46dd4e41f remove pybackend.py 2020-05-12 21:13:33 +10:00
Damien Elmes
13d23cd24b speed up browser load by rendering deck tree in Rust and skipping counts 2020-05-12 21:13:33 +10:00
Damien Elmes
611959e5a8 switch primary key to deck id 2020-05-12 21:13:33 +10:00
Damien Elmes
46e0469991 rework aux table sorting
Instead of inserting text into the aux table and sorting on the fly
(which does a binary sort), we insert the ids in unicase-sorted order,
and then sort based on the automatically assigned rowids - giving
us faster sorts, and proper unicase folding.
2020-05-12 21:13:33 +10:00
Damien Elmes
c727a9e3f1 fix case sensitivity of notetype/template searches 2020-05-12 21:13:33 +10:00
Damien Elmes
c9db36bc82 update searching code to use decks table 2020-05-12 21:13:33 +10:00
Damien Elmes
87551574c0 add partial index on odid, and search odid as well
the odid != 0 check in cards_for_deck.sql is necessary for sqlite
to be able to take advantage of the index
2020-05-12 21:13:33 +10:00
Damien Elmes
016fdd30ef ensure collection doesn't get stuck open if loading fails 2020-05-12 21:13:33 +10:00
Damien Elmes
24ef0cc6f1 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
cbfe20712e add (currently disabled) check for missing/empty decks on card add 2020-05-12 21:13:33 +10:00
Damien Elmes
082f9c95fd split decks into module 2020-05-12 21:13:33 +10:00
Damien Elmes
8481d224d6 remove notetype from cache when removing 2020-05-12 21:13:33 +10:00
Damien Elmes
2a17f99eaa remove unused _updateRequired and associated code 2020-05-12 21:13:33 +10:00
Damien Elmes
4aac9635fa catch template errors, and start on discarding changes to fields/cards
This is only a first step - all the current methods that implicitly
save need to be updated.
2020-05-12 21:13:33 +10:00
Damien Elmes
22440f32d7 remove :{} and leading/trailing whitespace from field names on save 2020-05-12 21:13:33 +10:00
Damien Elmes
d1cc4684d2 hook the empty cards code up to the GUI 2020-05-12 21:13:33 +10:00
Damien Elmes
6350e18680 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
d812853656 sort empty cards by notetype name 2020-05-12 21:13:33 +10:00
Damien Elmes
ed4c75c6c1 don't include non-empty notes in the list 2020-05-12 21:13:33 +10:00
Damien Elmes
c989e23012 handle negative due numbers when gathering existing cards 2020-05-12 21:13:33 +10:00
Damien Elmes
21d7df9473 empty card handling 2020-05-12 21:13:33 +10:00
Damien Elmes
2e84604903 add an extra second to a unit test 2020-05-12 21:13:33 +10:00
Damien Elmes
4edeca6ed9 fix use counts not including unused note types 2020-05-12 21:13:33 +10:00
Damien Elmes
4cc070a240 note type removal 2020-05-12 21:13:33 +10:00
Damien Elmes
7106af61ff update template on field removals as well 2020-05-12 21:13:33 +10:00