Commit graph

95 commits

Author SHA1 Message Date
Damien Elmes
252a0cb54f use protobuf for python/rust bridge
If we go ahead with betterproto on the Python side, it will mean
bumping the minimum Python dependency to 3.7.
2019-12-24 19:57:54 +10:00
Damien Elmes
17af26dcb5 apply black to all files 2019-12-23 10:34:10 +10:00
Damien Elmes
29179771b3
Merge pull request #382 from agentydragon/whitespace
Whitespace reformat to force 80-character line limit
2019-12-23 09:35:56 +10:00
Michal Pokorný (Rai)
1e9833ab2a Whitespace reformat to force 80-character line limit 2019-12-23 00:30:59 +01:00
Michal Pokorný (Rai)
c72051ba0d Move QA data tuple into separate type alias 2019-12-23 00:27:14 +01:00
Damien Elmes
7399e0bd2b Model->NoteType 2019-12-22 08:58:56 +10:00
Michal Pokorný (Rai)
67a39c58cb Add types for models, templates and field dicts 2019-12-21 12:02:16 +01:00
Damien Elmes
c1587254f4 use isort to tidy up imports 2019-12-20 19:19:29 +10:00
Damien Elmes
b6b8df2dcf add a bunch of annotations for mypy 2019-12-20 15:07:40 +10:00
Damien Elmes
55795822b5 importing 2019-12-20 11:41:24 +10:00
Damien Elmes
f69ef52845 collection 2019-12-20 11:07:08 +10:00
Damien Elmes
6ecfff56c5 add pytype inferred types to anki/
I've corrected some obvious issues, and we can fix others over time.
Mypy tests are currently broken, as adding the type hints has increased
mypy's testing surface.
2019-12-20 11:07:08 +10:00
Damien Elmes
cfd78367d4 don't set local offset in server mode 2019-12-17 17:10:56 +10:00
Damien Elmes
d7cb7eaea0 avoid recalculating reqs in actions like adding cards 2019-12-16 20:27:58 +10:00
Damien Elmes
b935c7e89b work around some typing inference issues 2019-12-16 17:52:51 +10:00
Damien Elmes
1da52f89fe be explicit in our not-None assumptions to appease type checker 2019-12-16 17:47:07 +10:00
Damien Elmes
4bc33e2f19 save local timezone to conf
saves the user needing to visit AnkiWeb when their timezone has changed
2019-12-12 11:30:01 +11:00
Damien Elmes
3b5f8fec4c default to v2 scheduler on new installs, remove warning 2019-12-06 18:37:39 +10:00
Arthur Milchior
3f45de87b3 New cards of existing note take due value of NEW siblings
Here is a bug, how to reproduce it, and why this is a fix.

This is a way to create a new note with a due card extremly high
without any add-on, just with basic anki.

Bug
===
Create a note type with three fields One, Two, and Three and three card
type One, Two and Three such that each card is generated when the
field of the same name is filled.

Create a note with fields One and Two filled only. Review card One and
click on good. Card one should goes in learning mode. Fill the field
Three. In the browser, you'll see that card Two and Three are new, but
card Two and Three's due value are distinct. More precisely, the due
value of card Three is equal to the due value of card One; except that
in card One it's interpreted as a timestamp, while in card Three it's
interpreted as a position in the list of new card.

You'll remark by the way that the due of card Three is extremly high,
potentially more than 1000000; which may explain why so many
collection has this bug.

Fix
===
Only consider due value of new cards.
2019-10-19 06:28:10 +02:00
lovac42
9069d282a2 clears undo before changing schedulers 2019-08-30 20:55:38 -04:00
Damien Elmes
00f171e6c3 fix flag changes in browser not syncing 2019-07-09 15:16:02 +10:00
Damien Elmes
599f57494b wrap due numbers instead of capping them, and add warning
Wrapping (mostly) preserves the original card order, and starting
at 1M makes it easier for users to find the cards with the high
due numbers even after they have wrapped.

