From 65fecded9daa347f7cda740952c1c323da6af600 Mon Sep 17 00:00:00 2001 From: sthen Date: Wed, 20 Nov 2024 12:09:16 +0000 Subject: [PATCH] backport some fixes for anki with newer python --- education/anki/Makefile | 6 +--- education/anki/patches/patch-aqt_deckconf_py | 35 +++++++++++++++++++ .../anki/patches/patch-aqt_preferences_py | 21 +++++++++++ 3 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 education/anki/patches/patch-aqt_deckconf_py create mode 100644 education/anki/patches/patch-aqt_preferences_py diff --git a/education/anki/Makefile b/education/anki/Makefile index 58357d33968..256f887cd6d 100644 --- a/education/anki/Makefile +++ b/education/anki/Makefile @@ -13,13 +13,9 @@ COMMENT = flashcard learning system with spaced repetition # (https://aur.archlinux.org/packages/anki), and see Anki's discussion # in https://github.com/ankitects/anki/issues/1378 # -# XXX expected to have problems with Python 3.10 - these may help: -# https://github.com/ankitects/anki/commit/daf2e0a78f2277cddf13bb0abed9e620d4d47179 -# https://github.com/ankitects/anki/commit/62426279ffca8a454ec4e3f5c22e6729932403f7 -# DISTNAME = anki-2.1.16 EXTRACT_SUFX = -source.tgz -REVISION = 7 +REVISION = 8 CATEGORIES = education diff --git a/education/anki/patches/patch-aqt_deckconf_py b/education/anki/patches/patch-aqt_deckconf_py new file mode 100644 index 00000000000..34b4b419c5d --- /dev/null +++ b/education/anki/patches/patch-aqt_deckconf_py @@ -0,0 +1,35 @@ +From 62426279ffca8a454ec4e3f5c22e6729932403f7 Mon Sep 17 00:00:00 2001 +From: Damien Elmes +Date: Fri, 11 Feb 2022 10:59:04 +1000 +Subject: [PATCH] fix error when opening old deck options in python 3.10 + +Index: aqt/deckconf.py +--- aqt/deckconf.py.orig ++++ aqt/deckconf.py +@@ -172,7 +172,7 @@ class DeckConf(QDialog): + f.lrnGradInt.setValue(c['ints'][0]) + f.lrnEasyInt.setValue(c['ints'][1]) + f.lrnEasyInt.setValue(c['ints'][1]) +- f.lrnFactor.setValue(c['initialFactor']/10.0) ++ f.lrnFactor.setValue(int(c['initialFactor']/10.0)) + f.newOrder.setCurrentIndex(c['order']) + f.newPerDay.setValue(c['perDay']) + f.bury.setChecked(c.get("bury", True)) +@@ -180,7 +180,7 @@ class DeckConf(QDialog): + # rev + c = self.conf['rev'] + f.revPerDay.setValue(c['perDay']) +- f.easyBonus.setValue(c['ease4']*100) ++ f.easyBonus.setValue(int(c['ease4']*100)) + f.fi1.setValue(c['ivlFct']*100) + f.maxIvl.setValue(c['maxIvl']) + f.revplim.setText(self.parentLimText('rev')) +@@ -192,7 +192,7 @@ class DeckConf(QDialog): + # lapse + c = self.conf['lapse'] + f.lapSteps.setText(self.listToUser(c['delays'])) +- f.lapMult.setValue(c['mult']*100) ++ f.lapMult.setValue(int(c['mult']*100)) + f.lapMinInt.setValue(c['minInt']) + f.leechThreshold.setValue(c['leechFails']) + f.leechAction.setCurrentIndex(c['leechAction']) diff --git a/education/anki/patches/patch-aqt_preferences_py b/education/anki/patches/patch-aqt_preferences_py new file mode 100644 index 00000000000..8e284471f54 --- /dev/null +++ b/education/anki/patches/patch-aqt_preferences_py @@ -0,0 +1,21 @@ +part of + +From d2ae874d9e1615d09afc912275cc3b27776a1392 Mon Sep 17 00:00:00 2001 +From: cecini +Date: Tue, 15 Dec 2020 13:09:19 +0000 +Subject: [PATCH] fix float to int conversion DeprecationWarning + +Index: aqt/preferences.py +--- aqt/preferences.py.orig ++++ aqt/preferences.py +@@ -77,8 +77,8 @@ class Preferences(QDialog): + f.hwAccel.setVisible(False) + else: + f.hwAccel.setChecked(self.mw.pm.glMode() != "software") +- f.lrnCutoff.setValue(qc['collapseTime']/60.0) +- f.timeLimit.setValue(qc['timeLim']/60.0) ++ f.lrnCutoff.setValue(int(qc['collapseTime']/60.0)) ++ f.timeLimit.setValue(int(qc['timeLim']/60.0)) + f.showEstimates.setChecked(qc['estTimes']) + f.showProgress.setChecked(qc['dueCounts']) + f.nightMode.setChecked(qc.get("nightMode", False))