From 41205bd5ca300f63eba45977f5475bb83bc0ea6b Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 27 Nov 2017 11:01:15 +1000 Subject: [PATCH] allow user to override scaling which may help wth issues like https://anki.tenderapp.com/discussions/beta-testing/918-text-size-in-ubuntu-1710 and https://anki.tenderapp.com/discussions/ankidesktop/25708-anki-with-high-dpi-screen --- aqt/__init__.py | 5 +++-- aqt/webview.py | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/aqt/__init__.py b/aqt/__init__.py index 3a50634b9..ed44c8d94 100644 --- a/aqt/__init__.py +++ b/aqt/__init__.py @@ -258,8 +258,9 @@ def _run(argv=None, exec=True): import ctypes ctypes.CDLL('libGL.so.1', ctypes.RTLD_GLOBAL) - # opt in to full hidpi support - QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) + # opt in to full hidpi support? + if not os.environ.get("ANKI_NOHIGHDPI"): + QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) # create the app app = AnkiApp(argv) diff --git a/aqt/webview.py b/aqt/webview.py index 5cc70cdb9..b6275d772 100644 --- a/aqt/webview.py +++ b/aqt/webview.py @@ -159,7 +159,11 @@ class AnkiWebView(QWebEngineView): oldFocus.setFocus() def zoomFactor(self): - from aqt import mw + # overridden scale factor? + webscale = os.environ.get("ANKI_WEBSCALE") + if webscale: + return float(webscale) + if isMac: return 1 screen = QApplication.desktop().screen()