dotfiles

My dotfiles
git clone https://git.neuralcrash.com/dotfiles.git
Log | Files | Refs

commit e66ec151dca1e129af2a0bb8fb8b6c0419b7f8d2
parent ca7c5044496dc7d5589a0b41745af40a9c5c7af6
Author: Kebigon <git@kebigon.xyz>
Date:   Sat, 21 Jan 2023 18:51:57 +0900

Add low-key anki addons

Diffstat:
A.local/share/Anki2/addons21/No Penalties or Boosting/__init__.py | 18++++++++++++++++++
A.local/share/Anki2/addons21/PassFail (EN)/__init__.py | 40++++++++++++++++++++++++++++++++++++++++
A.local/share/Anki2/addons21/ResetEZ/__init__.py | 94+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 152 insertions(+), 0 deletions(-)

diff --git a/.local/share/Anki2/addons21/No Penalties or Boosting/__init__.py b/.local/share/Anki2/addons21/No Penalties or Boosting/__init__.py @@ -0,0 +1,17 @@ +# Credit goes to https://eshapard.github.io/ +# +from __future__ import division +from anki.hooks import addHook +from aqt import mw +from aqt.utils import tooltip +#from aqt.utils import showInfo +import math + +def easeAdjustFunc(): + + + #Set new card ease factor + mw.reviewer.card.factor = 2500 + +addHook('showQuestion', easeAdjustFunc) +addHook('showAnswer', easeAdjustFunc) +\ No newline at end of file diff --git a/.local/share/Anki2/addons21/PassFail (EN)/__init__.py b/.local/share/Anki2/addons21/PassFail (EN)/__init__.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- + +# inspired by +# https://ankiweb.net/shared/info/1996229983 + +# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html + +from aqt.reviewer import Reviewer +from aqt import mw + +remap = {2: [None, 1, 2, 2, 2], # - nil Again Good Good Good - default 2-buttons: 1 = Again, 2 = Good, 3=None, 4=None + 3: [None, 1, 2, 2, 2], # nil Again Good Good Good - def 3-buttons: 1 = Again, 2 = Good, 3 = Easy, 4=None + 4: [None, 1, 3, 3, 3]} # 0=nil/none Again Good Good Good - def 4-buttons: 1 = Again, 2 = Hard, 3 = Good, 4 = Easy + +def myAnswerButtonList(self): + l = ((1, _("Fail")),) + + cnt = self.mw.col.sched.answerButtons(self.card) + + btn_label = 'Pass' + + if cnt == 2 or cnt == 3: #i believe i did this right: we want ease 2 = good if 2 or 3 buttons + return l + ((2, "<div class='btn-i-ease btn-i-good'>" + btn_label + "</div>"),) + elif cnt == 4: # b/c we want ease 3 = good in this version + return l + ((3, "<div class='btn-i-ease btn-i-good'>" + btn_label + "</div>"),) + +def AKR_answerCard(self, ease): + cnt = mw.col.sched.answerButtons(mw.reviewer.card) # Get button count + + try: + ease = remap[cnt][ease] + except (KeyError, IndexError): + pass + + __oldFunc(self, ease) + +__oldFunc = Reviewer._answerCard +Reviewer._answerCard = AKR_answerCard +Reviewer._answerButtonList = myAnswerButtonList +\ No newline at end of file diff --git a/.local/share/Anki2/addons21/ResetEZ/__init__.py b/.local/share/Anki2/addons21/ResetEZ/__init__.py @@ -0,0 +1,94 @@ +# import the main window object (mw) from aqt +from aqt import mw +# import the "show info" tool from utils.py +from aqt.utils import showInfo +# import all of the Qt GUI library +from aqt.qt import * + +"""MattVsJapan Anki Reset Ease script + +See: https://www.youtube.com/user/MATTvsJapan + +Description: + Some people (including me) found the updated red-pill ease values weren't + getting pushed from desktop to AnkiWeb without forcing a one-way sync so + this version of the script can remove the need to check "Settings > + Network > On next sync..." every time. Enable this in the config below. + + Alternatively, just use it to sync automatically before and after ease + reset to save a few clicks or keystrokes per day :) + +Usage: + 1. Sync your other devices with AnkiWeb + 2. Run this script from Tools -> Reset Ease... + 3. If the force_after config option is set below, click "Upload to + AnkiWeb" on Anki's sync dialog (your other devices can download on + next sync) + +Config option combinations (set them below): + +1. Normal sync before and after reset + * Set sync_before_reset and sync_after_reset to True + +2. Force sync in one direction after reset + * Set sync_after_reset and force_after to True + * Might as well set sync_before_reset to True as well + +3. Seen the reset ease dialog enough times? + Set skip_reset_notification to True + +4. Same as the original script (no sync) + * Set all four options to False +""" + + +###################################################################### +# Configuration +###################################################################### + +sync_before_reset = False +sync_after_reset = True +force_after = True +skip_reset_notification = False + +###################################################################### +# End configuration +###################################################################### + + +ezFactor = 2500 +ezFactor2 = ezFactor/10 + +def ResetEase(): + # sync before resetting ease if enabled + if sync_before_reset: + mw.onSync() + + # reset ease + mw.col.db.execute("update cards set factor = ?", ezFactor) + # show a message box + if not skip_reset_notification: + showInfo("Ease has been reset to " + str(ezFactor2) + "%.") + + # sync after resetting ease if enabled + if sync_after_reset: + # force a one-way sync if enabled + if force_after: + mw.col.scm += 1 + mw.col.setMod() + mw.onSync() + + +# format menu item based on configuration +menu_label = 'Reset Ease{}{}'.format( + ' + Sync Before' if sync_before_reset else '', + (' + {}Sync After' if sync_after_reset else '').format( + 'Force ' if force_after else '')) + +# create a new menu item +action = QAction(menu_label, mw) +# set it to call testFunction when it's clicked +action.triggered.connect(ResetEase) +# and add it to the tools menu +mw.form.menuTools.addAction(action) +