##// END OF EJS Templates
ipy_leo: push_plain_python (if P suffix in headstring)
Ville M. Vainio -
Show More
@@ -207,14 +207,23 b' def push_variable(p,varname):'
207 val = eval_body(body.strip())
207 val = eval_body(body.strip())
208 ip.user_ns[varname] = val
208 ip.user_ns[varname] = val
209 g.es('ipy var: %s' % (varname,), tabName = "IPython")
209 g.es('ipy var: %s' % (varname,), tabName = "IPython")
210
211 def push_plain_python(p):
212 script = g.getScript(c,p,useSelectedText=False,forcePythonSentinels=False,useSentinels=False)
213 exec script in ip.user_ns
214 g.es('ipy plain: %s' % (p.headString(),), tabName = "IPython")
210
215
211 def push_from_leo(p):
216 def push_from_leo(p):
212 tup = p.headString().split(None,1)
217 h = p.headString()
218 tup = h.split(None,1)
213 # @ipy foo is variable foo
219 # @ipy foo is variable foo
214 if len(tup) == 2 and tup[0] == '@ipy':
220 if len(tup) == 2 and tup[0] == '@ipy':
215 varname = tup[1]
221 varname = tup[1]
216 push_variable(p,varname)
222 push_variable(p,varname)
217 return
223 return
224 if h.endswith('P'):
225 push_plain_python(p)
226 return
218
227
219 push_script(p)
228 push_script(p)
220 return
229 return
General Comments 0
You need to be logged in to leave comments. Login now