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) | |
@@ -39,8 +40,8 b' def init_ipython(ipy):' | |||||
39 | wb = LeoWorkbook() |
|
40 | wb = LeoWorkbook() | |
40 | ip.user_ns['wb'] = wb |
|
41 | ip.user_ns['wb'] = wb | |
41 |
|
42 | |||
42 | show_welcome() |
|
|||
43 |
|
43 | |||
|
44 | first_launch = True | |||
44 |
|
45 | |||
45 | def update_commander(new_leox): |
|
46 | def update_commander(new_leox): | |
46 | """ Set the Leo commander to use |
|
47 | """ Set the Leo commander to use | |
@@ -50,7 +51,12 b' def update_commander(new_leox):' | |||||
50 | ipython-launch to tell ILeo what document the commands apply to. |
|
51 | ipython-launch to tell ILeo what document the commands apply to. | |
51 |
|
52 | |||
52 | """ |
|
53 | """ | |
53 |
|
54 | |||
|
55 | global first_launch | |||
|
56 | if first_launch: | |||
|
57 | show_welcome() | |||
|
58 | first_launch = False | |||
|
59 | ||||
54 | global c,g |
|
60 | global c,g | |
55 | c,g = new_leox.c, new_leox.g |
|
61 | c,g = new_leox.c, new_leox.g | |
56 | print "Set Leo Commander:",c.frame.getTitle() |
|
62 | print "Set Leo Commander:",c.frame.getTitle() | |
@@ -568,13 +574,12 b' def lee_f(self,s):' | |||||
568 | finally: |
|
574 | finally: | |
569 | c.redraw() |
|
575 | c.redraw() | |
570 |
|
576 | |||
571 |
|
||||
572 |
|
||||
573 | def leoref_f(self,s): |
|
577 | def leoref_f(self,s): | |
574 | """ Quick reference for ILeo """ |
|
578 | """ Quick reference for ILeo """ | |
575 | import textwrap |
|
579 | import textwrap | |
576 | print textwrap.dedent("""\ |
|
580 | print textwrap.dedent("""\ | |
577 |
%le |
|
581 | %lee file/object - open file / object in leo | |
|
582 | %lleo Launch leo (use if you started ipython first!) | |||
578 | wb.foo.v - eval node foo (i.e. headstring is 'foo' or '@ipy foo') |
|
583 | 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 |
|
584 | wb.foo.v = 12 - assign to body of node foo | |
580 | wb.foo.b - read or write the body of node foo |
|
585 | wb.foo.b - read or write the body of node foo | |
@@ -608,7 +613,11 b' def mb_completer(self,event):' | |||||
608 | return cmds |
|
613 | return cmds | |
609 |
|
614 | |||
610 | def ileo_pre_prompt_hook(self): |
|
615 | def ileo_pre_prompt_hook(self): | |
611 | c.outerUpdate() |
|
616 | # this will fail if leo is not running yet | |
|
617 | try: | |||
|
618 | c.outerUpdate() | |||
|
619 | except NameError: | |||
|
620 | pass | |||
612 | raise TryNext |
|
621 | raise TryNext | |
613 |
|
622 | |||
614 |
|
623 | |||
@@ -627,5 +636,25 b' def run_leo_startup_node():' | |||||
627 | print "Running @ipy-startup nodes" |
|
636 | print "Running @ipy-startup nodes" | |
628 | for n in LeoNode(p): |
|
637 | for n in LeoNode(p): | |
629 | push_from_leo(n) |
|
638 | push_from_leo(n) | |
630 |
|
||||
631 |
|
639 | |||
|
640 | def lleo_f(selg, args): | |||
|
641 | """ Launch leo from within IPython | |||
|
642 | ||||
|
643 | This command will return immediately when Leo has been | |||
|
644 | launched, leaving a Leo session that is connected | |||
|
645 | with current IPython session (once you press alt+I in leo) | |||
|
646 | ||||
|
647 | Usage:: | |||
|
648 | lleo foo.leo | |||
|
649 | lleo | |||
|
650 | """ | |||
|
651 | ||||
|
652 | import shlex, sys | |||
|
653 | argv = ['leo'] + shlex.split(args) | |||
|
654 | sys.argv = argv | |||
|
655 | # if this var exists and is true, leo will "launch" (connect) | |||
|
656 | # ipython immediately when it's started | |||
|
657 | global _request_immediate_connect | |||
|
658 | _request_immediate_connect = True | |||
|
659 | import leo.core.runLeo | |||
|
660 | leo.core.runLeo.run() |
General Comments 0
You need to be logged in to leave comments.
Login now