Commit graph

829 commits

Author SHA1 Message Date
Damien Elmes
cfd78367d4 don't set local offset in server mode 2019-12-17 17:10:56 +10:00
Damien Elmes
e59af745f7
Merge pull request #361 from Arthur-Milchior/testReqs
test req
2019-12-16 20:44:23 +10:00
Damien Elmes
d7cb7eaea0 avoid recalculating reqs in actions like adding cards 2019-12-16 20:27:58 +10:00
Damien Elmes
81e3acd599 fixes cycles in template imports 2019-12-16 18:16:26 +10:00
Damien Elmes
2d6173a631 don't try to decode str 2019-12-16 18:08:17 +10:00
Damien Elmes
5c008a328e clarify hasIllegal() arg 2019-12-16 17:54:57 +10:00
Damien Elmes
67d8284a33 mpv was passing separators incorrectly and unnecessarily 2019-12-16 17:54:40 +10:00
Damien Elmes
d4145d1f04 fix type inference in scheduler 2019-12-16 17:54:17 +10:00
Damien Elmes
6f7c8915fe fix mplayer typecheck 2019-12-16 17:54:04 +10:00
Damien Elmes
21108650fc handle invalid field mod regex 2019-12-16 17:53:43 +10:00
Damien Elmes
b06b2f26f0 Sniffer technically expects a string, not a list 2019-12-16 17:53:20 +10:00
Damien Elmes
b935c7e89b work around some typing inference issues 2019-12-16 17:52:51 +10:00
Damien Elmes
d2f4450dc0 platform-specific imports 2019-12-16 17:51:33 +10:00
Damien Elmes
c9820fae99 ignore missing props in the supermemo importer 2019-12-16 17:50:43 +10:00
Damien Elmes
b4b8717a20 set instance vars in __init__() 2019-12-16 17:49:32 +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
6757b30e72 pytype is confused by import from parent module
this change prevents the cache from constantly being rebuilt
2019-12-16 17:41:47 +10:00
Arthur Milchior
a1d602f154 update requireds saves reqs as lists instead of tuples.
The goal of this change is to be consistent with JSON. Indeed, the
dictionnary is saved as JSON, which has list and does not has
tuple. The request was made in https://github.com/dae/anki/pull/361#issuecomment-565915191
2019-12-15 22:55:29 -08:00
Damien Elmes
a2c9b160ca don't try to remove tmp folder if it's already been removed 2019-12-16 10:07:20 +10:00
Damien Elmes
4e377a3b33 fix travis build 2019-12-16 08:22:47 +10:00
Damien Elmes
37a239cf38 add basic type checking for anki/ 2019-12-16 08:17:28 +10:00
Damien Elmes
81bdd860f3 bump version 2019-12-15 15:32:24 +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
7f2fecb944 sort due in filtered decks by ordinal, like normal review
https://anki.tenderapp.com/discussions/ankidesktop/37419-card-order-of-siblings-not-preserved-in-filtered-deck#comment_47910714
2019-12-11 08:12:50 +10:00
Damien Elmes
5a5be92d09 add a token 1 day bonus so easy on a relearn card differs from good
https://anki.tenderapp.com/discussions/beta-testing/1589-anki-2116-beta#comment_47905454
2019-12-09 12:12:29 +10:00
Damien Elmes
9d6523e4dc allow importing scheduling-inclusive v1 imports into v2 2019-12-06 19:03:57 +10:00
Damien Elmes
15a9a6005e enable scheduling-inclusive exports from 2.1 2019-12-06 18:51:42 +10:00
Damien Elmes
3b5f8fec4c default to v2 scheduler on new installs, remove warning 2019-12-06 18:37:39 +10:00
Arthur Milchior
9d7b0e527f list of decks contains default iff deck chooser contains default
This way, the list is consistent with what users see otherwhere
2019-12-05 08:20:11 +01:00
Arthur Milchior
556ef5d34b newField checks its input is a str
Indeed, it takes as input a name (str). For some reason in some test
it was given a model. This actually led to some strange failed test.
2019-11-25 00:15:20 +01:00
Damien Elmes
48c1e668d4 minor grammar tweak 2019-11-14 09:27:25 +10:00
Damien Elmes
ea9e564b66
Merge pull request #352 from Arthur-Milchior/correctCaseInRename
Ensure that even childless deck's name is considered independtly of the case
2019-11-14 09:25:34 +10:00
Arthur Milchior
65ea5313c8 Correcting flag search
Currently, "flag:01" or "flag:12" does not throw exception, while it
should. Now it'll be the case
2019-11-13 17:41:48 +01:00
Arthur Milchior
9955048aec DeckManager: _checkDeckTree ignore case 2019-11-13 17:08:40 +01:00
Arthur Milchior
6aacd7782f Rename reject even when another deck has same name different cases 2019-11-13 17:08:40 +01:00
Arthur Milchior
31ccd31e97 DeckManager.id return existing deck ignoring case 2019-11-13 16:34:14 +01:00
Arthur Milchior
3afb28c05f DeckManager.byName check equality ignoring case name 2019-11-13 16:33:56 +01:00
Arthur Milchior
e44b049278 Decks: methods to normalize name and check equality of name 2019-11-13 16:33:39 +01:00
Damien Elmes
a4cb3debe2
Merge pull request #346 from Arthur-Milchior/dontTranslateShortcut
Tells QT not to translate shortcuts.
2019-11-03 08:50:04 +10:00
Damien Elmes
9a6f2be2b6 force a full sync when fields or templates changed without schema mod
This is not an ideal solution and will not catch repositioned fields
or templates, but is at least an improvement over the previous behaviour.

