Try dynamically loading screen

basic_orders
Tyler Goodlet 2021-01-09 10:56:35 -05:00
parent 5503a5705a
commit e51670a573
1 changed files with 6 additions and 1 deletions

View File

@ -25,6 +25,7 @@ from PyQt5 import QtCore, QtGui
from qdarkstyle.palette import DarkPalette
from ..log import get_logger
from ._exec import current_screen
log = get_logger(__name__)
@ -51,6 +52,10 @@ class DpiAwareFont:
self._qfont.setPixelSize(px_size)
self._qfm = QtGui.QFontMetrics(self._qfont)
@property
def screen(self) -> QtGui.QScreen:
return current_screen()
@property
def font(self):
return self._qfont
@ -82,7 +87,7 @@ class DpiAwareFont:
def boundingRect(self, value: str) -> QtCore.QRectF:
screen = self._screen
screen = self.screen
if screen is None:
raise RuntimeError("You must call .configure_to_dpi() first!")