Commit graph

848 commits

Author SHA1 Message Date
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
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
a6dab26d45 DeckManager: _checkDeckTree ignore case 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
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
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
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
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
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
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
Arthur Milchior
d33503177d 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
5eef660bc3 bump version 2019-09-24 16:12:38 +10:00
Damien Elmes
c69c4aa486 escape backslash in find&replace
https://anki.tenderapp.com/discussions/ankidesktop/35903-bug-find-and-replace-breaks-when-replacing-with-latexmathjax-commands
2019-09-24 15:46:26 +10:00
Damien Elmes
f7bbbfdbb1 fix negative due dates in filtered decks
https://anki.tenderapp.com/discussions/ankidesktop/35978-rebuilding-filtered-deck-on-experimental-v2-empties-deck-and-reschedules-to-the-year-1745

this means affected cards will not have the selected ordering applied,
but that seems preferable to the alternatives
2019-09-24 15:38:33 +10:00
Damien Elmes
9e3cd31e59 use locales instead of two digit lang codes
and move away from launchpad
2019-09-23 21:18:03 +10:00
Arthur Milchior
93afd44133 when sorting by easiness, put new card separately 2019-09-18 16:58:29 +02:00
Damien Elmes
4bfb8e8881 Merge pull request #328 from lovac42/clearUndoOnSchedConvert
clears undo before changing schedulers
2019-08-31 11:38:07 +10:00
Damien Elmes
ed0a1a255a Merge pull request #327 from Blauelf/patch-1
Prevent non-integer ivl when importing from Mnemosyne
2019-08-31 11:34:54 +10:00
lovac42
390dece050 clears undo before changing schedulers 2019-08-30 20:55:38 -04:00
Damien Elmes
59900ee458 statsbg credit/link 2019-08-31 10:47:01 +10:00
Blauelf
7e8604fde2 Prevent non-integer ivl when importing from Mnemosyne
A reddit user had a few issues when importing from Mnemosyne, one of which was non-integer values interpreted as "v2 scheduler bug". I assume that's the line where they originated.
https://www.reddit.com/r/Anki/comments/cxcv27/what_just_happened_cards_with_v2_scheduler_bug/
2019-08-30 14:56:44 +02:00
lovac42
68b8331347 rm unnecessary step 2019-08-20 23:31:04 -04:00
lovac42
6bddae5817 Fix case sensitive field names so that 'apple' and 'Apple' both show up in drop down list when performing a search and replace. 2019-08-20 22:28:45 -04:00
Damien Elmes
a2b7bcb3b1 Merge pull request #323 from SebastienGllmt/patch-1
Allow disabling timeTicks
2019-08-17 18:50:44 +10:00
Damien Elmes
9f27be3095 ensure random distribution of due cards for a given day in v2 sched 2019-08-17 18:45:00 +10:00
Sebastien Guillemot
afc741de7c Allow disabling timeTicks 2019-08-16 01:58:10 +10:00
Damien Elmes
54ba318171 cleanup recording on cancel 2019-07-14 11:19:29 +10:00
Damien Elmes
c2ea31422e fix flag changes in browser not syncing 2019-07-09 15:16:02 +10:00
Damien Elmes
b906593158 bump version 2019-06-27 10:27:31 +10:00
Damien Elmes
eca12446fa put deck fix messages in the collection log 2019-06-27 09:46:56 +10:00
Damien Elmes
51f9e7eec9 fix v2 relearning reset bug
https://anki.tenderapp.com/discussions/ankidesktop/34560-schedule-switching-bug
2019-06-14 09:15:48 +10:00
Damien Elmes
464ba4264b bump version 2019-06-11 15:25:45 +10:00
Damien Elmes
ca6142ccf0 fix v2 lrn scheduling bug
https://anki.tenderapp.com/discussions/ankimobile/9714-deleting-custom-study-deck-skips-learning-step-time
2019-05-31 15:05:12 +10:00
Damien Elmes
1a45b6e361 tweak type answer note type 2019-05-14 17:05:37 +10:00
Damien Elmes
0303939568 fix learn steps being assigned on relearn in v2 2019-04-30 09:27:28 +10:00
Damien Elmes
a0fe168137 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
aa1cad76a9 bump version 2019-04-29 14:51:34 +10:00
Damien Elmes
11bfe205d8 cleanup mpv on exit 2019-04-29 14:36:51 +10:00
Damien Elmes
60afbcf62d daemonize helper threads so that sys.exit() during startup works
with daemonize set to False, the app hangs waiting on the helper threads
2019-04-29 14:36:44 +10:00
Damien Elmes
d1d7f230fe catch full mpv request queue
presumably happening if multiple requests are sent before previous
response fetch times out

