Python: module screen

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

`This implements a virtual screen. This is used to support ANSI terminal
emulation. The screen representation and state is implemented in this class.
Most of the methods are inspired by ANSI screen control codes. The ANSI class
extends this class to add parsing of ANSI escape codes.
$Id: screen.py 486 2007-07-13 01:04:16Z noah $`

Modules
`` |  |
copy |  |  |

Classes
`` |  | screen
class screen
`` | `This object maintains the state of a virtual text screen as a rectangluar array. This maintains a virtual cursor position and handles scrolling as characters are added. This supports most of the methods needed by an ANSI text screen. Row and column indexes are 1-based (not zero-based, like arrays).`
| Methods defined here: __init__(self, r=24, c=80) `This initializes a blank scree of the given dimentions.` __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
`` |  | constrain(n, min, max) `This returns a number, n constrained to the min and max bounds.`

Data
`` |  | BEL = 7 BS = 8 CAN = 24 CR = 13 DEL = 127 ENQ = 5 ESC = 27 FF = 12 HT = 9 LF = 10 NUL = 0 SI = 15 SO = 14 SPACE = ' ' SUB = 26 VT = 11 XOFF = 19 XON = 17