ó
</Sc           @@ s  d  Z  d d l m Z m Z m Z d d l Z d d l Z d d l Z d d l m Z m	 Z	 m
 Z
 m Z m Z m Z m Z df Z dg Z dh Z di Z dj Z i d d 6Z d dk d	 „  ƒ  YZ d
 e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ i e j  d 6e j! d 6e j" d  6e j# d! 6e j$ d" 6e j% d# 6e j& d$ 6e j' d% 6e j( d& 6e j) d' 6e j* d( 6e j+ d) 6e j, d* 6e j- d+ 6e j. d, 6e j/ d- 6e j0 d. 6e j1 d/ 6e2 d0 ƒ d0 6Z3 x( e4 e3 j5 ƒ  ƒ D] Z6 e6 e3 e3 e6 <qnWxQ g  e j7 e j8 D] Z9 e2 e9 ƒ e9 f ^ qšD]  \ Z: Z9 e: e3 e9 <e9 e3 e: <q¶Wd1 dl d2 „  ƒ  YZ; d3 dm d4 „  ƒ  YZ< i e j= d5 6e j> d6 6e j? d7 6e j@ d8 6e jA d9 6e jB d: 6e jC d; 6e jD d< 6e jE d= 6e jF d> 6e jG d? 6e jH d@ 6e jI dA 6e jJ dB 6e jK dC 6e jL dD 6e jM dE 6e jN dF 6e jO dG 6e jP dH 6e jQ dI 6e jR dJ 6e jS dK 6ZT dL dn dM „  ƒ  YZU dN dN dO „ ZV dP e f dQ „  ƒ  YZW dR e< f dS „  ƒ  YZX dT e< f dU „  ƒ  YZY dV e< f dW „  ƒ  YZZ dX eZ f dY „  ƒ  YZ[ dZ e f d[ „  ƒ  YZ\ do d^ d d d d d_ „ Z^ d\ d] g d^ d d d d` „ Z_ d d^ da d\ d] g d db „ Z` dc e< f dd „  ƒ  YZa de „  Zb d S(p   uã  
This module provides the NEWT Windowing toolkit API for Python
This is a lightweight text-mode windowing library, based on slang.

Classes:

 - Widget  
 - Button  
 - CompactButton
 - Checkbox
 - SingleRadioButton
 - Listbox
 - Textbox
 - TextboxReflowed
 - Label
 - Scale
 - Entry
 - Form
 - Grid
 - SnackScreen
 - RadioGroup
 - RadioBar
 - ButtonBar
 - GridFormHelp
 - GridForm
 - CheckboxTree
 - Clistbox

Functions:

 - ListboxChoiceWindow
 - ButtonChoiceWindow
 - EntryWindow
