Commit graph

608 commits

Author SHA1 Message Date
Damien Elmes
120dd7fc03 fetch/set remaining collection properties as required 2020-05-15 13:33:37 +10:00
Damien Elmes
8012d4ec69 fix exporting bug
can't/shouldn't pop up confirmation message on export
2020-05-15 11:03:34 +10:00
Damien Elmes
6dd31341f8 add "fill empty" checkbox 2020-05-14 20:58:45 +10:00
Damien Elmes
b2b33d9ad8 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
4a00ad075c drop availOrds(), and use backend for getting cloze numbers 2020-05-14 12:14:00 +10:00
Damien Elmes
b59ea2d36f 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
b08613e37d remove obsolete preview code 2020-05-14 09:22:53 +10:00
Damien Elmes
257e893d95 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
4815010da0 don't hide static template text when card is empty 2020-05-13 11:17:44 +10:00
Damien Elmes
14c0a5891b 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
21ac2c14a7 handle scheduling preferences in the backend 2020-05-12 21:13:34 +10:00
Damien Elmes
2eaa759478 fetch timing_today() params in backend 2020-05-12 21:13:34 +10:00
Damien Elmes
1018204e4f switch server back into a bool and rely on config 2020-05-12 21:13:34 +10:00
Damien Elmes
befa66fb27 fix default rollover 2020-05-12 21:13:34 +10:00
Damien Elmes
d7f9bccd1e 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
667f9e6554 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
0a87b1ef2c support disabling unicode normalization in notes 2020-05-12 21:13:34 +10:00
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
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
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
ee97637cab release GIL on notetype save/delete 2020-05-12 21:13:34 +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
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
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
2a17f99eaa remove unused _updateRequired and associated code 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
2e84604903 add an extra second to a unit test 2020-05-12 21:13:33 +10:00
Damien Elmes
4566a35085 expose stock notetypes 2020-05-12 21:13:33 +10:00
Damien Elmes
f2e9146e52 drop legacy newBury option 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
27d2fb148a bump version 2020-05-11 19:28:17 +10:00
Damien Elmes
cad3d9e74d python formatting+lints 2020-05-08 17:30:27 +10:00
Damien Elmes
0cb4bb7a78 bundle socks
https://anki.tenderapp.com/discussions/ankidesktop/39801-sync-error
2020-05-08 15:26:19 +10:00
Damien Elmes
94222e8911 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
0160c80f67 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
87fd18a3a9 fix v1 log appearing next to export 2020-05-05 16:15:49 +10:00
Damien Elmes
06a69a72be fix unnecessary spaces being added to notes with empty tags 2020-05-04 21:53:22 +10:00
Damien Elmes
c2223610f1 bump version 2020-05-02 10:22:00 +10:00
evandrocoan
02c5091d1b 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
3dfe228b3e Add missing aqt and anki modules dependency requirements 2020-04-30 17:30:22 -03:00
Damien Elmes
cffe9fb7bd if conf points to an invalid configuration, fall back on default 2020-04-30 11:45:13 +10:00
Damien Elmes
65a9eaa418 expose clock hack via env var
closes #594
2020-04-30 09:33:02 +10:00
Damien Elmes
fb280937d6 fix tags with missing leading/trailing spaces in DB check 2020-04-30 08:54:17 +10:00
Damien Elmes
39070abb89 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
91248aa8cf bump version 2020-04-28 08:57:56 +10:00
Damien Elmes
d005dcc2bf Merge pull request #587 from BlueGreenMagick/tags
remove unnecessary code
2020-04-27 19:25:42 +10:00
BlueGreenMagick
e070320cfa remove unnecessary code 2020-04-27 10:05:38 +09:00
evandrocoan
e85c48298c Fixed make clean rule not working on Windows 2020-04-26 03:02:02 -03:00
Damien Elmes
c9f18ba3d2 fix deleting deck configs 2020-04-20 13:23:05 +10:00
Damien Elmes
dd20337a85 don't write log files when exporting 2020-04-15 21:45:32 +10:00
Damien Elmes
f5f2782e3b embed sort kind enum to avoid future namespace conflicts 2020-04-14 20:31:10 +10:00
Damien Elmes
826e8e4120 Revert "remove unused decks.count()"
This reverts commit dd790390db.

