##// 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 27 ip.expose_magic('mb',mb_f)
28 28 ip.expose_magic('lee',lee_f)
29 29 ip.expose_magic('leoref',leoref_f)
30 ip.expose_magic('lleo',lleo_f)
30 31 # Note that no other push command should EVER have lower than 0
31 32 expose_ileo_push(push_mark_req, -1)
32 33 expose_ileo_push(push_cl_node,100)
@@ -574,7 +575,8 b' def leoref_f(self,s):'
574 575 """ Quick reference for ILeo """
575 576 import textwrap
576 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 580 wb.foo.v - eval node foo (i.e. headstring is 'foo' or '@ipy foo')
579 581 wb.foo.v = 12 - assign to body of node foo
580 582 wb.foo.b - read or write the body of node foo
@@ -608,7 +610,11 b' def mb_completer(self,event):'
608 610 return cmds
609 611
610 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 618 raise TryNext
613 619
614 620
@@ -627,5 +633,21 b' def run_leo_startup_node():'
627 633 print "Running @ipy-startup nodes"
628 634 for n in LeoNode(p):
629 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