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