Commit Graph

787 Commits

Author SHA1 Message Date
RumovZ
80a4a85510 Remove redundant docstring 2021-01-30 10:37:46 +01:00
Damien Elmes
cb6b88da0f simplify nid/nids searches, and ditch helper function
- IdList could be re-used for a cids: search in the future if required.
- Embedding the message means it's easy to access from Python as
an attribute of SearchTerm.
2021-01-30 11:37:00 +10:00
Damien Elmes
1adc9952f4 simplify Dupe message and ditch helper function
Calling code doesn't need to know about the existence of such helpers;
it can just rely on code completion to discover the required arguments.
2021-01-30 11:10:26 +10:00
Damien Elmes
5e6dd54c8e export SearchTerm from collection.py, and avoid exporting embedded items 2021-01-30 11:01:11 +10:00
Damien Elmes
73b897c754 rename FilterToSearchIn in backend to match frontend 2021-01-30 10:54:21 +10:00
RumovZ
c299e271e8 Refactor search_string() and FilterToSearchIn
See #955.
2021-01-29 18:27:33 +01:00
Damien Elmes
5ff7944a26 add getter/setter for boolean config values 2021-01-29 21:03:19 +10:00
RumovZ
349bd9d681 Use proper docstrings 2021-01-29 09:40:21 +01:00
RumovZ
1fb6024454 Rename filters added_in etc. to added_in_days 2021-01-29 09:38:13 +01:00
Damien Elmes
7693879e3c remove unused set_all_config; expose .all_config(). 2021-01-29 16:30:42 +10:00
RumovZ
423d7e5098 Use backend filter for findDupes and handle excep. 2021-01-28 19:49:16 +01:00
RumovZ
d33442f901 Add backend filter for field name 2021-01-28 19:48:01 +01:00
RumovZ
407358ab68 Use backend nid filter in browser 2021-01-28 16:21:56 +01:00
RumovZ
51e1e82a9a Add helper functions for search strings in col 2021-01-28 11:13:57 +01:00
Maksim Abramchuk
0eb653559a Remove unused variable 2021-01-26 21:37:16 +00:00
Damien Elmes
31a3add848 fix finished screen not showing when learning cards due later 2021-01-25 21:12:57 +10:00
Damien Elmes
2a875ffc55
Merge pull request #934 from hgiesel/graphprefs
Add GraphsPreferences API to graphs for setting persistent preferences
2021-01-23 21:24:41 +10:00
Damien Elmes
37ca8afaf6 minor wording tweak: GraphsPreferences -> GraphPreferences 2021-01-23 20:47:45 +10:00
Damien Elmes
10757d563d refresh new/rev counts when fillNew/fillRev() fails
This was the behaviour before, but got lost when ._reset_counts() was
added. Also added the check back to schedv2:fillRev(), which also
appears to have gotten lost in the move to ._reset_counts()

