Commit graph

2324 commits

Author SHA1 Message Date
Damien Elmes
72dc6b7a74 handle formatting from google docs 2019-12-06 14:08:59 +10:00
Damien Elmes
14626aef54 preserve color in font tags
https://anki.tenderapp.com/discussions/ankidesktop/34688-format-of-copying
2019-12-06 13:44:06 +10:00
Damien Elmes
f9235a5482 strip bold/italics/underline when pasting without formatting
https://anki.tenderapp.com/discussions/ankidesktop/34413-formatting-is-not-fully-stripped-in-21
2019-12-06 13:40:51 +10:00
Damien Elmes
dab4e6526e preserve inline foreground/background color in spans
common in content pasted from MS Word
2019-12-06 13:39:05 +10:00
Damien Elmes
38ecbb8fb0 extended pasting is now the default 2019-12-06 13:37:50 +10:00
Damien Elmes
58651c7dec try 300ms preview delay
https://github.com/dae/anki/pull/357#issuecomment-560018459
2019-12-05 17:05:20 +10:00
Damien Elmes
6460de10a9 Merge pull request #357 from hakon-j-d-johnsen/fix-race-condition
Fix minor race condition in rendering of the preview window
2019-11-30 21:43:33 +13:00
Håkon J D Johnsen
d3fdac4ada Remove unnecessary lambda
Changing the signature of _renderScheduledPreview() made the
use of a lambda in _renderPreview() unnecessary. Remove it
to prevent linting errors.
2019-11-29 21:31:27 +01:00
Håkon J D Johnsen
f03333c9b3 Fix race condition in rendering of preview window
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
2019-11-29 21:27:50 +01:00
Damien Elmes
09c09ba5e5 Merge pull request #356 from Arthur-Milchior/correctNewTemplateTest
Another unimportant test error
2019-11-28 09:18:24 +13:00
Arthur Milchior
2472e151c0 correction 2019-11-27 08:10:37 +01:00
Damien Elmes
37521a05cd Merge pull request #355 from Arthur-Milchior/correctedNewFieldTest
Correcting a test
2019-11-26 08:15:03 +13:00
Arthur Milchior
d6b0f225a0 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
8ec631cc8c Merge pull request #354 from Arthur-Milchior/ignoreStickyFieldOnlyIfTheyDidntChanged
Ignore sticky field only if they didnt changed
2019-11-25 11:31:14 +13:00
Arthur Milchior
61290fa47e Use fieldsAreBlank with the previous note 2019-11-23 03:04:08 +01:00
Arthur Milchior
0df0d4d3a6 Fields are blank compare to previous note
So if a note is not empty but only because sticky fields didn't
change, then it's considered as empty and we can close the windows
without asking
2019-11-23 03:04:08 +01:00
Arthur Milchior
e169cda02f Add Cards save the previous note 2019-11-23 03:04:07 +01:00
Damien Elmes
83351ea515 minor grammar tweak 2019-11-14 09:27:25 +10:00
Damien Elmes
0ba06e2d6c 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
Damien Elmes
deede4ec42 Merge pull request #353 from Arthur-Milchior/correctFindFlag
Correct find flag
2019-11-14 09:20:30 +10:00
Arthur Milchior
27834ab932 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
a86e7fab79 Ensure flag:12 raises an alert 2019-11-13 17:41:48 +01:00
Arthur Milchior
a6dab26d45 DeckManager: _checkDeckTree ignore case 2019-11-13 17:08:40 +01:00
Arthur Milchior
422f52afbb test that if two decks differs only by case, they are renamed 2019-11-13 17:08:40 +01:00
Arthur Milchior
c81958531f Rename reject even when another deck has same name different cases 2019-11-13 17:08:40 +01:00
Arthur Milchior
d5e176f521 Test: Renaming with different cases 2019-11-13 17:08:40 +01:00
Arthur Milchior
6448d3de5f DeckManager.id return existing deck ignoring case 2019-11-13 16:34:14 +01:00
Arthur Milchior
aa5bb21785 DeckManager.byName check equality ignoring case name 2019-11-13 16:33:56 +01:00
Arthur Milchior
de0e08eaed Decks: methods to normalize name and check equality of name 2019-11-13 16:33:39 +01:00
Arthur Milchior
3ead848afd Test: rename over filtered deck 2019-11-13 16:32:45 +01:00
Damien Elmes
a139f5eb03 Merge pull request #346 from Arthur-Milchior/dontTranslateShortcut
Tells QT not to translate shortcuts.
2019-11-03 08:50:04 +10:00
Damien Elmes
76ac566b0a 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
edae3c2e0e Merge branch 'master' of github.com:dae/anki 2019-10-29 12:57:43 +10:00
Damien Elmes
f4659ab297 Merge pull request #347 from Arthur-Milchior/onSortChangedUseBool
Ensuring value of sortBackwards is a Boolean
2019-10-29 12:56:39 +10:00
Arthur Milchior
3bc1c67ef2 Ensuring value of sortBackwards is a Boolean
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.
2019-10-28 04:25:12 +01:00
Damien Elmes
fc085750f5 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
41c0a3f9a8 Revert "Merge pull request #345 from Arthur-Milchior/noFullSyncWhenEditingNewModel"
This reverts commit ac445b3def, reversing
changes made to b4d041a2ee.

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
Damien Elmes
ac445b3def Merge pull request #345 from Arthur-Milchior/noFullSyncWhenEditingNewModel
No full sync when editing new model
2019-10-25 08:24:56 +10:00
Arthur Milchior
3e0f5696db 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
66d019422c 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
f9ddb4abd9 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
de63245bd2 Stating that some UI strings are not translatable
Mostly because those strings are not actually supposed to be seen by
the user.
The point here being that it does not show in crowdin
2019-10-24 02:36:32 +02:00
Arthur Milchior
61564d6bfa Tells QT not to translate shortcuts.
There is currently a problem with crowdin. It asks to translate
shortcut. I assume that actually, shortcuts are intended to remain the
same independtly of the language, and thus that they should not appear
here.

I kind of assume that crowdin gets the strings to which _ or ngettext
are applied. So I wanted to ensure that none of those methods are
applied to shortcut.

The python file containing those shortcut are generated from .ui
files, used by QTCreator. I thus changed those files to indicates that
shortcuts should not be translated.

I assumed that shortcuts are strings containing either only "F(digit)",
a single letter, "Alt+" or "Ctrl+". I may have missed other shortcuts if they
exists.
2019-10-24 02:14:03 +02:00
Damien Elmes
b4d041a2ee Merge pull request #343 from Arthur-Milchior/createBackModelWithoutFullSync
Factorize standard models to use other models
2019-10-22 12:24:42 +10:00
Damien Elmes
0644855c77 fix lint 2019-10-22 12:22:30 +10:00
Arthur Milchior
75c118b2a2 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
Damien Elmes
7f98375b25 Merge pull request #340 from Arthur-Milchior/createBackModelWithoutFullSync
Creating new basic type without doing full sync
2019-10-22 09:24:37 +10:00
Arthur Milchior
bf1048d904 Making newBasicModel private
Following @timrae's advice on the pull request #340.
2019-10-21 07:02:08 +02:00
Arthur Milchior
4df6af3174 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
Damien Elmes
e464dfe37f Merge pull request #338 from Aqueminivan/master
Added file counts when deleting media
2019-10-20 09:46:14 +10:00