Polish menus and dialogs: lanes, headers, and a Device actions screen

- Dialog footer hints take the border's hue one shade darker (hint.*
  theme styles), mirroring the brighter title tinting.
- Dialogs get a blank breathing row above and below the body whenever
  it doesn't cost visible content.
- The chat conversation picker gains column headers over its lanes.
- The map screen titles itself "Map", matching its menu item.
- The config editor lays settings out in aligned SETTING / VALUE /
  DESCRIPTION columns under a header line, and with changes staged the
  Apply and Back rows sit together below the blank separator.
- Device actions move out of the config editor into their own screen
  behind a new menu-only device-actions tool (CLI equivalents stay
  under the config group).
- Type-to-filter keeps section headers (and column headers) in place,
  and section jumps now work over the filtered rows too.
- The main menu aligns tool names and muted descriptions into two
  columns, headerless.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jean-Pierre MartineauandClaude Fable 5 committed 2026-07-09 23:10:11 -04:00
1 parent a23b12f6a4
commit 768487e456
11 files changed
+367 -177

No files matched your search

+19 -21
View File
@@ -24,6 +24,7 @@ from meshterm.ui.config_editor import (
_parse_coords,
_valid_coords,
contact_share_url,
device_actions,
edit_config,
)
from meshterm.ui.tui.prompt import TypedConfirmDialog
@@ -434,7 +435,7 @@ async def test_editor_location_clear_stages_the_no_fix_pair(ctx: AppContext) ->
assert ("set", "adv_lon", 0.0) in ops
async def test_editor_advert_zero_hop_and_flood_run_immediately(ctx: AppContext) -> None:
async def test_actions_advert_zero_hop_and_flood_run_immediately(ctx: AppContext) -> None:
"""The advert dialog sends immediately: zero-hop by default, flood when chosen."""
device = await ctx.device()
sent: list[bool] = []
@@ -450,25 +451,25 @@ async def test_editor_advert_zero_hop_and_flood_run_immediately(ctx: AppContext)
("select", "flood"),
("select", "__cancel__"),
])
assert await edit_config(ctx) is None
await device_actions(ctx)
assert sent == [False, True]
assert any("zero-hop" in n for n in ui.notes)
assert any("flood" in n for n in ui.notes)
async def test_editor_advert_share_shows_the_contact_card(ctx: AppContext) -> None:
async def test_actions_advert_share_shows_the_contact_card(ctx: AppContext) -> None:
"""The share option opens the QR/URI view built from the node's own identity."""
ui = _install(ctx, [
("select", "__advert__"),
("select", "share"),
("select", "__cancel__"),
])
assert await edit_config(ctx) is None
await device_actions(ctx)
assert any(v.startswith("Share ") for v in ui.views)
async def test_editor_factory_reset_gates_on_typed_confirmation(ctx: AppContext) -> None:
"""Factory reset only runs behind the typed dialog, and drops staged changes."""
async def test_actions_factory_reset_gates_on_typed_confirmation(ctx: AppContext) -> None:
"""Factory reset only runs behind the typed dialog."""
device = await ctx.device()
await device.set_custom_var("mode", "test")
@@ -478,23 +479,20 @@ async def test_editor_factory_reset_gates_on_typed_confirmation(ctx: AppContext)
("typed_confirm", False),
("select", "__cancel__"),
])
assert await edit_config(ctx) is None
await device_actions(ctx)
assert await device.get_custom_vars() == {"mode": "test"}
# Confirmed: the reset runs and previously staged changes are cleared with it.
# Confirmed: the reset runs and the device comes back empty.
_install(ctx, [
("select", "name"),
("text", "Doomed"),
("select", "__reset__"),
("typed_confirm", True),
("select", "__cancel__"), # clean close: the staged change died with the reset
("select", "__cancel__"),
])
ui = ctx.ui
ui.script.insert(2, ("select", "__reset__")) # reset after staging the name
assert await edit_config(ctx) is None
await device_actions(ctx)
assert await device.get_custom_vars() == {}
async def test_editor_import_key_gates_on_typed_confirmation(ctx: AppContext) -> None:
async def test_actions_import_key_gates_on_typed_confirmation(ctx: AppContext) -> None:
"""Importing an identity key requires the typed IMPORT confirmation."""
device = await ctx.device()
new_key = "ab" * 32
@@ -505,31 +503,31 @@ async def test_editor_import_key_gates_on_typed_confirmation(ctx: AppContext) ->
("typed_confirm", True),
("select", "__cancel__"),
])
assert await edit_config(ctx) is None
await device_actions(ctx)
assert await device.export_private_key() == new_key
async def test_editor_reboot_on_simulator_stays_in_the_editor(ctx: AppContext) -> None:
async def test_actions_reboot_on_simulator_stays_on_the_screen(ctx: AppContext) -> None:
"""The simulator has no link to drop, so a confirmed reboot just notes and returns."""
ui = _install(ctx, [
("select", "__reboot__"),
("dialog", "reboot"),
("select", "__cancel__"),
])
assert await edit_config(ctx) is None
await device_actions(ctx)
assert ctx.reboot_in_progress is False
assert any("rebooting" in n for n in ui.notes)
async def test_editor_backup_writes_immediately(ctx: AppContext, tmp_path: Path) -> None:
"""Backup is a device action: the TOML lands on disk before the editor closes."""
async def test_actions_backup_writes_immediately(ctx: AppContext, tmp_path: Path) -> None:
"""Backup runs at once: the TOML lands on disk before the screen closes."""
target = tmp_path / "out" / "backup.toml"
ui = _install(ctx, [
("select", "__backup__"),
("path", str(target)),
("select", "__cancel__"),
])
assert await edit_config(ctx) is None
await device_actions(ctx)
assert target.exists()
assert any("wrote" in n for n in ui.notes)
+9 -7
View File
@@ -97,15 +97,17 @@ def test_select_default_and_arrow_wrap() -> None:
assert _run(screen, "enter") == 1
def test_select_filter_narrows_and_hides_separators() -> None:
"""Typing filters to matching choices only; separators drop out while filtering."""
def test_select_filter_narrows_but_keeps_separators() -> None:
"""Typing filters to matching choices while the section headings stay in place."""
screen = _menu()
screen.handle("text", "a") # matches alpha, beta(?), gamma -> those containing 'a'
screen.handle("text", "a") # matches alpha, beta, gamma — all contain 'a'
rows = screen._rows()
assert all(isinstance(r, Choice) for r in rows)
assert {r.title for r in rows} == {"alpha", "beta", "gamma"}
screen.handle("text", "l") # now 'al' -> only alpha
assert [r.title for r in screen._rows()] == ["alpha"]
assert [r.title for r in rows if isinstance(r, Separator)] == ["── group ──"]
assert {r.title for r in rows if isinstance(r, Choice)} == {"alpha", "beta", "gamma"}
screen.handle("text", "l") # now 'al' -> only alpha (the heading still shows)
rows = screen._rows()
assert [r.title for r in rows if isinstance(r, Choice)] == ["alpha"]
assert [r.title for r in rows if isinstance(r, Separator)] == ["── group ──"]
assert _run(screen, "enter") == 1