Show More
@@ -149,13 +149,31 b' def add_var(varname, value = _dummyval):' | |||||
149 | def add_file(self,fname): |
|
149 | def add_file(self,fname): | |
150 | p2 = c.currentPosition().insertAfter() |
|
150 | p2 = c.currentPosition().insertAfter() | |
151 |
|
151 | |||
152 |
def push_script(p): |
|
152 | def push_script(p): | |
153 | script = g.getScript(c,p,useSelectedText=False,forcePythonSentinels=True,useSentinels=False) |
|
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 | script = g.splitLines(script + '\n') |
|
157 | script = g.splitLines(script + '\n') | |
155 | script = ''.join(z for z in script if z.strip()) |
|
158 | script = ''.join(z for z in script if z.strip()) | |
|
159 | ||||
156 | ip.runlines(script) |
|
160 | ip.runlines(script) | |
157 | g.es('ipy script:',p.headString()) |
|
161 | ||
158 | print " ->" |
|
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 | def eval_body(body): |
|
178 | def eval_body(body): | |
161 | try: |
|
179 | try: | |
@@ -169,7 +187,7 b' def push_variable(p,varname):' | |||||
169 | body = p.bodyString() |
|
187 | body = p.bodyString() | |
170 | val = eval_body(body.strip()) |
|
188 | val = eval_body(body.strip()) | |
171 | ip.user_ns[varname] = val |
|
189 | ip.user_ns[varname] = val | |
172 |
g.es('ipy var:', |
|
190 | g.es('ipy var: %s' % (varname,), tabName = "IPython") | |
173 |
|
191 | |||
174 | def push_from_leo(p): |
|
192 | def push_from_leo(p): | |
175 | # headstring without @ are just scripts |
|
193 | # headstring without @ are just scripts |
General Comments 0
You need to be logged in to leave comments.
Login now