Show More
@@ -27,6 +27,7 b' def init_ipython(ipy):' | |||||
27 | # this should be the LAST one that will be executed, and it will never raise TryNext |
|
27 | # this should be the LAST one that will be executed, and it will never raise TryNext | |
28 | expose_ileo_push(push_ipython_script, 1000) |
|
28 | expose_ileo_push(push_ipython_script, 1000) | |
29 | expose_ileo_push(push_plain_python, 100) |
|
29 | expose_ileo_push(push_plain_python, 100) | |
|
30 | expose_ileo_push(push_ev_node, 100) | |||
30 | ip.user_ns['wb'] = LeoWorkbook() |
|
31 | ip.user_ns['wb'] = LeoWorkbook() | |
31 |
|
32 | |||
32 | show_welcome() |
|
33 | show_welcome() | |
@@ -334,8 +335,9 b' def push_ipython_script(node):' | |||||
334 | script = node.script() |
|
335 | script = node.script() | |
335 |
|
336 | |||
336 | script = g.splitLines(script + '\n') |
|
337 | script = g.splitLines(script + '\n') | |
337 |
|
338 | ip.user_ns['_p'] = node | ||
338 | ip.runlines(script) |
|
339 | ip.runlines(script) | |
|
340 | del ip.user_ns['_p'] | |||
339 |
|
341 | |||
340 | has_output = False |
|
342 | has_output = False | |
341 | for idx in range(hstart,len(ip.IP.input_hist)): |
|
343 | for idx in range(hstart,len(ip.IP.input_hist)): | |
@@ -391,6 +393,16 b' def push_cl_node(node):' | |||||
391 | LeoNode(p2).v = val |
|
393 | LeoNode(p2).v = val | |
392 | es(val) |
|
394 | es(val) | |
393 |
|
395 | |||
|
396 | def push_ev_node(node): | |||
|
397 | """ If headline starts with @ev, eval it and put result in body """ | |||
|
398 | if not node.h.startswith('@ev '): | |||
|
399 | raise TryNext | |||
|
400 | expr = node.h.lstrip('@ev ') | |||
|
401 | es('ipy eval ' + expr) | |||
|
402 | res = ip.ev(expr) | |||
|
403 | node.v = res | |||
|
404 | ||||
|
405 | ||||
394 |
|
406 | |||
395 |
|
407 | |||
396 | def push_position_from_leo(p): |
|
408 | def push_position_from_leo(p): |
General Comments 0
You need to be logged in to leave comments.
Login now