Show More
@@ -14,6 +14,8 b' import IPython.Shell' | |||||
14 |
|
14 | |||
15 | _leo_push_history = set() |
|
15 | _leo_push_history = set() | |
16 |
|
16 | |||
|
17 | wb = None | |||
|
18 | ||||
17 | def init_ipython(ipy): |
|
19 | def init_ipython(ipy): | |
18 | """ This will be run by _ip.load('ipy_leo') |
|
20 | """ This will be run by _ip.load('ipy_leo') | |
19 |
|
21 | |||
@@ -29,6 +31,7 b' def init_ipython(ipy):' | |||||
29 | ip.expose_magic('leoref',leoref_f) |
|
31 | ip.expose_magic('leoref',leoref_f) | |
30 | ip.expose_magic('lleo',lleo_f) |
|
32 | ip.expose_magic('lleo',lleo_f) | |
31 | ip.expose_magic('lshadow', lshadow_f) |
|
33 | ip.expose_magic('lshadow', lshadow_f) | |
|
34 | ip.expose_magic('lno', lno_f) | |||
32 | # Note that no other push command should EVER have lower than 0 |
|
35 | # Note that no other push command should EVER have lower than 0 | |
33 | expose_ileo_push(push_mark_req, -1) |
|
36 | expose_ileo_push(push_mark_req, -1) | |
34 | expose_ileo_push(push_cl_node,100) |
|
37 | expose_ileo_push(push_cl_node,100) | |
@@ -44,6 +47,8 b' def init_ipython(ipy):' | |||||
44 |
|
47 | |||
45 | first_launch = True |
|
48 | first_launch = True | |
46 |
|
49 | |||
|
50 | c,g = None, None | |||
|
51 | ||||
47 | def update_commander(new_leox): |
|
52 | def update_commander(new_leox): | |
48 | """ Set the Leo commander to use |
|
53 | """ Set the Leo commander to use | |
49 |
|
54 | |||
@@ -281,7 +286,13 b' class LeoNode(object, UserDict.DictMixin):' | |||||
281 | def go(self): |
|
286 | def go(self): | |
282 | """ Set node as current node (to quickly see it in Outline) """ |
|
287 | """ Set node as current node (to quickly see it in Outline) """ | |
283 | c.setCurrentPosition(self.p) |
|
288 | c.setCurrentPosition(self.p) | |
284 | c.redraw() |
|
289 | ||
|
290 | # argh, there should be another way | |||
|
291 | c.redraw() | |||
|
292 | s = self.p.bodyString() | |||
|
293 | c.setBodyString(self.p,s) | |||
|
294 | ||||
|
295 | ||||
285 |
|
296 | |||
286 | def append(self): |
|
297 | def append(self): | |
287 | """ Add new node as the last child, return the new node """ |
|
298 | """ Add new node as the last child, return the new node """ | |
@@ -617,7 +628,7 b' def ileo_pre_prompt_hook(self):' | |||||
617 | # this will fail if leo is not running yet |
|
628 | # this will fail if leo is not running yet | |
618 | try: |
|
629 | try: | |
619 | c.outerUpdate() |
|
630 | c.outerUpdate() | |
620 | except NameError: |
|
631 | except (NameError, AttributeError): | |
621 | pass |
|
632 | pass | |
622 | raise TryNext |
|
633 | raise TryNext | |
623 |
|
634 | |||
@@ -667,6 +678,30 b' def lleo_f(selg, args):' | |||||
667 | import leo.core.runLeo |
|
678 | import leo.core.runLeo | |
668 | leo.core.runLeo.run() |
|
679 | leo.core.runLeo.run() | |
669 |
|
680 | |||
|
681 | def lno_f(self, arg): | |||
|
682 | """ %lno [note text] | |||
|
683 | ||||
|
684 | Gather quick notes to leo notebook | |||
|
685 | ||||
|
686 | """ | |||
|
687 | ||||
|
688 | ||||
|
689 | import time | |||
|
690 | try: | |||
|
691 | scr = wb.Scratch | |||
|
692 | except AttributeError: | |||
|
693 | print "No leo yet, attempt launch of notebook..." | |||
|
694 | lleo_f(self,'') | |||
|
695 | scr = wb.Scratch | |||
|
696 | ||||
|
697 | child = scr.get(arg, None) | |||
|
698 | if child is None: | |||
|
699 | scr[arg] = time.asctime() | |||
|
700 | child = scr[arg] | |||
|
701 | ||||
|
702 | child.go() | |||
|
703 | ||||
|
704 | ||||
670 | def lshadow_f(self, arg): |
|
705 | def lshadow_f(self, arg): | |
671 | """ lshadow [path] |
|
706 | """ lshadow [path] | |
672 |
|
707 |
General Comments 0
You need to be logged in to leave comments.
Login now