
][\&                 @   s}   d  Z  d d l Td d l Z d d l Z d d   Z d d   Z y e Wn" e	 k
 rl d d	 l m Z Yn Xd
 d   Z
 d S)zcurses

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.initscr()
   ...

    )*Nc              C   s   d d  l  }  d d  l } t d t j j d d  d t j j    |  j	   } xR |  j
 j   D]A \ } } | d d  d k s | d
 k r_ t | | |  q_ q_ W| S)Nr   ZtermZTERMunknownfd   ZACS_LINESCOLS)r   r   )_cursescursesZ	setupterm_osenvironget_sys
__stdout__filenoinitscr__dict__itemssetattr)r   r	   stdscrkeyvalue r   %/usr/lib/python3.4/curses/__init__.pyr      s    "r   c              C   sd   d d  l  }  d d  l } |  j   } t |  d  rB |  j | _ n  t |  d  r` |  j | _ n  | S)Nr   COLORSCOLOR_PAIRS)r   r	   start_colorhasattrr   r   )r   r	   Zretvalr   r   r   r   *   s    r      )has_keyc             O   s   zN t    } t   t   | j d  y t   Wn Yn X|  | | |  SWd d t   k r | j d  t   t   t   n  Xd S)a  Wrapper function that initializes curses and calls another function,
    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
    wrapper().
    r   Nr   r   )	r   ZnoechoZcbreakZkeypadr   localsZechoZnocbreakZendwin)funcargskwdsr   r   r   r   wrapper?   s    	r#   )__doc__r   osr
   sysr   r   r   r   	NameErrorr#   r   r   r   r   <module>   s   

