[Python-checkins] cpython (merge 3.2 -> default): merge #6771: fix docs: curses.wrapper is exposed as a function, not a module

r.david.murray python-checkins at python.org
Sun Jun 19 01:42:47 CEST 2011


http://hg.python.org/cpython/rev/bb5e950ebb04
changeset:   70866:bb5e950ebb04
parent:      70863:9569d8c4c781
parent:      70865:f9b4cfc19264
user:        R David Murray <rdmurray at bitdance.com>
date:        Sat Jun 18 19:41:43 2011 -0400
summary:
  merge #6771: fix docs: curses.wrapper is exposed as a function, not a module

files:
  Doc/library/curses.rst |  46 ++++++++---------------------
  1 files changed, 13 insertions(+), 33 deletions(-)


diff --git a/Doc/library/curses.rst b/Doc/library/curses.rst
--- a/Doc/library/curses.rst
+++ b/Doc/library/curses.rst
@@ -41,10 +41,6 @@
    Module :mod:`curses.textpad`
       Editable text widget for curses supporting  :program:`Emacs`\ -like bindings.
 
-   Module :mod:`curses.wrapper`
-      Convenience function to ensure proper terminal setup and resetting on
-      application entry and exit.
-
    :ref:`curses-howto`
       Tutorial material on using curses with Python, by Andrew Kuchling and Eric
       Raymond.
@@ -592,6 +588,19 @@
    foreground color on the default background.
 
 
+.. function:: wrapper(func, ...)
+
+   Initialize curses and call another callable object, *func*, which should be the
+   rest of your curses-using application.  If the application raises an exception,
+   this function will restore the terminal to a sane state before re-raising the
+   exception and generating a traceback.  The callable object *func* is then passed
+   the main window 'stdscr' as its first argument, followed by any other arguments
+   passed to :func:`wrapper`.  Before calling *func*, :func:`wrapper` turns on
+   cbreak mode, turns off echo, enables the terminal keypad, and initializes colors
+   if the terminal has color support.  On exit (whether normally or by exception)
+   it restores cooked mode, turns on echo, and disables the terminal keypad.
+
+
 .. _curses-window-objects:
 
 Window Objects
@@ -1659,32 +1668,3 @@
       cursor motion that would land the cursor on a trailing blank goes to the
       end of that line instead, and trailing blanks are stripped when the window
       contents are gathered.
-
-
-:mod:`curses.wrapper` --- Terminal handler for curses programs
-==============================================================
-
-.. module:: curses.wrapper
-   :synopsis: Terminal configuration wrapper for curses programs.
-.. moduleauthor:: Eric Raymond <esr at thyrsus.com>
-.. sectionauthor:: Eric Raymond <esr at thyrsus.com>
-
-
-This module supplies one function, :func:`wrapper`, which runs another function
-which should be the rest of your curses-using application.  If the application
-raises an exception, :func:`wrapper` will restore the terminal to a sane state
-before re-raising the exception and generating a traceback.
-
-
-.. function:: wrapper(func, ...)
-
-   Wrapper function that initializes curses and calls another function, *func*,
-   restoring normal keyboard/screen behavior on error. The callable object *func*
-   is then passed the main window 'stdscr' as its first argument, followed by any
-   other arguments passed to :func:`wrapper`.
-
-Before calling the hook function, :func:`wrapper` turns on cbreak mode, turns
-off echo, enables the terminal keypad, and initializes colors if the terminal
-has color support.  On exit (whether normally or by exception) it restores
-cooked mode, turns on echo, and disables the terminal keypad.
-

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list