
</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_EXCEPTii   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
   ic         C@ so   t  | | | |  \ } } } | d k rR | | k rR t j |  | | | d  n t j |  | | | d  d  S(   Nii   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):
    iRF   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    (   ii    (   ii(   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