← Commit history

dev skill: background canvas-load SOLVED recipe (two-hop debounce, 3-arg DataViewEvent, GetSelection not model-walk, native VK_RETURN to tree hwnd) + the async-self-raise open question

John Lauer ·4fea232bcb ·2mo ago ·parent 83c1f24
1 file changed +19
skills/kicad-bridge-dev/SKILL.md+19
@@ -223,6 +223,25 @@ declares longer per-verb budgets; the bridge keeps working. Judge a beat by OBSE (`desktop_list_windows`, titles) rather than looping the call — re-issuing beat 1 in a loop is how five duplicate editor pairs got spawned (fixed by idempotent warm-up, but don't do it). ++**Background canvas-load: SOLVED (v0.9.74 / plugin 0.9.1, verified live 2026-08-09).**+The winning recipe, end to end: `open_symbol_editor` tries `_plugin_background_load()` first →+plugin `select_and_load_symbol` runs TWO UI-thread hops orchestrated from the RPC worker+thread — hop 1 sets the LIB_TREE filter, a 0.8 s worker-side sleep lets KiCad's search+debounce timer fire on the UI thread (one-hop always sees `selection:false`), hop 2 takes+`dvc.GetSelection()` (never the v0.6.0 whole-model walk — that segfaulted) and activates via+`DataViewEvent(wxEVT_DATAVIEW_ITEM_ACTIVATED, dvc, sel)` (3-arg ctor; the no-arg + SetItem+pattern raises TypeError on wxPython 4.2) plus a native `PostMessageW(VK_RETURN)` to the+tree's own hwnd. Result: title goes to `Adom:AdomDemo_IC — Symbol Editor` with zero focus,+keyboard, or cursor theft. `useSendInput:true` remains the explicit noisy fallback; the PS+navigate is the no-plugin fallback.++**Still open:** post-load the editor may self-raise AFTER the dispatcher's 16 s persistent+restore expires (the ITEM_ACTIVATED load is async). Verify on an idle desktop; if confirmed,+extend the demo/open_symbol_editor restore window or push an SW_SHOWNOACTIVATE after the+title flips. Do NOT measure this while the user is actively working — their own clicks+confound the z-order.+ ## 🎬 The demo verb (`kicad_demo`) — match the ecosystem contract  Hydrogen's installer demos BOTH bridges, so `kicad_demo` deliberately returns the SAME