Open the info screen with Enter and move edit into it

Enter on a guest now opens its info screen, replacing i. The guest
table shows Enter as "Info" in the footer. A priority binding at app
level would have taken Enter away from buttons and lists in the
dialogs, so the hint comes from the table's own binding instead.

Editing cores, memory and disk moved from the main screen into the
info screen (key e). When the edit dialog closes, you are back on the
info screen. Test helpers that pressed i or e on the main screen now
go through Enter, because the requirement changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit was merged in pull request #6.
This commit is contained in:
DuckbootandClaude Opus 5.5 committed 2026-11-02 22:34:13 +01:00
1 parent 9ff00e425f
commit 0c3669271c
3 files changed
+82 -22

No files matched your search

+60 -12
View File
@@ -378,6 +378,9 @@ async def test_busy_guest_refuses_second_action(fake):
async def open_edit(app, pilot):
"""Edit lives in the info screen (user request): Enter, then e."""
await settle(app, pilot)
await pilot.press("enter")
await settle(app, pilot)
await pilot.press("e")
await settle(app, pilot)
@@ -443,7 +446,7 @@ async def test_edit_cancel_changes_nothing(fake):
fill(app, cores="8")
await press_button(app, pilot, "#cancel")
assert fake.sets == [] and fake.resizes == []
assert not isinstance(app.screen, ModalScreen)
assert isinstance(app.screen, appmod.InfoScreen) # edit closed, back in info
async def test_grow_needs_confirm_then_resizes(fake):
@@ -549,17 +552,20 @@ async def test_declining_grow_cancels_whole_edit(fake):
assert fake.sets == [] and fake.resizes == []
@pytest.mark.parametrize("key", ["S", "e"])
async def test_escape_closes_modal_without_cli_call(fake, key):
@pytest.mark.parametrize("keys", [["S"], ["enter", "e"]])
async def test_escape_closes_modal_without_cli_call(fake, keys):
app = make_app()
async with app.run_test() as pilot:
await settle(app, pilot)
await pilot.press(key)
await settle(app, pilot)
assert isinstance(app.screen, ModalScreen)
under = app.screen
for key in keys:
under = app.screen
await pilot.press(key)
await settle(app, pilot)
assert isinstance(app.screen, (ConfirmScreen, EditScreen))
await pilot.press("escape")
await settle(app, pilot)
assert not isinstance(app.screen, ModalScreen)
assert app.screen is under # back where the dialog was opened from
assert fake.actions == [] and fake.sets == []
@@ -1047,7 +1053,7 @@ async def open_info(app, pilot, down=0):
await settle(app, pilot)
for _ in range(down):
await pilot.press("down")
await pilot.press("i")
await pilot.press("enter")
await settle(app, pilot)
assert isinstance(app.screen, appmod.InfoScreen)
@@ -1165,7 +1171,7 @@ async def test_i_on_empty_table_does_nothing(fake):
app = make_app()
async with app.run_test() as pilot:
await settle(app, pilot)
await pilot.press("i")
await pilot.press("enter")
await settle(app, pilot)
assert not isinstance(app.screen, appmod.InfoScreen)
assert fake.backups_calls == []
@@ -1798,7 +1804,7 @@ async def test_undo_entry_is_per_guest(fake):
await pilot.press("escape") # close InfoScreen
await settle(app, pilot)
await pilot.press("up")
await pilot.press("i") # VM 108: no change was made there
await pilot.press("enter") # VM 108: no change was made there
await settle(app, pilot)
assert isinstance(app.screen, appmod.InfoScreen)
await pilot.press("u")
@@ -1940,7 +1946,7 @@ async def test_edit_screen_fields_have_labels(fake):
async def open_each_dialog(app, pilot):
"""Yields after each dialog is open; closes it with escape afterwards."""
await settle(app, pilot)
for keys in (["S"], ["e"], ["c"], ["i", "b"], ["i", "n"]):
for keys in (["S"], ["enter", "e"], ["c"], ["enter", "b"], ["enter", "n"]):
for k in keys:
await pilot.press(k)
await settle(app, pilot)
@@ -1970,7 +1976,7 @@ async def test_main_table_is_framed_with_title_and_context(fake):
assert "mainframe" in str(frame.border_subtitle)
@pytest.mark.parametrize("keys", [["e"], ["i", "b"], ["i", "n"]])
@pytest.mark.parametrize("keys", [["enter", "e"], ["enter", "b"], ["enter", "n"]])
async def test_guest_name_with_markup_characters_does_not_break_dialogs(fake, keys):
# border titles are parsed as markup; a name like "a[/b]" must be shown literally
fake.guests = [dict(VM, name="a[/b]")]
@@ -1986,3 +1992,45 @@ async def test_guest_name_with_markup_characters_does_not_break_dialogs(fake, ke
"a[/b]" in Content.from_markup(title).plain
) # what is shown, not how it is stored
assert app.is_running
# --- keys: Enter opens the info screen; edit lives there (user request) ------------
async def test_enter_on_a_guest_opens_its_info_screen(fake):
app = make_app()
async with app.run_test() as pilot:
await settle(app, pilot)
await pilot.press("down") # CT 100
await pilot.press("enter")
await settle(app, pilot)
assert isinstance(app.screen, appmod.InfoScreen)
assert app.screen.guest["vmid"] == 100
async def test_i_and_e_do_nothing_on_the_main_screen(fake):
app = make_app()
async with app.run_test() as pilot:
await settle(app, pilot)
for key in ("i", "e"):
await pilot.press(key)
await settle(app, pilot)
assert not isinstance(app.screen, ModalScreen), key
async def test_e_in_info_screen_edits_that_guest_and_returns_to_info(fake):
app = make_app()
async with app.run_test() as pilot:
await open_edit(app, pilot)
fill(app, cores="8")
await press_button(app, pilot, "#apply")
assert fake.sets == [{"cores": 8}]
assert isinstance(app.screen, appmod.InfoScreen)
async def test_footer_on_main_screen_shows_enter_for_info(fake):
app = make_app()
async with app.run_test() as pilot:
await settle(app, pilot)
shown = [ab.binding for ab in app.active_bindings.values() if ab.binding.show]
assert any(b.key == "enter" and b.description == "Info" for b in shown)