app
KiCad - the KiCad Bridge
Public Made by Adomby adom
Reference implementation of the KiCad bridge: multi-instance Python server, forward path via kicad-cli, reverse path via in-process plugin. Most complex of the three bundled bridges.
← Commit history
0.9.286: Z-order guard fix: the 0.9.285 guard read AD's window list with the wrong envelope shape and always saw nothing (field test reported 'no window was launched' during a real relaunch). Both the Symbol Editor launch guard and handlers/foreground_guard now read z-order through handlers.kicad_windows, the one parser of AD's desktop_list_windows.
1 file changed
+9−9
handlers/open_symbol_editor.py+9−9@@ -358,19 +358,19 @@ def _caption_new_frame(user_top: dict | None, rescan: bool = False) -> None: def _user_top_window() -> dict | None:- """The window at the top of the z-order right now, from AD's list- (z field), or None when unreadable."""+ """The window at the top of the z-order right now, via the shared finder+ (handlers.kicad_windows parses AD's envelope: output -> data -> windows; a+ first version of this read res["windows"] and always saw nothing, which is+ why the 0.9.285 field test reported "no window was launched").""" try: from handlers import kicad_windows- from handlers import ad_client- res = ad_client.call("desktop_list_windows", {})- wins = (res or {}).get("windows") or []- if not wins:+ rows = kicad_windows.find(all_windows=True, fresh=True) or []+ rows = [r for r in rows if r.get("z") is not None]+ if not rows: return None- top = sorted(wins, key=lambda w: w.get("z", 10**9))[0]- img = str(top.get("image") or top.get("exe") or "").lower()+ top = sorted(rows, key=lambda r: r.get("z"))[0] return {"hwnd": int(top.get("hwnd") or 0), "title": top.get("title", ""),- "isKicad": ("kicad" in img or "eeschema" in img or "pcbnew" in img)}+ "isKicad": bool(kicad_windows._is_kicad(top))} except Exception: # pylint: disable=broad-except return None