Section headers: Capitalized and accent-highlighted, not UPPERCASE
Separator gains a style field (default muted) so section headings can carry the accent highlight while blank spacers, column-header lines, and inline notes stay muted. Panel titles and inline section labels (Trace summary, Route, Busiest links, ...) follow suit; column headers alone keep the UPPERCASE convention. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
768487e456
commit
8839e4cf70
9 files changed
+32
-25
No files matched your search
@@ -119,11 +119,14 @@ class ChatTool(Tool):
|
||||
lasts = ctx.repo.last_chat_messages()
|
||||
live = _LiveLasts(ctx, seed=lasts)
|
||||
|
||||
items: list = [Separator(_picker_header()), Separator("── 📡 CHANNELS ──")]
|
||||
items: list = [
|
||||
Separator(_picker_header()),
|
||||
Separator("── 📡 Channels ──", style="accent"),
|
||||
]
|
||||
for conversation in channels:
|
||||
items.append(Choice(title=_row_title(ctx, conversation, live), value=conversation))
|
||||
|
||||
items.append(Separator("── 👤 DIRECT ──"))
|
||||
items.append(Separator("── 👤 Direct ──", style="accent"))
|
||||
if contacts:
|
||||
# List contacts by recency — those with messages first, newest exchange at the
|
||||
# top — then the never-contacted ones alphabetically (see _recency_key).
|
||||
|
||||
@@ -256,7 +256,7 @@ def _radio_panel(config: RadioConfig) -> Panel:
|
||||
("symbol time ", "muted"), (f"{config.symbol_time_ms():.2f} ms\n", ""),
|
||||
("low data rate ", "muted"), (ldr, ""),
|
||||
)
|
||||
return Panel(body, title="[accent]RADIO CONFIG[/accent]", border_style="muted", expand=False)
|
||||
return Panel(body, title="[accent]Radio config[/accent]", border_style="muted", expand=False)
|
||||
|
||||
|
||||
def _budget_panel(budget: link_budget.LinkBudget) -> Panel:
|
||||
@@ -300,7 +300,7 @@ def _budget_panel(budget: link_budget.LinkBudget) -> Panel:
|
||||
)
|
||||
table.add_row(" dwell-time", cell)
|
||||
|
||||
return Panel(table, title="[accent]LINK BUDGET[/accent]", border_style="accent", expand=False)
|
||||
return Panel(table, title="[accent]Link budget[/accent]", border_style="accent", expand=False)
|
||||
|
||||
|
||||
def _is_pos_int(value: str) -> bool | str:
|
||||
|
||||
@@ -222,7 +222,7 @@ def _report_panel(report: HealthReport) -> Panel:
|
||||
)
|
||||
if not report.changes:
|
||||
return Panel(
|
||||
header, title="[accent]LINK HEALTH[/accent]", border_style=style, expand=False
|
||||
header, title="[accent]Link health[/accent]", border_style=style, expand=False
|
||||
)
|
||||
|
||||
table = Table(box=None, padding=(0, 2, 0, 0), expand=False)
|
||||
@@ -238,7 +238,7 @@ def _report_panel(report: HealthReport) -> Panel:
|
||||
from rich.console import Group
|
||||
|
||||
body = Group(header, Text(), table)
|
||||
return Panel(body, title="[accent]LINK HEALTH[/accent]", border_style=style, expand=False)
|
||||
return Panel(body, title="[accent]Link health[/accent]", border_style=style, expand=False)
|
||||
|
||||
|
||||
def _change_row(change: MetricChange) -> tuple[str, Text, str, str, Text]:
|
||||
|
||||
@@ -200,7 +200,7 @@ def _graph_panel(graph: RouteGraph) -> Panel:
|
||||
)
|
||||
if not graph.links:
|
||||
return Panel(
|
||||
header, title="[accent]ROUTE STABILITY[/accent]", border_style="muted", expand=False
|
||||
header, title="[accent]Route stability[/accent]", border_style="muted", expand=False
|
||||
)
|
||||
|
||||
table = Table(box=None, padding=(0, 2, 0, 0), expand=False)
|
||||
@@ -216,9 +216,9 @@ def _graph_panel(graph: RouteGraph) -> Panel:
|
||||
|
||||
from rich.console import Group
|
||||
|
||||
body = Group(header, Text("\nBUSIEST LINKS", style="muted"), table)
|
||||
body = Group(header, Text("\nBusiest links", style="accent"), table)
|
||||
return Panel(
|
||||
body, title="[accent]ROUTE STABILITY[/accent]", border_style="accent", expand=False
|
||||
body, title="[accent]Route stability[/accent]", border_style="accent", expand=False
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -228,7 +228,7 @@ async def _main_menu(
|
||||
ctx: "AppContext", slots: list[ChannelSlot], capacity: int, *, default: object = None
|
||||
) -> object:
|
||||
"""Show the channel list and the add-a-channel actions; return the chosen value."""
|
||||
items: list = [Separator(f"── CHANNELS ({len(slots)}/{capacity}) ──")]
|
||||
items: list = [Separator(f"── Channels ({len(slots)}/{capacity}) ──", style="accent")]
|
||||
if slots:
|
||||
for slot in slots:
|
||||
items.append(Choice(title=_slot_label(slot), value=slot.idx))
|
||||
@@ -236,10 +236,10 @@ async def _main_menu(
|
||||
items.append(Separator(" (no channels configured yet)"))
|
||||
|
||||
if len(slots) > 1:
|
||||
items.append(Separator("── ORGANIZE ──"))
|
||||
items.append(Separator("── Organize ──", style="accent"))
|
||||
items.append(Choice(title="↕ Reorder channels", value=_REORDER))
|
||||
|
||||
items.append(Separator("── ADD A CHANNEL ──"))
|
||||
items.append(Separator("── Add a channel ──", style="accent"))
|
||||
items.append(Choice(title="+ New private channel (random key)", value=_CREATE))
|
||||
items.append(Choice(title="# Public channel (key from its name)", value=_PUBLIC))
|
||||
items.append(Choice(title="🔑 Join a channel with its key", value=_JOIN))
|
||||
|
||||
@@ -194,7 +194,7 @@ def config_table(
|
||||
indent = " "
|
||||
for category, specs in settings_by_category():
|
||||
table.add_section()
|
||||
header = [f"[accent]── {category.upper()} ──[/accent]", ""]
|
||||
header = [f"[accent]── {category} ──[/accent]", ""]
|
||||
if show_staged:
|
||||
header.append("")
|
||||
table.add_row(*header, "")
|
||||
@@ -208,7 +208,7 @@ def config_table(
|
||||
table.add_section()
|
||||
cols = 4 if show_staged else 3
|
||||
table.add_row(
|
||||
"[accent]── CUSTOM ──[/accent]", *([""] * (cols - 1))
|
||||
"[accent]── Custom ──[/accent]", *([""] * (cols - 1))
|
||||
)
|
||||
for key, value in custom.items():
|
||||
row = [f"{indent}{key}", value]
|
||||
@@ -317,13 +317,13 @@ def _menu_items(
|
||||
)
|
||||
]
|
||||
for category, rows in sections:
|
||||
items.append(Separator(f"── {category.upper()} ──"))
|
||||
items.append(Separator(f"── {category} ──", style="accent"))
|
||||
for label, value, help_text, key in rows:
|
||||
items.append(
|
||||
Choice(title=_lane_row(label, value, help_text, label_w, value_w), value=key)
|
||||
)
|
||||
|
||||
items.append(Separator("── REVIEW ──"))
|
||||
items.append(Separator("── Review ──", style="accent"))
|
||||
items.append(
|
||||
Choice(
|
||||
title=Text.assemble(
|
||||
|
||||
+1
-1
@@ -260,7 +260,7 @@ async def _menu_loop(ctx: AppContext, session: TuiSession) -> None:
|
||||
for tool in tools:
|
||||
if tool.category != current_category:
|
||||
current_category = tool.category
|
||||
items.append(Separator(f"── {current_category.upper()} ──"))
|
||||
items.append(Separator(f"── {current_category} ──", style="accent"))
|
||||
label = tool.title or tool.name
|
||||
row = Text(label)
|
||||
row.append(" " * (name_w - cell_len(label) + 2))
|
||||
|
||||
@@ -46,13 +46,17 @@ def _plain(label: Union[str, Text]) -> str:
|
||||
|
||||
@dataclass
|
||||
class Separator:
|
||||
"""A non-selectable group heading.
|
||||
"""A non-selectable row between choices.
|
||||
|
||||
Attributes:
|
||||
title: The heading text (rendered muted).
|
||||
title: The row's text.
|
||||
style: Theme style the row is drawn in. Section headings pass ``"accent"`` so
|
||||
they read as highlighted landmarks; the default ``"muted"`` fits the
|
||||
structural rows (blank spacers, column-header lines, inline notes).
|
||||
"""
|
||||
|
||||
title: str
|
||||
style: str = "muted"
|
||||
|
||||
|
||||
Item = "Choice | Separator"
|
||||
@@ -215,7 +219,7 @@ class SelectScreen(Screen):
|
||||
lines.append(render_to_ansi(Text(f"/{self._filter}", style="warn"), width))
|
||||
for item in rows:
|
||||
if isinstance(item, Separator):
|
||||
sep = render_to_ansi(Text(item.title, style="muted"), width)
|
||||
sep = render_to_ansi(Text(item.title, style=item.style), width)
|
||||
self._sticky_headers.append((len(lines), sep))
|
||||
lines.append(sep)
|
||||
continue
|
||||
|
||||
@@ -106,7 +106,7 @@ def banner(
|
||||
f"[brand]MeshTerm[/brand] [muted]v{__version__}[/muted]\n"
|
||||
f"[muted]device:[/muted] {target}"
|
||||
)
|
||||
return Panel(body, border_style="accent", expand=False, title="[accent]MESH[/accent]")
|
||||
return Panel(body, border_style="accent", expand=False, title="[accent]Mesh[/accent]")
|
||||
|
||||
|
||||
def make_progress(console: Console) -> Progress:
|
||||
@@ -433,18 +433,18 @@ def stats_panel(
|
||||
)
|
||||
sections: list[Text | Table] = []
|
||||
if route is not None:
|
||||
sections.append(Text("ROUTE", style="muted"))
|
||||
sections.append(Text("Route", style="accent"))
|
||||
sections.append(_route_text(route, device_label, resolve, device_hash))
|
||||
sections.append(Text()) # blank line before the stats block
|
||||
sections.append(summary)
|
||||
if stats.hop_snrs:
|
||||
sections.append(Text("\nPER-HOP MEDIANS", style="muted"))
|
||||
sections.append(Text("\nPer-hop medians", style="accent"))
|
||||
hash_bytes = route.path_hash_bytes if route is not None else None
|
||||
sections.append(
|
||||
_hop_medians_table(stats.hop_snrs, device_label, resolve, hash_bytes, device_hash)
|
||||
)
|
||||
body: Text | Group = sections[0] if len(sections) == 1 else Group(*sections)
|
||||
return Panel(body, title="[accent]TRACE SUMMARY[/accent]", border_style="accent", expand=False)
|
||||
return Panel(body, title="[accent]Trace summary[/accent]", border_style="accent", expand=False)
|
||||
|
||||
|
||||
# Node-type glyphs and their colours, consistent with the map's marker palette across the
|
||||
@@ -760,4 +760,4 @@ def tx_opt_summary(result: TxOptResult) -> Panel:
|
||||
(f"{result.original_tx if result.original_tx is not None else '?'}\n", ""),
|
||||
("status ", "muted"), Text.from_markup(applied),
|
||||
)
|
||||
return Panel(body, title="[accent]TX OPTIMIZATION[/accent]", border_style="accent", expand=False)
|
||||
return Panel(body, title="[accent]TX optimization[/accent]", border_style="accent", expand=False)
|
||||
Reference in new issue
Block a user