##// END OF EJS Templates
generate_output_prompt hook
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 1303 2006-05-17 03:39:29Z fperez $"""
5 $Id: Prompts.py 1366 2006-06-15 19:45:50Z 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>
@@ -379,6 +379,7 b' class Prompt2(BasePrompt):'
379 self.col_p = Colors.out_prompt
379 self.col_p = Colors.out_prompt
380 self.col_num = Colors.out_number
380 self.col_num = Colors.out_number
381
381
382
382 #-----------------------------------------------------------------------------
383 #-----------------------------------------------------------------------------
383 class CachedOutput:
384 class CachedOutput:
384 """Class for printing output from calculations while keeping a cache of
385 """Class for printing output from calculations while keeping a cache of
@@ -500,8 +501,9 b' class CachedOutput:'
500 return
501 return
501 # don't use print, puts an extra space
502 # don't use print, puts an extra space
502 cout_write(self.output_sep)
503 cout_write(self.output_sep)
504 outprompt = self.shell.hooks.generate_output_prompt()
503 if self.do_full_cache:
505 if self.do_full_cache:
504 cout_write(str(self.prompt_out))
506 cout_write(outprompt)
505
507
506 if isinstance(arg,Macro):
508 if isinstance(arg,Macro):
507 print 'Executing Macro...'
509 print 'Executing Macro...'
@@ -583,3 +585,4 b' class CachedOutput:'
583 self.user_ns.update({'_':None,'__':None, '___':None})
585 self.user_ns.update({'_':None,'__':None, '___':None})
584 import gc
586 import gc
585 gc.collect() # xxx needed?
587 gc.collect() # xxx needed?
588
@@ -32,7 +32,7 b" ip.set_hook('editor', calljed)"
32 You can then enable the functionality by doing 'import myiphooks'
32 You can then enable the functionality by doing 'import myiphooks'
33 somewhere in your configuration files or ipython command line.
33 somewhere in your configuration files or ipython command line.
34
34
35 $Id: hooks.py 1365 2006-06-15 19:11:26Z vivainio $"""
35 $Id: hooks.py 1366 2006-06-15 19:45:50Z vivainio $"""
36
36
37 #*****************************************************************************
37 #*****************************************************************************
38 # Copyright (C) 2005 Fernando Perez. <fperez@colorado.edu>
38 # Copyright (C) 2005 Fernando Perez. <fperez@colorado.edu>
@@ -55,7 +55,7 b' from pprint import PrettyPrinter'
55 # but over time we'll move here all the public API for user-accessible things.
55 # but over time we'll move here all the public API for user-accessible things.
56 __all__ = ['editor', 'fix_error_editor', 'result_display',
56 __all__ = ['editor', 'fix_error_editor', 'result_display',
57 'input_prefilter', 'shutdown_hook', 'late_startup_hook',
57 'input_prefilter', 'shutdown_hook', 'late_startup_hook',
58 'generate_prompt' ]
58 'generate_prompt', 'generate_output_prompt' ]
59
59
60 pformat = PrettyPrinter().pformat
60 pformat = PrettyPrinter().pformat
61
61
@@ -203,4 +203,8 b' def generate_prompt(self, is_continuation):'
203 return str(ip.IP.outputcache.prompt2)
203 return str(ip.IP.outputcache.prompt2)
204 return str(ip.IP.outputcache.prompt1)
204 return str(ip.IP.outputcache.prompt1)
205
205
206 No newline at end of file
206 def generate_output_prompt(self):
207 ip = self.api
208 return str(ip.IP.outputcache.prompt_out)
209
210 No newline at end of file
@@ -4,6 +4,9 b''
4 used to create prompts dynamically, instead of the "old" way of
4 used to create prompts dynamically, instead of the "old" way of
5 assigning "magic" strings to prompt_in1 and prompt_in2. The old
5 assigning "magic" strings to prompt_in1 and prompt_in2. The old
6 way still works (it's invoked by the default hook), of course.
6 way still works (it's invoked by the default hook), of course.
7
8 * Prompts.py: added generate_output_prompt hook for altering output
9 prompt
7
10
8 * Release.py: Changed version string to 0.7.3.svn.
11 * Release.py: Changed version string to 0.7.3.svn.
9
12
General Comments 0
You need to be logged in to leave comments. Login now