diff --git a/meshterm/ui/braillechart.py b/meshterm/ui/braillechart.py index 19610dc..9735d2f 100644 --- a/meshterm/ui/braillechart.py +++ b/meshterm/ui/braillechart.py @@ -251,9 +251,8 @@ def activity_sparkline( else: height = min(4, max(1, round(count / scale * 4))) bars.append((0, height - 1)) - return _assemble( - bars, [float(c) for c in reversed(window)], 1, 0, style, "faint", per_column - )[0] + rows = _assemble(bars, [float(c) for c in reversed(window)], 1, 0, style, "faint", per_column) + return rows[0] #: Default percentile :func:`activity_peak` reads its ceiling at, in place of the raw diff --git a/meshterm/ui/fontset.py b/meshterm/ui/fontset.py index 5dc6073..603966d 100644 --- a/meshterm/ui/fontset.py +++ b/meshterm/ui/fontset.py @@ -23,6 +23,7 @@ from __future__ import annotations #: 512 glyphs — aliases (the rounded corners onto the square ones, ``⋯`` onto ``…``) and #: shared slots give a few glyphs more than one codepoint. Verified against a live table #: dump of the installed font (2026-08-01, post-P3 build). +# fmt: off FONT_RANGES: tuple[tuple[int, int], ...] = ( (0x0020, 0x007F), (0x00A0, 0x00A0), (0x00A7, 0x00A7), (0x00A9, 0x00A9), (0x00B0, 0x00B0), (0x00B2, 0x00B2), (0x00B6, 0x00B7), (0x03C0, 0x03C0), @@ -46,6 +47,7 @@ FONT_RANGES: tuple[tuple[int, int], ...] = ( (0x2699, 0x2699), (0x26A0, 0x26A0), (0x26BF, 0x26BF), (0x2713, 0x2713), (0x2717, 0x2717), (0x276F, 0x276F), (0x2800, 0x28FF), (0xFFFD, 0xFFFD), ) +# fmt: on #: Every codepoint the console font can draw, as one frozen set (built once at import; #: 520 members, so the set is small and the per-character membership test is a dict hit). diff --git a/meshterm/ui/packet_viewer.py b/meshterm/ui/packet_viewer.py index f5773ef..828af30 100644 --- a/meshterm/ui/packet_viewer.py +++ b/meshterm/ui/packet_viewer.py @@ -96,6 +96,7 @@ _PAYLOAD_GLOSS = { #: parsed into "class"/"route", the channel crypto handled by #: :meth:`PacketViewer._decrypt_rows`, or an advert field duplicating ``node``/ #: ``lat``/``lon``/etc.) — skipped so the generic dump doesn't repeat them. +# fmt: off _RAW_ROW_SKIP = frozenset({ "node", "name", "kind", "snr", "rssi", "lat", "lon", "path", "node_type", "observed_at", "text", @@ -107,6 +108,7 @@ _RAW_ROW_SKIP = frozenset({ "dest_hash", "src_hash", "src_key", "trace_tag", "ack_crc", "trace_snrs", "adv_key", "adv_name", "adv_type", "adv_lat", "adv_lon", }) +# fmt: on #: Display style per packet class, shared by every packet list and the viewer. KIND_STYLES = { diff --git a/meshterm/ui/theme.py b/meshterm/ui/theme.py index c61dd69..bae0453 100644 --- a/meshterm/ui/theme.py +++ b/meshterm/ui/theme.py @@ -507,6 +507,7 @@ _NODE_HUE_VAL = 0.95 #: hex a caller can parse into an RGB (the map canvas and the mesh walk read the hue back #: out of the style string), and so every downsample on the way out — Rich's, and the #: fold's :func:`_quantize_sgr` — lands on that exact slot rather than guessing. +# fmt: off _NODE_SLOT_HEXES: tuple[str, ...] = ( "#ff5555", # 9 red — 0° "#ffff55", # 11 yellow — 60° @@ -515,6 +516,7 @@ _NODE_SLOT_HEXES: tuple[str, ...] = ( "#5555ff", # 12 blue — 240° "#ff55ff", # 13 magenta — 300° ) +# fmt: on def node_style(key: str) -> str: @@ -631,6 +633,7 @@ def name_style(name: str, key: str | None = None) -> str: #: and never appear here. ``glyph()`` consumes this table at explicit icon call sites #: (a 1-cell lane the screen composes); the render-boundary fold consumes it for #: everything else, padding to the emoji's measured width so layout survives. +# fmt: off _GLYPH_MAP: dict[str, str] = { # Packet classes (KIND_ICONS) "📢": "☼", # advert — a node radiating its presence @@ -698,6 +701,7 @@ _GLYPH_MAP: dict[str, str] = { "⏳": "…", # pending/waiting "+": "+", # fullwidth plus (channels' add row) } +# fmt: on def glyph(icon: str) -> str: @@ -739,6 +743,7 @@ _FOLD_ALLOWED: frozenset[int] = FONT_CODEPOINTS.union(range(0x00, 0x20)) #: fold's translation table (storage is never touched). Characters *in* the font — #: ``— … ⋯ ⚠ ⌫ ⇧ ⚙ ↻ ◷ ⌖ ⚿ ← ↑ → ↓ ↔ ↕ • ·`` and the Cyrillic block — never appear #: here: they pass through untranslated. +# fmt: off _FOLD_SINGLES: dict[str, str] = { "–": "-", "−": "-", "‒": "-", "―": "—", "‘": "'", "’": "'", "‚": "'", "“": '"', "”": '"', "„": '"', @@ -758,6 +763,7 @@ _FOLD_SINGLES: dict[str, str] = { # VS16, ZWJ, ZWSP. "️": "", "‍": "", "​": "", } +# fmt: on #: Built lazily on first fold: ``str.translate`` table = accent folds (NFKD, computed #: over the Latin ranges once) + :data:`_FOLD_SINGLES` + the emoji map padded to each diff --git a/tests/test_device_config.py b/tests/test_device_config.py index c4884c0..8dea92c 100644 --- a/tests/test_device_config.py +++ b/tests/test_device_config.py @@ -744,7 +744,7 @@ async def test_a_refused_removal_is_shown_and_the_contact_stays() -> None: async def test_a_contact_the_device_never_held_is_still_removed_here() -> None: - """"Not on the device" is not a refusal — the removal finishes on our side, and says so. + """“Not on the device” is not a refusal — the removal finishes on our side, and says so. The list a screen removes from is the union of the device's table and the contacts MeshTerm remembers for it, so the entry may only ever have existed on our side (or the diff --git a/tests/test_theme16.py b/tests/test_theme16.py index c675373..19c501b 100644 --- a/tests/test_theme16.py +++ b/tests/test_theme16.py @@ -295,6 +295,7 @@ def test_heat_ladder_walks_jps_seven_slots_in_order() -> None: from meshterm.ui.widgets import _recency_style set_platform(PICOCALC) + # fmt: off expected = [ (60, 15), (299, 15), # under 5 minutes — white (300, 11), (3599, 11), # 5 minutes — yellow @@ -304,6 +305,7 @@ def test_heat_ladder_walks_jps_seven_slots_in_order() -> None: (2592000, 7), (31535999, 7), # 1 month — light grey (31536000, 8), (None, 8), # 1 year, and never — dark grey ] + # fmt: on for secs, slot in expected: style = MESH_THEME_16.styles[_recency_style(secs)] assert style.color is not None and style.color.number == slot, (secs, style)