Files
eco/tests
lemke_handClaude Sonnet 5 35c4e6bbd5 Add eco.ipymagic: opt-in inline component picker triggered by ...
from eco import bernina
    from eco import ipymagic
    ipymagic.start(bernina)

    In [1]: (1 / ...).plot()
    (1 / bernina.mono.energy).plot()
    <plot appears>

    In [2]: cen = (left := ...) - (right := ...)
    cen = (left := bernina.mono.energy) - (right := bernina.attenuator.transmission)

A bare `...` (the builtin Ellipsis literal -- not an IPython special form,
so this works anywhere IPython's own ast_transformers hook runs: terminal,
notebook/JupyterLab, qtconsole) is replaced, before execution, by the
picked component's real dotted path -- the expanded code is printed, then
run, so what actually executed stays visible and re-typeable. Multiple
`...` in one statement resolve left to right. A `...` used as a numpy
subscript (`arr[...]`) is left alone. Reuses eco.widgets.component_selector
for the actual tree/fold-state/Recent-list machinery -- nothing new there.

New eco.widgets.component_selector_qt.pick_component_modal(): the existing
ComponentSelectorQtWindow is built for embedding/async display (start()
hands off to IPython's own Qt pumping, or run() blocks the whole process
forever); an AST transform needs an actual answer before it can even
return control to IPython, so this drives the same window with its own
nested QEventLoop that quits the instant a pick (or a close) happens.

Also fixed a real bug found while testing this live: IPython's
ast_transformers calls `.visit(node)` on each registered entry (expects
an ast.NodeTransformer-shaped object) -- a bare function registered there
throws 'function' object has no attribute 'visit' once, and IPython
*silently* unregisters it with only a warning, no visible error. Verified
end-to-end against a real Qt window on a real X11 display (Xvfb) plus a
real IPython shell: spawned the picker, drove a real selection via
QTimer, confirmed the printed/executed code and result were both correct.

Deliberately namespace-tree-only for now -- picking from prior *commands*
(eco.logs' kernel history) is a planned second mode, not built here.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-12 16:34:41 +02:00
..
2026-08-30 22:50:56 +02:00
2026-08-21 15:10:25 +02:00
2026-09-11 15:29:43 +02:00
2026-09-07 16:54:05 +02:00
2026-09-07 16:54:05 +02:00
2026-09-09 23:39:12 +02:00
2026-09-06 16:34:29 +02:00
2026-08-21 15:10:25 +02:00
2026-08-21 15:10:25 +02:00
2026-09-11 16:04:34 +02:00
2026-08-28 14:25:39 +02:00
2026-08-21 15:10:25 +02:00
2026-09-06 21:05:04 +02:00
2026-09-11 16:04:34 +02:00
2026-09-06 16:34:29 +02:00
2026-08-21 15:10:25 +02:00
2026-08-21 15:10:25 +02:00
2026-08-21 15:10:25 +02:00
2026-09-07 17:11:28 +02:00
2026-08-21 15:10:25 +02:00
2026-08-21 15:10:25 +02:00
2026-08-30 22:50:56 +02:00
2026-08-21 15:10:25 +02:00
2026-09-06 16:34:29 +02:00
2026-09-11 16:04:34 +02:00
2026-09-11 16:04:34 +02:00
2026-09-06 16:34:29 +02:00