##// END OF EJS Templates
ileo: added lleo, launches Leo within the current ipython session
Ville M. Vainio -
Show More
@@ -27,6 +27,7 b' def init_ipython(ipy):'
27 ip.expose_magic('mb',mb_f)
27 ip.expose_magic('mb',mb_f)
28 ip.expose_magic('lee',lee_f)
28 ip.expose_magic('lee',lee_f)
29 ip.expose_magic('leoref',leoref_f)
29 ip.expose_magic('leoref',leoref_f)
30 ip.expose_magic('lleo',lleo_f)
30 # Note that no other push command should EVER have lower than 0
31 # Note that no other push command should EVER have lower than 0
31 expose_ileo_push(push_mark_req, -1)
32 expose_ileo_push(push_mark_req, -1)
32 expose_ileo_push(push_cl_node,100)
33 expose_ileo_push(push_cl_node,100)
@@ -574,7 +575,8 b' def leoref_f(self,s):'
574 """ Quick reference for ILeo """
575 """ Quick reference for ILeo """
575 import textwrap
576 import textwrap
576 print textwrap.dedent("""\
577 print textwrap.dedent("""\
577 %leoe file/object - open file / object in leo
578 %lee file/object - open file / object in leo
579 %lleo Launch leo (use if you started ipython first!)
578 wb.foo.v - eval node foo (i.e. headstring is 'foo' or '@ipy foo')
580 wb.foo.v - eval node foo (i.e. headstring is 'foo' or '@ipy foo')
579 wb.foo.v = 12 - assign to body of node foo
581 wb.foo.v = 12 - assign to body of node foo
580 wb.foo.b - read or write the body of node foo
582 wb.foo.b - read or write the body of node foo
@@ -608,7 +610,11 b' def mb_completer(self,event):'
608 return cmds
610 return cmds
609
611
610 def ileo_pre_prompt_hook(self):
612 def ileo_pre_prompt_hook(self):
611 c.outerUpdate()
613 # this will fail if leo is not running yet
614 try:
615 c.outerUpdate()
616 except NameError:
617 pass
612 raise TryNext
618 raise TryNext
613
619
614
620
@@ -627,5 +633,21 b' def run_leo_startup_node():'
627 print "Running @ipy-startup nodes"
633 print "Running @ipy-startup nodes"
628 for n in LeoNode(p):
634 for n in LeoNode(p):
629 push_from_leo(n)
635 push_from_leo(n)
630
631
636
637 def lleo_f(selg, args):
638 """ Launch leo from within IPython
639
640 This command will return immediately when Leo has been
641 launched, leaving a Leo session that is connected
642 with current IPython session (once you press alt+I in leo)
643
644 Usage::
645 lleo foo.leo
646 lleo
647 """
648
649 import shlex, sys
650 argv = ['leo'] + shlex.split(args)
651 sys.argv = argv
652 import leo.core.runLeo
653 leo.core.runLeo.run()
General Comments 0
You need to be logged in to leave comments. Login now