backport some fixes for anki with newer python

This commit is contained in:
sthen
2024-11-20 12:09:16 +00:00
parent 086ddfd834
commit 65fecded9d
3 changed files with 57 additions and 5 deletions
+1 -5
View File
@@ -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
@@ -0,0 +1,35 @@
From 62426279ffca8a454ec4e3f5c22e6729932403f7 Mon Sep 17 00:00:00 2001
From: Damien Elmes <gpg@ankiweb.net>
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'])
@@ -0,0 +1,21 @@
part of
From d2ae874d9e1615d09afc912275cc3b27776a1392 Mon Sep 17 00:00:00 2001
From: cecini <loleta842jhu@gmail.com>
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))