Warning
This documentation is for an old version of IPython. You can find docs for newer versions here.
Module: qt.console.ansi_code_processor
¶
Utilities for processing ANSI escape codes and special ASCII characters.
2 Classes¶
-
class
IPython.qt.console.ansi_code_processor.
AnsiCodeProcessor
¶ Bases:
object
Translates special ASCII characters and ANSI escape codes into readable attributes. It also supports a few non-standard, xterm-specific codes.
-
__init__
()¶
-
reset_sgr
()¶ Reset graphics attributs to their default values.
-
set_csi_code
(command, params=[])¶ Set attributes based on CSI (Control Sequence Introducer) code.
Parameters: command : str
The code identifier, i.e. the final character in the sequence.
params : sequence of integers, optional
The parameter codes for the command.
-
set_osc_code
(params)¶ Set attributes based on OSC (Operating System Command) parameters.
Parameters: params : sequence of str
The parameters for the command.
-
set_sgr_code
(params)¶ Set attributes based on SGR (Select Graphic Rendition) codes.
Parameters: params : sequence of ints
A list of SGR codes for one or more SGR commands. Usually this sequence will have one element per command, although certain xterm-specific commands requires multiple elements.
-
split_string
(string)¶ Yields substrings for which the same escape code applies.
-
-
class
IPython.qt.console.ansi_code_processor.
QtAnsiCodeProcessor
¶ Bases:
IPython.qt.console.ansi_code_processor.AnsiCodeProcessor
Translates ANSI escape codes into QTextCharFormats.
-
get_color
(color, intensity=0)¶ Returns a QColor for a given color code, or None if one cannot be constructed.
-
get_format
()¶ Returns a QTextCharFormat that encodes the current style attributes.
-
set_background_color
(color)¶ Given a background color (a QColor), attempt to set a color map that will be aesthetically pleasing.
-