]> granicus.if.org Git - python/commitdiff
bpo-30176: Add missing curses cell attributes constants (GH-1302)
authorXiang Zhang <angwerzx@126.com>
Fri, 16 Jun 2017 03:20:07 +0000 (11:20 +0800)
committerMariatta <Mariatta@users.noreply.github.com>
Fri, 16 Jun 2017 03:20:07 +0000 (20:20 -0700)
Doc/library/curses.rst
Misc/NEWS
Modules/_cursesmodule.c

index 6bb4c7a6d7ef47e322d4d642bafa7dd1a001ee76..2786e51a7e9c5b1048dd9f9929ed1426952e0814 100644 (file)
@@ -1271,34 +1271,70 @@ The :mod:`curses` module defines the following data members:
    A string representing the current version of the module.  Also available as
    :const:`__version__`.
 
-Several constants are available to specify character cell attributes:
+Some constants are available to specify character cell attributes.
+The exact constants available are system dependent.
 
 +------------------+-------------------------------+
 | Attribute        | Meaning                       |
 +==================+===============================+
-| ``A_ALTCHARSET`` | Alternate character set mode. |
+| ``A_ALTCHARSET`` | Alternate character set mode  |
 +------------------+-------------------------------+
-| ``A_BLINK``      | Blink mode.                   |
+| ``A_BLINK``      | Blink mode                    |
 +------------------+-------------------------------+
-| ``A_BOLD``       | Bold mode.                    |
+| ``A_BOLD``       | Bold mode                     |
 +------------------+-------------------------------+
-| ``A_ITALIC``     | Italic mode.                  |
+| ``A_DIM``        | Dim mode                      |
 +------------------+-------------------------------+
-| ``A_DIM``        | Dim mode.                     |
+| ``A_INVIS``      | Invisible or blank mode       |
 +------------------+-------------------------------+
-| ``A_NORMAL``     | Normal attribute.             |
+| ``A_ITALIC``     | Italic mode                   |
++------------------+-------------------------------+
+| ``A_NORMAL``     | Normal attribute              |
++------------------+-------------------------------+
+| ``A_PROTECT``    | Protected mode                |
 +------------------+-------------------------------+
 | ``A_REVERSE``    | Reverse background and        |
-|                  | foreground colors.            |
+|                  | foreground colors             |
++------------------+-------------------------------+
+| ``A_STANDOUT``   | Standout mode                 |
++------------------+-------------------------------+
+| ``A_UNDERLINE``  | Underline mode                |
++------------------+-------------------------------+
+| ``A_HORIZONTAL`` | Horizontal highlight          |
++------------------+-------------------------------+
+| ``A_LEFT``       | Left highlight                |
++------------------+-------------------------------+
+| ``A_LOW``        | Low highlight                 |
++------------------+-------------------------------+
+| ``A_RIGHT``      | Right highlight               |
 +------------------+-------------------------------+
-| ``A_STANDOUT``   | Standout mode.                |
+| ``A_TOP``        | Top highlight                 |
 +------------------+-------------------------------+
-| ``A_UNDERLINE``  | Underline mode.               |
+| ``A_VERTICAL``   | Vertical highlight            |
++------------------+-------------------------------+
+| ``A_CHARTEXT``   | Bit-mask to extract a         |
+|                  | character                     |
 +------------------+-------------------------------+
 
 .. versionadded:: 3.7
    ``A_ITALIC`` was added.
 
+Several constants are available to extract corresponding attributes returned
+by some methods.
+
++------------------+-------------------------------+
+| Bit-mask         | Meaning                       |
++==================+===============================+
+| ``A_ATTRIBUTES`` | Bit-mask to extract           |
+|                  | attributes                    |
++------------------+-------------------------------+
+| ``A_CHARTEXT``   | Bit-mask to extract a         |
+|                  | character                     |
++------------------+-------------------------------+
+| ``A_COLOR``      | Bit-mask to extract           |
+|                  | color-pair field information  |
++------------------+-------------------------------+
+
 Keys are referred to by integer constants with names starting with  ``KEY_``.
 The exact keycaps available are system dependent.
 
index 985d6c00415cd35c7ce47b2b2a58ae6e45c6ba91..95ae431c8b455ebf8921580a954f0b7b6430ecd6 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -445,7 +445,7 @@ Library
 - bpo-30149: inspect.signature() now supports callables with
   variable-argument parameters wrapped with partialmethod.
   Patch by Dong-hee Na.
-  
+
 - bpo-30436: importlib.find_spec() raises ModuleNotFoundError instead of
   AttributeError if the specified parent module is not a package
   (i.e. lacks a __path__ attribute).
@@ -1216,6 +1216,8 @@ C API
 Documentation
 -------------
 
+- bpo-30176: Add missing attribute related constants in curses documentation.
+
 - Issue #30052: the link targets for :func:`bytes` and
   :func:`bytearray` are now their respective type definitions, rather
   than the corresponding builtin function entries. Use :ref:`bytes <func-bytes>`
index f278268e6702abf883c7ace1675e38a64fdf4d7c..5dc0865c1c4dda87be504ab7571b04e5b3e3be50 100644 (file)
@@ -3335,9 +3335,6 @@ PyInit__curses(void)
     SetDictInt("A_BLINK",               A_BLINK);
     SetDictInt("A_DIM",                 A_DIM);
     SetDictInt("A_BOLD",                A_BOLD);
-#ifdef A_ITALIC
-    SetDictInt("A_ITALIC",              A_ITALIC);
-#endif
     SetDictInt("A_ALTCHARSET",          A_ALTCHARSET);
 #if !defined(__NetBSD__)
     SetDictInt("A_INVIS",           A_INVIS);
@@ -3366,6 +3363,11 @@ PyInit__curses(void)
     SetDictInt("A_VERTICAL",        A_VERTICAL);
 #endif
 
+    /* ncurses extension */
+#ifdef A_ITALIC
+    SetDictInt("A_ITALIC",          A_ITALIC);
+#endif
+
     SetDictInt("COLOR_BLACK",       COLOR_BLACK);
     SetDictInt("COLOR_RED",         COLOR_RED);
     SetDictInt("COLOR_GREEN",       COLOR_GREEN);