Commit graph

93 commits

Author SHA1 Message Date
Damien Elmes
d47e83c989 embed enum to avoid conflicts 2020-05-12 21:13:33 +10:00
Damien Elmes
3807dcacd5 native struct for CardTemplate 2020-05-12 21:13:33 +10:00
Damien Elmes
91767fc87b native struct for NoteField
ord is made optional so we can keep track of changes in the future
2020-05-12 21:13:33 +10:00
Damien Elmes
4566a35085 expose stock notetypes 2020-05-12 21:13:33 +10:00
Damien Elmes
65f12eeda2 add stock note types in backend 2020-05-12 21:13:33 +10:00
Damien Elmes
475478cec5 split note types into separate tables
- store the config in protobuf instead of json
- still loading+saving in bulk for now
- code using the schema11 structs needs to be migrated
2020-05-12 21:13:33 +10:00
Damien Elmes
f5f2782e3b embed sort kind enum to avoid future namespace conflicts 2020-04-14 20:31:10 +10:00
Damien Elmes
0538d9b764 (de)serialize decks in backend 2020-04-09 12:41:59 +10:00
Damien Elmes
bca49bd054 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
02d0d9a670 add separate json error 2020-04-06 16:29:31 +10:00
Damien Elmes
913c5b9854 use bytes for deck config proto 2020-04-06 15:39:47 +10:00
Damien Elmes
6471adafcc use bytes for config proto 2020-04-06 15:39:47 +10:00
Damien Elmes
b5022ad354 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
Damien Elmes
ac54f85840 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
07c414692e preserve mtime/usn when syncing deck config, and add snake_case names 2020-04-03 19:34:46 +10:00
Damien Elmes
284ee0860b 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
cffe146397 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
089a68eb43 move deck conf handling to backend 2020-03-30 14:39:46 +10:00
Damien Elmes
fc846ac4e4 use add_card() 2020-03-27 15:11:07 +10:00
Damien Elmes
e28fdde984 handle mtime/usn bump in backend, and tweak integer sizes 2020-03-26 20:55:04 +10:00
Damien Elmes
0510ab7c9c update_card() 2020-03-26 18:54:20 +10:00
Damien Elmes
b2fba4e1ff use backend to get card 2020-03-26 17:47:43 +10:00
Damien Elmes
e02f032a47 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
b8aaa8fba4 add enum for controlling sort order
eg col.find_cards("", order=BuiltinSortKind.CARD_DUE)
2020-03-22 12:59:24 +10:00
Damien Elmes
0089f0149a add note searching 2020-03-21 09:00:05 +10:00
Damien Elmes
23717089e9 add the ability to provide a custom sort order; use backend for find 2020-03-21 07:55:21 +10:00
Damien Elmes
f36857ae27 prototype of integration
no ordering yet, and no tests
2020-03-20 21:15:23 +10:00
Damien Elmes
e5f883d1c3 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
3cacc00fc3 make the collection optional 2020-03-20 21:15:23 +10:00
Damien Elmes
bd7ded18c3 drop the protobuf prototype 2020-03-20 21:15:23 +10:00
Damien Elmes
a129b8f8cf 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
e512199ace add restore media action 2020-03-10 13:35:09 +10:00
Damien Elmes
cac9ccfa0d add empty trash action in aqt 2020-03-10 12:49:40 +10:00
Damien Elmes
67a101add1 add missing newline to .proto 2020-03-09 18:58:49 +10:00
Damien Elmes
c97b37b7ae make logging explicit, and support logging to a file 2020-02-29 20:44:01 +10:00
Damien Elmes
b030f2b40b info is superfluous 2020-02-27 10:53:49 +10:00
Damien Elmes
83d894ac87 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
94953cf6b5 separate out infallible and fallible commands in .proto 2020-02-27 08:46:09 +10:00
Damien Elmes
59328d9ade 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
Damien Elmes
ea22296d4c expand clozes before rendering LaTeX
https://anki.tenderapp.com/discussions/ankidesktop/39071-latex-media-windows-version-2121-0cd1ee92-fail-rendering-latex
2020-02-24 18:34:08 +10:00
Damien Elmes
c98247fa0f translations no longer require an open collection 2020-02-23 14:57:02 +10:00
Damien Elmes
0d1a30c6d8 rework Fluent handling
- all .ftl files for a language are concatenated into a single file
at build time
- all languages are included in the binary
- external ftl files placed in the ftl folder can override the
built-in definitions
- constants are automatically generated for each string key
- dropped the separate StringsGroup enum
2020-02-23 13:22:50 +10:00
Damien Elmes
72528ee41c add deck config category 2020-02-21 20:53:20 +10:00
Damien Elmes
e84fa7dee3 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
3a83d9844a add studied_today(), move to statistics.ftl 2020-02-21 18:01:15 +10:00
Damien Elmes
74bff450e2 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
11647daec1 move answer_button_time to the backend, split sched into separate module 2020-02-21 15:29:38 +10:00
Damien Elmes
2633d6db4b move answer button labels into fluent 2020-02-21 15:29:38 +10:00
Damien Elmes
cf1824dac5 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
fd01cac4d7 split "Due" into three different contexts for translators 2020-02-17 14:41:01 +10:00