Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: /leo/plugins/ipython.py

leo
Discussion topic

Back to topic list

CVS update: /leo/plugins/ipython.py

Author vivainio
Full name Ville M. Vainio
Date 2008-02-12 12:07:54 PST
Message User: vivainio
Date: 2008-02-12 12:07:54-0800
Log:
 ipython plugin: call leox.push to let IPython handle most of the job

File Changes:

Directory: /leo/plugins/
========================

File [changed]: ipython.py
Url: http://leo.tigris.or​g/source/browse/leo/​plugins/ipython.py?r​1=1.10&r2=1.11
Delta lines: +12 -1
--------------------
--- ipython.py 2008-02-11 15:07:49-0800 1.10
+++ ipython.py 2008-02-12 12:07:50-0800 1.11
@@ -226,13 +226,16 @@
             my_ns = { self.leoxName:leox }
             ses = self.api.make_session(my_ns)
             self.ip = ip = ses.IP.getapi()
+ try:
+ self.ip.ex('import ipy_leo')
+ except ImportError:
+ g.es("ipy_leo.py extension not available - consider upgrading your IPython!")
             self.in_list, self.d_out = ip.IP.input_hist, ip.IP.output_hist
 
             c.inCommand = False # Disable the command lockout logic, just as for scripts.
             sys.argv = []
             ses.mainloop()
                 # Does not return until IPython closes!
- # self.ipshell() # This doesn't return until IPython closes!
         except Exception:
             self.error('exception creating IPython shell')
             g.es_exception()
@@ -293,6 +296,14 @@
         else:
             c = self.c ; p = c.currentPosition()
             sys.argv = [] # Clear the argv vector.
+ try:
+ # if ipython has defined leox.push, call push(p)
+ push = self.ip.user_ns['leox'].push
+ push(p)
+ return
+ except AttributeError:
+ # ipython has not defined 'push' (old version?). Just execute the node
+ pass
 
             # Get the script.
             if script is None:

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: /leo/plugins/ipython.py vivainio Ville M. Vainio 2008-02-12 12:07:54 PST
Messages per page: