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;
|
||||
xcbutilcursorStorePath = lib.getLib xcb-util-cursor;
|
||||
|
||||
pypkgs = python313Packages;
|
||||
qtpyStorePath = lib.getLib pypkgs.qtpy;
|
||||
pyqt6StorePath = lib.getLib pypkgs.pyqt6;
|
||||
pyqt6SipStorePath = lib.getLib pypkgs.pyqt6-sip;
|
||||
rapidfuzzStorePath = lib.getLib pypkgs.rapidfuzz;
|
||||
qdarkstyleStorePath = lib.getLib pypkgs.qdarkstyle;
|
||||
qtpyStorePath = lib.getLib python312Packages.qtpy;
|
||||
pyqt6StorePath = lib.getLib python312Packages.pyqt6;
|
||||
pyqt6SipStorePath = lib.getLib python312Packages.pyqt6-sip;
|
||||
rapidfuzzStorePath = lib.getLib python312Packages.rapidfuzz;
|
||||
qdarkstyleStorePath = lib.getLib python312Packages.qdarkstyle;
|
||||
|
||||
xorgLibX11StorePath = lib.getLib xorg.libX11;
|
||||
xorgLibxcbStorePath = lib.getLib xorg.libxcb;
|
||||
|
|
@ -52,12 +51,12 @@ stdenv.mkDerivation {
|
|||
xorg.xcbutilrenderutil
|
||||
|
||||
# Python requirements.
|
||||
python313
|
||||
uv
|
||||
pypkgs.qdarkstyle
|
||||
pypkgs.rapidfuzz
|
||||
pypkgs.pyqt6
|
||||
pypkgs.qtpy
|
||||
python312Full
|
||||
python312Packages.uv
|
||||
python312Packages.qdarkstyle
|
||||
python312Packages.rapidfuzz
|
||||
python312Packages.pyqt6
|
||||
python312Packages.qtpy
|
||||
];
|
||||
src = null;
|
||||
shellHook = ''
|
||||
|
|
@ -114,11 +113,11 @@ stdenv.mkDerivation {
|
|||
|
||||
export LD_LIBRARY_PATH
|
||||
|
||||
RPDFUZZ_PATH="${rapidfuzzStorePath}/lib/python3.13/site-packages"
|
||||
QDRKSTYLE_PATH="${qdarkstyleStorePath}/lib/python3.13/site-packages"
|
||||
QTPY_PATH="${qtpyStorePath}/lib/python3.13/site-packages"
|
||||
PYQT6_PATH="${pyqt6StorePath}/lib/python3.13/site-packages"
|
||||
PYQT6_SIP_PATH="${pyqt6SipStorePath}/lib/python3.13/site-packages"
|
||||
RPDFUZZ_PATH="${rapidfuzzStorePath}/lib/python3.12/site-packages"
|
||||
QDRKSTYLE_PATH="${qdarkstyleStorePath}/lib/python3.12/site-packages"
|
||||
QTPY_PATH="${qtpyStorePath}/lib/python3.12/site-packages"
|
||||
PYQT6_PATH="${pyqt6StorePath}/lib/python3.12/site-packages"
|
||||
PYQT6_SIP_PATH="${pyqt6SipStorePath}/lib/python3.12/site-packages"
|
||||
|
||||
PATCH="$PATCH:$RPDFUZZ_PATH"
|
||||
PATCH="$PATCH:$QDRKSTYLE_PATH"
|
||||
|
|
@ -128,8 +127,8 @@ stdenv.mkDerivation {
|
|||
|
||||
export PATCH
|
||||
|
||||
# install all dev and extras
|
||||
uv sync --dev --all-extras
|
||||
# Install deps
|
||||
uv lock
|
||||
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -220,10 +220,7 @@ class FutesPair(Pair):
|
|||
assert pair == self.pair # sanity
|
||||
return f'{expiry}'
|
||||
|
||||
case (
|
||||
'PERPETUAL'
|
||||
| 'TRADIFI_PERPETUAL'
|
||||
):
|
||||
case 'PERPETUAL':
|
||||
return 'PERP'
|
||||
|
||||
case '':
|
||||
|
|
@ -252,10 +249,7 @@ class FutesPair(Pair):
|
|||
margin: str = self.marginAsset
|
||||
|
||||
match ctype:
|
||||
case (
|
||||
'PERPETUAL'
|
||||
| 'TRADIFI_PERPETUAL'
|
||||
):
|
||||
case 'PERPETUAL':
|
||||
return f'{margin}M'
|
||||
|
||||
case (
|
||||
|
|
|
|||
|
|
@ -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 * pdpi)
|
||||
font_size = math.floor(inches * dpi)
|
||||
|
||||
log.debug(
|
||||
f"screen:{screen.name()}\n"
|
||||
|
|
|
|||
|
|
@ -85,6 +85,9 @@ uis = [
|
|||
# TODO: make sure the levenshtein shit compiles on nix..
|
||||
# rapidfuzz = {extras = ["speedup"], version = "^0.18.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,
|
||||
# - 'visidata'
|
||||
|
|
@ -115,10 +118,6 @@ dev = [
|
|||
|
||||
# ?from git, see below.
|
||||
"xonsh",
|
||||
"qdarkstyle >=3.0.2, <4.0.0",
|
||||
"pyqt6 >=6.7.0, <7.0.0",
|
||||
"pyqtgraph",
|
||||
|
||||
]
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ Resource list for mucking with DPIs on multiple screens:
|
|||
|
||||
'''
|
||||
|
||||
from pyqtgraph import QtGui
|
||||
from PyQt6 import (
|
||||
QtCore,
|
||||
QtWidgets,
|
||||
|
|
@ -42,7 +43,6 @@ from PyQt6.QtCore import (
|
|||
QSize,
|
||||
QRect,
|
||||
)
|
||||
from pyqtgraph import QtGui
|
||||
|
||||
# Proper high DPI scaling is available in Qt >= 5.6.0. This attibute
|
||||
# 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