-
-
Save eshapard/b15e0df7d115b20cb58f57f44ba17c08 to your computer and use it in GitHub Desktop.
# Filter Safety | |
# Anki 2.0 addon | |
# Author EJS | |
# https://eshapard.github.io/ | |
# | |
# Prevents cards in learning state from being moved out of a filtered deck | |
# when you rebuild it. | |
from anki.sched import Scheduler | |
#from aqt.utils import showInfo | |
def safeEmptyDyn(self, did, lim=None): | |
if not lim: | |
lim = "did = %s and type != 1 and queue != 1" % did | |
else: | |
lim = "%s and type != 1 and queue != 1" % lim | |
ret = origEmptyDyn(self, did, lim) | |
return ret | |
origEmptyDyn = Scheduler.emptyDyn | |
Scheduler.emptyDyn = safeEmptyDyn |
Still waiting for 2.1 :)
Waiting for 2.1 port too :)
Sorry, I don't use Anki anymore, so I'll probably never get around to porting it to 2.1.
If anyone wants to take a crack at it, it might work if you rename it to init.py and drop it in a subdirectory under the 2.1 addons directory.
I've just tried this under 2.1 and it appears to work, by more or less following eshapard's comment above on 24th Feb. Here's what I did:
- create a folder called filterSafety in the addons folder ie AppData\Roaming\Anki2\addons21\filterSafety
- in this folder create a file called __init__.py which contains lines 1 - 20 from filterSafety.py above.
- restart Anki
You should note that there are two underscores before and after 'init', as seen in point 2 above.
Hope this helps someone else.
Cheers
Am trying this too. Thanks for the quick tutorial @albo2albo !
If I don't come back here to complain then it probably works OR seems to work OR didn't cause major harm.
Sorry, I don't use Anki anymore, so I'll probably never get around to porting it to 2.1.
Hi, just stumbled on this repo..
@eshapard mind saying what made you quit anki? what do you use instead? (Just curious.. sorry if it seems nosy.)
Do you have any plans of porting this add on to 2.1? Would love that. Keep up the good work