mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
pass opts to main window; force zoom factor to 1 on lodpi
This commit is contained in:
parent
3407feeceb
commit
e1a4c52175
3 changed files with 6 additions and 8 deletions
|
@ -299,7 +299,7 @@ environment points to a valid, writable folder.""")
|
||||||
|
|
||||||
# load the main window
|
# load the main window
|
||||||
import aqt.main
|
import aqt.main
|
||||||
mw = aqt.main.AnkiQt(app, pm, args)
|
mw = aqt.main.AnkiQt(app, pm, opts, args)
|
||||||
if exec:
|
if exec:
|
||||||
app.exec()
|
app.exec()
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -32,9 +32,10 @@ from aqt.utils import saveGeom, restoreGeom, showInfo, showWarning, \
|
||||||
import sip
|
import sip
|
||||||
|
|
||||||
class AnkiQt(QMainWindow):
|
class AnkiQt(QMainWindow):
|
||||||
def __init__(self, app, profileManager, args):
|
def __init__(self, app, profileManager, opts, args):
|
||||||
QMainWindow.__init__(self)
|
QMainWindow.__init__(self)
|
||||||
self.state = "startup"
|
self.state = "startup"
|
||||||
|
self.opts = opts
|
||||||
aqt.mw = self
|
aqt.mw = self
|
||||||
self.app = app
|
self.app = app
|
||||||
self.pm = profileManager
|
self.pm = profileManager
|
||||||
|
|
|
@ -73,8 +73,6 @@ class AnkiWebPage(QWebEnginePage):
|
||||||
# Main web view
|
# Main web view
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
dpiWarned = False
|
|
||||||
|
|
||||||
class AnkiWebView(QWebEngineView):
|
class AnkiWebView(QWebEngineView):
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
|
@ -159,9 +157,11 @@ class AnkiWebView(QWebEngineView):
|
||||||
oldFocus.setFocus()
|
oldFocus.setFocus()
|
||||||
|
|
||||||
def zoomFactor(self):
|
def zoomFactor(self):
|
||||||
global dpiWarned
|
from aqt import mw
|
||||||
if isMac:
|
if isMac:
|
||||||
return 1
|
return 1
|
||||||
|
if isWin and mw.opts.lodpi:
|
||||||
|
return 1
|
||||||
screen = QApplication.desktop().screen()
|
screen = QApplication.desktop().screen()
|
||||||
dpi = screen.logicalDpiX()
|
dpi = screen.logicalDpiX()
|
||||||
factor = dpi / 96.0
|
factor = dpi / 96.0
|
||||||
|
@ -170,9 +170,6 @@ class AnkiWebView(QWebEngineView):
|
||||||
return factor
|
return factor
|
||||||
# compensate for qt's integer scaling
|
# compensate for qt's integer scaling
|
||||||
# on windows
|
# on windows
|
||||||
if isWin and screen.physicalDpiX() % 72 != 0 and not dpiWarned:
|
|
||||||
showWarning("Unexpected physical DPI - try starting Anki with --lodpi")
|
|
||||||
dpiWarned = True
|
|
||||||
qtIntScale = 72/screen.physicalDpiX()
|
qtIntScale = 72/screen.physicalDpiX()
|
||||||
desiredScale = factor * qtIntScale
|
desiredScale = factor * qtIntScale
|
||||||
newFactor = desiredScale / qtIntScale
|
newFactor = desiredScale / qtIntScale
|
||||||
|
|
Loading…
Reference in a new issue