The Panel tab was one flat list: every panel module with an "x" that removed it on any click, then every module on disk again with cryptic "x1" counts and a Browse row that looked selected. - "In the panel, left to right": the modules in panel order, each with move up / move down / remove buttons. Clicking the row itself does nothing, so a stray click no longer removes a module. Backspace/Delete removes the highlighted one, PageUp/PageDown move it. - "Add to the panel": grouped (Apps and windows, System, Clocks, Other), each with a one-line description and an Add button. A module already in the panel is left out, except clocks, which offer "Add another". With nothing left: "Everything is in the panel". - "Browse for a module file..." is a secondary outlined button. - Section headings are larger and full contrast; the popup is 320 wide and now fits a 720-high screen with the default panel. Reordering goes through a new modules.move-instance(slot, delta) capability call, plumbed through both hosts: wasmer stub request 17, host-wasm, the plasmoids host WIT (move-instance(instance-move)) and wasmhost. The shell's move_slot clamps to the ends and saves panel.edn, so the saved format is unchanged. DesktopShell::slot_popup_texts lets tests find popup rows by text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hhRDWZf5WcmrNwnFe3
This commit is contained in:
16 files changed
+514
-98
No files matched your search
@@ -244,21 +244,29 @@ test "launcher module reads the host catalog, filters on typed keys and launches
|
||||
}
|
||||
|
||||
///|
|
||||
test "the settings module's Panel tab lists host modules and asks to load, unload and browse" {
|
||||
test "the settings module's Panel tab lists host modules and asks to load, move, unload and browse" {
|
||||
let p = load_module("session-settings")
|
||||
assert_true(p.imports().contains("modules"))
|
||||
let av = Table::new()
|
||||
av.str("moon-disc")
|
||||
av.str("Moon Phase (disc)")
|
||||
av.str("/m/moon-disc.wasm")
|
||||
av.int(0)
|
||||
av.end_row()
|
||||
for m in [
|
||||
("moon-disc", "Moon Phase (disc)", "/m/moon-disc.wasm", 0),
|
||||
("tasks", "Task Manager", "/m/tasks.wasm", 1),
|
||||
("clock-digital", "Digital Clock", "/m/clock-digital.wasm", 1),
|
||||
] {
|
||||
av.str(m.0)
|
||||
av.str(m.1)
|
||||
av.str(m.2)
|
||||
av.int(m.3)
|
||||
av.end_row()
|
||||
}
|
||||
publish(Modules, av)
|
||||
let li = Table::new()
|
||||
li.str("w1")
|
||||
li.str("clock-digital")
|
||||
li.str("Digital Clock")
|
||||
li.end_row()
|
||||
for i in [("w1", "clock-digital", "Digital Clock"), ("w2", "tasks", "Task Manager")] {
|
||||
li.str(i.0)
|
||||
li.str(i.1)
|
||||
li.str(i.2)
|
||||
li.end_row()
|
||||
}
|
||||
publish(Instances, li)
|
||||
assert_true(p.on_event(false, PointerDown(1, 1)))
|
||||
assert_true(p.on_event(true, KeyDown("3"))) // the Panel tab
|
||||
@@ -266,15 +274,35 @@ test "the settings module's Panel tab lists host modules and asks to load, unloa
|
||||
None => fail("popup should be open")
|
||||
Some(ps) => {
|
||||
let ts = texts_of(ps.ops)
|
||||
assert_true(ts.contains("Digital Clock"))
|
||||
assert_true(ts.contains("Moon Phase (disc)"))
|
||||
assert_true(ts.contains("Clocks"))
|
||||
// The task manager is in the panel and one is enough: it is not offered again. A clock
|
||||
// can go in twice, so it is.
|
||||
assert_eq(ts.filter(t => t == "Task Manager").length(), 1)
|
||||
assert_eq(ts.filter(t => t == "Digital Clock").length(), 2)
|
||||
assert_true(ts.contains("Add another"))
|
||||
assert_false(ts.contains("x1"))
|
||||
}
|
||||
}
|
||||
// Below the tab bar (40), rows of 28: heading, loaded, heading, available, browse.
|
||||
ignore(p.on_event(true, PointerDown(20, 40 + 28 + 3)))
|
||||
ignore(p.on_event(true, PointerDown(20, 40 + 3 * 28 + 3)))
|
||||
ignore(p.on_event(true, PointerDown(20, 40 + 4 * 28 + 3)))
|
||||
assert_eq(drain(), [UnloadInstance("w1"), LoadModule("/m/moon-disc.wasm"), Browse])
|
||||
// Below the tab bar (40): heading (28), the two panel rows (30 each, buttons up at x 222-246,
|
||||
// down 248-272, remove 284-308), heading (28), "Clocks" (22), two Add rows (42 each), Browse.
|
||||
ignore(p.on_event(true, PointerDown(20, 82))) // w1's row itself: nothing
|
||||
ignore(p.on_event(true, PointerDown(234, 82))) // w1 is first: up does nothing
|
||||
ignore(p.on_event(true, PointerDown(260, 82))) // down
|
||||
ignore(p.on_event(true, PointerDown(296, 112))) // w2's remove
|
||||
ignore(p.on_event(true, PointerDown(20, 190))) // add the moon
|
||||
ignore(p.on_event(true, PointerDown(160, 285))) // browse
|
||||
assert_eq(drain(), [
|
||||
MoveInstance("w1", 1),
|
||||
UnloadInstance("w2"),
|
||||
LoadModule("/m/moon-disc.wasm"),
|
||||
Browse,
|
||||
])
|
||||
// Keys: Backspace removes the highlighted panel module, PageUp moves it.
|
||||
ignore(p.on_event(true, PointerMove(20, 112)))
|
||||
assert_true(p.on_event(true, KeyDown("PageUp")))
|
||||
assert_true(p.on_event(true, KeyDown("Backspace")))
|
||||
assert_eq(drain(), [MoveInstance("w2", -1), UnloadInstance("w1")])
|
||||
p.unload()
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user