The gesture ladder stops clicking the field before it types

check-gui-sketching.py located the value field by hunting for a small top-level
window and clicked into it before typing. Both halves are now wrong, and the second
was always a problem:

 - field_win() cannot find a field that is not a window any more, so every check
   built on it silently became one that cannot fail. Replaced by field_open(),
   which asks the app: sketch_describe's `editing` is value_field_open().

 - focus_field() clicked into the field first, and its own docstring said why —
   "WITHOUT THIS THE TYPED VALUE IS SILENTLY DISCARDED". That workaround is exactly
   what made this suite blind to the defect the user reported: a ladder that clicks
   the field first can never notice that typing WITHOUT clicking is broken. Now a
   documented no-op; the field is in the canvas and the canvas has the keyboard.

Measured on behemoth against e5659e0f0f: 64 checks pass, 2 fail. The two are
polygon regularity and area (sides {29.999986, 29.975164, 30.0}, area 2336.98 vs
2338.27) — geometry tolerances, nothing to do with typed values; before this change
the same run failed 5, all of them dimensions and constraints that never received
their value because focus_field() was clicking at a window that no longer exists.
No baseline exists for the remaining two, so they are reported, not claimed as
pre-existing. The suite also still stops at D3 with the app gone; tracked separately.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011FbJKJAJxxkhDTs9XdZzKA
This commit is contained in:
Tommaso Bianchi
2026-09-06 11:26:12 +02:00
co-authored by Claude Opus 5
parent e5659e0f0f
commit 1dff232f0b
+22 -33
View File
@@ -324,45 +324,34 @@ def calibrate_here():
PACE = 1.0 PACE = 1.0
def field_win(): def field_open():
"""The open in-canvas value field as (x, y, w, h) in SCREEN pixels, or None. """Is a sketch value field open? Asked of the APP, not of the window list.
It is a top-level window of its own, not a child of the canvas (a native child cannot be It used to be answered by hunting for a small top-level window, because the field WAS one.
composited over the double-buffered wxGLCanvas), so it is found by enumerating windows rather It is not any more — it is drawn by ImGui inside the GL canvas precisely so that no window
than by looking inside the app's frame. Two other small top-levels exist: the status chip, manager gets a vote on whether it may hold the keyboard. Enumerating windows now always
which lives on the bottom edge, and 1x1/10x10 helpers. answers "no field", which turns every check built on it into one that cannot fail.
sketch_describe's `editing` is DesignSketchTool::value_field_open(), i.e. the app's own
answer to the same question.
""" """
_, X, Y, W, H = win() d = try_call("sketch_describe")
for w in sh(f"DISPLAY={DISP} xdotool search --onlyvisible --class '.'").split(): return bool(d and d.get("editing"))
g = dict(l.split("=", 1) for l in
sh(f"DISPLAY={DISP} xdotool getwindowgeometry --shell {w}").strip().splitlines()
if "=" in l)
if "WIDTH" not in g:
continue
x, y, ww, hh = int(g["X"]), int(g["Y"]), int(g["WIDTH"]), int(g["HEIGHT"])
if ww >= W or hh < 24 or hh > 120 or ww < 40:
continue
if y > Y + H - 80: # the status chip, pinned to the bottom edge
continue
return (x, y, ww, hh)
return None
def focus_field(): def focus_field():
"""Put the keyboard in the value field, by clicking it. """Deliberately nothing.
WITHOUT THIS THE TYPED VALUE IS SILENTLY DISCARDED. The field is shown and raised but the This used to click into the value field before typing, and its old docstring explained why:
window manager does not give it the keyboard, so xdotool's digits go to the canvas and Return "WITHOUT THIS THE TYPED VALUE IS SILENTLY DISCARDED ... the window manager does not give it
commits the value the field opened with — the pre-filled as-drawn number. The failure is the keyboard, so xdotool's digits go to the canvas". That was a workaround for the field
invisible from the outside: a constraint IS created, the solve succeeds, and the sketch simply being a separate top-level window, and it is also what made this ladder blind to the very
holds the dimension you did not ask for (typed 40, got 54.94). One click fixes it. defect the user reported — a suite that clicks the field first can never see that typing
without clicking is broken.
The field is now inside the canvas and the canvas has the keyboard, so typing just works and
there is nothing to click. Kept as a no-op so the call sites still read in order.
""" """
r = field_win()
if r is None:
return False
x, y, w, h = r
xdo(f"mousemove {x + w // 2} {y + h // 2} click --delay 120 1")
time.sleep(0.3)
return True return True
@@ -1732,7 +1721,7 @@ def rung_type_guards():
clickmm(*rim(cs[0])); clickmm(*rim(cs[1])) clickmm(*rim(cs[0])); clickmm(*rim(cs[1]))
click(*CON_BTN["angle"]) click(*CON_BTN["angle"])
time.sleep(1.0) time.sleep(1.0)
check("ANGLE", field_win() is None, check("ANGLE", not field_open(),
"Angle on two circles opened no value field") "Angle on two circles opened no value field")
key("Escape", 0.6) key("Escape", 0.6)
d2 = confirm_and_reopen() d2 = confirm_and_reopen()