Home | Trees | Indices | Help |
---|
|
1 # ICE Revision: $Id$ 2 """Formats the output on a terminal""" 3 4 import os 5 6 from PyFoam.Infrastructure.Configuration import Configuration as config 7 1517 """Class that contains the formating codes for the terminal""" 18 19 reset =getTerminalCode("sgr0") 20 21 bold =getTerminalCode("bold") 22 under =getTerminalCode("smul") 23 standout=getTerminalCode("smso") 24 25 black =getTerminalCode("setaf 0") 26 red =getTerminalCode("setaf 1") 27 green =getTerminalCode("setaf 2") 28 cyan =getTerminalCode("setaf 3") 29 blue =getTerminalCode("setaf 4") 30 magenta =getTerminalCode("setaf 5") 31 yellow =getTerminalCode("setaf 6") 32 white =getTerminalCode("setaf 7") 33 34 back_black =getTerminalCode("setab 0") 35 back_red =getTerminalCode("setab 1") 36 back_green =getTerminalCode("setab 2") 37 back_cyan =getTerminalCode("setab 3") 38 back_blue =getTerminalCode("setab 4") 39 back_magenta =getTerminalCode("setab 5") 40 back_yellow =getTerminalCode("setab 6") 41 back_white =getTerminalCode("setab 7") 427544 """Build an escape sequence from a specification string 45 @param specification: the specification string that is a number 46 of komma-separated words. The words specify the color and the 47 formatting""" 48 49 seq="" 50 for s in specification.split(','): 51 seq+=eval("self."+s) 52 53 return seq5456 """Add a new format to the object 57 @param name: Name under which the format is added to the formatter 58 @param specification: The specification string for the format""" 59 60 exec("self."+name+"=self.buildSequence('"+specification+"')")6163 """Gets a format sequence from the global configuration and adds it 64 to the formatter object 65 @param name: Name under which this is found in the 'Formats'-section 66 of the configuration 67 @param shortName: Short name under which this is stored in the 68 foratter. If none is given the regular name is used""" 69 70 spec=config().get("Formats",name,default="reset") 71 nm=name 72 if shortName: 73 nm=shortName 74 self.addFormat(nm,spec)
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Wed Jun 12 09:10:14 2013 | http://epydoc.sourceforge.net |