##// END OF EJS Templates
ipy_leo: track results in leo tab
vivainio -
Show More
@@ -149,13 +149,31 b' def add_var(varname, value = _dummyval):'
149 149 def add_file(self,fname):
150 150 p2 = c.currentPosition().insertAfter()
151 151
152 def push_script(p):
153 script = g.getScript(c,p,useSelectedText=False,forcePythonSentinels=True,useSentinels=False)
152 def push_script(p):
153 ohist = ip.IP.output_hist
154 hstart = len(ip.IP.input_hist)
155 script = g.getScript(c,p,useSelectedText=False,forcePythonSentinels=False,useSentinels=False)
156
154 157 script = g.splitLines(script + '\n')
155 158 script = ''.join(z for z in script if z.strip())
159
156 160 ip.runlines(script)
157 g.es('ipy script:',p.headString())
158 print " ->"
161
162 has_output = False
163 for idx in range(hstart,len(ip.IP.input_hist)):
164 val = ohist.get(idx,None)
165 if val is None:
166 continue
167 has_output = True
168 inp = ip.IP.input_hist[idx]
169 if inp.strip():
170 g.es('In: %s' % (inp[:40], ), tabName = 'IPython')
171
172 g.es('<%d> %s' % (idx, pprint.pformat(ohist[idx],width = 40)), tabName = 'IPython')
173
174 if not has_output:
175 g.es('ipy run: %s' %( p.headString(),), tabName = 'IPython')
176
159 177
160 178 def eval_body(body):
161 179 try:
@@ -169,7 +187,7 b' def push_variable(p,varname):'
169 187 body = p.bodyString()
170 188 val = eval_body(body.strip())
171 189 ip.user_ns[varname] = val
172 g.es('ipy var:',varname)
190 g.es('ipy var: %s' % (varname,), tabName = "IPython")
173 191
174 192 def push_from_leo(p):
175 193 # headstring without @ are just scripts
General Comments 0
You need to be logged in to leave comments. Login now