anki: fix type errors and profile saving.

Also, disable useless auto update dialog on start.
This commit is contained in:
Dmitry Zakharchenko 2021-11-08 17:38:21 +02:00 committed by Michal Vasilek
parent 1ec0a96759
commit 065953c8cd
4 changed files with 68 additions and 1 deletions

View file

@ -0,0 +1,10 @@
--- a/aqt/update.py
+++ b/aqt/update.py
@@ -31,6 +31,7 @@ class LatestVersionFinder(QThread):
return d
def run(self):
+ return
if not self.config['updates']:
return
d = self._data()

View file

@ -0,0 +1,42 @@
--- a/aqt/deckconf.py
+++ b/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(c['initialFactor']//10)
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'])
--- a/aqt/preferences.py
+++ b/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(qc['collapseTime']//60)
+ f.timeLimit.setValue(qc['timeLim']//60)
f.showEstimates.setChecked(qc['estTimes'])
f.showProgress.setChecked(qc['dueCounts'])
f.nightMode.setChecked(qc.get("nightMode", False))

View file

@ -0,0 +1,15 @@
Fixes crash related to saving profile data on exit.
--- a/aqt/profiles.py
+++ b/aqt/profiles.py
@@ -160,7 +160,10 @@ a flash drive.""" % self.base)
return up.load()
def _pickle(self, obj):
- return pickle.dumps(obj, protocol=0)
+ for key, val in obj.items():
+ if isinstance(val, QByteArray):
+ obj[key] = bytes(val) # type: ignore
+ return pickle.dumps(obj, protocol=4)
def load(self, name):
assert name != "_global"

View file

@ -1,7 +1,7 @@
# Template file for 'anki'
pkgname=anki
version=2.1.15
revision=5
revision=6
build_style=gnu-makefile
depends="python3-PyQt5-webengine python3-requests python3-SQLAlchemy
python3-PyAudio python3-mpv python3-Markdown python3-send2trash