From 441e279f6ddd1db635d3ab56e8749bbb2186ff3f Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 19 Dec 2019 11:34:46 +1000 Subject: [PATCH] add signatures to calling code otherwise mypy ignores them. And even then, it's not smart enough to notice self.mw.pm.setUiScale("foo") is invalid unless the instance assignment in main has a type hint as well --- aqt/main.py | 2 +- aqt/preferences.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/aqt/main.py b/aqt/main.py index 89ad6b0d6..166cb9f3e 100644 --- a/aqt/main.py +++ b/aqt/main.py @@ -41,7 +41,7 @@ class AnkiQt(QMainWindow): self.col: Optional[_Collection] = None aqt.mw = self self.app = app - self.pm = profileManager + self.pm: ProfileManager = profileManager # init rest of app self.safeMode = self.app.queryKeyboardModifiers() & Qt.ShiftModifier try: diff --git a/aqt/preferences.py b/aqt/preferences.py index 96f888739..3f99bdae4 100644 --- a/aqt/preferences.py +++ b/aqt/preferences.py @@ -216,11 +216,11 @@ Not currently enabled; click the sync button in the main window to enable.""")) # Basic & Advanced Options ###################################################################### - def setupOptions(self): + def setupOptions(self) -> None: self.form.pastePNG.setChecked(self.prof.get("pastePNG", False)) self.form.uiScale.setValue(self.mw.pm.uiScale()*100) - def updateOptions(self): + def updateOptions(self) -> None: self.prof['pastePNG'] = self.form.pastePNG.isChecked() newScale = self.form.uiScale.value()/100 if newScale != self.mw.pm.uiScale():