Just a stop-gap fix until this code can get a proper rewrite.
2021-01-23 14:02:05 +10:00
Damien Elmes
ce2315591f remove "invalid current deck"
This should resolve itself when a user clicks on a deck.
2021-01-23 13:04:58 +10:00
Henrik Giesel
bf130d1da0 Change the function name in genbackend.py 2021-01-22 20:05:28 +01:00
Henrik Giesel
665a13e378 Add GraphsPreferences endpoint to backend 2021-01-22 13:13:48 +01:00
abdo
bf0086d565 Use new backend filters in rename_tag() 2021-01-16 18:49:48 +03:00
abdo
e018ea94b6 Merge branch 'master' of https://github.com/ankitects/anki into tagtree 2021-01-15 01:12:01 +03:00
abdo
2ff584c44d Pass escaped name to bulk_update in rename_tag 2021-01-14 18:38:46 +03:00
abdo
9c1d7c522a Refactor code for clearing unused tags and saving collapse state 2021-01-14 07:04:14 +03:00
RumovZ
7b9cc017c4 Use backend to set dupe filter 2021-01-14 10:42:37 +10:00
Damien Elmes
633034b24d add local sync server frontend 2021-01-13 11:42:00 +10:00
abdo
72e8f9d640 Merge branch 'master' of https://github.com/ankitects/anki into tagtree 2021-01-12 23:31:58 +03:00
Damien Elmes
fbd91b22f5 tidy up UTC offset handling/timing calculations
- use the TimestampSecs newtype instead of raw i64s
- use FixedOffset instead of a minutes_west offset
- check localOffset each time the timing is calculated, and set it
if it's stale - even for v1.
- check for and fix missing rollover when calculating timing
- stop explicitly passing localOffset in the sync/start call
2021-01-12 21:32:56 +10:00
Damien Elmes
9bc8434538 remove temporary sync/dbcheck logging 2021-01-12 18:47:08 +10:00
Damien Elmes
1425379d41 drop basicCheck()
It can considerably slow down syncing on large collections
2021-01-12 18:47:08 +10:00
Damien Elmes
401d5dd9cc
Merge pull request #917 from hgiesel/querynozero3
Coerce added/edited:0 to 1, Constrain rated:n to 1-365
2021-01-11 16:24:12 +10:00
Henrik Giesel
250b89be60 Adjust pyblib test_find 2021-01-10 16:25:52 +01:00
RumovZ
942632d579 Also add FilterToSearch to want_release_gil() 2021-01-10 11:31:00 +01:00
RumovZ
b763fc5b2a Use explicit wrapper functions to get filters 2021-01-09 16:48:47 +01:00
abdo
f7f509c70d Move tag collapse method to the backend 2021-01-09 17:10:16 +03:00
abdo
b33267f754 Do not check for missing tag parents at registration time 2021-01-09 17:10:16 +03:00
abdo
b276ce3dd5 Hierarchical tags 2021-01-09 17:10:13 +03:00
RumovZ
b99d9cda74 Prettify frontend filter code 2021-01-09 12:34:46 +01:00
RumovZ
fda2bfdb4e Use backend filters instead of literal searches 2021-01-09 10:51:15 +01:00
RumovZ
efd554ea29 Provide ConcatSeparator through rsbackend.py 2021-01-07 17:48:30 +01:00
RumovZ
c2e2a86ec9 Add writer functions to want_release_gil() 2021-01-07 13:09:00 +01:00
Damien Elmes
b30b7c3073 fix qt/ pylints 2021-01-07 16:21:50 +10:00
Damien Elmes
f9e939aaff Make orjson optional again
While 32 bit platform support is probably not going to come back,
this allows Anki to run on other architectures orjson doesn't support.
2021-01-07 09:44:40 +10:00
Damien Elmes
dad4c76089 no need to log card resets when exporting 2021-01-05 11:11:37 +10:00
Damien Elmes
f3fa9daae2 do tag rename and tag clearing in background; move logic to tags.py
Because the logic is in rename_tag() now, it means we create a
checkpoint even if the tag is orphaned. This is because currently
checkpointing is a GUI responsibility. In the future we need to introduce
multi-level undo, and should move responsibility for managing it
to the backend.
2021-01-04 14:14:39 +10:00
Damien Elmes
db3308e788 add linux_arm64 platform 2020-12-29 18:40:39 +10:00
Damien Elmes
a1498e9e81
Merge pull request #866 from guillem-palau-salva/master
Update consts.py
2020-12-29 10:15:42 +10:00
Damien Elmes
cb93a0909c
Merge pull request #872 from RumovZ/fix-deck-check
Fix deck check and thus blue sync arrow bug
2020-12-29 10:11:59 +10:00
RumovZ
9f18e12cb8 Fix deck check and thus blue snyc arrow bug
Cast col.decks.selected() to int so the return type fits the annotation.
Thus, fix the comparison in col.decks.select() which was leading to
a superfluous db modification and in turn to a false indication of a
necessary sync right after another one in certain cases.
2020-12-29 00:29:36 +01:00
Guillem Palau-Salvà
870df16b01 Update consts.py
I notices that type 4 is added in the revlog when rescheduling. Reviews are logged as 0 time and type 4.
2020-12-27 01:02:32 +01:00
Damien Elmes
c4382e38a1 update to stable pyo3 0.13 release 2020-12-23 10:08:38 +10:00
Damien Elmes
212b251334 tag the wheels as manual so test ... doesn't build them 2020-12-21 19:28:47 +10:00
Damien Elmes
73679b03e7 possible fix for sync button colour blue after sync
If the client's clock is behind AnkiWeb's, even by a few seconds,
we can end up with a situation where last_begin_at is updated after
the sync to a value less than the mtime we received from AnkiWeb,
causing the collection to be saved, which bumps the modtime.

