From 86d469aea8782052f1b682e92636a9cb763bcf53 Mon Sep 17 00:00:00 2001 From: Dmitry Zakharchenko Date: Mon, 8 Nov 2021 17:38:21 +0200 Subject: [PATCH] anki: fix type errors and profile saving. Also, disable useless auto update dialog on start. --- srcpkgs/anki/patches/disable_popup.patch | 10 +++++ srcpkgs/anki/patches/fix_float.patch | 42 +++++++++++++++++++++ srcpkgs/anki/patches/fix_profile_save.patch | 14 +++++++ srcpkgs/anki/template | 2 +- 4 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/anki/patches/disable_popup.patch create mode 100644 srcpkgs/anki/patches/fix_float.patch create mode 100644 srcpkgs/anki/patches/fix_profile_save.patch diff --git a/srcpkgs/anki/patches/disable_popup.patch b/srcpkgs/anki/patches/disable_popup.patch new file mode 100644 index 000000000000..8b7a041fc656 --- /dev/null +++ b/srcpkgs/anki/patches/disable_popup.patch @@ -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() diff --git a/srcpkgs/anki/patches/fix_float.patch b/srcpkgs/anki/patches/fix_float.patch new file mode 100644 index 000000000000..333d76c8efd7 --- /dev/null +++ b/srcpkgs/anki/patches/fix_float.patch @@ -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)) diff --git a/srcpkgs/anki/patches/fix_profile_save.patch b/srcpkgs/anki/patches/fix_profile_save.patch new file mode 100644 index 000000000000..5aed8126f27e --- /dev/null +++ b/srcpkgs/anki/patches/fix_profile_save.patch @@ -0,0 +1,14 @@ +--- 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" diff --git a/srcpkgs/anki/template b/srcpkgs/anki/template index f2a476844717..3cb3155760ea 100644 --- a/srcpkgs/anki/template +++ b/srcpkgs/anki/template @@ -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