Package twisted :: Package conch :: Package ui :: Module ansi :: Class AnsiParser

[frames | no frames]

## Class AnsiParser

Parser class for ANSI codes.

Method Summary
| `__init__(self, defaultFG, defaultBG)`
| `formatText(self, text)`
| ``parseColor`(self, str)` Handle a single ANSI color sequence
| `parseCursor(self, cursor)`
| `parseErase(self, erase)`
| ``parseString`(self, str)` Turn a string input into a list of ColorText elements.
| `pickColor(self, value, mode, BOLD)`
| ``stripEscapes`(self, string)` Remove all ANSI color escapes from the given string.
| `writeString(self, colorstr)`

Class Variable Summary
`tuple` | `ASSIGN_SET` = `('p',)`
`tuple` | `COLOR_SET` = `('m',)`
`tuple` | `CURSOR_SET` = `('H', 'f', 'A', 'B', 'C', 'D', 'R', 's', 'u...`
`tuple` | `ERASE_SET` = `('J', 'K', 'P')`
`tuple` | `MODE_SET` = `('h', 'l')`
`tuple` | `SETS` = `(('H', 'f', 'A', 'B', 'C', 'D', 'R', 's', 'u', 'd...`

Method Details

### parseColor(self, str)

Handle a single ANSI color sequence

### parseString(self, str)

Turn a string input into a list of ColorText elements.

### stripEscapes(self, string)

Remove all ANSI color escapes from the given string.

Class Variable Details

### ASSIGN_SET

  Type:
    `tuple`
  Value:

        ('p',)

### COLOR_SET

  Type:
    `tuple`
  Value:

        ('m',)

### CURSOR_SET

  Type:
    `tuple`
  Value:

        ('H', 'f', 'A', 'B', 'C', 'D', 'R', 's', 'u', 'd', 'G')

### ERASE_SET

  Type:
    `tuple`
  Value:

        ('J', 'K', 'P')

### MODE_SET

  Type:
    `tuple`
  Value:

        ('h', 'l')

### SETS

  Type:
    `tuple`
  Value:

        (('H', 'f', 'A', 'B', 'C', 'D', 'R', 's', 'u', 'd', 'G'),
         ('J', 'K', 'P'),
         ('h', 'l'),
         ('p',),
         ('m',))

Generated by Epydoc 2.0 on Sat May 15 20:08:35 2004 | http://epydoc.sf.net