Previously, if repeated calls to _renderPreview() were throttled by
the throttling mechanism, only the most recent value of
cardChanged would take effect, even if the card had changed
in previous _renderPreview() calls.
After this patch, if any of the throttled _renderPreview() calls
were called with cardChanged=True, the final _renderScheduledPreview()
will happen with cardChanged=True
As far as Python is concerned, this commit does not change anything at
all. The purpose of this commit is to avoid a rare bug in
AnkiDroid. https://github.com/ankidroid/Anki-Android/issues/5523
Indeed, because of
hh.sortIndicatorChanged.connect(self.onSortChanged), onSortChanged may
be called with the values 0 or 1 instead of True or False. Which means
than the method getBoolean in Ankidroid may throw an exception,
stating that the value is an integer and not a Boolean.
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.
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
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.
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.