| 1 |
"""curses |
| 2 |
|
| 3 |
The main package for curses support for Python. Normally used by importing |
| 4 |
the package, and perhaps a particular module inside it. |
| 5 |
|
| 6 |
import curses |
| 7 |
from curses import textpad |
| 8 |
curses.initscr() |
| 9 |
... |
| 10 |
|
| 11 |
""" |
| 12 |
|
| 13 |
__revision__ = "$Id$" |
| 14 |
|
| 15 |
from _curses import * |
| 16 |
from curses.wrapper import wrapper |
| 17 |
import os as _os |
| 18 |
import sys as _sys |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
def initscr(): |
| 29 |
import _curses, curses |
| 30 |
|
| 31 |
|
| 32 |
setupterm(term=_os.environ.get("TERM", "unknown"), |
| 33 |
fd=_sys.__stdout__.fileno()) |
| 34 |
stdscr = _curses.initscr() |
| 35 |
for key, value in _curses.__dict__.items(): |
| 36 |
if key[0:4] == 'ACS_' or key in ('LINES', 'COLS'): |
| 37 |
setattr(curses, key, value) |
| 38 |
|
| 39 |
return stdscr |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
def start_color(): |
| 46 |
import _curses, curses |
| 47 |
retval = _curses.start_color() |
| 48 |
if hasattr(_curses, 'COLORS'): |
| 49 |
curses.COLORS = _curses.COLORS |
| 50 |
if hasattr(_curses, 'COLOR_PAIRS'): |
| 51 |
curses.COLOR_PAIRS = _curses.COLOR_PAIRS |
| 52 |
return retval |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
try: |
| 57 |
has_key |
| 58 |
except NameError: |
| 59 |
from has_key import has_key |