Work around this by recording mtime at begin() time, and seeing if it
has changed in either direction.

Thanks to Rumo, who did the hard work looking into it:
https://forums.ankiweb.net/t/why-is-my-sync-button-blue/2078/21
2020-12-21 19:27:26 +10:00
Damien Elmes
e99a7c0f90 tweak naming and move method into col.decks 2020-12-20 10:26:16 +10:00
k12ish
cc0572a385 Added type hints, renamed kwarg 2020-12-19 18:12:58 +00:00
k12ish
ef1f58c8b6 Added method 2020-12-19 17:59:07 +00:00
Damien Elmes
af92bb5e93 exhaustiveness checks on literals are now possible with the move to py38 2020-12-18 16:50:55 +10:00
Damien Elmes
ecb7c1482f use QtMultimedia for recording instead of PyAudio
The unmute-on-first-duration-change approach is to try to prevent
clicks/pops that can happen at the start of recordings. If it doesn't
solve the problem, we may need to drop down to the lower-level
QAudioInput().

Closes https://github.com/ankitects/help-wanted/issues/23

May fix https://forums.ankiweb.net/t/anki-crashes-periodically-after-clicking-record-audio-button/5824,
which I suspect was caused by processEvents()
2020-12-16 19:33:25 +10:00
Damien Elmes
a61f3bbc48 fix some warnings on startup 2020-12-16 15:38:24 +10:00
Damien Elmes
c8f989239b remove conditional rsbackend_gen import
It causes PyCharm to think methods are missing on col.backend, and
should not be needed with the move to Bazel.
2020-12-16 13:30:54 +10:00
Damien Elmes
937247ab06 add type stub for _rsbridge to make PyCharm happy 2020-12-16 13:13:42 +10:00
Damien Elmes
53276b3044 symlink generated .py/.pyi into tree to fix Python code completion 2020-12-16 11:36:42 +10:00
Damien Elmes
1b98e7e48f add ability to specify an individual Python test 2020-12-16 10:40:29 +10:00
Damien Elmes
1da327c725 minor doc updates 2020-12-11 22:37:12 +10:00
Damien Elmes
13d66b22f4 remove unwanted leading '/' in wheel records 2020-12-10 23:02:18 +10:00
Damien Elmes
0cbb60169c simplify wheel building 2020-12-10 20:27:21 +10:00
Damien Elmes
85b7e1c623 drop unused i686 references
https://forums.ankiweb.net/t/changing-ankis-build-system-to-bazel/4737/9
2020-12-09 15:45:01 +10:00
Damien Elmes
4c3577b12e update Rust deps incl. Pyo3
This includes the refcount bug fix from pyo3 0.12.4
2020-12-01 16:48:45 +10:00
Damien Elmes
be6bd1322d expose Gaelic in language selection 2020-11-30 14:44:29 +10:00
Damien Elmes
c9b3ed1eae switch to workspace for Rust code 2020-11-24 18:41:03 +10:00
Damien Elmes
d85d0b88a1
Merge branch 'master' into init-lang 2020-11-22 16:10:49 +10:00
Damien Elmes
0b848eae56 update remaining python format strings to Fluent 2020-11-22 14:57:53 +10:00
abdo
7d7745fbb5 Set up default language before loading profile
We can make more strings translatable this way.
2020-11-21 05:29:23 +03:00
Damien Elmes
e23d40e850
Merge pull request #823 from RumovZ/rework-search-parser
Rework search parser
2020-11-20 16:22:12 +10:00
abdo
e3b4802f47 Fix description of exporters
Description broke yet again with the full migration to Fluent
2020-11-19 23:52:46 +03:00
RumovZ
cb2c19aced Add Python test for tag whitespace
Assert tag matches do not occur across different tags.
2020-11-19 09:28:19 +01:00
RumovZ
c185fb966b Merge branch 'master' into rework-search-parser
Conflicts:
    rslib/src/search/sqlwriter.rs