Caught exception:
  File "aqt/webview.py", line 314, in handler
  File "aqt/editor.py", line 351, in <lambda>
  File "aqt/addcards.py", line 225, in afterSave
  File "aqt/addcards.py", line 231, in doClose
  File "aqt/addcards.py", line 210, in _reject
  File "anki/sound.py", line 417, in clearAudioQueue
  File "anki/sound.py", line 117, in clearQueue
  File "anki/mpv.py", line 558, in command
  File "anki/mpv.py", line 352, in _send_request
  File "anki/mpv.py", line 311, in _send_message
<class 'anki.mpv.MPVTimeoutError'>: unable to put request
2019-04-21 18:56:11 +10:00
Damien Elmes
98ce38dcdd 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
609262624f another attempt to preventing mpv from accessing standard config
https://github.com/dae/anki/pull/296
2019-04-09 15:32:44 +10:00
Damien Elmes
78fc2e82c0 psutil may throw OSError when calling .exe()
https://anki.tenderapp.com/discussions/ankidesktop/33406-failed-to-execute-script-runanki
2019-04-08 15:56:06 +10:00
Damien Elmes
9e8a29532d Merge pull request #290 from jianli/change-chunk-by-deck-age
Fix chunk size for newer decks
2019-03-13 12:23:35 +10:00
Damien Elmes
47692a02f5 Update stats.py
disable spurious pylint warning
2019-03-11 15:12:21 +10:00
Damien Elmes
f6da277ab7 bump version 2019-03-11 14:36:19 +10:00
Damien Elmes
732aa38f93 Revert "moveTemplate slightly quicker"
This reverts commit 450f260781.

