fix DpiAwareFont default size calculation
parent
3751140fca
commit
c6c768eb77
|
|
@ -182,7 +182,7 @@ class DpiAwareFont:
|
|||
# always going to hit that error in range mapping from inches:
|
||||
# float to px size: int.
|
||||
self._font_inches = inches
|
||||
font_size = math.floor(inches * dpi)
|
||||
font_size = math.floor(inches * pdpi)
|
||||
|
||||
log.debug(
|
||||
f"screen:{screen.name()}\n"
|
||||
|
|
|
|||
|
|
@ -77,6 +77,9 @@ dependencies = [
|
|||
"trio-typing>=0.10.0",
|
||||
"numba>=0.61.0",
|
||||
"pyvnc",
|
||||
"pyqt6>=6.8.0",
|
||||
"pyqtgraph>=0.12.3",
|
||||
"qdarkstyle>=3.2.3",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
from PyQt6 import QtGui
|
||||
from piker.ui._style import DpiAwareFont
|
||||
|
||||
class MockScreen:
|
||||
def physicalDotsPerInch(self):
|
||||
return 169 # example HiDPI
|
||||
def logicalDotsPerInch(self):
|
||||
return 96
|
||||
def name(self):
|
||||
return "MockScreen"
|
||||
|
||||
# create font instance
|
||||
font = DpiAwareFont()
|
||||
|
||||
# pass the mock screen to configure_to_dpi
|
||||
font.configure_to_dpi(screen=MockScreen())
|
||||
|
||||
print("Computed pixel size:", font.px_size)
|
||||
6
uv.lock
6
uv.lock
|
|
@ -811,7 +811,10 @@ dependencies = [
|
|||
{ name = "polars-fuzzy-match" },
|
||||
{ name = "pyarrow" },
|
||||
{ name = "pygments" },
|
||||
{ name = "pyqt6" },
|
||||
{ name = "pyqtgraph" },
|
||||
{ name = "pyvnc" },
|
||||
{ name = "qdarkstyle" },
|
||||
{ name = "rapidfuzz" },
|
||||
{ name = "rich" },
|
||||
{ name = "tomli" },
|
||||
|
|
@ -866,9 +869,12 @@ requires-dist = [
|
|||
{ name = "polars-fuzzy-match", specifier = ">=0.1.5" },
|
||||
{ name = "pyarrow", specifier = ">=18.0.0" },
|
||||
{ name = "pygments", specifier = ">=2.16.1,<3.0.0" },
|
||||
{ name = "pyqt6", specifier = ">=6.8.0" },
|
||||
{ name = "pyqt6", marker = "extra == 'uis'", specifier = ">=6.7.0,<7.0.0" },
|
||||
{ name = "pyqtgraph", git = "https://github.com/pikers/pyqtgraph.git" },
|
||||
{ name = "pyqtgraph", marker = "extra == 'uis'", git = "https://github.com/pikers/pyqtgraph.git" },
|
||||
{ name = "pyvnc", git = "https://github.com/regulad/pyvnc.git" },
|
||||
{ name = "qdarkstyle", specifier = ">=3.2.3" },
|
||||
{ name = "qdarkstyle", marker = "extra == 'uis'", specifier = ">=3.0.2,<4.0.0" },
|
||||
{ name = "rapidfuzz", specifier = ">=3.5.2,<4.0.0" },
|
||||
{ name = "rapidfuzz", marker = "extra == 'uis'", specifier = ">=3.2.0,<4.0.0" },
|
||||
|
|
|
|||
Loading…
Reference in New Issue