i    (   t   absolute_importt   print_functiont   unicode_literalsN(   t   FLAG_DISABLEDt	   FLAGS_SETt   FLAGS_RESETt   FLAGS_TOGGLEt   FD_READt   FD_WRITEt	   FD_EXCEPTiÿÿÿÿi   u   appendt   Widgetc           B@ s#   e  Z d  Z d d „ Z d „  Z RS(   uÚ   Base class for NEWT toolkit - Do not use directly

    methods:

     - Widget(self)
     - setCallback(self, obj, data = None) : 
          The callback for when object activated.
          data is passed to obj.
    c         C@ s0   | r |  j  j | | ƒ n |  j  j | ƒ d  S(   N(   t   wt   setCallback(   t   selft   objt   data(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   D   s    c         C@ s
   t  ‚ d  S(   N(   t   NotImplementedError(   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   __init__J   s    N(   t   __name__t
   __module__t   __doc__t   NoneR   R   (    (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR
   :   s   	t   Buttonc           B@ s   e  Z d  Z d „  Z RS(   uq   Basic button class, takes button text as parameter

    method:

     - Button(self, text): returns a button
    c         C@ s   t  j | ƒ |  _ d  S(   N(   t   _snackt   buttonR   (   R   t   text(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   T   s    (   R   R   R   R   (    (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   M   s   t   CompactButtonc           B@ s   e  Z d  Z d „  Z RS(   u…   Compact Button class (less frilly button decoration).

    methods:

     - CompactButton(self,text) : create button, with text.
    c         C@ s   t  j | ƒ |  _ d  S(   N(   R   t   compactbuttonR   (   R   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   ^   s    (   R   R   R   R   (    (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   W   s   t   Checkboxc           B@ s>   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d d „ Z RS(   u…  A checkbox.

    methods:
    
      - Checkbox(self, text, isOn = 0) : text, and boolean as to default value
      - setValue(self)                 : set value
      - value(self, value)             : return checkbox value
      - selected(self)                 : returns boolean
      - setFlags(self, flag, sense)    : set flags

      flags:  FLAG_DISABLED, FLAGS_SET, FLAGS_RESET
    c         C@ s
   |  j  j S(   N(   R   t   checkboxValue(   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   valuen   s    c         C@ s   |  j  j d k S(   Ni    (   R   R   (   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   selectedq   s    c         C@ s   |  j  j | | ƒ S(   N(   R   t   checkboxSetFlags(   R   t   flagt   sense(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   setFlagst   s    c         C@ s   |  j  j | ƒ S(   N(   R   t   checkboxSetValue(   R   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   setValuex   s    i    c         C@ s   t  j | | ƒ |  _ d  S(   N(   R   t   checkboxR   (   R   R   t   isOn(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   {   s    (   R   R   R   R   R   R#   R%   R   (    (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   a   s   				t   SingleRadioButtonc           B@ s#   e  Z d  Z d „  Z d d „ Z RS(   uÌ   Single Radio Button.

    methods:
    
     -  SingleRadioButton(text, group, isOn = 0)  : create button
     -  selected(self)                            : returns bool, whether or not is selected.
    c         C@ s   |  j  j |  j  j k S(   N(   R   t   keyt
   radioValue(   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   ‡   s    i    c         C@ s@   | r$ t  j | | j | ƒ |  _ n t  j | d  | ƒ |  _ d  S(   N(   R   t   radiobuttonR   R   (   R   R   t   groupR'   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   Š   s    (   R   R   R   R   R   (    (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR(   ~   s   	t   Listboxc           B@ sq   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 d	 d	 d	 d	 d	 d
 „ Z RS(   uˆ  Listbox class.

    methods:

     - Listbox(self, height, scroll = 0, returnExit = 0, width = 0, showCursor = 0, multiple = 0, border = 0)
     - insert(self, text, item, before) : insert element; before = key to item to insert before, or None.
     - delete(self, item)               : delete item from list.
     - replace(self, text,item)         : Replace a given item's text
     - current(self)                    : returns currently selected item
     - getSelection(self)               : returns a list of selected items
     - setCurrent(self,i tem)           : select current.
     - clear(self)                      : clear listbox
    c         C@ s0   |  j  j | ƒ } | |  j | <| |  j | <d  S(   N(   R   t   listboxAddItemt   key2itemt   item2key(   R   R   t   itemR)   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   appendŸ   s    c         C@ sX   | s |  j  j | d ƒ } n |  j  j | |  j | ƒ } | |  j | <| |  j | <d  S(   Ni    (   R   t   listboxInsertItemR0   R/   (   R   R   R1   t   beforeR)   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   insert¤   s
    c         C@ s6   |  j  j |  j | ƒ |  j |  j | =|  j | =d  S(   N(   R   t   listboxDeleteItemR0   R/   (   R   R1   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   delete¬   s    c         C@ sb   |  j  j | |  j | ƒ } |  j  j |  j | ƒ |  j |  j | =| |  j | <| |  j | <d  S(   N(   R   R3   R0   R6   R/   (   R   R   R1   R)   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   replace±   s
    c         C@ s   |  j  |  j j ƒ  S(   N(   R/   R   t   listboxGetCurrent(   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   current¸   s    c         C@ s>   g  } |  j  j ƒ  } x" | D] } | j |  j | ƒ q W| S(   N(   R   t   listboxGetSelectionR2   R/   (   R   t	   selectiont   listR)   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   getSelection»   s
    c         C@ s   |  j  j |  j | ƒ d  S(   N(   R   t   listboxSetCurrentR0   (   R   R1   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt
   setCurrentÂ   s    c         C@ s#   i  |  _  i  |  _ |  j j ƒ  d  S(   N(   R/   R0   R   t   listboxClear(   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   clearÅ   s    		i    c         C@ sP   t  j | | | | | | ƒ |  _ i  |  _ i  |  _ | rL |  j j | ƒ n  d  S(   N(   R   t   listboxR   R/   R0   t   listboxSetWidth(   R   t   heightt   scrollt
   returnExitt   widtht
   showCursort   multiplet   border(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   Ê   s
    !		(   R   R   R   R2   R5   R7   R8   R:   R>   R@   RB   R   (    (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR-   �   s   								t   Textboxc           B@ s/   e  Z d  Z d „  Z d „  Z d d d „ Z RS(   u  Textbox, container for text.

    methods:

     - Textbox(self, width, height, scroll = 0, wrap = 0): scroll, wrap are flags
                                   include scroll bars, or text wrap.
     - setText(text) : set text.
     - setHeight(height): set height.
    c         C@ s   |  j  j | ƒ d  S(   N(   R   t   textboxText(   R   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   setTextÜ   s    c         C@ s   |  j  j | ƒ d  S(   N(   R   t   textboxHeight(   R   RE   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt	   setHeightß   s    i    c         C@ s"   t  j | | | | | ƒ |  _ d  S(   N(   R   t   textboxR   (   R   RH   RE   R   RF   t   wrap(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   â   s    (   R   R   R   RN   RP   R   (    (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRL   Ñ   s   			t   TextboxReflowedc           B@ s   e  Z d  d d d „ Z RS(   i   i
   iÿÿÿÿc         C@ so   t  | | | | ƒ \ } } } | d k rR | | k rR t j |  | | | d ƒ n t j |  | | | d ƒ d  S(   Niÿÿÿÿi   i    (   t   reflowRL   R   (   R   RH   R   t   flexDownt   flexUpt	   maxHeightt   newtextRE   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   ç   s    (   R   R   R   (    (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRS   å   s   t   Labelc           B@ s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   u¸   A Label (simple text).

    methods:

     - Label(self,text)   : create label
     - setText(self,text) : change text.
     - setColors(self, colorset) : change individual colors
    c         C@ s   |  j  j | ƒ d  S(   N(   R   t	   labelText(   R   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRN   ÷   s    c         C@ s   t  j | ƒ |  _ d  S(   N(   R   t   labelR   (   R   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   ú   s    c         C@ s   |  j  j | ƒ d  S(   N(   R   t   labelSetColors(   R   t   colorset(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt	   setColorsý   s    (   R   R   R   RN   R   R^   (    (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRY   î   s   		t   Scalec           B@ s    e  Z d  Z d „  Z d „  Z RS(   uÀ   A Scale (progress bar).

    methods:

     - Scale(self,width, total) : create scale; width: size on screen, fullamount: integer.
     - set(self,amount)         : set amount to integer.
    c         C@ s   |  j  j | ƒ d  S(   N(   R   t   scaleSet(   R   t   amount(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   set  s    c         C@ s   t  j | | ƒ |  _ d  S(   N(   R   t   scaleR   (   R   RH   t   total(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR     s    (   R   R   R   Rb   R   (    (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR_      s   	t   Entryc           B@ sD   e  Z d  Z d „  Z d d „ Z d „  Z d d d d d d „ Z RS(   u  Entry widget.

    methods:

     - Entry(self, width, text = "", hidden = 0, password = 0, scroll = 1, returnExit = 0)
          constructor. hidden doesn't show text, password stars it out,
          scroll includes scroll bars;
          if returnExit is set, return from Form when exiting this element, else
           proceed to next entry widget.
     - value(self): return value.
     - set(text, cursorAtEnd = 1) : set the text
     - setFlags (flag, sense) : flags can be FLAG_DISABLED, FLAGS_SET, FLAGS_RESET, FLAGS_TOGGLE
    c         C@ s
   |  j  j S(   N(   R   t
   entryValue(   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR     s    i   c         C@ s   |  j  j | | ƒ S(   N(   R   t   entrySetValue(   R   R   t   cursorAtEnd(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRb     s    c         C@ s   |  j  j | | ƒ S(   N(   R   t   entrySetFlags(   R   R!   R"   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR#   "  s    u    i    c         C@ s%   t  j | | | | | | ƒ |  _ d  S(   N(   R   t   entryR   (   R   RH   R   t   hiddent   passwordRF   RG   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   %  s    (   R   R   R   R   Rb   R#   R   (    (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRe     s   		u   F1u   F2u   F3u   F4u   F5u   F6u   F7u   F8u   F9u   F10u   F11u   F12u   ESCu   ENTERu   SUSPENDu	   BACKSPACEu   DELETEu   INSERTu    t   Formc           B@ sY   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d	 d „ Z d „  Z	 d „  Z
 d „  Z RS(
   uá   Base Form class, from which Grid, etc. inherit

    methods:

     - Form(self, helpArg = None) : constructor. 
     - addHotKey(self, keyname) : keynames of form "F1" through "F12", "ESC"
     - add(self, widget) : Add a widget
     - run(self): run a  form, expecting input
     - draw(self): draw form.
     - setTimer(self, timer) : add a timer
     - watchFile(self, file, flags) : watch a named file
     - setCurrent (self, co): Set a given widget as the current focus
    c         C@ s   |  j  j t | ƒ d  S(   N(   R   t	   addhotkeyt   hotkeys(   R   t   keyname(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt	   addHotKeyI  s    c         C@ s¥   d | j  k r9 x' | j j ƒ  D] } |  j | ƒ q Wn  d | j  k rl xV | j D] } |  j | ƒ qR Wn5 d | j  k r¡ | |  j | j j <|  j j | j ƒ Sd  S(   Nu   hotkeysu   gridmembersu   w(
   t   __dict__Ro   t   keysRq   t   gridmemberst   addt   transR   R)   R   (   R   t   widgetR)   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRu   L  s    c         C@ sd   |  j  j ƒ  \ } } | t j k r/ |  j | S| t j k rB d S| t j k r\ |  j | St | S(   Nu   TIMER(	   R   t   runR   t   FORM_EXIT_WIDGETRv   t   FORM_EXIT_TIMERt   FORM_EXIT_FDREADYt   filemapRo   (   R   t   whatt   which(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRx   Y  s    c         C@ s   |  j  j ƒ  d  S(   N(   R   t   drawR   (   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   d  s    c         C@ s1   i  |  _  i  |  _ t j | ƒ |  _ | |  _ d  S(   N(   Rv   R|   R   t   formR   t   helpArg(   R   R�   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   h  s    		c         C@ s   |  j  j | j  ƒ d  S(   N(   R   t
   setcurrent(   R   t   co(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR@   o  s    c         C@ s   |  j  j | ƒ d  S(   N(   R   t   settimer(   R   t   timer(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   setTimerr  s    c         C@ s0   | |  j  | j ƒ  <|  j j | j ƒ  | ƒ d  S(   N(   R|   t   filenoR   t   watchfd(   R   t   filet   flags(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt	   watchFileu  s    N(   R   R   R   Rq   Ru   Rx   R   R   R   R@   R†   R‹   (    (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRm   ;  s   						t   Gridc           B@ s>   e  Z d  Z d „  Z d d d d d d d d „ Z d „  Z RS(   uy  Grid class.

    methods:

     - place(self,x,y): Return what is placed at (x,y)
     - setField(self, what, col, row, padding = (0, 0, 0, 0),
                anchorLeft = 0, anchorTop = 0, anchorRight = 0,
                anchorBottom = 0, growx = 0, growy = 0):
                used to add widget 'what' to grid.
     - Grid(self, *args): eg. g = Grid(2,3) for 2x3 grid
    c         C@ s   |  j  j | | ƒ S(   N(   t   gt   place(   R   t   xt   y(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRŽ   …  s    i    c         C@ sè   |  j  j | ƒ d } | r( t j } n | r: t j } n  | rP | t j B} n | rf | t j B} n  d } |	 r~ t j } n  |
 r” | t j B} n  d | j	 k rÅ |  j
 j | | | j
 | | | ƒ S|  j
 j | | | j | | ƒ Sd  S(   Ni    u   g(   Rt   R2   R   t   ANCHOR_LEFTt   ANCHOR_RIGHTt
   ANCHOR_TOPt   ANCHOR_BOTTOMt
   GRID_GROWXt
   GRID_GROWYRr   R�   t   setfieldR   (   R   R}   t   colt   rowt   paddingt
   anchorLeftt	   anchorTopt   anchorRightt   anchorBottomt   growxt   growyt   anchorFlagst	   gridFlags(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   setFieldˆ  s&    c         G@ s   t  j | Œ  |  _ g  |  _ d  S(   N(   R   t   gridR�   Rt   (   R   t   args(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   £  s    (   i    i    i    i    (   R   R   R   RŽ   R£   R   (    (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRŒ   y  s   		u   ROOTu   BORDERu   WINDOWu   SHADOWu   TITLEu   BUTTONu	   ACTBUTTONu   CHECKBOXu   ACTCHECKBOXu   ENTRYu   LABELu   LISTBOXu
   ACTLISTBOXu   TEXTBOXu
   ACTTEXTBOXu   HELPLINEu   ROOTTEXTu
   EMPTYSCALEu	   FULLSCALEu   DISENTRYu   COMPACTBUTTONu   ACTSELLISTBOXu
   SELLISTBOXt   SnackScreenc           B@ sª   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d d „ Z
 d „  Z d	 „  Z d
 „  Z d „  Z d „  Z d d d „ Z e d „ Z d „  Z d „  Z RS(   u
  A Screen;

    methods:

    - Screen(self) : constructor
    - finish(self)
    - resume(self)
    - suspend(self)
    - doHelpCallback(self,arg) call callback with arg
    - helpCallback(self,cb): Set help callback
    - suspendcallback(self,cb, data=None) : set callback. data=data to pass to cb.
    - openWindow(self,left, top, width, height, title): Open a window.
    - pushHelpLine(self,text): put help line on screen. Returns current help line if text=None
    - setColor(self, colorset, fg, bg): Set foreground and background colors;
            colorset = key from snack.colorsets,
            fg & bg = english color names defined by S-Lang
                (ref: S-Lang Library C Programmer's Guide section:
                8.4.4.  Setting Character Attributes)
    c         C@ s3   t  j ƒ  t  j ƒ  \ |  _ |  _ |  j d  ƒ d  S(   N(   R   t   initt   sizeRH   RE   t   pushHelpLineR   (   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   Ó  s    
c         C@ s
   t  j ƒ  S(   N(   R   t   finish(   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRª   Ø  s    c         C@ s   t  j ƒ  d  S(   N(   R   t   resume(   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR«   Û  s    c         C@ s   t  j ƒ  d  S(   N(   R   t   suspend(   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR¬   Þ  s    c         C@ s   |  j  |  | ƒ d  S(   N(   t   helpCb(   R   t   arg(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   doHelpCallbacká  s    c         C@ s   | |  _  t j |  j ƒ S(   N(   R­   R   t   helpcallbackR¯   (   R   t   cb(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   helpCallbackä  s    	c         C@ s#   | r t  j | | ƒ St  j | ƒ S(   N(   R   t   suspendcallback(   R   R±   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   suspendCallbackè  s    c         C@ s   t  j | | | | | ƒ S(   N(   R   t
   openwindow(   R   t   leftt   topRH   RE   t   title(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt
   openWindowí  s    c         C@ s$   | s t  j d ƒ St  j | ƒ Sd  S(   Nu	   *default*(   R   t   pushhelpline(   R   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR©   ð  s    c         C@ s
   t  j ƒ  S(   N(   R   t   pophelpline(   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   popHelpLineö  s    c         C@ s   t  j | | | ƒ S(   N(   R   t   drawroottext(   R   R¶   R·   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   drawRootTextù  s    c         C@ s   t  j | | | ƒ S(   N(   R   t   centeredwindow(   R   RH   RE   R¸   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   centeredWindowü  s    c         C@ s8   | r% | r% t  j | j | | | ƒ St  j | j | ƒ S(   N(   R   t   gridwrappedwindowR�   (   R   R¤   R¸   R�   R�   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   gridWrappedWindowÿ  s    c         C@ s   | r t  j ƒ  St  j ƒ  S(   N(   R   t	   popwindowt   popwindownorefresh(   R   t   refresh(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt	   popWindow  s    
c         C@ s
   t  j ƒ  S(   N(   R   RÅ   (   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRÅ   
  s    c         C@ s:   | t  k r# t j t  | | | ƒ St j | | | ƒ Sd  S(   N(   t	   colorsetsR   t   setcolor(   R   R]   t   fgt   bg(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   setColor  s    N(   R   R   R   R   Rª   R«   R¬   R¯   R²   R   R´   R¹   R©   R¼   R¾   RÀ   RÂ   t   TrueRÆ   RÅ   RË   (    (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR¦   ¿  s"   												i   c         C@ s   t  j |  | | | ƒ S(   uR    returns a tuple of the wrapped text, the actual width, and the actual height
    (   R   RT   (   R   RH   RU   RV   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRT     s    t
   RadioGroupc           B@ s,   e  Z d  Z d „  Z d d „ Z d „  Z RS(   uô    Combo widget: Group of Radio buttons

    methods:

     - RadioGroup(self): constructor.
     - add(self,title, value, default = None): add a button. Returns button.
     - getSelection(self) : returns value of selected button | None    
    c         C@ s   d  |  _ g  |  _ d  S(   N(   R   t   prevt
   buttonlist(   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   $  s    	c         C@ sW   |  j  r | d  k r d } n  t | |  j  | ƒ } | |  _  |  j j | | f ƒ | S(   Ni   (   RÎ   R   R(   RÏ   R2   (   R   R¸   R   t   defaultt   b(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRu   (  s    		c         C@ s.   x' |  j  D] \ } } | j ƒ  r
 | Sq
 Wd  S(   N(   RÏ   R   R   (   R   RÑ   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR>   2  s     N(   R   R   R   R   R   Ru   R>   (    (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRÍ     s   	
t   RadioBarc           B@ s    e  Z d  Z d „  Z d „  Z RS(   u¬    Bar of Radio buttons, based on Grid.

    methods:

    - RadioBar(self, screen, buttonlist) : constructor.
    - getSelection(self): return value of selected button 
    c         C@ s¯   g  |  _  d |  _ t ƒ  |  _ t j |  d t | ƒ ƒ xq | D]i \ } } } |  j j | | | ƒ } |  j  j | | f ƒ |  j	 | d |  j d d ƒ|  j d |  _ q> Wd  S(   Ni    i   R›   (
   R=   R1   RÍ   R,   RŒ   R   t   lenRu   R2   R£   (   R   t   screenRÏ   R¸   R   RÐ   RÑ   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   A  s    		c         C@ s   |  j  j ƒ  S(   N(   R,   R>   (   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR>   L  s    (   R   R   R   R   R>   (    (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRÒ   8  s   	t	   ButtonBarc           B@ s#   e  Z d  Z d d „ Z d „  Z RS(   u   Bar of buttons, based on grid.

    methods:

     - ButtonBar(screen, buttonlist,buttonlist, compact = 0):
     - buttonPressed(self, result):  Takes the widget returned by Form.run and looks to see
                     if it was one of the widgets in the ButtonBar.
    i    c   	   	   C@ s  g  |  _  i  |  _ d |  _ t j |  t | ƒ d ƒ xä | D]Ü } t | t j d k r\ t	 n t
 ƒ rz | } | j ƒ  } n= t | ƒ d k r› | \ } } n | \ } } } | |  j | <| rÌ t | ƒ } n t | ƒ } |  j  j | | f ƒ |  j | |  j d d ƒ |  j d |  _ q; Wd  S(   Ni    i   u   3i   (   i   i    i   i    (   R=   Ro   R1   RŒ   R   RÓ   t
   isinstancet   syst   versiont   strt
   basestringt   lowerR   R   R2   R£   (	   R   RÔ   RÏ   t   compactt   blistR¸   R   t   hotkeyRÑ   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   [  s$    			$c         C@ sH   | |  j  k r |  j  | Sx' |  j D] \ } } | | k r$ | Sq$ Wd  S(   N(   Ro   R=   R   (   R   t   resultR   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   buttonPressedr  s    (   R   R   R   R   Rà   (    (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRÕ   R  s   t   GridFormHelpc           B@ s�   e  Z d  Z d „  Z d d d d d d d d „ Z d d d „ Z d „  Z d „  Z d d d „ Z	 d d d „ Z
 d	 „  Z d
 „  Z d „  Z RS(   u=   Subclass of Grid, for the help form text.

    methods:

     - GridFormHelp(self, screen, title, help, *args) :
     - add (self, widget, col, row, padding = (0, 0, 0, 0),
            anchorLeft = 0, anchorTop = 0, anchorRight = 0,
            anchorBottom = 0, growx = 0, growy = 0):
     - runOnce(self, x = None, y = None):  pop up the help window
     - addHotKey(self, keyname):
     - setTimer(self, keyname):
     - create(self, x = None, y = None):
     - run(self, x = None, y = None):
     - draw(self):
     - runPopup(self):
     - setCurrent (self, co):
    c         G@ sc   | |  _  | |  _ t | ƒ |  _ g  |  _ d |  _ t | ƒ } |  g | d *t j t	 | ƒ Œ  d  S(   Ni    (
   RÔ   R¸   Rm   R€   t	   childListt   form_createdR=   RŒ   R   t   tuple(   R   RÔ   R¸   t   helpR¥   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   Ž  s    				i    c         C@ s<   |  j  | | | | | | | | |	 |
 ƒ
 |  j j | ƒ d  S(   N(   R£   Râ   R2   (   R   Rw   R˜   R™   Rš   R›   Rœ   R�   Rž   RŸ   R    (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRu   ˜  s    	
c         C@ s#   |  j  | | ƒ } |  j j ƒ  | S(   N(   Rx   RÔ   RÆ   (   R   R�   R�   Rß   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   runOnce   s    c         C@ s   |  j  j | ƒ d  S(   N(   R€   Rq   (   R   Rp   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRq   ¥  s    c         C@ s   |  j  j | ƒ d  S(   N(   R€   R†   (   R   Rp   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR†   ¨  s    c         C@ si   |  j  se |  j d d ƒ x! |  j D] } |  j j | ƒ q# W|  j j |  |  j | | ƒ d |  _  n  d  S(   Ni   (   Rã   RŽ   Râ   R€   Ru   RÔ   RÂ   R¸   (   R   R�   R�   t   child(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   create«  s    	c         C@ s   |  j  | | ƒ |  j j ƒ  S(   N(   Rè   R€   Rx   (   R   R�   R�   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRx   ³  s    c         C@ s   |  j  ƒ  |  j j ƒ  S(   N(   Rè   R€   R   (   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   ·  s    
c         C@ s@   |  j  ƒ  |  j j |  |  j ƒ |  j j ƒ  } |  j j ƒ  | S(   N(   Rè   RÔ   RÂ   R¸   R€   Rx   RÆ   (   R   Rß   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   runPopup»  s
    
c         C@ s   |  j  j | ƒ d  S(   N(   R€   R@   (   R   Rƒ   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR@   Â  s    (   i    i    i    i    N(   R   R   R   R   Ru   R   Ræ   Rq   R†   Rè   Rx   R   Ré   R@   (    (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRá   |  s   	
					t   GridFormc           B@ s   e  Z d  Z d „  Z RS(   uh    GridForm class (extends GridFormHelp):

    methods:

     - GridForm(self, screen, title, *args):
    c         G@ s'   |  | | d  f | } t j | Œ  d  S(   N(   R   Rá   R   (   R   RÔ   R¸   R¥   t   myargs(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   Ì  s    (   R   R   R   R   (    (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRê   Å  s   t   CheckboxTreec           B@ sz   e  Z d  Z d d d „ Z d d d „ Z d „  Z d d d d d „ Z d „  Z d „  Z	 d „  Z
 d	 d
 „ Z d „  Z RS(   uì   CheckboxTree combo widget,

    methods:

     - CheckboxTree(self, height, scroll = 0, width = None, hide_checkbox = 0, unselectable = 0)
                    constructor.
     - append(self, text, item = None, selected = 0):
     - addItem(self, text, path, item = None, selected = 0):
     - getCurrent(self):
     - getSelection(self):
     - setEntry(self, item, text):
     - setCurrent(self, item):
     - setEntryValue(self, item, selected = 1):
     - getEntryValue(self, item):
    i    c         C@ s!   |  j  | t d f | | ƒ d  S(   Nu   append(   t   addItemt	   snackArgs(   R   R   R1   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR2   à  s    c         C@ sK   | d  k r | } n  |  j j | | | ƒ } | |  j | <| |  j | <d  S(   N(   R   R   t   checkboxtreeAddItemR/   R0   (   R   R   t   pathR1   R   R)   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRí   ã  s
    	c         C@ s   |  j  j ƒ  } |  j | S(   N(   R   t   checkboxtreeGetCurrentR/   (   R   t   curr(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt
   getCurrentê  s    c         C@ sJ   t  j | | | | ƒ |  _ i  |  _ i  |  _ | rF |  j j | ƒ n  d  S(   N(   R   t   checkboxtreeR   R/   R0   t   checkboxtreeSetWidth(   R   RE   RF   RH   t   hide_checkboxt   unselectable(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   î  s
    		c         C@ s>   g  } |  j  j ƒ  } x" | D] } | j |  j | ƒ q W| S(   N(   R   t   checkboxtreeGetSelectionR2   R/   (   R   R<   R=   R)   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR>   õ  s
    c         C@ s   |  j  j |  j | | ƒ d  S(   N(   R   t   checkboxtreeSetEntryR0   (   R   R1   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   setEntryü  s    c         C@ s   |  j  j |  j | ƒ d  S(   N(   R   t   checkboxtreeSetCurrentR0   (   R   R1   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR@   ÿ  s    i   c         C@ s   |  j  j |  j | | ƒ d  S(   N(   R   t   checkboxtreeSetEntryValueR0   (   R   R1   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   setEntryValue  s    c         C@ s   |  j  j |  j | ƒ S(   N(   R   t   checkboxtreeGetEntryValueR0   (   R   R1   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   getEntryValue  s    N(   R   R   R   R   R2   Rí   Ró   R   R>   Rú   R@   Rý   Rÿ   (    (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRì   Ð  s   				u   Oku   Canceli(   c
      	   C@ sw  | d k r t  | ƒ } n  t |  | ƒ }
 t | | ƒ } t | d | d d ƒ} d } x | D]w } t | ƒ t k r… | \ } } n | } | } | | k r¦ | } n | | k r» | } n  | j | | ƒ | d } q^ W| d
 k rõ | j | ƒ n  t	 |  | |	 d d ƒ } | j
 | d d ƒ | j
 | d d d d ƒ| j
 |
 d d d	 d ƒ| j ƒ  } |
 j | ƒ | j ƒ  f S(   uÀ   
    - ListboxChoiceWindow(screen, title, text, items, 
            buttons = ('Ok', 'Cancel'), 
            width = 40, scroll = 0, height = -1, default = None,
            help = None):
    iÿÿÿÿRF   RG   i   i    i   Rš   i   RŸ   N(   i    i   i    i   (   RÓ   RÕ   RS   R-   t   typeRä   R2   R   R@   Rá   Ru   Ræ   Rà   R:   (   RÔ   R¸   R   t   itemst   buttonsRH   RF   RE   RÐ   Rå   t   bbt   tt   lt   countR1   R)   R�   t   rc(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   ListboxChoiceWindow  s2    
 		c      	   C@ sŽ   t  |  | ƒ } t | | d |  j d ƒ}	 t |  | | d d ƒ }
 |
 j |	 d d d d ƒ|
 j | d d d d ƒ| j |
 j | | ƒ ƒ S(	   u    
     - ButtonChoiceWindow(screen, title, text, 
               buttons = [ 'Ok', 'Cancel' ], 
               width = 40, x = None, y = None, help = None):
    RW   i   i   i   i    Rš   RŸ   (   i    i    i    i   (   RÕ   RS   RE   Rá   Ru   Rà   Ræ   (   RÔ   R¸   R   R  RH   R�   R�   Rå   R  R  R�   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   ButtonChoiceWindow3  s    i   c	      
   C@ sé  t  |  | ƒ }	 t | | ƒ }
 d } x | D] } | d } q+ Wt d | ƒ } d } g  } xÆ | D]¾ } t | ƒ t k r¾ | \ } } t | t j d k r  t n t	 ƒ rÊ t
 | | ƒ } qÊ n t
 | ƒ } | j t | ƒ d | d d	 d d ƒ| j | d | d d ƒ| d } | j | ƒ qa Wt |  | | d d ƒ } | j |
 d d d d
 ƒ| j | d d d d ƒ| j |	 d d d d ƒ| j ƒ  } g  } d } x/ | D]' } | j | | j ƒ  ƒ | d } q¥W|	 j | ƒ t | ƒ f S(   u•   
    EntryWindow(screen, title, text, prompts, allowCancel = 1, width = 40,
        entryWidth = 20, buttons = [ 'Ok', 'Cancel' ], help = None):
    i    i   i   u   3Rš   R›   i   RŸ   (   i    i    i   i    (   i    i    i    i   (   i    i    i    i   (   RÕ   RS   RŒ   R   Rä   RÖ   R×   RØ   RÙ   RÚ   Re   R£   RY   R2   Rá   Ru   Ræ   R   Rà   (   RÔ   R¸   R   t   promptst   allowCancelRH   t
   entryWidthR  Rå   R  R  R  t   nt   sgt	   entryListt   eR�   Rß   t   entryValues(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   EntryWindowC  s:    $%
t   CListboxc        	   B@ s†   e  Z d  Z d d d d d d d d d „ Z d d d „ Z d d „ Z d d „ Z d „  Z d d „ Z	 d	 „  Z
 d
 „  Z d „  Z RS(   up  Clistbox convenience class.

    methods:

     - Clistbox(self, height, cols, cols_widths, scroll = 0)       : constructor
     - colFormText(self, col_text, align = None, adjust_width = 0) : column text.
     - append(self, col_text, item, col_text_align = None)         :
     - insert(self, col_text, item, before, col_text_align = None)
     - delete(self, item)
     - replace(self, col_text, item, col_text_align = None)
     - current(self) : returns current item
     - setCurrent(self, item): sets an item as current
     - clear(self): clear the listbox
     
     Alignments may be LEFT, RIGHT, CENTER, None
    i    i   c         C@ sá   | |  _  | |  _ | |  _ | |  _ |	 d  k r� t j |  d d ƒ d } |  j |	 |
 d | ƒ} t | ƒ |  _	 |  j
 |  j	 d d d d ƒn t j |  d d ƒ d } t | | | | ƒ |  _ |  j
 |  j d | d d ƒd  S(   Ni   i   t   adjust_widthi    R›   R�   (   t   colst
   col_widthst   col_padt   col_text_alignR   RŒ   R   t   colFormTextRY   R[   R£   R-   RC   (   R   RE   R  R  RF   RG   RH   R  R  t
   col_labelst   col_label_alignR  t   box_yt   lstr(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR   ‚  s    	
			c         C@ s…  d } d } t  | ƒ } xf| |  j k  r€| | k  r€| | } t j | ƒ } |  j | | k  rŒ | rx | |  j | <qŒ | |  j |  } n  |  j | t j | ƒ }	 |	 d k r?| d  k rÇ t }
 n
 | | }
 |
 t k rî | d |	 } n  |
 t k rd |	 d | d |	 d d } n  |
 t k r?d |	 | } q?n  | | d k r_d |  j	 } n d } | | | } | d } q W| S(   Ni    u    u    i   i   (
   RÓ   R  R   t   wstrlenR  R   t   LEFTt   CENTERt   RIGHTR  (   R   t   col_textt   alignR  t   iRÙ   t   c_lent   cstrt   cstrlent   deltat   at   pstr(    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR  �  s8    
	
c         C@ sA   | d  k r |  j } n  |  j | | ƒ } |  j j | | ƒ d  S(   N(   R   R  R  RC   R2   (   R   R"  R1   R  R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR2   Æ  s    c         C@ sD   | d  k r |  j } n  |  j | | ƒ } |  j j | | | ƒ d  S(   N(   R   R  R  RC   R5   (   R   R"  R1   R4   R  R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR5   Ì  s    c         C@ s   |  j  j | ƒ d  S(   N(   RC   R7   (   R   R1   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR7   Ò  s    c         C@ sA   | d  k r |  j } n  |  j | | ƒ } |  j j | | ƒ d  S(   N(   R   R  R  RC   R8   (   R   R"  R1   R  R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR8   Õ  s    c         C@ s   |  j  j ƒ  S(   N(   RC   R:   (   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR:   Û  s    c         C@ s   |  j  j | ƒ d  S(   N(   RC   R@   (   R   R1   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR@   Þ  s    c         C@ s   |  j  j ƒ  d  S(   N(   RC   RB   (   R   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyRB   á  s    N(   R   R   R   R   R   R  R2   R5   R7   R8   R:   R@   RB   (    (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyR  q  s   	)			c         C@ s   d |  S(   Ni   (    (   R�   (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   customColorsetä  s    (   iÿÿÿÿi    (   iÿÿÿÿiÿÿÿÿ(   i    i    (   i   i   (   i   i    (    (    (    (    (   u   Oku   Cancel(c   R   t
   __future__R    R   R   R   t   stringR×   R   R   R   R   R   R   R	   R  t   DOWNR   t   UPR!  Rî   R
   R   R   R   R(   R-   RL   RS   RY   R_   Re   t   KEY_F1t   KEY_F2t   KEY_F3t   KEY_F4t   KEY_F5t   KEY_F6t   KEY_F7t   KEY_F8t   KEY_F9t   KEY_F10t   KEY_F11t   KEY_F12t   KEY_ESCt	   KEY_ENTERt   KEY_SUSPENDt   KEY_BACKSPACEt
   KEY_DELETEt
   KEY_INSERTt   ordRo   R=   Rs   R  t   ascii_letterst   digitst   ct   oRm   RŒ   t   COLORSET_ROOTt   COLORSET_BORDERt   COLORSET_WINDOWt   COLORSET_SHADOWt   COLORSET_TITLEt   COLORSET_BUTTONt   COLORSET_ACTBUTTONt   COLORSET_CHECKBOXt   COLORSET_ACTCHECKBOXt   COLORSET_ENTRYt   COLORSET_LABELt   COLORSET_LISTBOXt   COLORSET_ACTLISTBOXt   COLORSET_TEXTBOXt   COLORSET_ACTTEXTBOXt   COLORSET_HELPLINEt   COLORSET_ROOTTEXTt   COLORSET_EMPTYSCALEt   COLORSET_FULLSCALEt   COLORSET_DISENTRYt   COLORSET_COMPACTBUTTONt   COLORSET_ACTSELLISTBOXt   COLORSET_SELLISTBOXRÇ   R¦   RT   RÍ   RÒ   RÕ   Rá   Rê   Rì   R   R  R	  R  R  R+  (    (    (    s)   /usr/lib/python2.7/dist-packages/snack.pyt   <module>(   sœ   4

A	!
<
>.




















U*I9)	-s