Python: module ANSI

ANSI | index /home/noah/pexpect/trunk/pexpect/ANSI.py

`This implements an ANSI terminal emulator as a subclass of screen.
$Id: ANSI.py 491 2007-12-16 20:04:57Z noah $`

Modules
`` |  |
FSM | copy | screen | string

Classes
`` |  | screen.screen term ANSI
class ANSI(term)
`` | `This class encapsulates a generic terminal. It filters a stream and maintains the state of a screen object.`
| Method resolution order: ANSI term screen.screen Methods defined here: __init__(self, r=24, c=80) flush(self) process(self, c) process_list(self, l) write(self, s) write_ch(self, ch) `This puts a character at the current cursor position. cursor position if moved forward with wrap-around, but no scrolling is done if the cursor hits the lower-right corner of the screen.` Methods inherited from screen.screen: __str__(self) `This returns a printable representation of the screen. The end of each screen line is terminated by a newline.` clear_all_tabs(self) `Clears all tabs.` clear_tab(self) `Clears tab at the current position.` cr(self) `This moves the cursor to the beginning (col 1) of the current row.` crlf(self) `This advances the cursor with CRLF properties. The cursor will line wrap and the screen may scroll.` cursor_back(self, count=1) cursor_constrain(self) `This keeps the cursor within the screen area.` cursor_down(self, count=1) cursor_force_position(self, r, c) `Identical to Cursor Home.` cursor_forward(self, count=1) cursor_home(self, r=1, c=1) cursor_restore_attrs(self) `Restores cursor position after a Save Cursor.` cursor_save(self) `Save current cursor position.` cursor_save_attrs(self) `Save current cursor position.` cursor_unsave(self) `Restores cursor position after a Save Cursor.` cursor_up(self, count=1) cursor_up_reverse(self) dump(self) `This returns a copy of the screen as a string. This is similar to __str__ except that lines are not terminated with line feeds.` erase_down(self) `Erases the screen from the current line down to the bottom of the screen.` erase_end_of_line(self) `Erases from the current cursor position to the end of the current line.` erase_line(self) `Erases the entire current line.` erase_screen(self) `Erases the screen with the background color.` erase_start_of_line(self) `Erases from the current cursor position to the start of the current line.` erase_up(self) `Erases the screen from the current line up to the top of the screen.` fill(self, ch=' ') fill_region(self, rs, cs, re, ce, ch=' ') get(self) get_abs(self, r, c) get_region(self, rs, cs, re, ce) `This returns a list of lines representing the region.` insert(self, ch) insert_abs(self, r, c, ch) `This inserts a character at (r,c). Everything under and to the right is shifted right one character. The last character of the line is lost.` lf(self) `This moves the cursor down with scrolling.` newline(self) `This is an alias for crlf().` pretty(self) `This returns a copy of the screen as a string with an ASCII text box around the screen border. This is similar to __str__ except that it adds a box.` put(self, ch) `This puts a characters at the current cursor position.` put_abs(self, r, c, ch) `Screen array starts at 1 index.` scroll_constrain(self) `This keeps the scroll region within the screen region.` scroll_down(self) `Scroll display down one line.` scroll_screen(self) `Enable scrolling for entire display.` scroll_screen_rows(self, rs, re) `Enable scrolling from row {start} to row {end}.` scroll_up(self) `Scroll display up one line.` set_tab(self) `Sets a tab at the current position.`
class term(screen.screen)
`` | `This is a placeholder. In theory I might want to add other terminal types.`
| Methods defined here: __init__(self, r=24, c=80) Methods inherited from screen.screen: __str__(self) `This returns a printable representation of the screen. The end of each screen line is terminated by a newline.` clear_all_tabs(self) `Clears all tabs.` clear_tab(self) `Clears tab at the current position.` cr(self) `This moves the cursor to the beginning (col 1) of the current row.` crlf(self) `This advances the cursor with CRLF properties. The cursor will line wrap and the screen may scroll.` cursor_back(self, count=1) cursor_constrain(self) `This keeps the cursor within the screen area.` cursor_down(self, count=1) cursor_force_position(self, r, c) `Identical to Cursor Home.` cursor_forward(self, count=1) cursor_home(self, r=1, c=1) cursor_restore_attrs(self) `Restores cursor position after a Save Cursor.` cursor_save(self) `Save current cursor position.` cursor_save_attrs(self) `Save current cursor position.` cursor_unsave(self) `Restores cursor position after a Save Cursor.` cursor_up(self, count=1) cursor_up_reverse(self) dump(self) `This returns a copy of the screen as a string. This is similar to __str__ except that lines are not terminated with line feeds.` erase_down(self) `Erases the screen from the current line down to the bottom of the screen.` erase_end_of_line(self) `Erases from the current cursor position to the end of the current line.` erase_line(self) `Erases the entire current line.` erase_screen(self) `Erases the screen with the background color.` erase_start_of_line(self) `Erases from the current cursor position to the start of the current line.` erase_up(self) `Erases the screen from the current line up to the top of the screen.` fill(self, ch=' ') fill_region(self, rs, cs, re, ce, ch=' ') get(self) get_abs(self, r, c) get_region(self, rs, cs, re, ce) `This returns a list of lines representing the region.` insert(self, ch) insert_abs(self, r, c, ch) `This inserts a character at (r,c). Everything under and to the right is shifted right one character. The last character of the line is lost.` lf(self) `This moves the cursor down with scrolling.` newline(self) `This is an alias for crlf().` pretty(self) `This returns a copy of the screen as a string with an ASCII text box around the screen border. This is similar to __str__ except that it adds a box.` put(self, ch) `This puts a characters at the current cursor position.` put_abs(self, r, c, ch) `Screen array starts at 1 index.` scroll_constrain(self) `This keeps the scroll region within the screen region.` scroll_down(self) `Scroll display down one line.` scroll_screen(self) `Enable scrolling for entire display.` scroll_screen_rows(self, rs, re) `Enable scrolling from row {start} to row {end}.` scroll_up(self) `Scroll display up one line.` set_tab(self) `Sets a tab at the current position.`

Functions
`` |  | BuildNumber(fsm) DoBack(fsm) DoBackOne(fsm) DoCursorRestore(fsm) DoCursorSave(fsm) DoDown(fsm) DoDownOne(fsm) DoEnableScroll(fsm) DoErase(fsm) DoEraseDown(fsm) DoEraseEndOfLine(fsm) DoEraseLine(fsm) DoForward(fsm) DoForwardOne(fsm) DoHome(fsm) DoHomeOrigin(fsm) DoMode(fsm) DoScrollRegion(fsm) DoUp(fsm) DoUpOne(fsm) DoUpReverse(fsm) Emit(fsm) Log(fsm) StartNumber(fsm)