related discussion:
https://anki.tenderapp.com/discussions/ankidesktop/33664-due-value-of-new-card-being-1000000
2019-04-29 18:17:33 +10:00
Damien Elmes
8497da27cf ensure the list of note types is not empty
fixes an issue opening the add screen if a user manages to delete
all their note types with an add-on or a sync
2019-04-21 18:02:12 +10:00
Damien Elmes
ebdd8dae4b tidy up unused imports 2019-03-04 17:25:19 +10:00
Damien Elmes
d8f059b570 style and arg order fix 2019-02-18 12:44:04 +10:00
Arthur-Milchior
20ff61e59e Show deck of the addCard window 2019-02-16 12:25:22 +01:00
Arthur-Milchior
89719ee5d5 Correct deck when previewing an existing card 2019-02-16 11:28:50 +01:00
Damien Elmes
372d5ed6e8 update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
Damien Elmes
cf25b3c053 make sure bulk flag changes sync
https://anki.tenderapp.com/discussions/ankidesktop/31774-flag-syncing-bug
2019-02-05 13:01:07 +10:00
Damien Elmes
867e4b9f94 support {{CardFlag}}
https://anki.tenderapp.com/discussions/ankidesktop/32158-flags
2019-02-05 13:00:47 +10:00
Damien Elmes
29a680d8bf fix decimal intervals in revlog as well 2019-02-05 12:30:22 +10:00
Damien Elmes
1675d2f01e fix due column as well in db check 2019-02-04 14:33:53 +10:00
Damien Elmes
41f1ef02de add decimal ivl fix to fixIntegrity() 2019-01-29 08:17:24 +10:00
Damien Elmes
a28973c2aa when rebuilding field cache make sure we don't discard filenames
stripHTMLMedia() already used in notes.py
2018-09-20 15:28:28 +10:00
Damien Elmes
ab57faf58e catch suspended new cards w/ wrong due number
https://anki.tenderapp.com/discussions/ankidesktop/29267-01
2018-08-30 12:43:53 +10:00
Mai Lavelle
128bfcd481 avoid reordering entire deck when importing notes
No need to reorder existing cards, which may have been manually
ordered by the user, when importing notes if we can give cards
a proper due number from the start. Retrieving any sibling's
due number for this is easy as all relevant cards will have
already been queried for when generating the new cards.
2018-07-06 00:49:47 -04:00
Damien Elmes
d3d61ce93f add option to show day learn cards before reviews 2018-01-20 16:07:57 +10:00
Damien Elmes
cf6d85baa4 support sched versions in collection 2018-01-14 16:58:04 +10:00
Damien Elmes
435afed325 fix error when importing 2017-12-12 11:55:27 +10:00
Damien Elmes
81d4b77ee1 more open() and regex strings 2017-12-11 17:25:51 +10:00
Damien Elmes
71101d041a ditch marked tag in favour of card flags
Users can now mark individual cards with one of four different coloured
flags, instead of relying on a tag that applied to the whole note.

- replaced marking functionality in reviewer and browser with new
flag options
- added flag:x search
- marked and leech tags now show in normal tag list in filter screen,
instead of being treated specially
- the other clients will need updating to set and shown the flags, but
flags set in the beta should be preserved by the other clients
2017-08-12 16:08:10 +10:00
Damien Elmes
82aeb57318 Revert "experiment with displaying FrontSide under answer"
This reverts commit a1b0ddb00c.
2017-08-10 15:04:24 +10:00
Damien Elmes
a1b0ddb00c experiment with displaying FrontSide under answer
- avoids having to move eyes to answer section
- the fade out/fade in step feels more natural when the
question section moves

feedback welcome
2017-08-07 18:38:35 +10:00
Damien Elmes
0543a4533b add devMode flag to utils
also remove the extra toolbar call in loadProfile(), as we require a
restart to update the translations anyway
2017-08-01 14:28:13 +10:00
Damien Elmes
1dd17e9f3a when reviews have incorrect due date, make them due today
https://anki.tenderapp.com/discussions/ankidesktop/19394-strange-behavior-with-year-long-intervals#comment_42510830
2017-05-09 12:27:23 +10:00
Damien Elmes
4430785122 fix error when closing collection on python 3.6 2017-02-08 19:41:44 +10:00
Illia Volochii
13b7e01044 Stop inheriting from object
It is not needed in Python 3.
2017-02-07 00:21:33 +02:00
Damien Elmes
e6adc3c195 fixes for sqlite on python 3.6
we need to switch to autocommit mode before executing vacuums &
certain pragmas

also removed the pysqlite version workaround; we just use the
python-provided versions in all cases now as it is new enough
2017-01-13 17:00:03 +10:00
Damien Elmes
a05ebdbefb do GC on autosave
- ensures we're not called as part of the db progress callback
- minimises the chance of data loss if a gc causes a crash
2017-01-13 16:20:39 +10:00
Damien Elmes
4fbe091c3b don't reload data on close 2016-12-24 15:33:46 +10:00