Compare commits
5 Commits
74fcf8ec25
...
a853d5f7a7
| Author | SHA1 | Date |
|---|---|---|
|
|
a853d5f7a7 | |
|
|
d4efb33c25 | |
|
|
60c1efb6a6 | |
|
|
8769d7777a | |
|
|
baddea69d1 |
37
default.nix
37
default.nix
|
|
@ -11,12 +11,11 @@ let
|
||||||
libxkbcommonStorePath = lib.getLib libxkbcommon;
|
libxkbcommonStorePath = lib.getLib libxkbcommon;
|
||||||
xcbutilcursorStorePath = lib.getLib xcb-util-cursor;
|
xcbutilcursorStorePath = lib.getLib xcb-util-cursor;
|
||||||
|
|
||||||
pypkgs = python313Packages;
|
qtpyStorePath = lib.getLib python312Packages.qtpy;
|
||||||
qtpyStorePath = lib.getLib pypkgs.qtpy;
|
pyqt6StorePath = lib.getLib python312Packages.pyqt6;
|
||||||
pyqt6StorePath = lib.getLib pypkgs.pyqt6;
|
pyqt6SipStorePath = lib.getLib python312Packages.pyqt6-sip;
|
||||||
pyqt6SipStorePath = lib.getLib pypkgs.pyqt6-sip;
|
rapidfuzzStorePath = lib.getLib python312Packages.rapidfuzz;
|
||||||
rapidfuzzStorePath = lib.getLib pypkgs.rapidfuzz;
|
qdarkstyleStorePath = lib.getLib python312Packages.qdarkstyle;
|
||||||
qdarkstyleStorePath = lib.getLib pypkgs.qdarkstyle;
|
|
||||||
|
|
||||||
xorgLibX11StorePath = lib.getLib xorg.libX11;
|
xorgLibX11StorePath = lib.getLib xorg.libX11;
|
||||||
xorgLibxcbStorePath = lib.getLib xorg.libxcb;
|
xorgLibxcbStorePath = lib.getLib xorg.libxcb;
|
||||||
|
|
@ -52,12 +51,12 @@ stdenv.mkDerivation {
|
||||||
xorg.xcbutilrenderutil
|
xorg.xcbutilrenderutil
|
||||||
|
|
||||||
# Python requirements.
|
# Python requirements.
|
||||||
python313
|
python312Full
|
||||||
uv
|
python312Packages.uv
|
||||||
pypkgs.qdarkstyle
|
python312Packages.qdarkstyle
|
||||||
pypkgs.rapidfuzz
|
python312Packages.rapidfuzz
|
||||||
pypkgs.pyqt6
|
python312Packages.pyqt6
|
||||||
pypkgs.qtpy
|
python312Packages.qtpy
|
||||||
];
|
];
|
||||||
src = null;
|
src = null;
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
|
|
@ -114,11 +113,11 @@ stdenv.mkDerivation {
|
||||||
|
|
||||||
export LD_LIBRARY_PATH
|
export LD_LIBRARY_PATH
|
||||||
|
|
||||||
RPDFUZZ_PATH="${rapidfuzzStorePath}/lib/python3.13/site-packages"
|
RPDFUZZ_PATH="${rapidfuzzStorePath}/lib/python3.12/site-packages"
|
||||||
QDRKSTYLE_PATH="${qdarkstyleStorePath}/lib/python3.13/site-packages"
|
QDRKSTYLE_PATH="${qdarkstyleStorePath}/lib/python3.12/site-packages"
|
||||||
QTPY_PATH="${qtpyStorePath}/lib/python3.13/site-packages"
|
QTPY_PATH="${qtpyStorePath}/lib/python3.12/site-packages"
|
||||||
PYQT6_PATH="${pyqt6StorePath}/lib/python3.13/site-packages"
|
PYQT6_PATH="${pyqt6StorePath}/lib/python3.12/site-packages"
|
||||||
PYQT6_SIP_PATH="${pyqt6SipStorePath}/lib/python3.13/site-packages"
|
PYQT6_SIP_PATH="${pyqt6SipStorePath}/lib/python3.12/site-packages"
|
||||||
|
|
||||||
PATCH="$PATCH:$RPDFUZZ_PATH"
|
PATCH="$PATCH:$RPDFUZZ_PATH"
|
||||||
PATCH="$PATCH:$QDRKSTYLE_PATH"
|
PATCH="$PATCH:$QDRKSTYLE_PATH"
|
||||||
|
|
@ -128,8 +127,8 @@ stdenv.mkDerivation {
|
||||||
|
|
||||||
export PATCH
|
export PATCH
|
||||||
|
|
||||||
# install all dev and extras
|
# Install deps
|
||||||
uv sync --dev --all-extras
|
uv lock
|
||||||
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -220,10 +220,7 @@ class FutesPair(Pair):
|
||||||
assert pair == self.pair # sanity
|
assert pair == self.pair # sanity
|
||||||
return f'{expiry}'
|
return f'{expiry}'
|
||||||
|
|
||||||
case (
|
case 'PERPETUAL':
|
||||||
'PERPETUAL'
|
|
||||||
| 'TRADIFI_PERPETUAL'
|
|
||||||
):
|
|
||||||
return 'PERP'
|
return 'PERP'
|
||||||
|
|
||||||
case '':
|
case '':
|
||||||
|
|
@ -252,10 +249,7 @@ class FutesPair(Pair):
|
||||||
margin: str = self.marginAsset
|
margin: str = self.marginAsset
|
||||||
|
|
||||||
match ctype:
|
match ctype:
|
||||||
case (
|
case 'PERPETUAL':
|
||||||
'PERPETUAL'
|
|
||||||
| 'TRADIFI_PERPETUAL'
|
|
||||||
):
|
|
||||||
return f'{margin}M'
|
return f'{margin}M'
|
||||||
|
|
||||||
case (
|
case (
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ class DpiAwareFont:
|
||||||
# always going to hit that error in range mapping from inches:
|
# always going to hit that error in range mapping from inches:
|
||||||
# float to px size: int.
|
# float to px size: int.
|
||||||
self._font_inches = inches
|
self._font_inches = inches
|
||||||
font_size = math.floor(inches * pdpi)
|
font_size = math.floor(inches * dpi)
|
||||||
|
|
||||||
log.debug(
|
log.debug(
|
||||||
f"screen:{screen.name()}\n"
|
f"screen:{screen.name()}\n"
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,9 @@ uis = [
|
||||||
# TODO: make sure the levenshtein shit compiles on nix..
|
# TODO: make sure the levenshtein shit compiles on nix..
|
||||||
# rapidfuzz = {extras = ["speedup"], version = "^0.18.0"}
|
# rapidfuzz = {extras = ["speedup"], version = "^0.18.0"}
|
||||||
"rapidfuzz >=3.2.0, <4.0.0",
|
"rapidfuzz >=3.2.0, <4.0.0",
|
||||||
|
"qdarkstyle >=3.0.2, <4.0.0",
|
||||||
|
"pyqt6 >=6.7.0, <7.0.0",
|
||||||
|
"pyqtgraph",
|
||||||
|
|
||||||
# for consideration,
|
# for consideration,
|
||||||
# - 'visidata'
|
# - 'visidata'
|
||||||
|
|
@ -115,10 +118,6 @@ dev = [
|
||||||
|
|
||||||
# ?from git, see below.
|
# ?from git, see below.
|
||||||
"xonsh",
|
"xonsh",
|
||||||
"qdarkstyle >=3.0.2, <4.0.0",
|
|
||||||
"pyqt6 >=6.7.0, <7.0.0",
|
|
||||||
"pyqtgraph",
|
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ Resource list for mucking with DPIs on multiple screens:
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
from pyqtgraph import QtGui
|
||||||
from PyQt6 import (
|
from PyQt6 import (
|
||||||
QtCore,
|
QtCore,
|
||||||
QtWidgets,
|
QtWidgets,
|
||||||
|
|
@ -42,7 +43,6 @@ from PyQt6.QtCore import (
|
||||||
QSize,
|
QSize,
|
||||||
QRect,
|
QRect,
|
||||||
)
|
)
|
||||||
from pyqtgraph import QtGui
|
|
||||||
|
|
||||||
# Proper high DPI scaling is available in Qt >= 5.6.0. This attibute
|
# Proper high DPI scaling is available in Qt >= 5.6.0. This attibute
|
||||||
# must be set before creating the application
|
# must be set before creating the application
|
||||||
|
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
import pytest
|
|
||||||
from piker.ui._style import DpiAwareFont
|
|
||||||
|
|
||||||
|
|
||||||
class MockScreen:
|
|
||||||
def __init__(self, pdpi, ldpi, name="MockScreen"):
|
|
||||||
self._pdpi = pdpi
|
|
||||||
self._ldpi = ldpi
|
|
||||||
self._name = name
|
|
||||||
|
|
||||||
def physicalDotsPerInch(self):
|
|
||||||
return self._pdpi
|
|
||||||
|
|
||||||
def logicalDotsPerInch(self):
|
|
||||||
return self._ldpi
|
|
||||||
|
|
||||||
def name(self):
|
|
||||||
return self._name
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
|
||||||
"pdpi, ldpi, expected_px",
|
|
||||||
[
|
|
||||||
(96, 96, 9), # normal DPI
|
|
||||||
(169, 96, 15), # HiDPI
|
|
||||||
(120, 96, 10), # mid-DPI
|
|
||||||
]
|
|
||||||
)
|
|
||||||
def test_font_px_size(pdpi, ldpi, expected_px):
|
|
||||||
font = DpiAwareFont()
|
|
||||||
font.configure_to_dpi(screen=MockScreen(pdpi, ldpi))
|
|
||||||
|
|
||||||
px = font.px_size
|
|
||||||
print(f"{pdpi}x{ldpi} DPI -> Computed pixel size: {px}")
|
|
||||||
|
|
||||||
assert px == expected_px
|
|
||||||
Loading…
Reference in New Issue