##// END OF EJS Templates
Macros are now simple callables, no special handling in Prompt.py
vivainio -
Show More
@@ -2,7 +2,7 b''
2 """
2 """
3 Classes for handling input/output prompts.
3 Classes for handling input/output prompts.
4
4
5 $Id: Prompts.py 2192 2007-04-01 20:51:06Z fperez $"""
5 $Id: Prompts.py 2349 2007-05-15 16:20:35Z vivainio $"""
6
6
7 #*****************************************************************************
7 #*****************************************************************************
8 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
8 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
@@ -512,13 +512,6 b' class CachedOutput:'
512 if self.do_full_cache:
512 if self.do_full_cache:
513 cout_write(outprompt)
513 cout_write(outprompt)
514
514
515 if isinstance(arg,Macro):
516 print 'Executing Macro...'
517 # in case the macro takes a long time to execute
518 Term.cout.flush()
519 self.shell.runlines(arg.value)
520 return None
521
522 # and now call a possibly user-defined print mechanism
515 # and now call a possibly user-defined print mechanism
523 manipulated_val = self.display(arg)
516 manipulated_val = self.display(arg)
524
517
@@ -7,11 +7,18 b''
7 # the file COPYING, distributed as part of this software.
7 # the file COPYING, distributed as part of this software.
8 #*****************************************************************************
8 #*****************************************************************************
9
9
10 import IPython.ipapi
11
12
13 from IPython.genutils import Term
14
15
10 class Macro:
16 class Macro:
11 """Simple class to store the value of macros as strings.
17 """Simple class to store the value of macros as strings.
12
18
13 This allows us to later exec them by checking when something is an
19 Macro is just a callable that executes a string of IPython
14 instance of this class."""
20 input when called.
21 """
15
22
16 def __init__(self,data):
23 def __init__(self,data):
17
24
@@ -24,3 +31,8 b' class Macro:'
24
31
25 def __repr__(self):
32 def __repr__(self):
26 return 'IPython.macro.Macro(%s)' % repr(self.value)
33 return 'IPython.macro.Macro(%s)' % repr(self.value)
34
35 def __call__(self):
36 Term.cout.flush()
37 ip = IPython.ipapi.get()
38 ip.runlines(self.value) No newline at end of file
@@ -11,9 +11,6 b''
11 * Magic.py, ipy_rehashdir.py, ipy_profile_sh.py: System command
11 * Magic.py, ipy_rehashdir.py, ipy_profile_sh.py: System command
12 aliases are now lower case on windows (MyCommand.exe => mycommand).
12 aliases are now lower case on windows (MyCommand.exe => mycommand).
13
13
14
15
16
17 2007-05-10 Fernando Perez <Fernando.Perez@colorado.edu>
14 2007-05-10 Fernando Perez <Fernando.Perez@colorado.edu>
18
15
19 * IPython/rlineimpl.py: check for clear_history in readline and
16 * IPython/rlineimpl.py: check for clear_history in readline and
General Comments 0
You need to be logged in to leave comments. Login now