diff --git a/aqt/__init__.py b/aqt/__init__.py
index 07d872edb..d1a38fa0e 100644
--- a/aqt/__init__.py
+++ b/aqt/__init__.py
@@ -12,7 +12,6 @@ import locale
import gettext
from typing import Optional
-from aqt.main import AnkiQt
from aqt.qt import *
import anki.lang
from anki.consts import HELP_SITE
@@ -26,6 +25,9 @@ appDonate="http://ankisrs.net/support/"
appShared="https://ankiweb.net/shared/"
appUpdate="https://ankiweb.net/update/desktop"
appHelpSite=HELP_SITE
+
+from aqt.main import AnkiQt
+
mw: Optional[AnkiQt] = None # set on init
moduleDir = os.path.split(os.path.dirname(os.path.abspath(__file__)))[0]
@@ -319,6 +321,9 @@ def _run(argv=None, exec=True):
if os.environ.get("ANKI_SOFTWAREOPENGL"):
QCoreApplication.setAttribute(Qt.AA_UseSoftwareOpenGL)
+ # apply user-provided scale factor
+ os.environ["QT_SCALE_FACTOR"] = str(pm.uiScale())
+
# create the app
QCoreApplication.setApplicationName("Anki")
QGuiApplication.setDesktopFileName("anki.desktop")
diff --git a/aqt/main.py b/aqt/main.py
index 616dd4623..89ad6b0d6 100644
--- a/aqt/main.py
+++ b/aqt/main.py
@@ -13,6 +13,7 @@ from threading import Thread
from typing import Optional
from send2trash import send2trash
from anki.collection import _Collection
+from aqt.profiles import ProfileManager
from aqt.qt import *
from anki.storage import Collection
from anki.utils import isWin, isMac, intTime, splitFields, ids2str, \
@@ -33,7 +34,7 @@ from aqt.qt import sip
from anki.lang import _, ngettext
class AnkiQt(QMainWindow):
- def __init__(self, app, profileManager, opts, args):
+ def __init__(self, app: QApplication, profileManager: ProfileManager, opts, args):
QMainWindow.__init__(self)
self.state = "startup"
self.opts = opts
diff --git a/aqt/preferences.py b/aqt/preferences.py
index 5bdd7d033..96f888739 100644
--- a/aqt/preferences.py
+++ b/aqt/preferences.py
@@ -3,6 +3,8 @@
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import datetime, time
+
+from aqt import AnkiQt
from aqt.qt import *
import anki.lang
from aqt.utils import openHelp, showInfo, askUser
@@ -11,7 +13,7 @@ from anki.lang import _
class Preferences(QDialog):
- def __init__(self, mw):
+ def __init__(self, mw: AnkiQt):
QDialog.__init__(self, mw, Qt.Window)
self.mw = mw
self.prof = self.mw.pm.profile
@@ -216,7 +218,11 @@ Not currently enabled; click the sync button in the main window to enable."""))
def setupOptions(self):
self.form.pastePNG.setChecked(self.prof.get("pastePNG", False))
+ self.form.uiScale.setValue(self.mw.pm.uiScale()*100)
def updateOptions(self):
self.prof['pastePNG'] = self.form.pastePNG.isChecked()
-
+ newScale = self.form.uiScale.value()/100
+ if newScale != self.mw.pm.uiScale():
+ self.mw.pm.setUiScale(newScale)
+ showInfo(_("Changes will take effect when you restart Anki."))
diff --git a/aqt/profiles.py b/aqt/profiles.py
index dd257ac16..1505b1f0c 100644
--- a/aqt/profiles.py
+++ b/aqt/profiles.py
@@ -465,3 +465,12 @@ please see:
self.setGlMode("software")
elif mode == "angle":
self.setGlMode("software")
+
+ # Scale
+ ######################################################################
+
+ def uiScale(self) -> float:
+ return self.meta.get("uiScale", 1.0)
+
+ def setUiScale(self, scale: float) -> None:
+ self.meta["uiScale"] = scale
diff --git a/designer/preferences.ui b/designer/preferences.ui
index 6c0c07581..752ad926e 100644
--- a/designer/preferences.ui
+++ b/designer/preferences.ui
@@ -137,34 +137,35 @@
12
- -
+
-
+
+
+ 9999
+
+
+
+ -
+
+
+ hours past midnight
+
+
+
+ -
+
+
+ mins
+
+
+
+ -
Next day starts at
- -
-
-
-
- 60
- 16777215
-
-
-
- 23
-
-
-
- -
-
-
- Learn ahead limit
-
-
-
- -
+
-
@@ -177,38 +178,60 @@
- -
-
+
-
+
- mins
+ Learn ahead limit
- -
+
-
+
+
+
+ 60
+ 16777215
+
+
+
+ 23
+
+
+
+ -
Timebox time limit
- -
-
-
- 9999
-
-
-
-
-
+
mins
- -
-
+
-
+
- hours past midnight
+ User interface size
+
+
+
+ -
+
+
+ %
+
+
+ 50
+
+
+ 200
+
+
+ 5
@@ -490,6 +513,7 @@
newSched
useCurrent
newSpread
+ uiScale
dayOffset
lrnCutoff
timeLimit