The Archived list puts PLACE before ARCHIVED
The lanes read NAME · PLACE · ARCHIVED · KEY, and the sort ring follows them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d159e006ea
commit
9539ec8f83
5 files changed
+25
-23
No files matched your search
@@ -4,7 +4,7 @@
|
||||
An archive sweep (refer to :mod:`~meshterm.ui.sweep_screen`) removes a contact from the
|
||||
*device*, which is the scarce resource, and keeps the contact here in full. This screen is
|
||||
where those contacts are. It has the same sortable and filterable lane layout as the
|
||||
Contacts list, with its own lane set (``NAME · ARCHIVED · PLACE · KEY``,
|
||||
Contacts list, with its own lane set (``NAME · PLACE · ARCHIVED · KEY``,
|
||||
:data:`~meshterm.ui.contactlist.ARCHIVED_LANES`) and its own sort ring over exactly those
|
||||
four columns. The rest is the same as on the Contacts list: the ``PLACE`` lane comes from
|
||||
the place service and fills in while the list is open, the filter matches a place, and no
|
||||
|
||||
+13
-12
@@ -19,7 +19,7 @@ starts with the name and ends with the key. These two lanes are what a contact *
|
||||
flexible widths are built around them. Each list declares the middle lanes that it wants as
|
||||
a tuple of :class:`ContactLane` (:data:`DEFAULT_LANES` for ``NAME · HEARD · PKTS · KEY``,
|
||||
:data:`TRACE_LANES` for the extra ``TRACED`` of the Trace picker, :data:`ARCHIVED_LANES` for
|
||||
the ``ARCHIVED`` and ``PLACE`` of the Archived list).
|
||||
the ``PLACE`` and ``ARCHIVED`` of the Archived list).
|
||||
|
||||
A lane has its own sort ring id, header label, width, and the way to read its value from a
|
||||
row. Thus to add a lane is a declaration, not a branch: the header, the row builder, the
|
||||
@@ -136,7 +136,7 @@ PKTS_LANE = ContactLane("packets", "PKTS", 5, "count", kind="count")
|
||||
#: How long ago the node was last traced: the extra lane of the Trace-target picker.
|
||||
TRACED_LANE = ContactLane("traced", "TRACED", 6, "last_traced")
|
||||
|
||||
#: How long ago the contact was archived and removed from the device: the first lane of the
|
||||
#: How long ago the contact was archived and removed from the device: the last lane of the
|
||||
#: Archived list. It is drawn exactly as ``HEARD`` is, with the recency heat. It is the same
|
||||
#: question (how long ago did this occur) about a different event. A visual language of its
|
||||
#: own is a second grammar that the user must learn, with no benefit.
|
||||
@@ -144,7 +144,8 @@ ARCHIVED_LANE = ContactLane("archived", "ARCHIVED", 8, "archived_at")
|
||||
|
||||
#: The place of the node: the named area nearest its location (refer to
|
||||
#: :class:`~meshterm.core.places.Place`). It is text, so the list sizes it to its widest value.
|
||||
#: It is the last lane, so it is immediately before the key.
|
||||
#: On the Contacts screen it is the last lane, so it is immediately before the key. On the
|
||||
#: Archived list it is the first lane, after the name (JP, 2026-11-03).
|
||||
PLACE_LANE = ContactLane("place", "PLACE", 5, "place", kind="text")
|
||||
|
||||
#: The middle lanes of the usual contact list: ``NAME · HEARD · PKTS · KEY``.
|
||||
@@ -156,11 +157,11 @@ CONTACTS_LANES: tuple[ContactLane, ...] = (HEARD_LANE, PKTS_LANE, PLACE_LANE)
|
||||
#: The middle lanes of the Trace-target picker, which puts ``TRACED`` before the usual two.
|
||||
TRACE_LANES: tuple[ContactLane, ...] = (TRACED_LANE, HEARD_LANE, PKTS_LANE)
|
||||
|
||||
#: The middle lanes of the Archived list: ``NAME · ARCHIVED · PLACE · KEY``. There is no
|
||||
#: The middle lanes of the Archived list: ``NAME · PLACE · ARCHIVED · KEY``. There is no
|
||||
#: ``HEARD`` and no ``PKTS``. An archived contact is not on the device, so this screen is not
|
||||
#: about what the contact still transmits. It is about when the contact left, and where it
|
||||
#: is. The ``PLACE`` lane is the same as on the Contacts screen, immediately before the key.
|
||||
ARCHIVED_LANES: tuple[ContactLane, ...] = (ARCHIVED_LANE, PLACE_LANE)
|
||||
#: about what the contact still transmits. It is about where the contact is, and when it
|
||||
#: left. The ``PLACE`` lane is the same as on the Contacts screen.
|
||||
ARCHIVED_LANES: tuple[ContactLane, ...] = (PLACE_LANE, ARCHIVED_LANE)
|
||||
|
||||
|
||||
def _row_marks(row: ContactRow) -> str:
|
||||
@@ -228,17 +229,17 @@ TRACE_SORT_OPENS_ASCENDING: dict[str, bool] = {
|
||||
"hash": True,
|
||||
}
|
||||
|
||||
#: The sort ring of the Archived list: ``NAME · ARCHIVED · PLACE · KEY``, the same as
|
||||
#: The sort ring of the Archived list: ``NAME · PLACE · ARCHIVED · KEY``, the same as
|
||||
#: :data:`ARCHIVED_LANES`. ``archived`` opens *ascending* on the age of the lane, so the
|
||||
#: most recently archived contacts come first. This screen answers the question "what did
|
||||
#: that sweep just take?", and the answer must be at the top of the screen. ``place`` sorts
|
||||
#: as on the Contacts screen (refer to
|
||||
#: :data:`~meshterm.ui.widgets.CONTACTS_SORT_OPENS_ASCENDING`).
|
||||
ARCHIVED_SORT_COLUMNS: tuple[str, ...] = ("name", "archived", "place", "hash")
|
||||
ARCHIVED_SORT_COLUMNS: tuple[str, ...] = ("name", "place", "archived", "hash")
|
||||
ARCHIVED_SORT_OPENS_ASCENDING: dict[str, bool] = {
|
||||
"name": True,
|
||||
"archived": True,
|
||||
"place": True,
|
||||
"archived": True,
|
||||
"hash": True,
|
||||
}
|
||||
|
||||
@@ -584,8 +585,8 @@ class ContactListScreen(SelectScreen):
|
||||
other rows in the active sort order. ``lanes`` selects the set: :data:`DEFAULT_LANES`
|
||||
for the usual ``NAME · HEARD · PKTS · KEY``, :data:`TRACE_LANES` for the extra
|
||||
``TRACED`` of the Trace picker, and :data:`ARCHIVED_LANES` for the
|
||||
``NAME · ARCHIVED · KEY`` of the Archived list. Give the set a ``sort`` whose ring
|
||||
covers it.
|
||||
``NAME · PLACE · ARCHIVED · KEY`` of the Archived list. Give the set a ``sort`` whose
|
||||
ring covers it.
|
||||
|
||||
The lanes stay at the left. The name lane has the width of its widest name (not of the
|
||||
terminal). Thus the columns do not move when the window becomes wider, and the free
|
||||
|
||||
@@ -27,10 +27,11 @@ candidate, because it is not in the contact table of the device.
|
||||
|
||||
MeshTerm never hides what a sweep took. **View archived contacts** is directly under the
|
||||
archive action. It opens the archived list (refer to :mod:`~meshterm.ui.archived_screen`).
|
||||
This is its own screen, with the same lane layout, sorted on its own ``NAME · ARCHIVED ·
|
||||
KEY`` columns. It is a screen and not a section at the end of this screen, because it is a
|
||||
different list with different columns. An archived contact has no live heard age or packet
|
||||
count that is worth a lane. What it does have, the time that it left, has no column here.
|
||||
This is its own screen, with the same lane layout, sorted on its own ``NAME · PLACE ·
|
||||
ARCHIVED · KEY`` columns. It is a screen and not a section at the end of this screen,
|
||||
because it is a different list with different columns. An archived contact has no live
|
||||
heard age or packet count that is worth a lane. What it does have, the time that it left,
|
||||
has no column here.
|
||||
|
||||
To remove *one* named contact for good belongs to that contact and not to the list. It is
|
||||
the last action on the Node detail page of the contact, where the user already looks at
|
||||
|
||||
@@ -256,10 +256,10 @@ def _archived_names(screen: ContactListScreen) -> list[str]:
|
||||
|
||||
|
||||
def test_archived_list_has_the_place_column_before_the_key() -> None:
|
||||
"""The Archived list reads NAME, ARCHIVED, PLACE, KEY, and shows each full label."""
|
||||
"""The Archived list reads NAME, PLACE, ARCHIVED, KEY, and shows each full label."""
|
||||
screen = _archived()
|
||||
header = next(line for line in _lines(screen, 200) if "NAME" in line)
|
||||
labels = [header.index(label) for label in ("NAME", "ARCHIVED", "PLACE", "KEY")]
|
||||
labels = [header.index(label) for label in ("NAME", "PLACE", "ARCHIVED", "KEY")]
|
||||
assert labels == sorted(labels)
|
||||
alice = _row(screen, 200, "Alice")
|
||||
assert "Villeray, Montréal" in alice
|
||||
@@ -267,9 +267,9 @@ def test_archived_list_has_the_place_column_before_the_key() -> None:
|
||||
|
||||
|
||||
def test_archived_list_sorts_by_place() -> None:
|
||||
"""Ctrl+→ reaches the place column. Places run A to Z, and a node with none runs last."""
|
||||
"""Ctrl+← reaches the place column. Places run A to Z, and a node with none runs last."""
|
||||
screen = _archived(sort="archived")
|
||||
screen.handle("ctrl_right")
|
||||
screen.handle("ctrl_left")
|
||||
assert screen._sort.column == "place" # noqa: SLF001
|
||||
assert _archived_names(screen) == ["Bob", "Alice", "Carl"]
|
||||
screen.handle("ctrl_down")
|
||||
|
||||
@@ -719,8 +719,8 @@ def test_a_list_draws_exactly_the_lanes_it_declares() -> None:
|
||||
"""The set of lanes decides everything: the header, the row, and the widths read the same tuple.
|
||||
|
||||
The test checks three sets in one run, because none of them must be a special case. The
|
||||
ordinary list, the extra ``TRACED`` of the Trace picker, and the ``NAME · ARCHIVED ·
|
||||
KEY`` of the Archived list all come from the same two builders.
|
||||
ordinary list, the extra ``TRACED`` of the Trace picker, and the ``NAME · PLACE ·
|
||||
ARCHIVED · KEY`` of the Archived list all come from the same two builders.
|
||||
"""
|
||||
from meshterm.ui.contactlist import (
|
||||
ARCHIVED_LANES,
|
||||
|
||||
Reference in new issue
Block a user