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.314: Tour layout: restore a window's bounds before the tour closes it so KiCad's sticky geometry is never corrupted
3 files changed
+28−2
BRIDGE_VERSION+1−1@@ -1 +1 @@-0.9.313+0.9.314
bridge.json+1−1@@ -2,7 +2,7 @@ "manifest_version": 1, "name": "kicad", "displayName": "KiCad EDA",- "version": "0.9.313",+ "version": "0.9.314", "description": "Reverse bridge for KiCad \u2014 board/schematic introspection, lint via kicad-cli, plugin install, multi-instance probe, in-process DRC.", "homepage": "https://wiki.adom.inc/adom/adom-bridge", "author": "Adom Inc.",
handlers/demo.py+26@@ -934,9 +934,35 @@ def _viewer_3d_owned_by(editor_title: str) -> int | None: return None +def _restore_one(hwnd: int | None) -> bool:+ """Put ONE moved window back before the tour closes it. KiCad writes a+ frame's geometry to its sticky settings on close (measured on ConfRoomROG+ 2026-09-04: the chip viewer closed in its slot, and the board viewer then+ opened in that slot and was 'restored' to it), so a window the tour closes+ must be back where the user had it first."""+ if not hwnd or int(hwnd) not in _SAVED_BOUNDS:+ return False+ b = _SAVED_BOUNDS.pop(int(hwnd))+ try:+ _leftovers_path().write_text(json.dumps(_SAVED_BOUNDS), encoding="utf-8")+ except Exception: # pylint: disable=broad-except+ pass+ try:+ from handlers import ad_client+ if b.get("w") and b.get("h"):+ ad_client.call("desktop_set_window_bounds", {"hwnd": int(hwnd), "x": int(b["x"]), "y": int(b["y"]), "w": int(b["w"]), "h": int(b["h"]),+ "reason": "KiCad tour: restore this window to where the user had it before closing it"}, timeout=8)+ __import__("time").sleep(0.4) # let wx see the new geometry before the close saves it+ return True+ except Exception: # pylint: disable=broad-except+ pass+ return False++ def _close_hwnd(hwnd: int | None) -> None: if not hwnd: return+ _restore_one(hwnd) try: from handlers import ad_client ad_client.call("desktop_close_window", {"hwnd": int(hwnd),