2020-11-18 09:04:04 +01:00
Damien Elmes
a86ce5a1d4 remove print statement from unit tests 2020-11-18 13:56:44 +10:00
Damien Elmes
1c5f94d46f strip out unused gettext refs 2020-11-18 13:22:51 +10:00
Damien Elmes
ffa26fe4bc fix remaining _() references; remove unused imports 2020-11-18 12:43:46 +10:00
Damien Elmes
177d98489a update pylib ngettext references 2020-11-18 09:12:25 +10:00
Damien Elmes
e9cd956acd drop i18n references in old stats 2020-11-18 09:12:03 +10:00
Damien Elmes
2453e5c488 update temporary val="%s" references to standard ftl 2020-11-17 22:00:44 +10:00
Damien Elmes
9d1b6231d7 merge pylib references 2020-11-17 19:23:06 +10:00
Damien Elmes
44489a480f map gettext strings to keys/modules for ftl conversion 2020-11-17 14:11:09 +10:00
RumovZ
d1ee507b3a Update frontend test to new escape handling 2020-11-15 09:39:10 +01:00
Damien Elmes
8e93b0ee38 use full path in backend_pb2 import 2020-11-13 14:21:21 +10:00
Damien Elmes
5bb3d7c114 format_fix -> format; rename svelte-check for consistency 2020-11-12 20:19:32 +10:00
Damien Elmes
2897707263 update Python deps 2020-11-12 20:03:41 +10:00
Damien Elmes
b0aedd6c76 orjson was missing from dep list; drop 32 bit compat 2020-11-12 20:03:41 +10:00
Damien Elmes
8ca023048a add coding specifier to anki/__init__.py
older gettext versions will complain otherwise (was breaking Windows CI)
2020-11-11 21:51:11 +10:00
Damien Elmes
0fcccae6e8
Merge pull request #817 from cecini/formatcheck
Update mypy and black format check to python version 3.8
2020-11-11 21:36:32 +10:00
Damien Elmes
8d4df820cc update i18n scripts
- export updated .po files for consumption
- add a script to pull and push translations
2020-11-11 21:08:06 +10:00
cecini
62da8e6a40 Update mypy and black format check to python version 3.8 2020-11-11 09:24:28 +00:00
Damien Elmes
fd5815653f fix error exporting v2 collection when translations don't match
https://forums.ankiweb.net/t/utf8-error-in-importing-deck/4430/13
2020-11-11 15:42:08 +10:00
Damien Elmes
6e3f971ae1 handle packaged pylib buildinfo.txt; drop aqt buildinfo 2020-11-11 10:33:49 +10:00
Damien Elmes
e99c0dbe15
Merge pull request #793 from nwwt/object-audio-tags-support
Audio & object tag support
2020-11-11 10:33:31 +10:00
Andreas Reis
e68a40f13e cleanup / renames
・ soundRegexps →  sound_regexps

・ htmlRegexps →  html_media_regexps

・ HTML_TAGS →  HTML_MEDIA_TAGS

・ escapeImages →  escape_media_filenames + alias

・ strip_html_preserving_image_filenames →  strip_html_preserving_media_filenames
2020-11-10 14:53:04 +01:00