##// END OF EJS Templates
ipy_leo: '@ipy foo' like nodes can now contain @cl directive
Ville M. Vainio -
Show More
@@ -41,7 +41,7 b' def format_for_leo(obj):'
41 def format_list(obj):
41 def format_list(obj):
42 return "\n".join(str(s) for s in obj)
42 return "\n".join(str(s) for s in obj)
43
43
44 nodename_re = r'(@ipy?[\w-]+)?\s?(\w+)'
44 nodename_re = r'^(@ipy\w*\s+)?(\w+)$'
45
45
46 def all_cells():
46 def all_cells():
47 d = {}
47 d = {}
@@ -91,8 +91,6 b' def eval_node(n):'
91 xformer = ip.ev(hd.strip())
91 xformer = ip.ev(hd.strip())
92 es('Transform w/ %s' % repr(xformer))
92 es('Transform w/ %s' % repr(xformer))
93 return xformer(rest)
93 return xformer(rest)
94
95
96
94
97 class LeoNode(object):
95 class LeoNode(object):
98 def __init__(self,p):
96 def __init__(self,p):
@@ -221,9 +219,14 b' def eval_body(body):'
221 val = IPython.genutils.SList(body.splitlines())
219 val = IPython.genutils.SList(body.splitlines())
222 return val
220 return val
223
221
224 def push_variable(p,varname):
222 def push_variable(p,varname):
225 body = p.bodyString()
223 try:
226 val = eval_body(body.strip())
224 val = eval_node(LeoNode(p))
225 except:
226
227 body = p.bodyString()
228 val = IPython.genutils.SList(body.splitlines())
229
227 ip.user_ns[varname] = val
230 ip.user_ns[varname] = val
228 es('ipy var: %s' % (varname,))
231 es('ipy var: %s' % (varname,))
229
232
@@ -3,7 +3,7 b''
3 <leo_file>
3 <leo_file>
4 <leo_header file_format="2" tnodes="0" max_tnode_index="0" clone_windows="0"/>
4 <leo_header file_format="2" tnodes="0" max_tnode_index="0" clone_windows="0"/>
5 <globals body_outline_ratio="0.5">
5 <globals body_outline_ratio="0.5">
6 <global_window_position top="263" left="521" height="600" width="800"/>
6 <global_window_position top="167" left="763" height="600" width="800"/>
7 <global_log_window_position top="0" left="0" height="0" width="0"/>
7 <global_log_window_position top="0" left="0" height="0" width="0"/>
8 </globals>
8 </globals>
9 <preferences/>
9 <preferences/>
@@ -15,17 +15,22 b''
15 <v t="vivainio.20080218184613.1"><vh>b</vh></v>
15 <v t="vivainio.20080218184613.1"><vh>b</vh></v>
16 <v t="vivainio.20080218200031" a="E"><vh>Some classes</vh>
16 <v t="vivainio.20080218200031" a="E"><vh>Some classes</vh>
17 <v t="vivainio.20080218190816"><vh>File-like access</vh></v>
17 <v t="vivainio.20080218190816"><vh>File-like access</vh></v>
18 <v t="vivainio.20080218200106" a="TV"><vh>csv data</vh></v>
18 <v t="vivainio.20080218200106"><vh>csv data</vh></v>
19 </v>
19 </v>
20 </v>
20 </v>
21 <v t="vivainio.20080218195413" a="E"><vh>Class tests</vh>
21 <v t="vivainio.20080218195413"><vh>Class tests</vh>
22 <v t="vivainio.20080218200509"><vh>csvr</vh></v>
22 <v t="vivainio.20080218200509"><vh>csvr</vh></v>
23 <v t="vivainio.20080218191007"><vh>tempfile</vh></v>
23 <v t="vivainio.20080218191007"><vh>tempfile</vh></v>
24 <v t="vivainio.20080218195413.1"><vh>rfile</vh></v>
24 <v t="vivainio.20080218195413.1"><vh>rfile</vh></v>
25 </v>
25 </v>
26 <v t="vivainio.20080218201219" a="E"><vh>Direct variables</vh>
27 <v t="vivainio.20080218201219.1" a="TV"><vh>@ipy foo</vh></v>
28 <v t="vivainio.20080218201622"><vh>@ipy </vh></v>
29 <v t="vivainio.20080218201219.2"><vh>@ipy bar</vh></v>
30 </v>
26 </vnodes>
31 </vnodes>
27 <tnodes>
32 <tnodes>
28 <t tx="vivainio.20080218184525"></t>
33 <t tx="vivainio.20080218184525">?</t>
29 <t tx="vivainio.20080218184540"># this stuff will be pushed at ipython bridge startup
34 <t tx="vivainio.20080218184540"># this stuff will be pushed at ipython bridge startup
30
35
31 @others</t>
36 @others</t>
@@ -72,5 +77,10 b' readable </t>'
72
77
73 a,b,b
78 a,b,b
74 1,2,2</t>
79 1,2,2</t>
80 <t tx="vivainio.20080218201219"></t>
81 <t tx="vivainio.20080218201219.1">@cl rfile
82 121212</t>
83 <t tx="vivainio.20080218201219.2">"hello world"</t>
84 <t tx="vivainio.20080218201622"></t>
75 </tnodes>
85 </tnodes>
76 </leo_file>
86 </leo_file>
General Comments 0
You need to be logged in to leave comments. Login now