Commit Graph

2324 Commits

Author SHA1 Message Date
Damien Elmes
4fda2358b0 handle formatting from google docs 2019-12-06 14:08:59 +10:00
Damien Elmes
e2d7e5a8d7 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
eacf788b40 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
d4b87a678a preserve inline foreground/background color in spans
common in content pasted from MS Word
2019-12-06 13:39:05 +10:00
Damien Elmes
987256ff26 extended pasting is now the default 2019-12-06 13:37:50 +10:00
Damien Elmes
ba9ece83f1 try 300ms preview delay
https://github.com/dae/anki/pull/357#issuecomment-560018459
2019-12-05 17:05:20 +10:00
Damien Elmes
5411cf06c1
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
9be993c76d 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
419456eacd 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
a6327630f5
Merge pull request #356 from Arthur-Milchior/correctNewTemplateTest
Another unimportant test error
2019-11-28 09:18:24 +13:00
Arthur Milchior
984d39fd6b correction 2019-11-27 08:10:37 +01:00
Damien Elmes
41fdbc8394
Merge pull request #355 from Arthur-Milchior/correctedNewFieldTest
Correcting a test
2019-11-26 08:15:03 +13: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
734f7acf73
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
6fc89d2f96 Use fieldsAreBlank with the previous note 2019-11-23 03:04:08 +01:00
Arthur Milchior
d598434bde 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
f41014ca4b Add Cards save the previous note 2019-11-23 03:04:07 +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
Damien Elmes
fe599522ef
Merge pull request #353 from Arthur-Milchior/correctFindFlag
Correct find flag
2019-11-14 09:20:30 +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
f1c3f124e2 Ensure flag:12 raises an alert 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
9a40f29bce test that if two decks differs only by case, they are renamed 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
769d52d6b2 Test: Renaming with 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
Arthur Milchior
3d6c0ec36c Test: rename over filtered deck 2019-11-13 16:32:45 +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
fc713d2010 Merge branch 'master' of github.com:dae/anki 2019-10-29 12:57:43 +10:00
Damien Elmes
6f28b285d5
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
35f42523d5 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
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
Damien Elmes
0ffb308004
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
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
955db2d133 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
b5b7f7ec50 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
fed2f2fa3d
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
b1eccd67f7 fix lint 2019-10-22 12:22:30 +10: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
Damien Elmes
9b1858568a
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
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
Damien Elmes
e2475244d3
Merge pull request #338 from Aqueminivan/master
Added file counts when deleting media
2019-10-20 09:46:14 +10:00