https://github.com/dae/anki/pull/349#issuecomment-547236285
2019-10-30 10:17:09 +10:00
Damien Elmes
54fac70e22 use --exact with dvisvgm
https://anki.tenderapp.com/discussions/ankidesktop/36561-latex-svgs-getting-cut-off
2019-10-28 08:43:49 +10:00
Damien Elmes
0577157970 Revert "Merge pull request #345 from Arthur-Milchior/noFullSyncWhenEditingNewModel"
This reverts commit 0ffb308004, reversing
changes made to fed2f2fa3d.

This approach is flawed. Any minor change to the note type will set usn
to -1, causing the schema not to be modified when it should be.
2019-10-27 21:37:21 +10:00
Arthur Milchior
9863b6f9ff Use _modSchemaIfRequired in all cases.
Same logic than in last commit. Actually, there is no change of model
which need a full sync until the model is uploaded. After all, even if
a change in model imply that some card will change, those cards and
notes have not been uploaded either
2019-10-24 04:45:12 +02:00
Arthur Milchior
b78480fe52 New model can be edited without full sync
This commit solves a problem that I had many time in the past. When I
create a new model, I usually want to edit it. Clone of existing
models present no interest by themselves. And as soon as I edit it, I
need to do a full sync.

As far as I understand ankiweb (which is sadly closed source), the
full sync is required because ankiweb needs to know that the model
associated to note type on the server did change. But since the model
is new, it has no note type associated to on the server, so there is
no need to do a full sync immediatly. Since the model is new, it also
means there is no risk of the inconsistency with a change made in
another computer/smartphone.

Thus, when a field/template is added, I check that the model is not
new by checking both whether it's id is not null, and also that it's
usn is not -1. (I set usn early in the model's life)

If it does not make into anki, then it'll be an add-on. But it's worth
a try first.
2019-10-24 04:44:52 +02:00
Arthur Milchior
26acc412b1 Adding explanation to translators
Some strings are missing in French at least. And some are quite
complex to understand. Especially without context, without knowledge
of Python. I tried to copy the only indication I found and add more
indication, hoping I did it correctly.
2019-10-24 02:36:32 +02:00
Arthur Milchior
73bd183b8b Factorize standard models to use other models
As discussed in
https://github.com/dae/anki/pull/340#issuecomment-544749153
2019-10-22 02:43:20 +02:00
Arthur Milchior
db4edf62eb Making newBasicModel private
Following @timrae's advice on the pull request #340.
2019-10-21 07:02:08 +02:00
Arthur Milchior
c14b9e2077 Creating now basic type without doing full sync
There is currently what I believe to be a small bug in anki. You can
clone a note type without doing a full sync, but you can't create
forwardReverse and forwardOptionalReverse note type without doing a
full sync. On the other hand you can clone, and even create any other
basic type without doing a full sync.

This commit simply wants to correct this.

The main trouble is that the method to create a copy of forwardReverse
and forwardOptionalReverse use a copy of the basic model, and add this
copy in the model manager BEFORE adding yet another template. This
commit corrects it by ensuring that the model is added only after all
templates are added, so that anki does not detect any change of a
template in the schema.

In order to do this, I created a method newBasicModel which creates
the basic model without adding it.

By the way, addBasicTypingModel could also use newBasicModel, and then
only change afmt. I didn't do it here because I believe that you want
the change to be minimal, and this correction would not add any
feature, only factorize the code.
2019-10-21 02:30:06 +02: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
Damien Elmes
2e7b756000 bump version 2019-09-24 16:12:38 +10:00