mirror of
https://github.com/python/cpython.git
synced 2024-11-25 19:03:49 +08:00
836baa53d8
svn+ssh://pythondev@svn.python.org/python/trunk ........ r61063 | andrew.kuchling | 2008-02-25 17:29:19 +0100 (Mon, 25 Feb 2008) | 1 line Move .setupterm() output so that we don't try to call endwin() if it fails ........ r61064 | andrew.kuchling | 2008-02-25 17:29:58 +0100 (Mon, 25 Feb 2008) | 1 line Use file descriptor for real stdout ........ r61067 | facundo.batista | 2008-02-25 19:06:00 +0100 (Mon, 25 Feb 2008) | 4 lines Issue 2117. Update compiler module to handle class decorators. Thanks Thomas Herve ........ r61069 | georg.brandl | 2008-02-25 21:17:56 +0100 (Mon, 25 Feb 2008) | 2 lines Rename sphinx.addons to sphinx.ext. ........ r61071 | georg.brandl | 2008-02-25 21:20:45 +0100 (Mon, 25 Feb 2008) | 2 lines Revert r61029. ........ r61072 | facundo.batista | 2008-02-25 23:33:55 +0100 (Mon, 25 Feb 2008) | 4 lines Issue 2168. gdbm and dbm needs to be iterable; this fixes a failure in the shelve module. Thanks Thomas Herve. ........ r61073 | raymond.hettinger | 2008-02-25 23:42:32 +0100 (Mon, 25 Feb 2008) | 1 line Make sure the itertools filter functions give the same performance for func=bool as func=None. ........ r61074 | raymond.hettinger | 2008-02-26 00:17:41 +0100 (Tue, 26 Feb 2008) | 1 line Revert part of r60927 which made invalid assumptions about the API offered by db modules. ........ r61075 | facundo.batista | 2008-02-26 00:46:02 +0100 (Tue, 26 Feb 2008) | 3 lines Coerced PyBool_Type to be able to compare it. ........ r61076 | raymond.hettinger | 2008-02-26 03:46:54 +0100 (Tue, 26 Feb 2008) | 1 line Docs for itertools.combinations(). Implementation in forthcoming checkin. ........ r61077 | neal.norwitz | 2008-02-26 05:50:37 +0100 (Tue, 26 Feb 2008) | 3 lines Don't use a hard coded port. This test could hang/fail if the port is in use. Speed this test up by avoiding a sleep and using the event. ........ r61078 | neal.norwitz | 2008-02-26 06:12:50 +0100 (Tue, 26 Feb 2008) | 1 line Whitespace normalization ........ r61079 | neal.norwitz | 2008-02-26 06:23:51 +0100 (Tue, 26 Feb 2008) | 1 line Whitespace normalization ........ r61080 | georg.brandl | 2008-02-26 07:40:10 +0100 (Tue, 26 Feb 2008) | 2 lines Banish tab. ........
60 lines
1.8 KiB
Python
60 lines
1.8 KiB
Python
"""curses
|
|
|
|
The main package for curses support for Python. Normally used by importing
|
|
the package, and perhaps a particular module inside it.
|
|
|
|
import curses
|
|
from curses import textpad
|
|
curses.initwin()
|
|
...
|
|
|
|
"""
|
|
|
|
__revision__ = "$Id$"
|
|
|
|
from _curses import *
|
|
from curses.wrapper import wrapper
|
|
import os as _os
|
|
import sys as _sys
|
|
|
|
# Some constants, most notably the ACS_* ones, are only added to the C
|
|
# _curses module's dictionary after initscr() is called. (Some
|
|
# versions of SGI's curses don't define values for those constants
|
|
# until initscr() has been called.) This wrapper function calls the
|
|
# underlying C initscr(), and then copies the constants from the
|
|
# _curses module to the curses package's dictionary. Don't do 'from
|
|
# curses import *' if you'll be needing the ACS_* constants.
|
|
|
|
def initscr():
|
|
import _curses, curses
|
|
# we call setupterm() here because it raises an error
|
|
# instead of calling exit() in error cases.
|
|
setupterm(term=_os.environ.get("TERM", "unknown"),
|
|
fd=_sys.__stdout__.fileno())
|
|
stdscr = _curses.initscr()
|
|
for key, value in _curses.__dict__.items():
|
|
if key[0:4] == 'ACS_' or key in ('LINES', 'COLS'):
|
|
setattr(curses, key, value)
|
|
|
|
return stdscr
|
|
|
|
# This is a similar wrapper for start_color(), which adds the COLORS and
|
|
# COLOR_PAIRS variables which are only available after start_color() is
|
|
# called.
|
|
|
|
def start_color():
|
|
import _curses, curses
|
|
retval = _curses.start_color()
|
|
if hasattr(_curses, 'COLORS'):
|
|
curses.COLORS = _curses.COLORS
|
|
if hasattr(_curses, 'COLOR_PAIRS'):
|
|
curses.COLOR_PAIRS = _curses.COLOR_PAIRS
|
|
return retval
|
|
|
|
# Import Python has_key() implementation if _curses doesn't contain has_key()
|
|
|
|
try:
|
|
has_key
|
|
except NameError:
|
|
from has_key import has_key
|