PyFoam.Basics.TerminalFormatter module

Formats the output on a terminal

class PyFoam.Basics.TerminalFormatter.TerminalFormatter[source]

Bases: object

Class that contains the formating codes for the terminal

__dict__ = mappingproxy({'back_red': '\x1b[41m', '__module__': 'PyFoam.Basics.TerminalFormatter', 'getConfigFormat': <function TerminalFormatter.getConfigFormat>, 'back_blue': '\x1b[44m', 'under': '\x1b[4m', 'back_green': '\x1b[42m', 'bold': '\x1b[1m', 'back_cyan': '\x1b[43m', 'back_magenta': '\x1b[45m', 'buildSequence': <function TerminalFormatter.buildSequence>, 'white': '\x1b[37m', 'back_yellow': '\x1b[46m', 'green': '\x1b[32m', '__weakref__': <attribute '__weakref__' of 'TerminalFormatter' objects>, '__doc__': 'Class that contains the formating codes for the terminal', 'reset': '\x1b(B\x1b[m', 'blue': '\x1b[34m', 'red': '\x1b[31m', 'yellow': '\x1b[36m', 'addFormat': <function TerminalFormatter.addFormat>, 'cyan': '\x1b[33m', 'back_black': '\x1b[40m', '__dict__': <attribute '__dict__' of 'TerminalFormatter' objects>, 'magenta': '\x1b[35m', 'standout': '\x1b[7m', 'back_white': '\x1b[47m', 'black': '\x1b[30m'})
__module__ = 'PyFoam.Basics.TerminalFormatter'
__weakref__

list of weak references to the object (if defined)

addFormat(name, specification)[source]

Add a new format to the object :param name: Name under which the format is added to the formatter :param specification: The specification string for the format

back_black = '\x1b[40m'
back_blue = '\x1b[44m'
back_cyan = '\x1b[43m'
back_green = '\x1b[42m'
back_magenta = '\x1b[45m'
back_red = '\x1b[41m'
back_white = '\x1b[47m'
back_yellow = '\x1b[46m'
black = '\x1b[30m'
blue = '\x1b[34m'
bold = '\x1b[1m'
buildSequence(specification)[source]

Build an escape sequence from a specification string :param specification: the specification string that is a number of komma-separated words. The words specify the color and the formatting

cyan = '\x1b[33m'
getConfigFormat(name, shortName=None)[source]

Gets a format sequence from the global configuration and adds it to the formatter object :param name: Name under which this is found in the ‘Formats’-section of the configuration :param shortName: Short name under which this is stored in the foratter. If none is given the regular name is used

green = '\x1b[32m'
magenta = '\x1b[35m'
red = '\x1b[31m'
reset = '\x1b(B\x1b[m'
standout = '\x1b[7m'
under = '\x1b[4m'
white = '\x1b[37m'
yellow = '\x1b[36m'
PyFoam.Basics.TerminalFormatter.getTerminalCode(code)[source]