The handhelds are named for their variant: picocalc-lyra and cardputer-zero

M5Stack makes three Cardputers and only the Zero runs Linux; the PicoCalc
takes several cores and only the Luckfox Lyra runs MeshTerm. So the bare
names were ambiguous, and every reference to the two devices now carries
the variant: the --platform values and MESHTERM_PLATFORM, the Platform
constants (PICOCALC_LYRA, CARDPUTER_ZERO), their lane decks and every
screen's picocalc_lyra_lane / cardputer_zero_lane, the font inventories,
the lane chips' theme styles, the scripts/ folders, the two chrome test
files, and the docs and CLAUDE.md that name them.

There is no alias: --platform picocalc is refused with the three real
choices listed, rather than falling back to the desktop layout. The
PicoCalc is auto-detected from its device tree, so it needs nothing.
What names hardware or a user's data keeps its name: the PicoCalc
keyboard's input-device name, its battery's sysfs supply, and the serial
profile the Lyra setup script writes. .gitignore follows the firmware's
folder, and the changelog keeps the words each release used.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jean-Pierre MartineauandClaude Opus 5.5 committed 2026-10-04 11:52:41 -04:00
1 parent a4619aa17d
commit b6e7cd5c16
104 files changed
+587 -542

No files matched your search

+1 -1
View File
@@ -120,7 +120,7 @@ def _isolate_config_dir(tmp_path_factory: pytest.TempPathFactory) -> Iterator[No
def _reset_platform() -> Iterator[None]:
"""Every test starts and ends on :data:`~meshterm.platforms.REGULAR`.
A test that calls ``set_platform(PICOCALC)`` (directly, or via the gallery harness)
A test that calls ``set_platform(PICOCALC_LYRA)`` (directly, or via the gallery harness)
can't leak that choice into whatever runs next — regular is the suite's baseline, the
same way it is the default for a process that never passes ``--platform``/
``MESHTERM_PLATFORM`` (see :mod:`meshterm.platforms`).
+8 -8
View File
@@ -195,18 +195,18 @@ def test_the_console_lane_claims_the_section_step_only_while_the_page_scrolls()
never advertises a key that would do nothing (``CLAUDE.md``) — and a page you can
see whole has no section to step to.
"""
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
try:
screen = AboutPage("About MeshTerm", about_meshterm())
screen.note_metrics(12, 40) # the whole page fits
assert [pair.label for pair in screen.picocalc_lane[:2]] == ["Sect ↑", "Sect ↓"]
assert not any(pair.enabled for pair in screen.picocalc_lane[:2])
assert [pair.label for pair in screen.picocalc_lyra_lane[:2]] == ["Sect ↑", "Sect ↓"]
assert not any(pair.enabled for pair in screen.picocalc_lyra_lane[:2])
screen.note_metrics(60, 20) # taller than the viewport
assert all(pair.enabled for pair in screen.picocalc_lane[:2])
assert [pair.action for pair in screen.picocalc_lane[:2]] == [
assert all(pair.enabled for pair in screen.picocalc_lyra_lane[:2])
assert [pair.action for pair in screen.picocalc_lyra_lane[:2]] == [
"ctrl_pageup",
"ctrl_pagedown",
]
@@ -228,12 +228,12 @@ def test_menu_rows_carry_the_icon_and_the_titles_do_not() -> None:
def test_every_page_icon_has_a_picocalc_glyph() -> None:
"""No emoji reaches the console: each icon folds to a font character (CLAUDE.md)."""
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
from meshterm.tools import get_tool
from meshterm.ui.fontset import FONT_CODEPOINTS
from meshterm.ui.theme import glyph
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
try:
for name in ("about", "about-author", "discord", "support"):
tool = get_tool(name)
+2 -2
View File
@@ -264,7 +264,7 @@ def test_axis_chart_mirrors_marks_where_the_platform_affords_them() -> None:
The desktop frames a chart with marks on both gutters; the console keeps the right
``├`` tick but spends the mirrored label's cells on the chart instead.
"""
from meshterm.platforms import PICOCALC, set_platform
from meshterm.platforms import PICOCALC_LYRA, set_platform
from meshterm.ui.braillechart import axis_chrome
rows = timeline_rows([9] * 8, rows=2)
@@ -275,7 +275,7 @@ def test_axis_chart_mirrors_marks_where_the_platform_affords_them() -> None:
assert out[2].plain.startswith(" └") and out[2].plain.endswith("┘")
assert axis_chrome(1) == 2 * (1 + 2) # what a caller must budget beside the cells
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
tight = axis_chart(timeline_rows([9] * 8, rows=2), 9, 4, lambda f: "x")
assert tight[0].plain == " 8 ┤⣿⣿⣿⣿├" # the tick survives; the label's cells don't
assert tight[1].plain == " 3 ┤⣿⣿⣿⣿├"
@@ -9,14 +9,14 @@ from rich.cells import cell_len
from rich.text import Text
from meshterm import __version__
from meshterm.platforms import CARDPUTER, PICOCALC, set_platform
from meshterm.platforms import CARDPUTER_ZERO, PICOCALC_LYRA, set_platform
from meshterm.ui import menu
from meshterm.ui.tui import frame
from meshterm.ui.tui.screen import ScrollScreen
from meshterm.ui.widgets import battery_cell
from tests.conftest import plain as _plain
ROWS, COLS = CARDPUTER.readable_rows, CARDPUTER.readable_cols
ROWS, COLS = CARDPUTER_ZERO.readable_rows, CARDPUTER_ZERO.readable_cols
def _status() -> Text:
@@ -41,8 +41,8 @@ def _rows(header: Text, cols: int = COLS, rows: int = ROWS, **lane) -> list[str]
def test_the_cardputer_has_no_header_row() -> None:
"""The title bar is the top row, and every screen gets the header's row for its body."""
set_platform(CARDPUTER)
assert not CARDPUTER.header_row
set_platform(CARDPUTER_ZERO)
assert not CARDPUTER_ZERO.header_row
assert frame.header_lines(_status(), COLS) == []
composed = [_plain(line) for line in _rows(_status())]
assert len(composed) == ROWS
@@ -54,7 +54,7 @@ def test_the_cardputer_has_no_header_row() -> None:
def test_a_platform_with_a_header_row_keeps_it() -> None:
"""The PicoCalc is unchanged: header on top, the bar under it, no status on the bar."""
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
composed = [_plain(line) for line in _rows(Text("hdr"), 53, 26)]
assert composed[0].startswith("hdr")
assert composed[1].startswith("↑↓ ") and "hdr" not in composed[1]
@@ -62,7 +62,7 @@ def test_a_platform_with_a_header_row_keeps_it() -> None:
def test_the_status_sits_in_the_corner_after_the_way_out() -> None:
"""``↑↓ ── Title ──── Esc back ● 3 ⣷ 87%``: the badges and battery keep their corner."""
set_platform(CARDPUTER)
set_platform(CARDPUTER_ZERO)
bar = frame._title_bar(_screen(), COLS, False, True, _status()).plain
assert cell_len(bar) == COLS
assert bar.endswith("Esc back " + _status().plain)
@@ -71,14 +71,14 @@ def test_the_status_sits_in_the_corner_after_the_way_out() -> None:
def test_an_empty_status_draws_the_bar_as_it_always_was() -> None:
"""Nothing unread and no pack: the bar is exactly the one a header row would sit over."""
set_platform(CARDPUTER)
set_platform(CARDPUTER_ZERO)
plain_bar = frame._title_bar(_screen(), COLS, False, True).plain
assert frame._title_bar(_screen(), COLS, False, True, Text()).plain == plain_bar
def test_a_long_title_gives_way_before_the_status_does() -> None:
"""The way out sheds first, then the title is cut short; the status is never pushed off."""
set_platform(CARDPUTER)
set_platform(CARDPUTER_ZERO)
status = _status()
long_title = "Trace — Hilltop-Repeater over a much longer spec than fits"
bar = frame._title_bar(_screen(long_title), COLS, False, True, status).plain
@@ -90,7 +90,7 @@ def test_a_long_title_gives_way_before_the_status_does() -> None:
def test_the_header_is_its_atoms_alone_without_a_row() -> None:
"""No version, no pulse, no padding: the badges and the battery, a space apart."""
set_platform(CARDPUTER)
set_platform(CARDPUTER_ZERO)
ctx = SimpleNamespace(
mock=False,
chat=SimpleNamespace(unread_total=lambda: 3),
@@ -108,7 +108,7 @@ def test_the_header_is_its_atoms_alone_without_a_row() -> None:
def test_the_main_menu_wears_the_wordmark_where_no_header_row_does() -> None:
"""The root screen's title is ``MeshTerm vX`` in the header's colours, or else the question."""
set_platform(CARDPUTER)
set_platform(CARDPUTER_ZERO)
assert menu._menu_title() == f"MeshTerm v{__version__}"
screen = menu._MainMenu(menu._menu_title(), [], footer_hint="↑↓ move · ^Q quit?")
bar = frame._title_bar(screen, COLS, False, False, _status())
@@ -116,7 +116,7 @@ def test_the_main_menu_wears_the_wordmark_where_no_header_row_does() -> None:
styles = {str(span.style) for span in bar.spans if span.start <= start < span.end}
assert "brand" in styles
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
assert menu._menu_title() == "What would you like to do?"
@@ -127,8 +127,8 @@ def test_a_tall_dialog_covers_the_bar_and_blanks_its_ends() -> None:
short of it. On the bar, the cells either side of the box are blanked: there, a stray
``7%`` would read as the battery.
"""
set_platform(CARDPUTER)
assert ROWS - 2 - CARDPUTER.dialog_row_margin == 11 # the dialog's budget
set_platform(CARDPUTER_ZERO)
assert ROWS - 2 - CARDPUTER_ZERO.dialog_row_margin == 11 # the dialog's budget
base = _rows(_status(), footer_lane=lambda: Text("LANE"))
box = "\n".join("|" + "x" * 45 + "|" for _ in range(ROWS - 1))
rows = [_plain(row) for row in frame.composite_float(base, box, COLS, ROWS)]
@@ -139,7 +139,7 @@ def test_a_tall_dialog_covers_the_bar_and_blanks_its_ends() -> None:
def test_a_short_dialog_leaves_the_bar_whole() -> None:
"""A box that doesn't reach the top row leaves the bar, and its status, in view."""
set_platform(CARDPUTER)
set_platform(CARDPUTER_ZERO)
base = _rows(_status())
rows = frame.composite_float(base, "\n".join(["[box]"] * 5), COLS, ROWS)
assert rows[0] == base[0]
+4 -4
View File
@@ -316,7 +316,7 @@ def test_where_braille_is_solid_every_code_is_drawn_in_it() -> None:
"""
import segno
from meshterm.platforms import PICOCALC, set_platform
from meshterm.platforms import PICOCALC_LYRA, set_platform
def is_braille(text: str) -> bool:
return any("⠀" <= ch <= "⣿" for ch in text)
@@ -325,7 +325,7 @@ def test_where_braille_is_solid_every_code_is_drawn_in_it() -> None:
channel = "meshcore://channel/add?name=Test&secret=" + "ab" * 16
assert not is_braille(fit_qr(url, 53, 22).plain) and not is_braille(qr_text(channel).plain)
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
assert is_braille(qr_text(channel).plain) and "█" not in qr_text(channel).plain
screen = QrScreen(url, title="Share YUL-Cartierville")
screen.note_viewport(26)
@@ -844,7 +844,7 @@ async def test_the_detail_summary_sheds_atoms_rather_than_wrapping(ctx: AppConte
this screen from — never the channel's own identity.
"""
from meshterm.core.models import ChatMessage
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
from meshterm.ui.channels import _detail_summary, _LiveStats
device = await ctx.device()
@@ -857,7 +857,7 @@ async def test_the_detail_summary_sheds_atoms_rather_than_wrapping(ctx: AppConte
ctx.chat._unread[slot.conversation.key] = 2
try:
for platform in (REGULAR, PICOCALC):
for platform in (REGULAR, PICOCALC_LYRA):
set_platform(platform)
line = _detail_summary(ctx, slot, _LiveStats(ctx))
assert cell_len(line) <= platform.readable_cols, (platform.name, line)
+41 -32
View File
@@ -1073,18 +1073,20 @@ async def test_chat_fkey_lane_dims_retry_and_the_nav_slots() -> None:
return message
empty = _screen(_StubSession(), send=None, resend=resend)
assert not any(pair.enabled for pair in empty.picocalc_lane if pair) # nothing to walk
assert not any(pair.enabled for pair in empty.picocalc_lyra_lane if pair) # nothing to walk
failed = ChatMessage(text="oops", outbound=True, peer="d4e5f6a7", acked=False)
screen = _screen(_StubSession(), send=None, messages=[failed], resend=resend)
assert all(pair.enabled for pair in screen.picocalc_lane[3:]) # the pager walks the pick
assert screen.picocalc_lane[2].opp_enabled is True # F8 Retry: the message never acked
assert all(pair.enabled for pair in screen.picocalc_lyra_lane[3:]) # the pager walks the pick
assert screen.picocalc_lyra_lane[2].opp_enabled is True # F8 Retry: the message never acked
screen.handle("retry")
await asyncio.sleep(0)
assert failed.acked is True
assert screen.picocalc_lane[2].opp_enabled is False # acknowledged — nothing left to retry
assert screen.picocalc_lane[2].opp_label == "Retry" # dim, not gone: it belongs on this screen
assert screen.picocalc_lyra_lane[2].opp_enabled is False # acknowledged — nothing left to retry
assert (
screen.picocalc_lyra_lane[2].opp_label == "Retry"
) # dim, not gone: it belongs on this screen
def test_chat_fkey_lane_speaks_the_transcript_and_drops_channel_retry() -> None:
@@ -1095,10 +1097,10 @@ def test_chat_fkey_lane_speaks_the_transcript_and_drops_channel_retry() -> None:
# Not "Bottom"/"Top": what the Shift bank does to a conversation is come back to the
# latest message and the compose line, or reach back to its oldest one. Relabelled in
# place, so each jump still rides the pager heading for it.
assert [pair.opp_label for pair in direct.picocalc_lane[3:]] == ["Latest", "Oldest"]
assert [pair.opp_action for pair in direct.picocalc_lane[3:]] == ["ctrl_end", "ctrl_home"]
assert [pair.label for pair in direct.picocalc_lane[3:]] == ["Page ↓", "Page ↑"]
assert direct.picocalc_lane[2].opp_label == "Retry"
assert [pair.opp_label for pair in direct.picocalc_lyra_lane[3:]] == ["Latest", "Oldest"]
assert [pair.opp_action for pair in direct.picocalc_lyra_lane[3:]] == ["ctrl_end", "ctrl_home"]
assert [pair.label for pair in direct.picocalc_lyra_lane[3:]] == ["Page ↓", "Page ↑"]
assert direct.picocalc_lyra_lane[2].opp_label == "Retry"
channel = ChatScreen(
Conversation(label="#general", is_channel=True, channel_id="1"),
@@ -1109,8 +1111,8 @@ def test_chat_fkey_lane_speaks_the_transcript_and_drops_channel_retry() -> None:
)
# A channel message is never acknowledged, so retrying one isn't a thing here: the
# slot is empty rather than dimmed, and its key resolves to nothing.
assert channel.picocalc_lane[2].opp_label == ""
assert fkeys.PICOCALC_DECK.action_for(channel.picocalc_lane, 8) is None
assert channel.picocalc_lyra_lane[2].opp_label == ""
assert fkeys.PICOCALC_LYRA_DECK.action_for(channel.picocalc_lyra_lane, 8) is None
def test_chat_screen_up_picks_and_ctrl_end_returns_to_compose() -> None:
@@ -1311,7 +1313,7 @@ async def test_chat_paths_key_needs_a_picked_message() -> None:
await asyncio.sleep(0)
assert shown == []
assert "^P" not in screen.footer_hint
assert screen.picocalc_lane[2].enabled is False
assert screen.picocalc_lyra_lane[2].enabled is False
screen.handle("up")
screen.handle("up") # pick the older message
@@ -1321,7 +1323,7 @@ async def test_chat_paths_key_needs_a_picked_message() -> None:
# With a pick, paths are on offer — here on Enter, since a direct chat has no reply
# to prime (a channel's hint keeps the ^P atom beside its Enter reply).
assert "Enter paths" in screen.footer_hint
assert screen.picocalc_lane[2].enabled is True
assert screen.picocalc_lyra_lane[2].enabled is True
async def test_chat_direct_enter_on_a_pick_opens_paths() -> None:
@@ -1870,7 +1872,7 @@ def test_picker_marker_lane_lines_the_two_groups_up(repo: Repository) -> None:
padded to whatever it actually measures rather than to a written-down width: a
hard-coded pad left every channel row a cell adrift of every direct row on the PicoCalc.
"""
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
from meshterm.tools.chat import _lanes
channel = Conversation(label="Public", is_channel=True, channel_idx=0, channel_id="c0")
@@ -1879,7 +1881,7 @@ def test_picker_marker_lane_lines_the_two_groups_up(repo: Repository) -> None:
)
ctx = _RowCtx(repo)
try:
for platform in (REGULAR, PICOCALC):
for platform in (REGULAR, PICOCALC_LYRA):
set_platform(platform)
lanes = _lanes([channel, contact])
rows = [_title(ctx, c, {}, _NO_KEYS, lanes).plain for c in (channel, contact)]
@@ -2293,9 +2295,14 @@ def test_chat_fkey_lane_steps_by_day_on_the_free_left_pair() -> None:
now = utcnow()
one_day = [ChatMessage(text="hi", peer="d4e5f6a7", created_at=now)]
single = _screen(_StubSession(), send=None, messages=one_day)
assert [pair.label for pair in single.picocalc_lane[:2]] == ["Day ↑", "Day ↓"]
assert [pair.action for pair in single.picocalc_lane[:2]] == ["ctrl_pageup", "ctrl_pagedown"]
assert not any(pair.enabled for pair in single.picocalc_lane[:2]) # one day: nowhere to step
assert [pair.label for pair in single.picocalc_lyra_lane[:2]] == ["Day ↑", "Day ↓"]
assert [pair.action for pair in single.picocalc_lyra_lane[:2]] == [
"ctrl_pageup",
"ctrl_pagedown",
]
assert not any(
pair.enabled for pair in single.picocalc_lyra_lane[:2]
) # one day: nowhere to step
spread = _screen(
_StubSession(),
@@ -2305,11 +2312,11 @@ def test_chat_fkey_lane_steps_by_day_on_the_free_left_pair() -> None:
ChatMessage(text="now", peer="d4e5f6a7", created_at=now),
],
)
assert all(pair.enabled for pair in spread.picocalc_lane[:2])
assert all(pair.enabled for pair in spread.picocalc_lyra_lane[:2])
# A left-hand pair rises toward F1, so stepping *back* through the transcript is the
# outer key — the same handedness as the pager's on the right.
assert fkeys.PICOCALC_DECK.action_for(spread.picocalc_lane, 1) == "ctrl_pageup"
spread.handle(fkeys.PICOCALC_DECK.action_for(spread.picocalc_lane, 1))
assert fkeys.PICOCALC_LYRA_DECK.action_for(spread.picocalc_lyra_lane, 1) == "ctrl_pageup"
spread.handle(fkeys.PICOCALC_LYRA_DECK.action_for(spread.picocalc_lyra_lane, 1))
assert spread._selected == 0 # jumped to the first message of the older day
@@ -2341,9 +2348,9 @@ def test_on_the_picocalc_each_url_hangs_a_code_under_its_message_side_by_side()
"""
import segno
from meshterm.platforms import PICOCALC, set_platform
from meshterm.platforms import PICOCALC_LYRA, set_platform
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
first, second = "https://meshterm.net", "https://github.com/jpmartineau/MeshTerm"
conv = Conversation(label="#ops", is_channel=True, channel_idx=1)
message = ChatMessage(text=f"Alice: map at {first}, code at {second}!", is_channel=True)
@@ -2379,10 +2386,10 @@ def test_codes_that_outrun_the_line_start_a_new_band() -> None:
"""Two short links fit beside each other in the 44 cells after the indent; a third wraps."""
import segno
from meshterm.platforms import PICOCALC, set_platform
from meshterm.platforms import PICOCALC_LYRA, set_platform
from meshterm.ui.qr import qr_strip
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
urls = [f"https://meshterm.net/{c}" for c in "abc"]
size = segno.make(urls[0], error="m").symbol_size(border=4)[0]
cols, height = -(-size // 2), -(-size // 4)
@@ -2395,10 +2402,10 @@ def test_codes_that_outrun_the_line_start_a_new_band() -> None:
def test_a_picked_message_keeps_its_codes_in_view() -> None:
"""Walking the pick down onto a link shows its code, not just the message's first row."""
from meshterm.platforms import PICOCALC, set_platform
from meshterm.platforms import PICOCALC_LYRA, set_platform
from meshterm.ui.tui import frame
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
conv = Conversation(label="#ops", is_channel=True, channel_idx=1)
messages = [ChatMessage(text=f"Alice: line {i}", is_channel=True) for i in range(12)]
messages.insert(6, ChatMessage(text="Bob: map at https://meshterm.net", is_channel=True))
@@ -2497,8 +2504,10 @@ def test_ctrl_u_is_named_only_on_a_picked_message_with_a_link() -> None:
linked.handle("up")
plain.handle("up")
assert "^U QR" in linked.footer_hint and "^U" not in plain.footer_hint
assert fkeys.PICOCALC_DECK.action_for(linked.picocalc_lane, 7) == "url_code" # Shift+F2
assert linked.picocalc_lane[1].opp_enabled and not plain.picocalc_lane[1].opp_enabled
assert (
fkeys.PICOCALC_LYRA_DECK.action_for(linked.picocalc_lyra_lane, 7) == "url_code"
) # Shift+F2
assert linked.picocalc_lyra_lane[1].opp_enabled and not plain.picocalc_lyra_lane[1].opp_enabled
# Every pick state's hint, with a link in it, inside the 72-cell budget.
direct = _screen(
@@ -2523,15 +2532,15 @@ def test_on_the_cardputer_a_link_takes_the_share_screen_as_on_the_desktop() -> N
and the share screen draws the code in braille — small enough that a link and its
code share the 53x14 panel, URL under the code, nothing a page down.
"""
from meshterm.platforms import CARDPUTER, set_platform
from meshterm.platforms import CARDPUTER_ZERO, set_platform
from meshterm.ui.qr import QrScreen
set_platform(CARDPUTER)
set_platform(CARDPUTER_ZERO)
url = "https://github.com/jpmartineau/MeshTerm"
screen = _url_chat(f"the road list is at {url}")
assert not _code_rows(_strip_ansi(screen._render_grouped(53)).splitlines())
screen.handle("up")
assert fkeys.CARDPUTER_DECK.action_for(screen.cardputer_lane, 17) == "url_code"
assert fkeys.CARDPUTER_ZERO_DECK.action_for(screen.cardputer_zero_lane, 17) == "url_code"
share = QrScreen(url, title="Links")
share.note_viewport(14)
+2 -2
View File
@@ -251,10 +251,10 @@ def test_the_row_writer_pins_what_it_writes(monkeypatch) -> None: # noqa: ANN00
def test_a_platform_that_draws_no_emoji_pins_nothing() -> None:
"""The PicoCalc draws only glyphs its own font has verified, so there is nothing to pin."""
from meshterm.platforms import PICOCALC, set_platform
from meshterm.platforms import PICOCALC_LYRA, set_platform
assert colsnap.enabled()
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
assert not colsnap.enabled()
+11 -11
View File
@@ -23,7 +23,7 @@ from meshterm.core.admin_store import AdminStore
from meshterm.core.config import Settings
from meshterm.core.device_store import DeviceStore
from meshterm.persistence.repository import Repository
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
from meshterm.ui.config_editor import (
_ConfigMenu,
_menu_items,
@@ -134,15 +134,15 @@ def test_config_table_drops_the_description_lane_where_it_cannot_fit() -> None:
The setting and its value are all that fit, and with nothing competing for the
cells the labels keep their natural width.
"""
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
try:
lines = _table_lines(PICOCALC.readable_cols)
lines = _table_lines(PICOCALC_LYRA.readable_cols)
finally:
set_platform(REGULAR)
header = next(line for line in lines if line.lstrip().startswith("SETTING"))
assert "DESCRIPTION" not in header
assert any("Telemetry mode (environment)" in line for line in lines)
assert max(len(line.rstrip()) for line in lines) <= PICOCALC.readable_cols
assert max(len(line.rstrip()) for line in lines) <= PICOCALC_LYRA.readable_cols
def test_config_table_drops_the_description_lane_beside_a_staged_column() -> None:
@@ -234,11 +234,11 @@ def test_the_lane_chip_and_the_key_are_one_behaviour() -> None:
One behaviour reached two ways, not a second copy of it.
"""
screen = _info_screen(_SNAPSHOT)
assert screen.picocalc_lane[2].label == "Reveal"
assert screen.picocalc_lyra_lane[2].label == "Reveal"
screen.handle("reveal")
assert "123456" in _pin_row(screen.render_body(72))
assert screen.picocalc_lane[2].label == "Hide"
assert screen.picocalc_lyra_lane[2].label == "Hide"
def test_the_footer_names_what_the_press_would_do_now() -> None:
@@ -257,9 +257,9 @@ def test_a_page_with_no_pin_advertises_no_key_for_it() -> None:
"""
screen = _info_screen({k: v for k, v in _SNAPSHOT.items() if k != "ble_pin"})
assert "PIN" not in screen.footer_hint
assert screen.picocalc_lane[2] is None
assert screen.picocalc_lyra_lane[2] is None
screen.handle("reveal")
assert screen.picocalc_lane[2] is None
assert screen.picocalc_lyra_lane[2] is None
def test_uncovering_the_pin_keeps_the_reader_where_they_were() -> None:
@@ -321,12 +321,12 @@ def test_the_editor_reveals_on_the_same_chord_as_the_info_page() -> None:
"""
menu = _editor(_SNAPSHOT)
assert f"{REVEAL_KEY} show PIN" in menu.footer_hint
assert menu.picocalc_lane[2].label == "Reveal"
assert menu.picocalc_lyra_lane[2].label == "Reveal"
menu.handle("reveal")
assert "123456" in _pin_row(menu.render_body(72))
assert f"{REVEAL_KEY} hide PIN" in menu.footer_hint
assert menu.picocalc_lane[2].label == "Hide"
assert menu.picocalc_lyra_lane[2].label == "Hide"
def test_revealing_keeps_the_filter_and_the_row_the_reader_was_on() -> None:
@@ -350,7 +350,7 @@ def test_an_editor_over_a_device_with_no_pin_offers_no_reveal() -> None:
"""An editor over a device with no PIN offers no reveal either, footer or lane."""
menu = _editor({k: v for k, v in _SNAPSHOT.items() if k != "ble_pin"})
assert "PIN" not in menu.footer_hint
assert menu.picocalc_lane[2] is None
assert menu.picocalc_lyra_lane[2] is None
# -- contact share URL ----------------------------------------------------------
+7 -7
View File
@@ -16,7 +16,7 @@ from meshterm.host.raster import PANEL_H, PANEL_W, Raster, rgb565
from meshterm.host.run import host_output, run
from meshterm.host.sim import key_from_tk
from meshterm.host.vt import BOLD, REVERSE, UNDERLINE, Terminal
from meshterm.ui.tui.fkeys import CARDPUTER_DECK
from meshterm.ui.tui.fkeys import CARDPUTER_ZERO_DECK
_BDF = """STARTFONT 2.1
FONT test
@@ -127,8 +127,8 @@ def test_the_lane_keys_reach_prompt_toolkit_as_the_deck_expects() -> None:
"""Fn+4..8 parse as F4-F8 and Shift with them as F16-F20, the Cardputer deck's banks."""
plain = [_parsed(encode(Key(name=f"f{n}")))[0] for n in range(4, 9)]
shifted = [_parsed(encode(Key(name=f"f{n}", shift=True)))[0] for n in range(4, 9)]
assert [k.value for k in plain] == [f"f{n}" for n in CARDPUTER_DECK.keys]
assert [k.value for k in shifted] == [f"f{n}" for n in CARDPUTER_DECK.shift_keys]
assert [k.value for k in plain] == [f"f{n}" for n in CARDPUTER_ZERO_DECK.keys]
assert [k.value for k in shifted] == [f"f{n}" for n in CARDPUTER_ZERO_DECK.shift_keys]
def test_modified_navigation_and_control_letters() -> None:
@@ -268,14 +268,14 @@ def test_meshterm_runs_inside_the_host(monkeypatch) -> None:
def test_the_cardputer_inventory_is_what_the_host_draws() -> None:
"""``fontset.CARDPUTER_CODEPOINTS`` holds every mark, and the installed font exactly."""
"""``fontset.CARDPUTER_ZERO_CODEPOINTS`` holds every mark, and the installed font exactly."""
from meshterm.host.font import ALIASES, BRAILLE, font_dir, load_bdf
from meshterm.ui.fontset import CARDPUTER_CODEPOINTS
from meshterm.ui.fontset import CARDPUTER_ZERO_CODEPOINTS
ours = set(MARKS) | set(ALIASES) | set(BRAILLE)
assert ours <= CARDPUTER_CODEPOINTS
assert ours <= CARDPUTER_ZERO_CODEPOINTS
installed = font_dir() / "ter-u12n.bdf"
if not installed.is_file():
return # no Terminus on this machine (CI): the marks are the part that is ours
drawn = {cp for cp in load_bdf(installed) if cp >= 0x20} | ours
assert drawn == CARDPUTER_CODEPOINTS
assert drawn == CARDPUTER_ZERO_CODEPOINTS
+2 -2
View File
@@ -564,9 +564,9 @@ async def test_courier_command_rows_go_bare_where_the_platform_draws_no_icons(
those rows aligned with one another — while the queue, clear, send and cancel rows lose
their icons exactly as every other command row does there.
"""
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
try:
rows = _outbox_titles(tmp_path / "outbox")
assert "Queue a message…" in rows and "Clear finished" in rows
+5 -3
View File
@@ -95,13 +95,13 @@ def test_the_activity_aside_names_dot_columns_only_where_braille_has_dots() -> N
There are no dots there to count, and on 53 columns the words cost the heading its
line. The desktop keeps them; both keep what the chart counts.
"""
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
def heading(width: int) -> str:
body = _plain(_screen(histogram=[1] * ACTIVITY_BUCKETS).render_body(width))
return next(line for line in body.splitlines() if "Activity" in line)
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
assert heading(53).strip() == "Activity · every packet heard"
set_platform(REGULAR)
assert heading(72).strip() == "Activity · every packet heard · one minute per dot column"
@@ -534,6 +534,8 @@ def test_no_scope_view_is_offered_without_a_flood_to_narrow_to() -> None:
"""A window of direct frames only offers nothing to cycle: no hint atom, no chip."""
screen = _scoped_screen([_flood(None, "TEXT_MSG")])
assert "scope" not in screen.footer_hint
assert screen.picocalc_lane[2] is None or not getattr(screen.picocalc_lane[2], "label", "")
assert screen.picocalc_lyra_lane[2] is None or not getattr(
screen.picocalc_lyra_lane[2], "label", ""
)
screen.handle("text", "s")
assert screen.title == "Dashboard — mesh overview"
+3 -3
View File
@@ -673,7 +673,7 @@ async def test_sparing_every_row_leaves_the_sweep_with_nothing_to_do() -> None:
assert victims == []
@pytest.mark.parametrize("platform_name", ["regular", "picocalc"])
@pytest.mark.parametrize("platform_name", ["regular", "picocalc-lyra"])
def test_the_archive_preview_keeps_its_cursor_in_its_box_walking_both_ways(
platform_name: str,
) -> None:
@@ -689,11 +689,11 @@ def test_the_archive_preview_keeps_its_cursor_in_its_box_walking_both_ways(
from meshterm.core.contact_score import ContactSignals, ScoredContact
from meshterm.core.models import Contact
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
from meshterm.ui.sweep_screen import _preview_screen
from meshterm.ui.tui.frame import compose_dialog
platform = {"regular": REGULAR, "picocalc": PICOCALC}[platform_name]
platform = {"regular": REGULAR, "picocalc-lyra": PICOCALC_LYRA}[platform_name]
set_platform(platform)
def scored(index: int) -> ScoredContact:
+4 -4
View File
@@ -149,7 +149,7 @@ def test_states_the_facts_a_bug_report_opens_with(ctx: AppContext) -> None:
assert values["install"] in {"frozen", "source", "package"}
assert values["os"] and values["python"] and values["arch"]
assert "x" in values["terminal_size"]
assert values["platform"] in {"regular", "picocalc"}
assert values["platform"] in {"regular", "picocalc-lyra"}
# The simulator answers like a radio, so the device half is populated rather than
# skipped: this is the shape a real connected run produces.
assert values["connected"] is True
@@ -231,9 +231,9 @@ def test_the_save_is_advertised_on_both_platforms(ctx: AppContext) -> None:
page = _page(ctx)
assert f"{SAVE_KEY} save" in page.footer_hint
assert page.footer_hint.endswith("Esc back")
assert page.picocalc_lane[2] is not None
assert page.picocalc_lane[2].label == "Save"
assert page.picocalc_lane[2].action == SAVE_ACTION
assert page.picocalc_lyra_lane[2] is not None
assert page.picocalc_lyra_lane[2].label == "Save"
assert page.picocalc_lyra_lane[2].action == SAVE_ACTION
# --- saving it ------------------------------------------------------------------------
+21 -13
View File
@@ -8,8 +8,8 @@ Each entry below builds one full-screen :class:`~meshterm.ui.tui.screen.Screen`
hand-built (simulator-shaped) data — the same "fake session, real screen" approach every
individual screen's own test file already uses — then renders it, both directly
(``render_body``) and through the real frame compositor (``compose_base``), at REGULAR's
72x24, at PICOCALC's two live/lux row counts (53x26, the actual on-device floor; 53x40,
the boot-font/6x8-font-B case), and at the CARDPUTER's 53x14. No rendered line may exceed
72x24, at PICOCALC_LYRA's two live/lux row counts (53x26, the actual on-device floor; 53x40,
the boot-font/6x8-font-B case), and at the CARDPUTER_ZERO's 53x14. No rendered line may exceed
its terminal's width.
This is the platform-parity harness the PicoCalc work was built around: a
@@ -58,7 +58,14 @@ from meshterm.core.regions import frame_scope, region_key, scope_body, transport
from meshterm.core.remote_store import CachedValue
from meshterm.core.watch_store import WatchStore
from meshterm.persistence.repository import DiscoveredPath
from meshterm.platforms import CARDPUTER, PICOCALC, REGULAR, Platform, get_platform, set_platform
from meshterm.platforms import (
CARDPUTER_ZERO,
PICOCALC_LYRA,
REGULAR,
Platform,
get_platform,
set_platform,
)
from meshterm.services.courier import CourierService
from meshterm.services.message_paths import Arrival
from meshterm.services.monitor_service import ACTIVITY_BUCKETS
@@ -1518,16 +1525,16 @@ _ENTRIES: list[_Entry] = [
#: judged worklist, not an xfail list (see the port's logbook).
_COMBOS: list[tuple[Platform, int, int]] = [
(REGULAR, REGULAR.readable_cols, REGULAR.readable_rows),
(PICOCALC, PICOCALC.readable_cols, PICOCALC.readable_rows),
(PICOCALC, PICOCALC.readable_cols, 40),
(CARDPUTER, CARDPUTER.readable_cols, CARDPUTER.readable_rows),
(PICOCALC_LYRA, PICOCALC_LYRA.readable_cols, PICOCALC_LYRA.readable_rows),
(PICOCALC_LYRA, PICOCALC_LYRA.readable_cols, 40),
(CARDPUTER_ZERO, CARDPUTER_ZERO.readable_cols, CARDPUTER_ZERO.readable_rows),
]
#: Entries that overflow PICOCALC's 53 columns today (a width overflow doesn't depend on
#: row count, so one entry here covers both picocalc combos). P6 emptied it — the whole
#: Entries that overflow PICOCALC_LYRA's 53 columns today (a width overflow doesn't depend on
#: row count, so one entry here covers both picocalc-lyra combos). P6 emptied it — the whole
#: P1 worklist graduated once the F-key lane replaced the per-screen hint strings and the
#: path composer's wrapped empty-state note stopped smuggling a newline into one row —
#: so every picocalc case is now a hard gate. A new screen that can't fit 53 goes here
#: so every picocalc-lyra case is now a hard gate. A new screen that can't fit 53 goes here
#: only with a ticket, never to stay.
_KNOWN_WIDE: set[str] = set()
@@ -1549,12 +1556,13 @@ def _cases():
for platform, cols, rows in _COMBOS:
case_id = f"{entry.name}-{platform.name}-{cols}x{rows}"
marks = []
if platform.name == "picocalc" and entry.name in _KNOWN_WIDE:
if platform.name == "picocalc-lyra" and entry.name in _KNOWN_WIDE:
marks.append(
pytest.mark.xfail(
reason=(
f"{entry.name} overflows picocalc's {PICOCALC.readable_cols} cols "
"today -- see _KNOWN_WIDE, the width-reduction worklist"
f"{entry.name} overflows picocalc-lyra's "
f"{PICOCALC_LYRA.readable_cols} cols today -- see _KNOWN_WIDE, "
"the width-reduction worklist"
),
strict=False,
)
@@ -1624,7 +1632,7 @@ def test_gallery_screen_fits_its_platform(
assert line.strip() != "Back", f"{entry.name}: an exit row came back: {line!r}"
# P3 assertions, on the *rendered ANSI* (the theme/fold contracts, not the config):
# picocalc output may carry no truecolor or 256-colour SGR (the console has 16 slots,
# picocalc-lyra output may carry no truecolor or 256-colour SGR (the console has 16 slots,
# addressed as plain 30-37/90-97/40-47 codes), and no character outside the 512-glyph
# console font. Together these are the parity gate that catches a stray emoji or hex
# colour the moment a screen grows one, instead of as tofu found on-device.
+41 -39
View File
@@ -6,15 +6,15 @@ from __future__ import annotations
from prompt_toolkit.keys import Keys
from rich.cells import cell_len
from meshterm.platforms import CARDPUTER, PICOCALC, REGULAR, resolve, set_platform
from meshterm.platforms import CARDPUTER_ZERO, PICOCALC_LYRA, REGULAR, resolve, set_platform
from meshterm.services import modifier_watch
from meshterm.ui.tui import session
from meshterm.ui.tui.fkeys import (
CARDPUTER_DECK,
CARDPUTER_ZERO_DECK,
DECKS,
DEFAULT_LANE,
EMPTY_LANE,
PICOCALC_DECK,
PICOCALC_LYRA_DECK,
FPair,
active_deck,
)
@@ -25,37 +25,39 @@ class _OwnCardputerLane(ScrollScreen):
"""A screen that has decided its Cardputer lane for itself."""
@property
def cardputer_lane(self):
def cardputer_zero_lane(self):
return (FPair("Mine", "mine"), None, None, None, None)
def test_every_handheld_names_a_deck_of_its_own() -> None:
"""A platform with a lane names a deck that exists; the desktop names none."""
assert PICOCALC.lane_deck == "picocalc" and CARDPUTER.lane_deck == "cardputer"
assert all(DECKS[p.lane_deck].name == p.lane_deck for p in (PICOCALC, CARDPUTER))
assert (
PICOCALC_LYRA.lane_deck == "picocalc-lyra" and CARDPUTER_ZERO.lane_deck == "cardputer-zero"
)
assert all(DECKS[p.lane_deck].name == p.lane_deck for p in (PICOCALC_LYRA, CARDPUTER_ZERO))
assert REGULAR.lane_deck == "" and not REGULAR.footer_fkeys
assert PICOCALC.footer_fkeys and CARDPUTER.footer_fkeys
assert PICOCALC_LYRA.footer_fkeys and CARDPUTER_ZERO.footer_fkeys
def test_the_active_deck_follows_the_platform() -> None:
"""The deck is bound at platform-switch time, never looked up per frame."""
assert active_deck() is None
set_platform(PICOCALC)
assert active_deck() is PICOCALC_DECK
set_platform(CARDPUTER)
assert active_deck() is CARDPUTER_DECK
set_platform(PICOCALC_LYRA)
assert active_deck() is PICOCALC_LYRA_DECK
set_platform(CARDPUTER_ZERO)
assert active_deck() is CARDPUTER_ZERO_DECK
def test_the_cardputer_deals_the_picocalc_lanes_until_a_screen_says_otherwise() -> None:
"""JP, 2026-09-30: same entries for now, and each platform reads its own definition."""
screen = ScrollScreen("body")
assert screen.cardputer_lane == screen.picocalc_lane
assert screen.cardputer_zero_lane == screen.picocalc_lyra_lane
own = _OwnCardputerLane("body")
set_platform(CARDPUTER)
set_platform(CARDPUTER_ZERO)
assert own.fkey_lane[0].label == "Mine"
set_platform(PICOCALC)
assert own.fkey_lane == own.picocalc_lane # the PicoCalc never sees the Cardputer's choice
set_platform(PICOCALC_LYRA)
assert own.fkey_lane == own.picocalc_lyra_lane # the PicoCalc never sees the Cardputer's choice
set_platform(REGULAR)
assert own.fkey_lane == EMPTY_LANE # no lane on the desktop
@@ -63,16 +65,16 @@ def test_the_cardputer_deals_the_picocalc_lanes_until_a_screen_says_otherwise()
def test_cardputer_keys_are_fn_4_to_8_with_their_shift_bank() -> None:
"""Fn+4..8 arrive as F4-F8, Shift with them as F16-F20; nothing else is the lane's."""
lane = DEFAULT_LANE
assert CARDPUTER_DECK.action_for(lane, 7) == "pagedown"
assert CARDPUTER_DECK.action_for(lane, 8) == "pageup"
assert CARDPUTER_DECK.action_for(lane, 19) == "end"
assert CARDPUTER_DECK.action_for(lane, 20) == "home"
assert all(CARDPUTER_DECK.action_for(lane, n) is None for n in (1, 2, 3, 9, 10, 11, 12))
assert CARDPUTER_DECK.is_shift_key(16) and not CARDPUTER_DECK.is_shift_key(6)
assert CARDPUTER_ZERO_DECK.action_for(lane, 7) == "pagedown"
assert CARDPUTER_ZERO_DECK.action_for(lane, 8) == "pageup"
assert CARDPUTER_ZERO_DECK.action_for(lane, 19) == "end"
assert CARDPUTER_ZERO_DECK.action_for(lane, 20) == "home"
assert all(CARDPUTER_ZERO_DECK.action_for(lane, n) is None for n in (1, 2, 3, 9, 10, 11, 12))
assert CARDPUTER_ZERO_DECK.is_shift_key(16) and not CARDPUTER_ZERO_DECK.is_shift_key(6)
# The same lane on the PicoCalc's own keys, untouched by the Cardputer's.
assert PICOCALC_DECK.action_for(lane, 4) == "pagedown"
assert PICOCALC_DECK.action_for(lane, 10) == "home"
assert PICOCALC_DECK.action_for(lane, 16) is None
assert PICOCALC_LYRA_DECK.action_for(lane, 4) == "pagedown"
assert PICOCALC_LYRA_DECK.action_for(lane, 10) == "home"
assert PICOCALC_LYRA_DECK.action_for(lane, 16) is None
def test_the_session_binds_every_key_a_deck_can_use() -> None:
@@ -84,39 +86,39 @@ def test_the_session_binds_every_key_a_deck_can_use() -> None:
def test_cardputer_chips_are_laid_out_as_the_picocalcs() -> None:
"""The PicoCalc's chips — caption, 9-cell width, 2-cell gaps — under the Cardputer's keys."""
assert CARDPUTER_DECK.columns == PICOCALC_DECK.columns
assert CARDPUTER_DECK.chip_width == PICOCALC_DECK.chip_width
assert CARDPUTER_ZERO_DECK.columns == PICOCALC_LYRA_DECK.columns
assert CARDPUTER_ZERO_DECK.chip_width == PICOCALC_LYRA_DECK.chip_width
lane = (FPair("Region", "home"), FPair("You", "locate", enabled=False), None, *DEFAULT_LANE[3:])
row = CARDPUTER_DECK.lane_text(lane)
assert cell_len(row.plain) == CARDPUTER.readable_cols
chips = [row.plain[c : c + CARDPUTER_DECK.chip_width] for c in CARDPUTER_DECK.columns]
row = CARDPUTER_ZERO_DECK.lane_text(lane)
assert cell_len(row.plain) == CARDPUTER_ZERO.readable_cols
chips = [row.plain[c : c + CARDPUTER_ZERO_DECK.chip_width] for c in CARDPUTER_ZERO_DECK.columns]
assert chips == ["F4 Region", "F5 You ", "F6 ", "F7 Page ↓", "F8 Page ↑"]
styles = {row.plain[s.start : s.end].strip(): str(s.style) for s in row.spans}
assert styles["F4 Region"] == "fkey.chip.cardputer"
assert styles["F4 Region"] == "fkey.chip.cardputer_zero"
assert styles["F5 You"] == "muted" and styles["F6"] == "muted"
def test_cardputer_shift_bank_draws_in_its_own_fill() -> None:
"""Shifted, the companions show in the Shift fill under the same keys' captions."""
row = CARDPUTER_DECK.lane_text(DEFAULT_LANE, shifted=True)
row = CARDPUTER_ZERO_DECK.lane_text(DEFAULT_LANE, shifted=True)
styles = {row.plain[s.start : s.end].strip(): str(s.style) for s in row.spans}
assert styles["F7 Bottom"] == "fkey.chip.cardputer.shift"
assert styles["F8 Top"] == "fkey.chip.cardputer.shift"
assert styles["F7 Bottom"] == "fkey.chip.cardputer_zero.shift"
assert styles["F8 Top"] == "fkey.chip.cardputer_zero.shift"
assert styles["F4"] == "muted"
def test_the_picocalc_row_is_unchanged() -> None:
"""Five captioned 9-cell chips with 2-cell gaps: exactly the console's 53 columns."""
row = PICOCALC_DECK.lane_text(DEFAULT_LANE)
assert cell_len(row.plain) == PICOCALC.readable_cols
row = PICOCALC_LYRA_DECK.lane_text(DEFAULT_LANE)
assert cell_len(row.plain) == PICOCALC_LYRA.readable_cols
assert row.plain.startswith("F1 ")
assert row.plain.endswith("F5 Page ↑")
def test_the_platform_resolves_by_name() -> None:
"""Chosen by flag or environment only: no device-tree model is known for it yet."""
assert resolve("cardputer").platform is CARDPUTER
assert CARDPUTER.readable_cols == 53 and CARDPUTER.readable_rows == 14
assert resolve("cardputer-zero").platform is CARDPUTER_ZERO
assert CARDPUTER_ZERO.readable_cols == 53 and CARDPUTER_ZERO.readable_rows == 14
def test_the_shift_watcher_looks_for_the_platforms_keyboard(tmp_path, monkeypatch) -> None:
@@ -126,5 +128,5 @@ def test_the_shift_watcher_looks_for_the_platforms_keyboard(tmp_path, monkeypatc
device.mkdir(parents=True)
(device / "name").write_text(f"{name}\n")
monkeypatch.setattr(modifier_watch, "_SYS_INPUT", tmp_path)
assert modifier_watch._find_keyboard(CARDPUTER.modifier_watch).name == "event1"
assert modifier_watch._find_keyboard(PICOCALC.modifier_watch) is None
assert modifier_watch._find_keyboard(CARDPUTER_ZERO.modifier_watch).name == "event1"
assert modifier_watch._find_keyboard(PICOCALC_LYRA.modifier_watch) is None
+3 -3
View File
@@ -473,7 +473,7 @@ def _words_start(row: str) -> int:
return cell_len(row[: next(i for i, ch in enumerate(row) if ch.isalnum())])
@pytest.mark.parametrize("platform_name", ["regular", "picocalc"])
@pytest.mark.parametrize("platform_name", ["regular", "picocalc-lyra"])
def test_every_action_row_starts_its_words_in_one_cell_in_both_modes(platform_name: str) -> None:
"""Every action the screen can draw, in either mode, lit or not, shares one word column.
@@ -489,10 +489,10 @@ def test_every_action_row_starts_its_words_in_one_cell_in_both_modes(platform_na
how a two-cell icon lands in a one-cell column. On the PicoCalc the lane is dropped
whole, so every word starts straight after the pointer.
"""
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
from meshterm.ui.trace_screen import _ACTION_ICONS
platform = {"regular": REGULAR, "picocalc": PICOCALC}[platform_name]
platform = {"regular": REGULAR, "picocalc-lyra": PICOCALC_LYRA}[platform_name]
set_platform(platform)
starts: set[int] = set()
marks: set[str] = set()
+22 -22
View File
@@ -1554,10 +1554,10 @@ def test_map_fkey_lane_names_its_three_destinations_and_the_zoom() -> None:
"""The map repurposes the nav keys, so its lane labels them — and offers no dead key."""
from meshterm.ui.map_render import MapMarker
from meshterm.ui.map_screen import MapScreen
from meshterm.ui.tui.fkeys import PICOCALC_DECK
from meshterm.ui.tui.fkeys import PICOCALC_LYRA_DECK
screen = MapScreen(_StubSession(80, 24), [MapMarker("A", 45.5, -73.6)], _StubSource(), 14)
lane = screen.picocalc_lane
lane = screen.picocalc_lyra_lane
# PgUp/PgDn zoom here and Home reframes — the shared paging labels would all be lies,
# and "end" is bound to nothing at all, so no jump rides the zoom rocker's Shift bank.
@@ -1570,20 +1570,20 @@ def test_map_fkey_lane_names_its_three_destinations_and_the_zoom() -> None:
"Zoom +",
]
assert (
PICOCALC_DECK.action_for(lane, 1) == "home"
and PICOCALC_DECK.action_for(lane, 5) == "pageup"
PICOCALC_LYRA_DECK.action_for(lane, 1) == "home"
and PICOCALC_LYRA_DECK.action_for(lane, 5) == "pageup"
)
assert (
PICOCALC_DECK.action_for(lane, 2) == "locate"
and PICOCALC_DECK.action_for(lane, 3) == "frame"
PICOCALC_LYRA_DECK.action_for(lane, 2) == "locate"
and PICOCALC_LYRA_DECK.action_for(lane, 3) == "frame"
)
# Two slots carry a Shift half along their own axis: You + homes in on us zoomed,
# Clear drops the find query. The other three Shift keys stay unbound.
assert (
PICOCALC_DECK.action_for(lane, 7) == "locate_zoom"
and PICOCALC_DECK.action_for(lane, 8) == "clear_find"
PICOCALC_LYRA_DECK.action_for(lane, 7) == "locate_zoom"
and PICOCALC_LYRA_DECK.action_for(lane, 8) == "clear_find"
)
assert all(PICOCALC_DECK.action_for(lane, n) is None for n in (6, 9, 10))
assert all(PICOCALC_LYRA_DECK.action_for(lane, n) is None for n in (6, 9, 10))
# Region and the zoom always act; the other two only where they'd land somewhere —
# and each Shift half gates with its own axis (no self marker, no query typed).
assert [pair.enabled for pair in lane] == [True, False, False, True, True]
@@ -1605,7 +1605,7 @@ def test_map_locate_recenters_on_our_own_node_at_the_current_zoom() -> None:
zoom = screen._viewport.zoom
screen.handle("left") # and pan away from wherever we are
assert screen.picocalc_lane[1].enabled is True # we're on the map, so You can act
assert screen.picocalc_lyra_lane[1].enabled is True # we're on the map, so You can act
screen.handle("locate")
assert screen._viewport.center_lat == pytest.approx(45.40)
assert screen._viewport.center_lon == pytest.approx(-73.50)
@@ -1616,12 +1616,12 @@ def test_map_locate_recenters_on_our_own_node_at_the_current_zoom() -> None:
away.render_body(80)
before = away._viewport
away.handle("locate")
assert away.picocalc_lane[1].enabled is False and away._viewport is before
assert away.picocalc_lyra_lane[1].enabled is False and away._viewport is before
def test_map_echoes_the_find_query_in_the_body_only_where_the_footer_is_gone() -> None:
"""The PicoCalc draws no hint line, so the query it carries moves into the body."""
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
from meshterm.ui.attribution import CREDIT_SHORT
from meshterm.ui.map_render import MapMarker
from meshterm.ui.map_screen import MapScreen
@@ -1639,7 +1639,7 @@ def test_map_echoes_the_find_query_in_the_body_only_where_the_footer_is_gone() -
assert len(desktop.render_body(72)) == 20
assert "find: hil" in desktop.footer_hint
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
device = MapScreen(_StubSession(53, 23), markers, _StubSource(), 14)
assert len(device.render_body(53)) == 23
for ch in "hil":
@@ -1700,18 +1700,18 @@ def test_map_frame_chip_lights_only_with_matches_to_frame() -> None:
screen.render_body(80)
before = screen._viewport
screen.handle("frame") # no query typed: nothing to frame, so nothing moves
assert screen.picocalc_lane[2].enabled is False and screen._viewport is before
assert screen.picocalc_lyra_lane[2].enabled is False and screen._viewport is before
for ch in "ali":
screen.handle("text", ch)
assert screen.picocalc_lane[2].enabled is True
assert screen.picocalc_lyra_lane[2].enabled is True
screen.handle("frame")
assert screen._viewport.center_lat == pytest.approx(45.40)
# A query nothing matches has no extent either — the chip goes back to dim.
for ch in "zzz":
screen.handle("text", ch)
assert screen._matches() == [] and screen.picocalc_lane[2].enabled is False
assert screen._matches() == [] and screen.picocalc_lyra_lane[2].enabled is False
def test_map_screen_find_filters_frames_and_clears() -> None:
@@ -2704,10 +2704,10 @@ def _mark(screen: MapScreen, cols: int = 80) -> str:
def _both_platforms():
"""The two platforms, restoring REGULAR afterwards — the credit differs across them."""
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
try:
for platform in (REGULAR, PICOCALC):
for platform in (REGULAR, PICOCALC_LYRA):
set_platform(platform)
yield platform
finally:
@@ -2757,11 +2757,11 @@ def test_a_bordered_frame_sets_the_credit_in_its_bottom_rule_and_spares_the_draw
def test_a_frame_with_no_bottom_rule_stamps_the_drawing_instead() -> None:
"""The PicoCalc has a title bar and an F-key lane, and no rule to set a caption into."""
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
from meshterm.ui import attribution
try:
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
screen = _credited_map(53)
assert screen.bottom_caption == "" # nowhere to put it but the map
assert _last_row(screen, 53).endswith(attribution.CREDIT_FULL)
@@ -2823,11 +2823,11 @@ def test_the_bottom_rule_keeps_its_clip_arrows_when_a_caption_shares_it() -> Non
def test_the_find_query_and_the_credit_share_the_row_with_the_credit_kept_whole() -> None:
"""Where the F-key lane replaces the hint, the echo yields its right end to the credit."""
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
from meshterm.ui import attribution
try:
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
screen = _credited_map(53)
screen.render_body(53) # keys do nothing until the map has a viewport to move
screen.handle("right")
+5 -5
View File
@@ -16,7 +16,7 @@ from rich.cells import cell_len
from rich.padding import Padding
from rich.text import Text
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
from meshterm.ui.fontset import FONT_CODEPOINTS
from meshterm.ui.markdown import MarkdownDoc, render_markdown
from meshterm.ui.tui.render import render_lines
@@ -45,7 +45,7 @@ maps and a ~~telepathic~~ courier queue over the top.
> Nothing here transmits without being asked.
```
meshterm --mock --platform picocalc
meshterm --mock --platform picocalc-lyra
```
| Platform | Cols | Colours |
@@ -300,14 +300,14 @@ def test_every_construct_survives_the_picocalc() -> None:
every construct a page *could* grow, so a table or a code fence added to one of them
is a known quantity rather than tofu found on-device.
"""
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
try:
rendered = render_lines(render_markdown(KITCHEN_SINK), PICOCALC.readable_cols)
rendered = render_lines(render_markdown(KITCHEN_SINK), PICOCALC_LYRA.readable_cols)
finally:
set_platform(REGULAR)
for index, line in enumerate(rendered):
assert cell_len(plain(line)) <= PICOCALC.readable_cols, (index, line)
assert cell_len(plain(line)) <= PICOCALC_LYRA.readable_cols, (index, line)
assert "[38;2;" not in line and "[38;5;" not in line, (index, line)
strays = {ch for ch in plain(line) if ord(ch) >= 0x20 and ord(ch) not in FONT_CODEPOINTS}
assert not strays, (index, sorted(strays), line)
+6 -6
View File
@@ -17,7 +17,7 @@ from types import SimpleNamespace
import pytest
from rich.cells import cell_len
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
from meshterm.tools import all_tools, load_all_tools
from meshterm.ui import menu
from meshterm.ui.tui import Choice
@@ -38,9 +38,9 @@ def tools() -> list:
@pytest.fixture
def picocalc() -> Iterator[None]:
def picocalc_lyra() -> Iterator[None]:
"""Run a test on the PicoCalc platform, restoring the regular one afterwards."""
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
try:
yield
finally:
@@ -114,7 +114,7 @@ def test_the_quit_mark_is_measured_into_the_column(monkeypatch: pytest.MonkeyPat
assert set(starts.values()) == {cell_len(_WIDE) + 1}
@pytest.mark.usefixtures("picocalc")
@pytest.mark.usefixtures("picocalc_lyra")
def test_no_icon_lane_leaves_the_bare_word_flush_with_the_titles(tools: list) -> None:
"""No icon lane on the PicoCalc: the row is just *Quit*, with no padding left behind."""
items = menu._menu_items(tools)
@@ -144,6 +144,6 @@ def test_the_quit_confirm_keeps_the_chip_that_asked(monkeypatch: pytest.MonkeyPa
monkeypatch.setattr(menu, "_can_unpair", no_bond)
assert asyncio.run(menu._confirm_quit(SimpleNamespace(), Session())) is False
assert asked["lane"][2].label == "Quit!"
assert fkeys.PICOCALC_DECK.action_for(asked["lane"], 3) == "quit" # F3
assert fkeys.CARDPUTER_DECK.action_for(asked["lane"], 6) == "quit" # Fn+6, its middle chip
assert fkeys.PICOCALC_LYRA_DECK.action_for(asked["lane"], 3) == "quit" # F3
assert fkeys.CARDPUTER_ZERO_DECK.action_for(asked["lane"], 6) == "quit" # Fn+6, its middle chip
assert [slot for i, slot in enumerate(asked["lane"]) if i != 2] == [None] * 4
+4 -4
View File
@@ -344,9 +344,9 @@ def test_menu_rows_line_up_mixed_icon_widths_without_being_told() -> None:
def test_align_icons_pads_nothing_where_the_platform_draws_no_icons() -> None:
"""No icon lane: the icons go, and no padding is left standing in their place."""
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
try:
labels = align_icons([f"{_NARROW} Archive contacts…", f"{_WIDE} View archived"])
assert [_plain(label) for label in labels] == ["Archive contacts…", "View archived"]
@@ -390,9 +390,9 @@ def test_an_iconless_platform_collapses_the_column_and_keeps_the_tint(
A destructive row announces itself by its red mark; drop the mark and the claim has to
land somewhere, or a delete reads like any other action.
"""
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
try:
assert icon_lane((_NARROW, _WIDE)) == 0
assert icon_mark(_NARROW, "err", 0).plain == ""
+6 -6
View File
@@ -974,16 +974,16 @@ def test_the_main_menu_lane_puts_the_way_out_on_f3() -> None:
"""``Quit?`` on F3 asks; its Shift half, F8, is ``Quit!``, which doesn't."""
from meshterm.ui.menu import _MainMenu
from meshterm.ui.menus import section_heading
from meshterm.ui.tui.fkeys import PICOCALC_DECK
from meshterm.ui.tui.fkeys import PICOCALC_LYRA_DECK
menu = _MainMenu(
"menu",
[section_heading("A"), Choice("alpha", 1), section_heading("B"), Choice("beta", 2)],
)
lane = menu.picocalc_lane
lane = menu.picocalc_lyra_lane
assert (lane[2].label, lane[2].opp_label) == ("Quit?", "Quit!")
assert PICOCALC_DECK.action_for(lane, 3) == "quit"
assert PICOCALC_DECK.action_for(lane, 8) == "quit_now"
assert PICOCALC_LYRA_DECK.action_for(lane, 3) == "quit"
assert PICOCALC_LYRA_DECK.action_for(lane, 8) == "quit_now"
assert lane[0].label == "Sect ↑", "the section jumps keep F1/F2"
@@ -1250,10 +1250,10 @@ async def test_the_chip_that_asked_to_quit_leaves_when_pressed_again() -> None:
The confirm's lane carries ``Quit!`` on the slot the menu's ``Quit?`` sat on, sending
the same ``quit`` — which, with the question up, is the leaving, as a second ^Q is.
"""
from meshterm.platforms import PICOCALC, set_platform
from meshterm.platforms import PICOCALC_LYRA, set_platform
from meshterm.ui.tui.fkeys import EMPTY_LANE, FPair
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
lane = list(EMPTY_LANE)
lane[2] = FPair("Quit!", "quit")
with create_pipe_input() as inp:
+11 -11
View File
@@ -675,7 +675,7 @@ def test_the_remove_row_is_tinted_and_keeps_its_tint_where_the_icon_lane_goes()
"""
import re
from meshterm.platforms import PICOCALC, set_platform
from meshterm.platforms import PICOCALC_LYRA, set_platform
remove = _Action("remove", "🗑", "err", "Remove contact…")
screen = _screen(info_actions=[remove])
@@ -683,7 +683,7 @@ def test_the_remove_row_is_tinted_and_keeps_its_tint_where_the_icon_lane_goes()
line = screen._action_line(remove, selected=False, width=40)
assert "🗑" in line and "Remove contact…" in _plain([line])
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
screen = _screen(info_actions=[remove])
screen.note_viewport(30)
folded = screen._action_line(remove, selected=False, width=40)
@@ -820,7 +820,7 @@ def test_node_detail_routes_stage_spends_the_caption_and_top_air_on_the_fan() ->
The graph's own end padding leaves a whole empty canvas row above its topmost label; the
stage draws one row over its ceiling and peels that row off, so the peel pays for itself.
"""
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
# A fan busy enough that the row ceiling — not its own ideal height — is what sizes it,
# so the reclaimed rows show up as lanes rather than as slack.
@@ -849,7 +849,7 @@ def test_node_detail_routes_stage_spends_the_caption_and_top_air_on_the_fan() ->
)
return [_plain([ln]) for ln in lines[strip_idx + 2 : rule_idx]] # past the strip's own rule
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
pico = _stage(22)
assert pico[0].strip(), "no blank row between the tab strip and the fan"
assert not any("selected route" in line for line in pico), "the caption is dropped"
@@ -895,10 +895,10 @@ def test_a_short_frame_wears_the_identity_in_the_title_bar() -> None:
under the bar that said the same would only say it twice (JP, 2026-10-04). A tall
frame keeps both as they were.
"""
from meshterm.platforms import CARDPUTER, set_platform
from meshterm.platforms import CARDPUTER_ZERO, set_platform
from meshterm.ui.tui import frame
set_platform(CARDPUTER)
set_platform(CARDPUTER_ZERO)
screen = _screen(mark=_mark())
screen.note_viewport(12) # the Cardputer's body, under the bar and over the lane
body = _plain(screen.render_body(53))
@@ -928,9 +928,9 @@ def test_a_short_frame_gives_the_route_graph_the_rows_it_freed() -> None:
Between the tab strip and the route list there is nothing but the fan, which takes
every row the list's guaranteed window leaves it.
"""
from meshterm.platforms import CARDPUTER, set_platform
from meshterm.platforms import CARDPUTER_ZERO, set_platform
set_platform(CARDPUTER)
set_platform(CARDPUTER_ZERO)
screen = _screen(mark=_mark(), routes=_busy_routes())
screen.handle("tab") # onto Routes
screen.note_viewport(12)
@@ -1344,12 +1344,12 @@ def test_node_detail_screen_tabs_switch_the_stage() -> None:
assert screen.consume_edge_scrub() == 2
# The F-key chip names where the switch would take you, so it flips with the stage.
assert screen.picocalc_lane[2].label == "Routes"
assert screen.picocalc_lyra_lane[2].label == "Routes"
screen.handle("tab") # switch to the Routes tab
body = _plain(screen.render_body(72))
assert "│ Routes │" in body and "no route observed yet" in body
assert screen.consume_edge_scrub() == 0 # the braille preview isn't showing now
assert screen.picocalc_lane[2].label == "Info"
assert screen.picocalc_lyra_lane[2].label == "Info"
def test_node_detail_single_tab_hides_the_switch_hint() -> None:
@@ -1358,7 +1358,7 @@ def test_node_detail_single_tab_hides_the_switch_hint() -> None:
assert "←→ tab" not in screen.footer_hint
assert "↑↓ move" in screen.footer_hint and screen.footer_hint.endswith("Esc back")
# Nothing to switch to, so the lane leaves the slot empty rather than dimming it.
assert screen.picocalc_lane[2] is None
assert screen.picocalc_lyra_lane[2] is None
def test_toggling_the_lock_rewrites_the_rows_and_keeps_the_cursor_on_it() -> None:
+8 -8
View File
@@ -128,16 +128,16 @@ def test_packet_viewer_lane_names_the_ends_of_the_list_not_the_body() -> None:
lone = PacketViewer([old], 0, resolve=lambda h: "")
lone.note_metrics(4, 20) # a short body in a roomy box: nothing to page either
assert [pair.opp_label for pair in lone.picocalc_lane[3:]] == ["Oldest", "Newest"]
assert not any(pair.enabled or pair.opp_enabled for pair in lone.picocalc_lane[3:])
assert [pair.opp_label for pair in lone.picocalc_lyra_lane[3:]] == ["Oldest", "Newest"]
assert not any(pair.enabled or pair.opp_enabled for pair in lone.picocalc_lyra_lane[3:])
# A second packet lights the jumps on their own — the pager still needs a tall body.
pair_view = PacketViewer([newer, old], 0, resolve=lambda h: "")
pair_view.note_metrics(4, 20)
assert [pair.opp_enabled for pair in pair_view.picocalc_lane[3:]] == [True, True]
assert [pair.enabled for pair in pair_view.picocalc_lane[3:]] == [False, False]
assert [pair.opp_enabled for pair in pair_view.picocalc_lyra_lane[3:]] == [True, True]
assert [pair.enabled for pair in pair_view.picocalc_lyra_lane[3:]] == [False, False]
pair_view.note_metrics(80, 20)
assert [pair.enabled for pair in pair_view.picocalc_lane[3:]] == [True, True]
assert [pair.enabled for pair in pair_view.picocalc_lyra_lane[3:]] == [True, True]
def test_packet_viewer_follows_the_stream_off_the_top_of_a_live_list() -> None:
@@ -203,7 +203,7 @@ def test_packet_viewer_home_resumes_the_stream() -> None:
lone = PacketViewer(feed[:1], 0, resolve=lambda h: "", source=lambda: feed[:1])
lone.note_metrics(4, 20) # a short body in a roomy box: nothing to page
assert [pair.opp_enabled for pair in lone.picocalc_lane[3:]] == [True, True]
assert [pair.opp_enabled for pair in lone.picocalc_lyra_lane[3:]] == [True, True]
def test_packet_viewer_without_a_source_stays_a_snapshot() -> None:
@@ -456,11 +456,11 @@ def test_packet_viewer_reception_row_keeps_rssi_on_one_line() -> None:
misses the roomy `` · `` by exactly its padding — and folding puts the bare word
``rssi`` on a line of its own.
"""
from meshterm.platforms import PICOCALC, REGULAR
from meshterm.platforms import PICOCALC_LYRA, REGULAR
from meshterm.ui.tui.frame import _dialog_layout
entry = PacketEntry(when=utcnow(), kind="advert", node="3d63", snr=-13.5, rssi=-101.0)
for platform, cols in ((REGULAR, 72), (PICOCALC, PICOCALC.readable_cols)):
for platform, cols in ((REGULAR, 72), (PICOCALC_LYRA, PICOCALC_LYRA.readable_cols)):
set_platform(platform)
viewer = _viewer(entry)
_, _, _, body = _dialog_layout(viewer, cols, 26)
+11 -11
View File
@@ -23,7 +23,7 @@ from prompt_toolkit.data_structures import Size
from prompt_toolkit.output import DummyOutput
from meshterm.persistence import db
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
from meshterm.ui.tui.session import _has_wide_glyph
from meshterm.ui.tui.spinner import Spinner
@@ -139,20 +139,20 @@ def test_wide_glyph_scan_short_circuits_without_emoji() -> None:
"""A no-emoji console font has no wide glyph, so the per-frame scan can be skipped."""
waving = "hi \U0001f44b"
assert _has_wide_glyph(waving) is True
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
assert _has_wide_glyph(waving) is False
def test_spinner_cycle_follows_the_platform() -> None:
"""Braille where effects are on, the plain LINE cycle where they aren't."""
assert Spinner().frames == Spinner.BRAILLE
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
assert Spinner().frames == Spinner.LINE
def test_an_explicit_spinner_cycle_still_wins() -> None:
"""The platform supplies a *default*; a caller that names its frames keeps them."""
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
assert Spinner("ab").frames == "ab"
@@ -181,10 +181,10 @@ def test_battery_gauge_steps_the_sweep_at_the_platforms_own_cadence(monkeypatch)
out.append(_battery_segment(ctx).plain[0]) # type: ignore[arg-type]
return out
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
# A step per 2 s idle repaint: the sweep climbs, and does not alias across skipped frames.
assert len(set(_sweep(PICOCALC.tick_s))) == 5
assert len(set(_sweep(PICOCALC.tick_s / 2))) < 5 # half a tick apart, some frames repeat
assert len(set(_sweep(PICOCALC_LYRA.tick_s))) == 5
assert len(set(_sweep(PICOCALC_LYRA.tick_s / 2))) < 5 # half a tick apart, some frames repeat
set_platform(REGULAR)
assert len(set(_sweep(REGULAR.tick_s))) == 5
assert _battery_segment(ctx).plain.endswith("5%") # type: ignore[arg-type]
@@ -200,10 +200,10 @@ def test_idle_and_spin_cadences_are_slower_where_a_frame_is_dear() -> None:
"""
assert REGULAR.tick_s == 1.0
assert REGULAR.spinner_tick_s == 0.12
assert PICOCALC.tick_s > REGULAR.tick_s
assert PICOCALC_LYRA.tick_s > REGULAR.tick_s
# A frame costs ~110 ms at the taller 53x40 geometry; a spin cadence under that would
# queue repaints faster than they can finish.
assert PICOCALC.spinner_tick_s > 0.12
assert PICOCALC_LYRA.spinner_tick_s > 0.12
def test_spinner_interval_reads_the_active_platform() -> None:
@@ -211,8 +211,8 @@ def test_spinner_interval_reads_the_active_platform() -> None:
from meshterm.ui.tui.spinner import spinner_interval
assert spinner_interval() == REGULAR.spinner_tick_s
set_platform(PICOCALC)
assert spinner_interval() == PICOCALC.spinner_tick_s
set_platform(PICOCALC_LYRA)
assert spinner_interval() == PICOCALC_LYRA.spinner_tick_s
# --- the direct row-diff renderer ---------------------------------------------------
@@ -6,11 +6,11 @@ from __future__ import annotations
from rich.cells import cell_len
from rich.text import Text
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
from meshterm.ui.tui import frame
from meshterm.ui.tui.fkeys import (
DEFAULT_LANE,
PICOCALC_DECK,
PICOCALC_LYRA_DECK,
FPair,
default_lane,
strip_lane_atoms,
@@ -37,7 +37,7 @@ def test_borderless_frame_swaps_the_panel_for_a_title_bar() -> None:
It carries the rule, the title, and the clip arrow. No border column is spent, so the
body starts at column 0 and owns all 53 cells.
"""
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
composed = frame.compose_base(Text("hdr"), _screen(), "hint", 53, 26).split("\n")
assert len(composed) == 26
plain = [_plain(line) for line in composed]
@@ -180,7 +180,7 @@ def test_bordered_frame_is_unchanged_on_regular() -> None:
def test_picocalc_header_brands_the_app_not_the_device() -> None:
"""The PicoCalc header brands the app, not the device.
Per JP's spec for the ``header_atoms`` wiring: picocalc shows ``MeshTerm vX``,
Per JP's spec for the ``header_atoms`` wiring: picocalc-lyra shows ``MeshTerm vX``,
because a soldered radio's port never changes and so the device segment earns
nothing. Regular keeps both.
"""
@@ -198,11 +198,11 @@ def test_picocalc_header_brands_the_app_not_the_device() -> None:
chat = _Badges()
watchtower = _Badges()
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
text = "".join(seg.plain for seg in _header_segments(_Ctx(), {}))
assert "MeshTerm" in text
assert "simulator" not in text # the device atom is composed out
assert "pulse" in PICOCALC.header_atoms # the sparkline takes the remaining room
assert "pulse" in PICOCALC_LYRA.header_atoms # the sparkline takes the remaining room
set_platform(REGULAR)
text = "".join(seg.plain for seg in _header_segments(_Ctx(), {}))
assert "MeshTerm" in text and "simulator" in text
@@ -218,19 +218,19 @@ def test_fkey_lane_resolution_and_banks() -> None:
# F4/F5 (paging — no physical key at all) carry the pager, and each jump rides the
# Shift half of the very pager heading for it: Home behind Page ↑, End behind Page ↓.
assert (
PICOCALC_DECK.action_for(lane, 4) == "pagedown"
and PICOCALC_DECK.action_for(lane, 9) == "end"
PICOCALC_LYRA_DECK.action_for(lane, 4) == "pagedown"
and PICOCALC_LYRA_DECK.action_for(lane, 9) == "end"
)
assert (
PICOCALC_DECK.action_for(lane, 5) == "pageup"
and PICOCALC_DECK.action_for(lane, 10) == "home"
PICOCALC_LYRA_DECK.action_for(lane, 5) == "pageup"
and PICOCALC_LYRA_DECK.action_for(lane, 10) == "home"
)
# F1-F3 are free on every screen — the shared lane claims none of them.
for number in (1, 2, 3, 6, 7, 8):
assert PICOCALC_DECK.action_for(lane, number) is None
assert PICOCALC_LYRA_DECK.action_for(lane, number) is None
# Enter/Esc never occupy a slot — both keys are already close at hand.
assert "enter" not in {PICOCALC_DECK.action_for(lane, n) for n in range(1, 11)}
assert "escape" not in {PICOCALC_DECK.action_for(lane, n) for n in range(1, 11)}
assert "enter" not in {PICOCALC_LYRA_DECK.action_for(lane, n) for n in range(1, 11)}
assert "escape" not in {PICOCALC_LYRA_DECK.action_for(lane, n) for n in range(1, 11)}
def test_fkey_lane_text_fits_and_flips() -> None:
@@ -239,8 +239,8 @@ def test_fkey_lane_text_fits_and_flips() -> None:
The directional pair rises toward its outer key, and a free slot draws as a bare
key number rather than an empty gap.
"""
primary = PICOCALC_DECK.lane_text(DEFAULT_LANE)
shifted = PICOCALC_DECK.lane_text(DEFAULT_LANE, shifted=True)
primary = PICOCALC_LYRA_DECK.lane_text(DEFAULT_LANE)
shifted = PICOCALC_LYRA_DECK.lane_text(DEFAULT_LANE, shifted=True)
assert cell_len(primary.plain) == 53 and cell_len(shifted.plain) == 53
# A directional pair rises to the right: down/out left, up/in right — and each
# companion keeps its slot's end of that axis.
@@ -251,15 +251,15 @@ def test_fkey_lane_text_fits_and_flips() -> None:
assert f"F{number} " in primary.plain
assert f"F{number + 5} " in shifted.plain
wide = [FPair("Muchtoolonglabel", "a", "Muchtoolonglabel", "b")] * 5
assert cell_len(PICOCALC_DECK.lane_text(wide).plain) == 53 # clipped to the slot budget
assert cell_len(PICOCALC_DECK.lane_text(wide, shifted=True).plain) == 53
assert cell_len(PICOCALC_LYRA_DECK.lane_text(wide).plain) == 53 # clipped to the slot budget
assert cell_len(PICOCALC_LYRA_DECK.lane_text(wide, shifted=True).plain) == 53
def test_fkey_slot_dims_when_its_action_is_unavailable() -> None:
"""An unavailable slot keeps its label and drops its fill — it never offers a dead key."""
lane = [FPair("Paths", "paths", "Retry", "retry", enabled=False)] + [None] * 4
primary = PICOCALC_DECK.lane_text(lane)
shifted = PICOCALC_DECK.lane_text(lane, shifted=True)
primary = PICOCALC_LYRA_DECK.lane_text(lane)
shifted = PICOCALC_LYRA_DECK.lane_text(lane, shifted=True)
# The label survives: the lane still says what F1 is for, just not that it acts now.
assert "F1 Paths" in primary.plain and _slot_style(primary, 0) == "muted"
@@ -268,7 +268,7 @@ def test_fkey_slot_dims_when_its_action_is_unavailable() -> None:
# The row is still exactly the lane's width, dim chips and all.
assert cell_len(primary.plain) == 53 and cell_len(shifted.plain) == 53
# Dimming is presentational: the key still resolves, and the screen's handler no-ops.
assert PICOCALC_DECK.action_for(lane, 1) == "paths"
assert PICOCALC_LYRA_DECK.action_for(lane, 1) == "paths"
def test_default_lane_dims_every_nav_slot_when_nothing_moves() -> None:
@@ -278,24 +278,24 @@ def test_default_lane_dims_every_nav_slot_when_nothing_moves() -> None:
assert [pair.label for pair in dim if pair] == ["Page ↓", "Page ↑"]
assert not any(pair.enabled or pair.opp_enabled for pair in dim if pair)
row = PICOCALC_DECK.lane_text(dim)
row = PICOCALC_LYRA_DECK.lane_text(dim)
assert cell_len(row.plain) == 53 and "F4 Page ↓" in row.plain and "F5 Page ↑" in row.plain
assert {str(span.style) for span in row.spans} == {"muted"}
# Both banks dim together: the jump behind a dead pager is just as dead.
assert {str(span.style) for span in PICOCALC_DECK.lane_text(dim, shifted=True).spans} == {
assert {str(span.style) for span in PICOCALC_LYRA_DECK.lane_text(dim, shifted=True).spans} == {
"muted"
}
def test_lane_is_built_after_the_body_renders() -> None:
"""The frame defers the lane, so its gates read this paint's metrics, not the last one's."""
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
screen = _screen() # 40 body rows into a 23-row viewport: it overflows
seen: dict[str, bool] = {}
def build() -> Text:
seen["nav"] = all(pair.enabled for pair in screen.picocalc_lane if pair)
return PICOCALC_DECK.lane_text(screen.picocalc_lane)
seen["nav"] = all(pair.enabled for pair in screen.picocalc_lyra_lane if pair)
return PICOCALC_LYRA_DECK.lane_text(screen.picocalc_lyra_lane)
composed = frame.compose_base(Text("hdr"), screen, "hint", 53, 26, footer_lane=build)
@@ -307,9 +307,9 @@ def test_scroll_screen_lane_tracks_whether_its_body_overflows() -> None:
"""The result window's nav slots light only once there is something to scroll to."""
screen = _screen()
screen.note_metrics(4, 20) # the whole body fits the viewport
assert not any(pair.enabled for pair in screen.picocalc_lane if pair)
assert not any(pair.enabled for pair in screen.picocalc_lyra_lane if pair)
screen.note_metrics(80, 20) # taller than the viewport
assert all(pair.enabled for pair in screen.picocalc_lane if pair)
assert all(pair.enabled for pair in screen.picocalc_lyra_lane if pair)
def test_select_lane_promotes_the_section_jumps_only_where_there_are_sections() -> None:
@@ -319,8 +319,8 @@ def test_select_lane_promotes_the_section_jumps_only_where_there_are_sections()
flat = SelectScreen("Flat", [Choice("one", 1), Choice("two", 2)])
# No headings anywhere: sections are not a thing on this list, so the slots are empty
# rather than dim — and F1/F2 resolve to nothing at all.
assert flat.picocalc_lane[0] is None and flat.picocalc_lane[1] is None
assert PICOCALC_DECK.action_for(flat.picocalc_lane, 1) is None
assert flat.picocalc_lyra_lane[0] is None and flat.picocalc_lyra_lane[1] is None
assert PICOCALC_LYRA_DECK.action_for(flat.picocalc_lyra_lane, 1) is None
grouped = SelectScreen(
"Grouped",
@@ -332,12 +332,12 @@ def test_select_lane_promotes_the_section_jumps_only_where_there_are_sections()
Choice("gamma", 3),
],
)
lane = grouped.picocalc_lane
lane = grouped.picocalc_lyra_lane
assert [pair.label for pair in lane[:2]] == ["Sect ↑", "Sect ↓"]
# A pair rises toward its outer key: on this left-edge pair, up takes F1.
assert (
PICOCALC_DECK.action_for(lane, 1) == "ctrl_pageup"
and PICOCALC_DECK.action_for(lane, 2) == "ctrl_pagedown"
PICOCALC_LYRA_DECK.action_for(lane, 1) == "ctrl_pageup"
and PICOCALC_LYRA_DECK.action_for(lane, 2) == "ctrl_pagedown"
)
assert all(pair.enabled for pair in lane[:2])
@@ -345,7 +345,7 @@ def test_select_lane_promotes_the_section_jumps_only_where_there_are_sections()
# the sections are still a thing here, they just have nowhere to jump right now.
for ch in "gam":
grouped.handle("text", ch)
dim = grouped.picocalc_lane
dim = grouped.picocalc_lyra_lane
assert [pair.label for pair in dim[:2]] == ["Sect ↑", "Sect ↓"]
assert not any(pair.enabled for pair in dim[:2])
@@ -360,8 +360,8 @@ def test_dialogs_draw_no_lane_at_all() -> None:
ConfirmScreen("Sure?"),
ButtonDialog("Reboot the node?", ["Cancel", "Reboot"]),
):
assert list(screen.picocalc_lane) == list(EMPTY_LANE)
row = PICOCALC_DECK.lane_text(screen.picocalc_lane)
assert list(screen.picocalc_lyra_lane) == list(EMPTY_LANE)
row = PICOCALC_LYRA_DECK.lane_text(screen.picocalc_lyra_lane)
assert cell_len(row.plain) == 53
assert {str(span.style) for span in row.spans} == {"muted"}
@@ -407,7 +407,7 @@ def test_dialog_wrap_shrinks_on_picocalc() -> None:
"""A dialog message wraps to fewer cells on the PicoCalc, the screen being narrower."""
from meshterm.ui.surface import _dialog_wrap_cells
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
assert _dialog_wrap_cells() == 37 # 53 readable - 4 margin - 12 chrome
set_platform(REGULAR)
assert _dialog_wrap_cells() == 54 # 72 readable - 6 margin - 12 chrome
@@ -433,13 +433,13 @@ def test_a_dialog_keeps_its_hint_where_the_lane_is_the_footer() -> None:
screen = _dialog("↑↓ move · Enter select · Esc back")
set_platform(REGULAR)
assert frame._dialog_hint(screen) == ""
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
assert "Esc back" in _plain(frame.compose_dialog(screen, 53, 26))
def test_the_dialog_hint_drops_what_the_lane_already_says() -> None:
"""An atom whose every key is a chip on the very next row is the same claim twice."""
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
screen = _dialog("↑↓ move · PgUp/PgDn scroll · Home/End ends · Enter select · Esc back")
# The shared lane pages on F4/F5 and jumps to either end behind their Shift halves.
assert frame._dialog_hint(screen) == "↑↓ move · Enter select · Esc back"
@@ -452,7 +452,7 @@ def test_the_dialog_hint_is_resolved_on_every_paint() -> None:
The packet viewer rewrites its own hint as the list it pages through grows past one
entry (JP, 2026-08-31), and every screen reads its lane fresh each frame.
"""
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
screen = _dialog("Esc close")
assert frame._dialog_hint(screen) == "Esc close"
screen._footer_hint = "↑↓ newer/older · PgUp/PgDn scroll · Home/End ends · Esc close"
+34 -21
View File
@@ -14,7 +14,7 @@ import pytest
import meshterm.platforms as platforms_mod
from meshterm.platforms import (
PICOCALC,
PICOCALC_LYRA,
REGULAR,
get_platform,
resolve,
@@ -34,12 +34,12 @@ def test_regular_is_todays_behaviour() -> None:
def test_picocalc_is_the_narrower_plainer_flavour() -> None:
"""PICOCALC never claims a capability the console can't back up."""
assert PICOCALC.name == "picocalc"
assert PICOCALC.readable_cols < REGULAR.readable_cols
assert PICOCALC.width_reclaim is False # a phantom column would tear the exact-width frame
assert PICOCALC.emoji is False
assert PICOCALC.truecolor is False
"""PICOCALC_LYRA never claims a capability the console can't back up."""
assert PICOCALC_LYRA.name == "picocalc-lyra"
assert PICOCALC_LYRA.readable_cols < REGULAR.readable_cols
assert PICOCALC_LYRA.width_reclaim is False # a phantom column would tear the exact-width frame
assert PICOCALC_LYRA.emoji is False
assert PICOCALC_LYRA.truecolor is False
def test_get_platform_defaults_to_regular() -> None:
@@ -49,8 +49,8 @@ def test_get_platform_defaults_to_regular() -> None:
def test_set_platform_is_visible_through_get_platform() -> None:
"""set_platform takes effect immediately for any caller reading via get_platform()."""
set_platform(PICOCALC)
assert get_platform() is PICOCALC
set_platform(PICOCALC_LYRA)
assert get_platform() is PICOCALC_LYRA
set_platform(REGULAR)
assert get_platform() is REGULAR
@@ -63,8 +63,8 @@ def test_set_platform_reaches_a_dotted_import_too() -> None:
access (``platforms_mod.PLATFORM``) — and every real binding point in this codebase,
which reads through :func:`get_platform` — does.
"""
set_platform(PICOCALC)
assert platforms_mod.PLATFORM is PICOCALC
set_platform(PICOCALC_LYRA)
assert platforms_mod.PLATFORM is PICOCALC_LYRA
def test_resolve_defaults_to_regular_off_device(monkeypatch: pytest.MonkeyPatch) -> None:
@@ -79,29 +79,42 @@ def test_resolve_defaults_to_regular_off_device(monkeypatch: pytest.MonkeyPatch)
def test_resolve_flag_wins_over_everything(monkeypatch: pytest.MonkeyPatch) -> None:
"""An explicit --platform overrides both the env var and auto-detection."""
monkeypatch.setenv("MESHTERM_PLATFORM", "picocalc")
monkeypatch.setenv("MESHTERM_PLATFORM", "picocalc-lyra")
monkeypatch.setattr(platforms_mod, "_DEVICE_TREE_MODEL_PATH", Path("/nonexistent/model"))
r = resolve("regular")
assert r.platform is REGULAR
assert r.source == "--platform flag"
assert r.env == "picocalc" # recorded even though it didn't decide the outcome
assert r.env == "picocalc-lyra" # recorded even though it didn't decide the outcome
def test_resolve_env_wins_when_no_flag(monkeypatch: pytest.MonkeyPatch) -> None:
"""MESHTERM_PLATFORM decides when --platform wasn't passed."""
monkeypatch.setenv("MESHTERM_PLATFORM", "picocalc")
monkeypatch.setenv("MESHTERM_PLATFORM", "picocalc-lyra")
monkeypatch.setattr(platforms_mod, "_DEVICE_TREE_MODEL_PATH", Path("/nonexistent/model"))
r = resolve(None)
assert r.platform is PICOCALC
assert r.platform is PICOCALC_LYRA
assert r.source == "MESHTERM_PLATFORM env var"
def test_resolve_matching_is_case_insensitive_and_trims_space() -> None:
"""A flag/env value matches regardless of case or stray whitespace."""
assert resolve(" PicoCalc ").platform is PICOCALC
assert resolve(" PicoCalc-Lyra ").platform is PICOCALC_LYRA
assert resolve("REGULAR").platform is REGULAR
@pytest.mark.parametrize("old", ["picocalc", "cardputer"])
def test_the_old_device_names_are_refused_with_the_new_ones_listed(old: str) -> None:
"""``picocalc`` and ``cardputer`` were renamed for the device variant, with no alias.
M5Stack makes three Cardputers and the PicoCalc takes several cores, so the bare names
were ambiguous. A launcher still passing one fails loudly, naming the real choices,
rather than quietly falling back to the desktop layout.
"""
with pytest.raises(ValueError) as exc:
resolve(old)
assert "picocalc-lyra" in str(exc.value) and "cardputer-zero" in str(exc.value)
def test_resolve_unknown_flag_raises_with_the_choices(monkeypatch: pytest.MonkeyPatch) -> None:
"""A typo'd --platform is a clear ValueError, not a silent fallback to REGULAR."""
monkeypatch.delenv("MESHTERM_PLATFORM", raising=False)
@@ -109,7 +122,7 @@ def test_resolve_unknown_flag_raises_with_the_choices(monkeypatch: pytest.Monkey
resolve("laptop")
message = str(exc.value)
assert "laptop" in message and "--platform" in message
assert "picocalc" in message and "regular" in message
assert "picocalc-lyra" in message and "regular" in message
def test_resolve_unknown_env_raises_only_when_it_would_decide(
@@ -134,13 +147,13 @@ def test_resolve_auto_detects_the_lyra_model(monkeypatch: pytest.MonkeyPatch) ->
monkeypatch.setattr(platforms_mod, "_DEVICE_TREE_MODEL_PATH", _FakePath())
r = resolve()
assert r.platform is PICOCALC
assert r.platform is PICOCALC_LYRA
assert r.source == "auto-detect"
assert r.detected_model == "Luckfox Lyra" # trailing space/NUL stripped
def test_resolve_auto_detect_is_conservative(monkeypatch: pytest.MonkeyPatch) -> None:
"""A device tree that exists but names different hardware never guesses picocalc."""
"""A device tree that exists but names different hardware never guesses picocalc-lyra."""
monkeypatch.delenv("MESHTERM_PLATFORM", raising=False)
class _FakePath:
@@ -183,9 +196,9 @@ def test_without_emoji_leaves_an_already_compact_platform_alone() -> None:
"""A platform whose icons are already compact comes back untouched.
The same object, not a copy that would compare equal but break every ``is`` check
the suite makes against PICOCALC.
the suite makes against PICOCALC_LYRA.
"""
assert without_emoji(PICOCALC) is PICOCALC
assert without_emoji(PICOCALC_LYRA) is PICOCALC_LYRA
def test_the_emoji_less_variant_still_drives_the_theme() -> None:
+2 -2
View File
@@ -681,10 +681,10 @@ def test_a_newly_watched_node_takes_the_preferred_silence_rule(tmp_path: Path) -
def test_the_last_column_preference_overrules_the_platform() -> None:
"""``full_width`` steps aside on ``auto`` and decides otherwise (env still wins over both)."""
from meshterm.platforms import PICOCALC, set_platform
from meshterm.platforms import PICOCALC_LYRA, set_platform
from meshterm.ui.tui.session import _reclaim_last_column
set_platform(PICOCALC) # a platform that defaults the reclaim off
set_platform(PICOCALC_LYRA) # a platform that defaults the reclaim off
prefs = Preferences()
install(prefs)
try:
+2 -2
View File
@@ -267,7 +267,7 @@ def test_record_dialog_actions_start_both_labels_in_the_same_cell() -> None:
it is the cell the words land in that the eye compares. Where the platform draws no icon
lane the marks go, and so must their padding: both labels open right after the pointer.
"""
from meshterm.platforms import PICOCALC, set_platform
from meshterm.platforms import PICOCALC_LYRA, set_platform
def starts() -> set[int]:
lines = _plain(_dialog(_record()).render_body(60)).splitlines()
@@ -284,7 +284,7 @@ def test_record_dialog_actions_start_both_labels_in_the_same_cell() -> None:
assert len(regular) == 1 # one column for both words…
assert regular == {2 + 2 + 1} # …after the pointer, the two-cell lane, and its space
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
assert starts() == {2} # no lane, no leftover padding: the words follow the pointer
+2 -2
View File
@@ -664,13 +664,13 @@ async def test_ctrl_r_reads_again_and_f3_is_read_over_remove() -> None:
menu = RegionMenu(title, items)
menu.future = asyncio.get_running_loop().create_future()
assert not menu.floating
lane = menu.picocalc_lane
lane = menu.picocalc_lyra_lane
assert (lane[2].label, lane[2].opp_label) == ("Read", "Remove")
assert not lane[2].opp_enabled # the wildcard row is highlighted first
assert "Del remove" not in menu.footer_hint
menu.handle("down")
menu.handle("down") # lakeside-north
assert menu.picocalc_lane[2].opp_enabled
assert menu.picocalc_lyra_lane[2].opp_enabled
assert "Del remove" in menu.footer_hint
menu.handle("retry")
assert menu.future.result() == region_editor._READ
+2 -2
View File
@@ -582,14 +582,14 @@ async def test_ctrl_r_reads_only_a_highlighted_setting() -> None:
menu.future = loop.create_future()
assert menu._current_choice().value == "name"
assert menu.footer_hint.endswith("Enter select · ^R read · Esc back")
assert menu.picocalc_lane[2].label == "Read" and menu.picocalc_lane[2].enabled
assert menu.picocalc_lyra_lane[2].label == "Read" and menu.picocalc_lyra_lane[2].enabled
menu.handle("retry")
assert menu.future.result() == ReadOne("name")
menu.future = loop.create_future()
menu.handle("end") # the last action row: nothing there to read
assert "^R" not in menu.footer_hint
assert not menu.picocalc_lane[2].enabled
assert not menu.picocalc_lyra_lane[2].enabled
menu.handle("retry")
assert not menu.future.done()
+2 -2
View File
@@ -212,9 +212,9 @@ def test_the_feed_never_collapses_a_lane() -> None:
def test_the_picocalc_feed_names_the_class_without_an_icon() -> None:
"""On the console the class icon is a one-glyph stand-in; the name alone says it."""
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
try:
screen = _feed(_scoped("harbour"))
header, row = _stripped(screen.render_body(53))[:2]
+7 -7
View File
@@ -20,7 +20,7 @@ import re
import pytest
from rich.text import Text
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
from meshterm.ui.contactlist import _SORT_ACTIVE
from meshterm.ui.pathline import PathHop, PathLine
from meshterm.ui.theme import (
@@ -181,7 +181,7 @@ def test_a_name_beside_a_path_line_still_folds() -> None:
assert node_style("77").removeprefix("bold ") in hues # …the route did not
@pytest.mark.parametrize("platform", [REGULAR, PICOCALC])
@pytest.mark.parametrize("platform", [REGULAR, PICOCALC_LYRA])
def test_the_message_paths_dialog_colours_its_picked_route_like_its_graph(platform) -> None: # noqa: ANN001
"""The end JP asked for: the picked row and the graph above it agree on each node.
@@ -244,7 +244,7 @@ def test_the_ansi_cache_tells_a_highlighted_row_from_the_same_row_unhighlighted(
assert render_to_ansi(_row(selected=False), 60) == plain_ansi # not clobbered
@pytest.mark.parametrize("platform", [REGULAR, PICOCALC])
@pytest.mark.parametrize("platform", [REGULAR, PICOCALC_LYRA])
def test_the_fold_speaks_whichever_hue_vocabulary_is_bound(platform) -> None: # noqa: ANN001
"""PicoCalc quantizes the hue to a palette slot; the rule above it is the same rule."""
set_platform(platform)
@@ -257,7 +257,7 @@ def test_the_fold_speaks_whichever_hue_vocabulary_is_bound(platform) -> None: #
assert lit != unlit
assert "Lakeside" in re.sub(r"\x1b\[[\d;]*m", "", lit)
if platform is PICOCALC:
if platform is PICOCALC_LYRA:
assert "\x1b[1;97mLakeside" in lit, lit # slot 15, the console's white
else:
assert "38;2;255;255;255mLakeside" in lit, lit
@@ -266,7 +266,7 @@ def test_the_fold_speaks_whichever_hue_vocabulary_is_bound(platform) -> None: #
# -- the vocabulary itself ------------------------------------------------------------
@pytest.mark.parametrize("platform", [REGULAR, PICOCALC])
@pytest.mark.parametrize("platform", [REGULAR, PICOCALC_LYRA])
def test_every_hue_a_key_can_mint_is_recognised_as_one(platform) -> None: # noqa: ANN001
""":func:`node_style` read backwards has to answer for all 256 first bytes.
@@ -307,7 +307,7 @@ def test_the_two_platforms_hue_vocabularies_cannot_be_confused() -> None:
"""
set_platform(REGULAR)
spectrum = {node_style(f"{byte:02x}") for byte in range(256)}
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
slots = {node_style(f"{byte:02x}") for byte in range(256)}
assert not (spectrum & slots)
@@ -376,7 +376,7 @@ def test_the_active_sort_column_is_lit_in_the_cursor_white() -> None:
def test_the_sort_cue_survives_the_console_s_sixteen_slots() -> None:
"""A bare hex would have been quantized at the fold; a theme name is chosen deliberately."""
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
header = Text("NAME ▲", style=_SORT_ACTIVE)
assert "\x1b[1;97m" in render_to_ansi(header, 20) # slot 15, not the brand's 14
+3 -3
View File
@@ -389,7 +389,7 @@ async def test_resend_unscoped_targets_only_a_newest_scoped_message() -> None:
screen = _channel_chat(_Session(), [scoped], resend=resend)
assert screen._retry_target() is scoped
assert "^R resend unscoped" in screen.footer_hint
lane = screen.picocalc_lane
lane = screen.picocalc_lyra_lane
assert lane[2].opp_label == "Resend" and lane[2].opp_enabled
screen.handle("retry")
@@ -455,9 +455,9 @@ def test_a_channel_with_nothing_to_resend_dims_the_chip() -> None:
return message
screen = _channel_chat(_Session(), [unscoped], resend=resend)
lane = screen.picocalc_lane
lane = screen.picocalc_lyra_lane
assert lane[2].opp_label == "Resend" and not lane[2].opp_enabled
assert fkeys.PICOCALC_DECK.lane_text(lane, shifted=True).plain
assert fkeys.PICOCALC_LYRA_DECK.lane_text(lane, shifted=True).plain
def _plain_lines(screen: ChatScreen) -> str:
+2 -2
View File
@@ -15,7 +15,7 @@ from __future__ import annotations
from prompt_toolkit.output.color_depth import ColorDepth
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
from meshterm.ui.tui.session import _color_depth
@@ -61,7 +61,7 @@ def test_picocalc_is_never_promoted(monkeypatch) -> None:
"""A 16-slot console addresses its palette by index; RGB has nowhere to land there."""
_auto(monkeypatch)
monkeypatch.setenv("COLORTERM", "truecolor")
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
assert _color_depth() is None
+5 -5
View File
@@ -17,7 +17,7 @@ from types import SimpleNamespace
from prompt_toolkit.data_structures import Size
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
from meshterm.ui.tui.session import TuiSession, _WidthExtendedOutput
@@ -71,18 +71,18 @@ def test_session_pins_the_real_terminal_inside_the_width_extension(monkeypatch)
def test_session_leaves_the_bare_terminal_on_picocalc(monkeypatch) -> None:
"""PICOCALC's exact-width console → no reclaim: a phantom column would tear the frame."""
"""PICOCALC_LYRA's exact-width console → no reclaim: a phantom column would tear the frame."""
monkeypatch.delenv("MESHTERM_FULL_WIDTH", raising=False)
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
assert TuiSession()._resolve_output() is None
def test_env_override_forces_reclaim_on_despite_picocalc(monkeypatch) -> None:
"""``MESHTERM_FULL_WIDTH=1`` wins over PICOCALC's off-by-default."""
"""``MESHTERM_FULL_WIDTH=1`` wins over PICOCALC_LYRA's off-by-default."""
fake = SimpleNamespace(get_size=lambda: Size(rows=30, columns=100))
monkeypatch.setattr("prompt_toolkit.output.defaults.create_output", lambda: fake)
monkeypatch.setenv("MESHTERM_FULL_WIDTH", "1")
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
assert isinstance(TuiSession()._resolve_output(), _WidthExtendedOutput)
+1 -1
View File
@@ -17,7 +17,7 @@ def test_spdx_headers():
python_files = []
# Collect all Python files from the required directories
for directory in ["meshterm", "tests", "packaging", "scripts/picocalc/xiao-radio"]:
for directory in ["meshterm", "tests", "packaging", "scripts/picocalc-lyra/xiao-radio"]:
dir_path = repo_root / directory
if dir_path.exists():
if directory == "packaging":
+22 -22
View File
@@ -17,7 +17,7 @@ from pathlib import Path
from rich.cells import cell_len
from rich.default_styles import DEFAULT_STYLES
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
from meshterm.ui import theme
from meshterm.ui.fontset import FONT_CODEPOINTS
from meshterm.ui.theme import MESH_THEME, MESH_THEME_16, fold_text, glyph, name_style
@@ -25,7 +25,7 @@ from meshterm.ui.theme import MESH_THEME, MESH_THEME_16, fold_text, glyph, name_
_FONT_SCRIPT = (
Path(__file__).resolve().parent.parent
/ "scripts"
/ "picocalc"
/ "picocalc-lyra"
/ "calculinux-console-font-6x12.sh"
)
@@ -101,7 +101,7 @@ def test_unknown_node_grey_survives_a_selected_row() -> None:
from rich.console import Console
from rich.text import Text
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
console = Console(
theme=MESH_THEME_16,
width=20,
@@ -190,7 +190,7 @@ def test_glyph_is_identity_on_regular_and_compact_on_picocalc() -> None:
"""
set_platform(REGULAR)
assert glyph("📡") == "📡"
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
assert glyph("📡") == "☼"
assert glyph("★") == "★" # node/status marks pass through — they are font-native
@@ -199,8 +199,8 @@ def test_glyph_is_identity_on_regular_and_compact_on_picocalc() -> None:
def test_fold_is_identity_on_regular_even_after_picocalc_used_it() -> None:
"""The bound impls may not leak cached picocalc folds into a regular render."""
set_platform(PICOCALC)
"""The bound impls may not leak cached picocalc-lyra folds into a regular render."""
set_platform(PICOCALC_LYRA)
assert fold_text("café") == "cafe"
set_platform(REGULAR)
assert fold_text("café") == "café"
@@ -212,7 +212,7 @@ def test_fold_strips_accents_and_preserves_cell_widths() -> None:
An accent drops to its base letter and an emoji becomes its mapped mark, each in
place, so nothing downstream has to measure the row again.
"""
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
for text in ("café ⚠", "Ĉu vi paroläs", "📡 Advert", "🗑 Clear", "…", "npo Waymarker 🇨🇦"):
folded = fold_text(text)
assert cell_len(folded) == cell_len(text), (text, folded)
@@ -222,14 +222,14 @@ def test_fold_strips_accents_and_preserves_cell_widths() -> None:
def test_fold_replaces_the_unmappable_at_width() -> None:
"""CJK and unmapped emoji leave as ``?`` at their own width — never as tofu."""
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
assert fold_text("你好") == "????"
assert cell_len(fold_text("🦕")) == cell_len("🦕")
def test_fold_keeps_ansi_sequences_intact() -> None:
"""The fold rewrites text only: colour escapes and newlines cross it untouched."""
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
line = "\x1b[1;93mwarn é\x1b[0m\nnext"
folded = fold_text(line)
assert folded == "\x1b[1;93mwarn e\x1b[0m\nnext"
@@ -237,7 +237,7 @@ def test_fold_keeps_ansi_sequences_intact() -> None:
def test_fold_quantizes_embedded_truecolor_to_the_slots() -> None:
"""Canvas-emitted truecolor (the braille rasters) lands on the nearest palette slot."""
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
folded = fold_text("\x1b[38;2;148;163;184m○\x1b[0m")
assert "38;2;" not in folded
# #94a3b8 → nearest stock slot is 7 (#aaaaaa); a dim-bank slot states its intensity.
@@ -255,7 +255,7 @@ def test_fold_quantizes_a_colour_that_shares_its_sequence_with_another() -> None
The QR module's white-on-black is the case that found it: ``ESC[38;2;…;48;2;…m`` is
two colours in one list, and a matcher for a colour standing alone saw neither.
"""
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
folded = fold_text("\x1b[38;2;255;255;255;48;2;0;0;0m█\x1b[0m")
assert "8;2;" not in folded, folded
assert folded.startswith("\x1b[97;40m"), folded # bright white ink, black field
@@ -282,7 +282,7 @@ def test_the_qr_style_is_white_on_black_on_both_themes() -> None:
def test_fold_drops_zero_width_machinery() -> None:
"""Variation selectors and zero-width joiners are dropped — they have no cell to occupy."""
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
assert fold_text("🕸️") == fold_text("🕸")
assert "‍" not in fold_text("a‍b")
@@ -292,7 +292,7 @@ def test_fold_drops_zero_width_machinery() -> None:
def test_names_colour_by_key_on_both_platforms() -> None:
"""One rule everywhere: the key picks the hue, and only its first byte does."""
for platform in (REGULAR, PICOCALC):
for platform in (REGULAR, PICOCALC_LYRA):
set_platform(platform)
hue = name_style("Hilltop-Repeater", "3d63c6429436")
assert hue.startswith("bold #"), platform.name
@@ -310,7 +310,7 @@ def test_picocalc_node_hues_land_on_their_own_palette_slots() -> None:
Each returned hex is a slot's own RGB, so every downsample on the way out — Rich's,
and the fold's — lands on that exact slot instead of guessing a neighbour.
"""
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
slots = {hex_: slot for slot, _, hex_ in theme._VT_SLOTS}
landed = [name_style("n", f"{byte:02x}").removeprefix("bold ") for byte in range(256)]
assert set(landed) == set(theme._NODE_SLOT_HEXES)
@@ -326,7 +326,7 @@ def test_route_graph_resolves_a_named_marker_colour_to_rgb() -> None:
"""
from meshterm.ui.widgets import route_graph_style
for platform in (REGULAR, PICOCALC):
for platform in (REGULAR, PICOCALC_LYRA):
set_platform(platform)
_glyph_of, _label_of, label_rgb_of = route_graph_style(
resolve=lambda hop: None,
@@ -339,7 +339,7 @@ def test_route_graph_resolves_a_named_marker_colour_to_rgb() -> None:
def test_node_type_marks_stay_distinct_on_the_console() -> None:
"""Each type mark owns a slot — a naive downsample would grey the repeater's violet."""
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
marks = ("type.node", "type.repeater", "type.room", "type.sensor")
rgbs = [theme.mark_rgb(name) for name in marks]
assert len(set(rgbs)) == len(marks)
@@ -354,7 +354,7 @@ def test_heat_ladder_walks_jps_seven_slots_in_order() -> None:
"""
from meshterm.ui.widgets import _recency_style
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
# fmt: off
expected = [
(60, 15), (299, 15), # under 5 minutes — white
@@ -383,7 +383,7 @@ def test_canvas_drops_emphasis_where_bold_means_brightness() -> None:
"""
from meshterm.ui.mapcanvas import MapCanvas
for platform, expect_bold in ((REGULAR, True), (PICOCALC, False)):
for platform, expect_bold in ((REGULAR, True), (PICOCALC_LYRA, False)):
set_platform(platform)
canvas = MapCanvas(6, 1)
canvas.marker(0, 0, "x", (148, 163, 184)) # markers always draw emboldened
@@ -430,7 +430,7 @@ def test_font_script_marks_and_fontset_move_together() -> None:
def test_specimen_renders_clean_on_picocalc() -> None:
"""`meshterm specimen` obeys on picocalc every contract it demonstrates.
"""`meshterm specimen` obeys on picocalc-lyra every contract it demonstrates.
At most 53 cells per line, 16-slot SGR only, and console-font characters only.
"""
@@ -440,7 +440,7 @@ def test_specimen_renders_clean_on_picocalc() -> None:
from meshterm.ui.specimen import specimen_lines
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
console = Console(
theme=MESH_THEME_16,
width=53,
@@ -554,7 +554,7 @@ def test_the_mark_the_console_picks_stays_inside_its_font() -> None:
from meshterm.ui.logo import load_logo
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
rows = load_logo(53)
assert rows, "the 53-column mark should fit a 53-column console"
for i, row in enumerate(rows):
@@ -579,7 +579,7 @@ def test_narrow_wordmark_keeps_its_dim_rows_off_the_bright_bank() -> None:
from meshterm.ui.logo import load_logo
from meshterm.ui.tui.frame import _banner_lines
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
rows = _banner_lines(load_logo(53), 53)
assert rows, "the 53-column mark should fit a 53-column console"
dim = [
+5 -5
View File
@@ -975,10 +975,10 @@ def test_screen_cycles_windows_and_caches(tmp_path: Path) -> None:
# The F-key chip is the same behaviour under another name — the only way a platform
# that draws no hint line can learn that `w` exists at all. It names the span it takes
# you *to*, since the title already says where you are.
assert screen.picocalc_lane[2].label == "all"
assert screen.picocalc_lyra_lane[2].label == "all"
screen.handle("window")
assert "all time" in screen.title
assert screen.picocalc_lane[2].label == "24 h" # the ring wraps back around
assert screen.picocalc_lyra_lane[2].label == "24 h" # the ring wraps back around
def test_picocalc_window_ring_stops_at_30_days() -> None:
@@ -987,16 +987,16 @@ def test_picocalc_window_ring_stops_at_30_days() -> None:
All time is the one span whose scan grows with the whole history — a desktop
affordance (see ``_bind_windows``); the chip cycles the three spans that remain.
"""
from meshterm.platforms import PICOCALC, set_platform
from meshterm.platforms import PICOCALC_LYRA, set_platform
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
screen = TimeMachineScreen(
session=_FakeSession(), label="Hub", build=lambda window, width, scope: []
)
assert "7 d" in screen.title # opens on 7 d, as everywhere
screen.handle("text", "w")
assert "30 d" in screen.title
assert screen.picocalc_lane[2].label == "24 h" # never "all" on this ring
assert screen.picocalc_lyra_lane[2].label == "24 h" # never "all" on this ring
screen.handle("window")
assert "24 h" in screen.title # wrapped straight past where all time would sit
+8 -8
View File
@@ -1053,11 +1053,11 @@ def test_startup_splash_fits_every_platform_width() -> None:
the gallery doesn't cover, and it shipped torn there until the narrow mark landed —
so this is the gate.
"""
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
from meshterm.ui.logo import load_logo
try:
for platform in (REGULAR, PICOCALC):
for platform in (REGULAR, PICOCALC_LYRA):
set_platform(platform)
cols = platform.readable_cols
screen = SelectScreen("Choose a device", [Choice("alpha", 1)])
@@ -3413,7 +3413,7 @@ def test_the_splash_action_rows_share_one_icon_column() -> None:
"""
from rich.cells import cell_len
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
from meshterm.ui.device_picker import _ADD_TCP, _QUIT, _action_rows
from meshterm.ui.tui import Choice
@@ -3425,7 +3425,7 @@ def test_the_splash_action_rows_share_one_icon_column() -> None:
}
assert len(set(starts().values())) == 1
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
try:
assert set(starts().values()) == {2}, "the icons go, and no padding stays behind"
finally:
@@ -3504,7 +3504,7 @@ def test_the_splash_scrolls_the_whole_row_it_is_on() -> None:
"""
from meshterm.core.device_store import RememberedDevice
from meshterm.core.discovery import serial_device
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
from meshterm.ui.device_picker import _build_items
from meshterm.ui.tui import Choice, SelectScreen
@@ -3520,7 +3520,7 @@ def test_the_splash_scrolls_the_whole_row_it_is_on() -> None:
)
}
try:
for platform, width in ((REGULAR, 66), (PICOCALC, 47)):
for platform, width in ((REGULAR, 66), (PICOCALC_LYRA, 47)):
set_platform(platform)
items = _build_items([radio], registry[radio.stable_id], registry)
screen = SelectScreen(
@@ -3553,14 +3553,14 @@ def test_the_splash_hint_stays_inside_the_box_it_is_drawn_in() -> None:
from rich.cells import cell_len
from meshterm.core.discovery import serial_device
from meshterm.platforms import PICOCALC, REGULAR
from meshterm.platforms import PICOCALC_LYRA, REGULAR
from meshterm.ui.device_picker import _shortcut_hint
from meshterm.ui.tui.select import splice_hint
base = "↑↓ move · Enter select · Esc bye" # the splash's own send-off
radio = serial_device("COM7", name="A Radio")
common = splice_hint(base, _shortcut_hint(0)(radio))
for platform in (REGULAR, PICOCALC):
for platform in (REGULAR, PICOCALC_LYRA):
budget = platform.readable_cols - platform.dialog_margin - 2
assert cell_len(common) <= budget, (platform.name, common)
+5 -5
View File
@@ -29,7 +29,7 @@ from meshterm.core.config import Settings
from meshterm.core.device_store import DeviceStore
from meshterm.core.preferences import Preferences, by_group, get_spec
from meshterm.persistence.repository import Repository
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
from meshterm.services import consolefont
from meshterm.tools.preferences import PreferencesTool
from meshterm.ui.theme import active_theme
@@ -53,7 +53,7 @@ class _Recorder:
@pytest.fixture
def device(monkeypatch: pytest.MonkeyPatch) -> _Recorder:
"""Make the process look like MeshTerm running on the handheld's own VT."""
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
monkeypatch.setattr(os, "ttyname", lambda fd: "/dev/tty1", raising=False)
monkeypatch.setattr(consolefont.shutil, "which", lambda name: "/usr/bin/setfont")
recorder = _Recorder()
@@ -204,14 +204,14 @@ def test_a_failed_remember_leaves_nothing_to_restore(
def test_the_preference_is_offered_on_the_handheld_only() -> None:
"""A row about hardware the desktop does not have is a question it cannot answer."""
spec = get_spec("console_font")
assert spec.offered_on("picocalc") is True
assert spec.offered_on("picocalc-lyra") is True
assert spec.offered_on("regular") is False
# Everything else is offered everywhere; the gate is the exception, not the rule.
gated = {s.key for _, specs in by_group() for s in specs if s.platforms is not None}
assert gated == {"console_font"}
@pytest.mark.parametrize("platform", [REGULAR, PICOCALC])
@pytest.mark.parametrize("platform", [REGULAR, PICOCALC_LYRA])
def test_the_preference_round_trips_on_every_platform(tmp_path: Path, platform: Any) -> None:
"""A file written on the handheld loads, keeps its value, and saves back on a desktop."""
set_platform(platform)
@@ -232,7 +232,7 @@ def test_the_page_draws_the_row_on_the_handheld_and_not_on_the_desktop() -> None
"""The gate's one visible effect: a Display row that exists on one platform."""
from meshterm.ui.preferences import _menu_items
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
_, items = _menu_items(Preferences(), {})
assert "console_font" in [getattr(item, "value", None) for item in items]
+11 -11
View File
@@ -394,7 +394,7 @@ def test_walk_locate_refocuses_us_and_home_end_walk_the_list() -> None:
def test_walk_echoes_the_find_query_above_the_matches_it_narrows() -> None:
"""The PicoCalc draws no hint line, so the query it carries moves into the body."""
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
try:
set_platform(REGULAR)
@@ -405,7 +405,7 @@ def test_walk_echoes_the_find_query_above_the_matches_it_narrows() -> None:
body = _plain(desktop.render_body(80))
assert "/al" not in body and "find: al" in desktop.footer_hint
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
device = _screen(_topo())
device.render_body(53)
for ch in "al":
@@ -428,11 +428,11 @@ def test_walk_echoes_the_find_query_above_the_matches_it_narrows() -> None:
def test_walk_fkey_lane_gives_you_its_own_slot_over_the_pagers_ends() -> None:
"""``You`` is a verb of this screen (F3), not an end of the list the pager scrolls."""
from meshterm.ui.tui.fkeys import PICOCALC_DECK
from meshterm.ui.tui.fkeys import PICOCALC_LYRA_DECK
screen = _screen(_topo())
screen.render_body(80)
lane = screen.picocalc_lane
lane = screen.picocalc_lyra_lane
assert [pair.label if pair else None for pair in lane] == [
None,
@@ -441,26 +441,26 @@ def test_walk_fkey_lane_gives_you_its_own_slot_over_the_pagers_ends() -> None:
"Page ↓",
"Page ↑",
]
assert PICOCALC_DECK.action_for(lane, 3) == "locate"
assert PICOCALC_LYRA_DECK.action_for(lane, 3) == "locate"
assert lane[2].opp_label == "" # nothing is the opposite of going home
# And the pager's Shift bank means what it means everywhere else: the list's two ends.
assert lane[4].opp_label == "Top" and PICOCALC_DECK.action_for(lane, 10) == "home"
assert lane[3].opp_label == "Bottom" and PICOCALC_DECK.action_for(lane, 9) == "end"
assert lane[4].opp_label == "Top" and PICOCALC_LYRA_DECK.action_for(lane, 10) == "home"
assert lane[3].opp_label == "Bottom" and PICOCALC_LYRA_DECK.action_for(lane, 9) == "end"
def test_walk_you_dims_once_the_focus_is_already_us() -> None:
"""Dim says *a thing here, just not right now* — there is nowhere to come back from."""
screen = _screen(_topo())
screen.render_body(80)
assert screen.picocalc_lane[2].enabled is False # opens on us, trail of one
assert screen.picocalc_lyra_lane[2].enabled is False # opens on us, trail of one
screen.handle("enter") # walked away: now there is
assert screen.picocalc_lane[2].enabled is True
assert screen.picocalc_lyra_lane[2].enabled is True
screen.handle("locate")
assert screen.picocalc_lane[2].enabled is False
assert screen.picocalc_lyra_lane[2].enabled is False
screen.handle("text", "a") # a find narrows the list off our own neighbours too
assert screen.picocalc_lane[2].enabled is True
assert screen.picocalc_lyra_lane[2].enabled is True
def test_walk_the_fan_is_all_east_and_holds_no_came_from() -> None:
+4 -4
View File
@@ -345,7 +345,7 @@ def test_watchtower_actions_start_every_label_in_the_same_cell() -> None:
from rich.cells import cell_len
from meshterm.core.watch_store import Alert
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
from meshterm.ui.watchtower_screen import _ACK_ALL, _CLEAR, _TOGGLE_NEW, _WATCH, _menu_items
assert {cell_len("✓"), cell_len("⭐")} == {1, 2}, "a list of one icon width proves nothing"
@@ -361,7 +361,7 @@ def test_watchtower_actions_start_every_label_in_the_same_cell() -> None:
}
assert set(_word_starts(_menu_items(alerts, {}, True), words).values()) == {3}
try:
set_platform(PICOCALC)
set_platform(PICOCALC_LYRA)
assert set(_word_starts(_menu_items(alerts, {}, True), words).values()) == {0}
finally:
set_platform(REGULAR)
@@ -375,14 +375,14 @@ def test_node_rules_start_every_label_and_value_in_the_same_cell() -> None:
here too: whatever the icon column measures, the values stay in one column.
"""
from meshterm.core.watch_store import WatchedNode
from meshterm.platforms import PICOCALC, REGULAR, set_platform
from meshterm.platforms import PICOCALC_LYRA, REGULAR, set_platform
from meshterm.ui.watchtower_screen import _rule_items
entry = WatchedNode(key="a1" * 6, name="Roof", silence_hours=12, snr_watch=True)
words = {"silence": "Silence", "snr": "SNR", "unwatch": "Stop"}
values = {"silence": "after 12 h", "snr": "on"}
try:
for platform, start in ((REGULAR, 3), (PICOCALC, 0)):
for platform, start in ((REGULAR, 3), (PICOCALC_LYRA, 0)):
set_platform(platform)
items = _rule_items(entry)
assert set(_word_starts(items, words).values()) == {start}