This caused a regression:
https://github.com/dae/anki/pull/294
2019-03-11 13:49:58 +10:00
Jian Li
4dc49322ee Clean up code 2019-03-10 18:20:08 -07:00
Jian Li
5079b8aab8 Restrict bin count to 100 2019-03-10 17:30:14 -07:00
Jian Li
ba9c89ccb0 Change bin width (chunk) based on deck age 2019-03-10 17:19:16 -07:00
Jian Li
b4732efdf1 Refactor chunk calculation 2019-03-10 16:37:06 -07:00
Damien Elmes
b6e12e13cb bump version 2019-03-07 18:43:56 +10:00
Damien Elmes
8c6d5b6332 keep json in utils for add-on compat
https://anki.tenderapp.com/discussions/beta-testing/1399-anki-2110-beta#comment_47036452
2019-03-06 07:18:26 +10:00
Damien Elmes
856c11082e cleanup old mplayer instances in profile unload as well
possible fix for users still having permission errors when
renaming profiles
2019-03-05 09:01:31 +10:00
Damien Elmes
d118c5cc9f add option to strip html in export 2019-03-05 08:57:53 +10:00
Damien Elmes
2319ba8706 strip [[type:...]] in card export 2019-03-05 08:55:57 +10:00
Damien Elmes
75a95ee1fb tidy up unused imports 2019-03-04 17:25:19 +10:00
Damien Elmes
300231e318 use raw strings for regexs 2019-03-04 17:03:43 +10:00
Damien Elmes
60aac80a2c fix wrong var name in previous warning fix 2019-03-04 17:02:52 +10:00
Damien Elmes
71f2b0627d fix inconsistent indentation 2019-03-04 16:54:22 +10:00
Damien Elmes
7d0f7ae33c fix some warnings 2019-03-04 16:01:10 +10:00
Damien Elmes
b9957d820a use distro in place of deprecated dist() method 2019-03-04 15:39:10 +10:00
Damien Elmes
8981da61c1 silence some spurious errors and remove some unused code 2019-03-04 11:22:40 +10:00
Damien Elmes
085679d5d1 move versionWithBuild into anki module 2019-02-28 08:37:42 +10:00
David Lönnhager
f087d77ce0 Fix permissions error on Windows 2019-02-27 02:51:28 +01:00
Damien Elmes
95bdcfbb11 bump version 2019-02-24 16:20:49 +10:00
Damien Elmes
a42bfe2839 send build number when syncing too 2019-02-19 08:04:25 +10:00
Damien Elmes
5ca567362c style and arg order fix 2019-02-18 12:44:04 +10:00
Arthur-Milchior
2608513381 Show deck of the addCard window 2019-02-16 12:25:22 +01:00
Arthur-Milchior
7e72361b22 Correct deck when previewing an existing card 2019-02-16 11:28:50 +01:00
Damien Elmes
d62794779d allow running with pyaudio missing 2019-02-13 09:36:39 +10:00
Damien Elmes
f8bdf0ceec revlog changes need to limited to (re)learning cards
if you switched schedulers with the git code or the beta, please
restore from a backup prior to the switch
2019-02-11 18:12:44 +10:00
Damien Elmes
da4e5955b3 rollover may not be set 2019-02-08 16:31:56 +10:00
Damien Elmes
77bd141638 cleanup old mplayer instances after crash
fixes
https://anki.tenderapp.com/discussions/ankidesktop/31908-no-consigo-renomear-meu-nome-no-anki
2019-02-06 09:03:39 +10:00
Damien Elmes
a7eb6bb357 update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
Damien Elmes
8261873364 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
852b9b60d7 support {{CardFlag}}
https://anki.tenderapp.com/discussions/ankidesktop/32158-flags
2019-02-05 13:00:47 +10:00
Damien Elmes
5a1aaf1426 don't outline answer buttons graph
small numbers lead to the outline overlapping the graph bounds
2019-02-05 12:40:05 +10:00
Damien Elmes
7dada26674 fix decimal intervals in revlog as well 2019-02-05 12:30:22 +10:00
Damien Elmes
9e540ea5e6 shift revlog eases when turning v2 sched on/off
fixes old 'good'/'easy' answers showing up as 'hard'/'good' in
the graphs
2019-02-05 12:30:01 +10:00
Damien Elmes
fb6082c572 show all four possible eases in v2 sched learning ease graph 2019-02-05 12:27:17 +10:00
Damien Elmes
88050fc4e7 fix v2 sched+hourly retention graph issue 2019-02-05 12:26:36 +10:00
Damien Elmes
b50edbd3ae fix due column as well in db check 2019-02-04 14:33:53 +10:00
Damien Elmes
89d784a0d7 ensure today and dayCutoff are integers
https://github.com/dae/anki/pull/272
2019-02-04 14:29:52 +10:00
Damien Elmes
bc8bd7b092 add decimal ivl fix to fixIntegrity() 2019-01-29 08:17:24 +10:00
Damien Elmes
ff0d478694 add .cursor() 2019-01-29 08:17:10 +10:00
Damien Elmes
914077e807 make sure lapse % doesn't create decimal intervals
issue reported on
https://github.com/dae/anki/pull/272
2019-01-29 08:01:23 +10:00
Arthur-Milchior
450f260781 moveTemplate slightly quicker
When a template is moved, only move the ord of cards whose position
did change.
2019-01-20 15:46:58 +01:00
Damien Elmes
c292964095 bump version 2019-01-02 15:24:00 +10:00
Damien Elmes
d9e4a1c98b make sure we normalize deck names on input
https://anki.tenderapp.com/discussions/ankidesktop/31635-anki-crashes-when-new-card-is-added
2018-12-24 10:03:59 +10:00
Damien Elmes
bf38475ffc deck fix print statements may be running in ascii environment
this should probably use the collection log in the future
2018-12-24 09:54:59 +10:00
Damien Elmes
ae591ce240 fix recording overflow handling 2018-12-22 13:41:35 +10:00
Damien Elmes
25c4491a21 bump version 2018-12-18 19:42:00 +10:00