dd790390db
2020-04-13 19:26:12 +10:00
Damien Elmes
8dafa8bce5 move autoplay() into card 2020-04-13 09:04:30 +10:00
Damien Elmes
6bef493aa5 fix replay audio again, and decouple the code from the reviewer 2020-04-13 08:59:36 +10:00
Damien Elmes
96af559d67 set db mod flag if mtime changed by backend 2020-04-11 15:41:21 +10:00
Damien Elmes
46877dbe4e document ankidev and remove sync changes
https://github.com/ankitects/anki/pull/548
2020-04-11 14:36:05 +10:00
Damien Elmes
dd790390db remove unused decks.count() 2020-04-10 10:25:31 +10:00
Damien Elmes
0538d9b764 (de)serialize decks in backend 2020-04-09 12:41:59 +10:00
Damien Elmes
11bbb906a5 fix errorsAfterMidnight 2020-04-08 10:05:19 +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
f8f00f9d21 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
12e9293f60 avoid unnecessary work in 'make build' 2020-04-07 10:59:14 +10:00
Arthur Milchior
6e36bc5f2e immediate_parent 2020-04-06 23:56:24 +02:00
Arthur Milchior
8290f9ff2a immediate_parent_path 2020-04-06 23:55:17 +02:00
Arthur Milchior
d095b017e4 _basename to basename, since it's not private in use 2020-04-06 23:51:50 +02:00
Arthur Milchior
859178c113 _basename used where possible 2020-04-06 23:51:42 +02:00
Arthur Milchior
e6024d4d3d replace _path by path (because it's not private here) 2020-04-06 23:50:43 +02:00
Arthur Milchior
8962194dcb uses _path where possible 2020-04-06 23:50:37 +02:00
Arthur Milchior
7bef7ef8ec 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
b94f138989 make _path static 2020-04-06 22:45:30 +02:00
Damien Elmes
9ad6480959 hide deprecation warning triggered by supermemo test 2020-04-06 20:24:17 +10:00
Damien Elmes
26a30d95be hide warning when running tests 2020-04-06 20:24:05 +10:00
Damien Elmes
d777abfa4a emulate named args 2020-04-06 20:09:44 +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
915f741330 use a new file each time when testing graphs 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
Arthur Milchior
c837143d31 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
1834b65714 downgrade when writing dummy collection 2020-04-04 18:43:26 +10:00
Damien Elmes
3c7eabc51e 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
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
296ebd9c63 set col mod explicitly in decks.select() 2020-04-03 19:34:46 +10:00
Damien Elmes
96e1eca4bb ensure pending deck/tag/note type changes flushed before searching 2020-04-03 19:34:46 +10:00
Damien Elmes
d7edbedac0 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
b3ed8ebfdb Fixed double python version check for python_requires=">=3.7" 2020-04-02 12:31:12 -03:00
evandrocoan
30107ab09d 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
6beb2ff1e3 return the added card id instead of mutating the backend card object 2020-04-02 12:09:46 +10:00
Damien Elmes
7068f97e1f make sure None is returned in no-such-card case 2020-04-02 11:29:40 +10:00
Damien Elmes
cbfc0207ec tolerate string values in deck["conf"] 2020-04-01 19:36:40 +10:00
Damien Elmes
9c09d08152 remove defaultConf 2020-04-01 17:36: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
6482af7361 add a temporary cache to bring deck list performance back 2020-03-30 20:27:53 +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
918ec2a5a0 explicitly save deck conf after mutating it 2020-03-30 12:27:52 +10:00
Damien Elmes
d41124343d initial work on undo support 2020-03-29 17:52:16 +10:00
Damien Elmes
db3538aae3 add an extra second so slow CI server doesn't fail 2020-03-27 15:52:35 +10:00
Damien Elmes
36314f3b6f 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
fc846ac4e4 use add_card() 2020-03-27 15:11:07 +10:00
evandrocoan
f1fe0209f6 Merge remote-tracking branch 'danielelmes/master' into create_actions_for_windows_macos 2020-03-26 19:31:01 -03:00
Damien Elmes
e28fdde984 handle mtime/usn bump in backend, and tweak integer sizes 2020-03-26 20:55:04 +10:00
Damien Elmes
369457a1c7 fix two cases where a float was being written into due 2020-03-26 19:05:18 +10:00
Damien Elmes
0510ab7c9c update_card() 2020-03-26 18:54:20 +10:00
Damien Elmes
245a31a432 tweak code for mypy 2020-03-26 17:47:53 +10:00
Damien Elmes
b2fba4e1ff use backend to get card 2020-03-26 17:47:43 +10:00
Damien Elmes
4d428f9fa8 high due numbers shouldn't force a full sync 2020-03-26 09:09:11 +10:00
evandrocoan
964cc1a11a 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
1d819bd750 don't error when -l passes in language without _ 2020-03-25 08:53:31 +10:00
Damien Elmes
da07298418 fix sync getting stuck in a loop when changes is a multiple of 250 2020-03-24 19:30:35 +10:00
Damien Elmes
83d1be8743 Merge pull request #510 from evandroforks/fix_tests_on_windows
Fix tests on windows
2020-03-24 15:33:02 +10:00
Damien Elmes
602d6b00c2 remove : check from dbproxy 2020-03-24 10:37:12 +10:00
evandrocoan
4fcecaed9f 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
093af85c2e 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
7a67f73183 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
a5d27ede6e fix v2 timing being returned for v1 users 2020-03-23 13:53:09 +10:00
Damien Elmes
b7fdb8aeb4 fix setting of wal 2020-03-23 13:52:57 +10:00
Damien Elmes
f9f5a33e1f 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
0e9e7a84e9 release GIL during collection open/close 2020-03-23 09:27:42 +10:00
Damien Elmes
ac78699d13 add back new_timezone_enabled(), as it's used in the prefs screen 2020-03-23 07:40:50 +10:00
Damien Elmes
9d55260425 apply same list->tuple fix to v1 sched 2020-03-22 21:56:02 +10:00
zjosua
119df8c662 Fill _lrnQueue with tuples, not lists 2020-03-22 11:49:40 +01:00
Damien Elmes
71fcbc3ead fix sync error introduced by e02f032a47 2020-03-22 17:32:34 +10:00
Damien Elmes
f44996075d handle the two remaining timing issues 2020-03-22 14:43:29 +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
b6ac1c0d1c fall back on stock json if orjson unavailable 2020-03-21 21:24:21 +10:00
Damien Elmes
eab7686d2f remove old finder code; add search hooks to browser & remove old one 2020-03-21 16:38:46 +10:00
Damien Elmes
0089f0149a add note searching 2020-03-21 09:00:05 +10:00
Damien Elmes
f3a4552df3 don't set deck.sched.today in test 2020-03-21 08:12:32 +10:00
Damien Elmes
3cebb5b3fd update tests to reflect what now constitutes an error 2020-03-21 08:12:01 +10:00
Damien Elmes
18b37bcb59 tests need to flush before searching 2020-03-21 08:10:52 +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
ae42885ee2 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
5aba5c3ab9 drop the separate i18n backend 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
90a44509be drop usage of flushSched() 2020-03-20 21:15:23 +10:00
Damien Elmes
e53ee52d2a remove db.close() 2020-03-20 21:15:23 +10:00
Damien Elmes
258a8282d4 move .reopen() to mw; fix exporting 2020-03-20 21:15:23 +10:00
Damien Elmes
a02c4ed994 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
8cb3ed7435 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
3256c74409 pass weakref in from storage to fix type checking/code completion 2020-03-20 21:15:23 +10:00
Damien Elmes
116f7fa3f1 support first_row_only 2020-03-20 21:15:23 +10:00
Damien Elmes
7e5f713f05 proper implementation of executemany(); drop executescript() 2020-03-20 21:15:23 +10:00
Damien Elmes
3f3a45e2ba 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
700d713f80 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
0147d9e470 drop log= argument from Collection 2020-03-20 21:15:23 +10:00
Damien Elmes
70c7cde2cd remove remaining db kwargs 2020-03-20 21:15:23 +10:00
Damien Elmes
d42df6e0f1 add a temporary executemany() 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
38d4ea5311 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
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
1db876ba1c tweak db type hints 2020-03-20 21:15:23 +10:00
Damien Elmes
7fbc229dcd drop usage of pysqlite Cursor 2020-03-20 21:15:23 +10:00
Damien Elmes
e5a465cccb tweak layout of db methods 2020-03-20 21:15:23 +10:00
Damien Elmes
7bf27febe6 drop .cursor() 2020-03-20 21:15:23 +10:00
Damien Elmes
fb9db72dde use total_changes() sqlite func 2020-03-20 21:15:23 +10:00
Damien Elmes
45bc1cd73e drop the schema <11 upgrade code 2020-03-20 21:15:23 +10:00
Damien Elmes
fcfe1bd66c drop context manager 2020-03-20 21:15:23 +10:00
Damien Elmes
9e67ea736a drop named sql arguments 2020-03-20 21:15:23 +10:00
Damien Elmes
6d0c84a1e9 drop progress handler and timeout arg 2020-03-20 21:15:23 +10:00
Damien Elmes
45399df30d drop echo and text factory 2020-03-20 21:15:23 +10:00
Damien Elmes
923d85f66b clone db.py into dbproxy.py 2020-03-20 21:15:23 +10:00
evandrocoan
5d75a0c9f1 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
51477a4033 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
105e2a2502 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
7d976249db Fixed test_importing.py unit tests failing on windows with
PermissionError: [Errno 13] Permission denied
2020-03-17 12:49:36 -03:00
evandrocoan
f5b02423c1 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
d6fecea4ff 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
a5021ee92e 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
9a9265f113 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
a216fbedbc Spanish is 'es' on disk 2020-03-11 14:53:19 +10:00
Damien Elmes
ea094a60da Revert "es-ES -> es"
This reverts commit 7409deae34.

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
52599f364e Renamed _decode_htmlescapes s variable 2020-03-10 13:57:09 -03:00
Damien Elmes
404a8ca3ec 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():

b198ba8073/pylib/anki/schedv2.py (L1357)

with the following supporting Python functions:

b198ba8073/pylib/anki/schedv2.py (L1410)

 _timing_today() is calculated in Rust (lines up to 92, the rest are
tests):

b198ba8073/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
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
0dc4886558 add col.weakref() and fix more reference cycles in pylib 2020-03-05 09:47:47 +10:00
Damien Elmes
0589573dfa 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
d9eb170962 hooks for limit new/rev for a single deck 2020-03-04 16:11:13 +01:00
Arthur Milchior
bf0e5f0d6e single return in sched2 _deckRevLimitSingle 2020-03-04 16:07:15 +01:00
Damien Elmes
2343ddcb02 add diffing script 2020-03-04 21:34:18 +10:00
Damien Elmes
950d39571e remove a few more common methods 2020-03-04 21:33:44 +10:00
Damien Elmes
27438d8625 use _deckLimit() in a few more places 2020-03-04 21:24:09 +10:00
Damien Elmes
db00452ded reuse _leftToday() 2020-03-04 12:26:57 +10:00
Damien Elmes
7a32a0eb6f import tidyup 2020-03-04 12:25:02 +10:00
Damien Elmes
d7c3c5d3b1 reuse _deckNewLimitSingle() 2020-03-04 12:23:56 +10:00
Damien Elmes
7bd1c59abd reuse v2's _logRev() 2020-03-04 12:23:42 +10:00
Damien Elmes
7880227b43 remove duplicate methods from sched.py 2020-03-04 12:14:26 +10:00