
aHc           @   s[  d  Z  d d k Z d d k Z d d k Z d d k l Z l Z l Z l Z l Z l	 Z	 l
 Z
 d_ Z d` Z da Z db Z dc Z h d d 6Z d dd 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 h e i d 6e i d 6e i d 6e i d  6e i  d! 6e i! d" 6e i" d# 6e i# d$ 6e i$ d% 6e i% d& 6e i& d' 6e i' d( 6e i( d) 6e) d*  d* 6Z* x" e* i+   D] Z, e, e* e* e, <qWd+ de d,     YZ- d- df d.     YZ. h e i/ d/ 6e i0 d0 6e i1 d1 6e i2 d2 6e i3 d3 6e i4 d4 6e i5 d5 6e i6 d6 6e i7 d7 6e i8 d8 6e i9 d9 6e i: d: 6e i; d; 6e i< d< 6e i= d= 6e i> d> 6e i? d? 6e i@ d@ 6e iA dA 6e iB dB 6e iC dC 6e iD dD 6e iE dE 6ZF dF dg dG     YZG dH dH dI  ZH dJ e f dK     YZI dL e. f dM     YZJ dN e. f dO     YZK dP e. f dQ     YZL dR eL f dS     YZM dT e f dU     YZN dh dX d d d d dY  ZP dV dW g dX d d d dZ  ZQ d dX d[ dV dW g d d\  ZR d] e. f d^     YZS d S(i   s  
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
iN(   t   FLAG_DISABLEDt	   FLAGS_SETt   FLAGS_RESETt   FLAGS_TOGGLEt   FD_READt   FD_WRITEt	   FD_EXCEPTi    i   t   appendt   Widgetc           B   s#   e  Z d  Z d d  Z d   Z RS(   s   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   s2   | o |  i  i | |  n |  i  i |  d  S(   N(   t   wt   setCallback(   t   selft   objt   data(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR
   B   s    c         C   s
   t   d  S(   N(   t   NotImplementedError(   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   __init__H   s    N(   t   __name__t
   __module__t   __doc__t   NoneR
   R   (    (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR   8   s   	t   Buttonc           B   s   e  Z d  Z d   Z RS(   sq   Basic button class, takes button text as parameter

    method:

     - Button(self, text): returns a button
    c         C   s   t  i |  |  _ d  S(   N(   t   _snackt   buttonR	   (   R   t   text(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR   R   s    (   R   R   R   R   (    (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR   K   s   t   CompactButtonc           B   s   e  Z d  Z d   Z RS(   s   Compact Button class (less frilly button decoration).

    methods:

     - CompactButton(self,text) : create button, with text.
    c         C   s   t  i |  |  _ d  S(   N(   R   t   compactbuttonR	   (   R   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR   \   s    (   R   R   R   R   (    (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR   U   s   t   Checkboxc           B   s>   e  Z d  Z d   Z d   Z d   Z d   Z d d  Z RS(   s  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
   |  i  i S(   N(   R	   t   checkboxValue(   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   valuel   s    c         C   s   |  i  i d j S(   Ni    (   R	   R   (   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   selectedo   s    c         C   s   |  i  i | |  S(   N(   R	   t   checkboxSetFlags(   R   t   flagt   sense(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   setFlagsr   s    c         C   s   |  i  i |  S(   N(   R	   t   checkboxSetValue(   R   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   setValuev   s    i    c         C   s   t  i | |  |  _ d  S(   N(   R   t   checkboxR	   (   R   R   t   isOn(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR   y   s    (   R   R   R   R   R   R!   R#   R   (    (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR   _   s   				t   SingleRadioButtonc           B   s#   e  Z d  Z d   Z d d  Z RS(   s   Single Radio Button.

    methods:
    
     -  SingleRadioButton(text, group, isOn = 0)  : create button
     -  selected(self)                            : returns bool, whether or not is selected.
    c         C   s   |  i  i |  i  i j S(   N(   R	   t   keyt
   radioValue(   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR      s    i    c         C   sB   | o t  i | | i |  |  _ n t  i | d  |  |  _ d  S(   N(   R   t   radiobuttonR	   R   (   R   R   t   groupR%   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR      s    (   R   R   R   R   R   (    (    (    s)   /usr/lib/python2.6/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(   s  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   |  i  i |  } | |  i | <| |  i | <d  S(   N(   R	   t   listboxAddItemt   key2itemt   item2key(   R   R   t   itemR'   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR      s    c         C   sZ   | p |  i  i | d  } n |  i  i | |  i |  } | |  i | <| |  i | <d  S(   Ni    (   R	   t   listboxInsertItemR.   R-   (   R   R   R/   t   beforeR'   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   insert   s
    c         C   s6   |  i  i |  i |  |  i |  i | =|  i | =d  S(   N(   R	   t   listboxDeleteItemR.   R-   (   R   R/   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   delete   s    c         C   sb   |  i  i | |  i |  } |  i  i |  i |  |  i |  i | =| |  i | <| |  i | <d  S(   N(   R	   R0   R.   R3   R-   (   R   R   R/   R'   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   replace   s
    c         C   s   |  i  |  i i   S(   N(   R-   R	   t   listboxGetCurrent(   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   current   s    c         C   s>   g  } |  i  i   } x" | D] } | i |  i |  q W| S(   N(   R	   t   listboxGetSelectionR   R-   (   R   t	   selectiont   listR'   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   getSelection   s     c         C   s   |  i  i |  i |  d  S(   N(   R	   t   listboxSetCurrentR.   (   R   R/   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt
   setCurrent   s    c         C   s#   h  |  _  h  |  _ |  i i   d  S(   N(   R-   R.   R	   t   listboxClear(   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   clear   s    		i    c         C   sR   t  i | | | | | |  |  _ h  |  _ h  |  _ | o |  i i |  n d  S(   N(   R   t   listboxR	   R-   R.   t   listboxSetWidth(   R   t   heightt   scrollt
   returnExitt   widtht
   showCursort   multiplet   border(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR      s
    !		(   R   R   R   R   R2   R4   R5   R7   R;   R=   R?   R   (    (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR+      s   								t   Textboxc           B   s/   e  Z d  Z d   Z d   Z d d d  Z RS(   s  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   |  i  i |  d  S(   N(   R	   t   textboxText(   R   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   setText   s    c         C   s   |  i  i |  d  S(   N(   R	   t   textboxHeight(   R   RB   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt	   setHeight   s    i    c         C   s"   t  i | | | | |  |  _ d  S(   N(   R   t   textboxR	   (   R   RE   RB   R   RC   t   wrap(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR      s    (   R   R   R   RK   RM   R   (    (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyRI      s   			t   TextboxReflowedc           B   s   e  Z d  d d d  Z RS(   i   i
   ic         C   sr   t  | | | |  \ } } } | d j o* | | j o t i |  | | | d  n t i |  | | | d  d  S(   Nii   i    (   t   reflowRI   R   (   R   RE   R   t   flexDownt   flexUpt	   maxHeightt   newtextRB   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR      s    (   R   R   R   (    (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyRP      s   t   Labelc           B   s    e  Z d  Z d   Z d   Z RS(   s|   A Label (simple text).

    methods:

     - Label(self,text)   : create label
     - setText(self,text) : change text.
    c         C   s   |  i  i |  d  S(   N(   R	   t	   labelText(   R   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyRK      s    c         C   s   t  i |  |  _ d  S(   N(   R   t   labelR	   (   R   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR      s    (   R   R   R   RK   R   (    (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyRV      s   	t   Scalec           B   s    e  Z d  Z d   Z d   Z RS(   s   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   |  i  i |  d  S(   N(   R	   t   scaleSet(   R   t   amount(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   set  s    c         C   s   t  i | |  |  _ d  S(   N(   R   t   scaleR	   (   R   RE   t   total(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR     s    (   R   R   R   R\   R   (    (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyRY      s   	t   Entryc           B   sD   e  Z d  Z d   Z d d  Z d   Z d d d d d d  Z RS(   s  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
   |  i  i S(   N(   R	   t
   entryValue(   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR     s    i   c         C   s   |  i  i | |  S(   N(   R	   t   entrySetValue(   R   R   t   cursorAtEnd(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR\     s    c         C   s   |  i  i | |  S(   N(   R	   t   entrySetFlags(   R   R   R    (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR!     s    t    i    c         C   s%   t  i | | | | | |  |  _ d  S(   N(   R   t   entryR	   (   R   RE   R   t   hiddent   passwordRC   RD   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR     s    (   R   R   R   R   R\   R!   R   (    (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR_     s   		t   F1t   F2t   F3t   F4t   F5t   F6t   F7t   F8t   F9t   F10t   F11t   F12t   ESCt    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(
   s   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   |  i  i t |  d  S(   N(   R	   t	   addhotkeyt   hotkeys(   R   t   keyname(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt	   addHotKey<  s    c         C   s   | i  i d  o+ x( | i i   D] } |  i |  q# Wn | i  i d  o% x\ | i D] } |  i |  q[ Wn; | i  i d  o' | |  i | i i	 <|  i i | i  Sd  S(   NRx   t   gridmembersR	   (   t   __dict__t   has_keyRx   t   keysRz   R{   t   addt   transR	   R'   R   (   R   t   widgetR'   R	   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR   ?  s     
 c         C   sj   |  i  i   \ } } | t i j o |  i | S| t i j o d S| t i j o |  i | St | S(   Nt   TIMER(	   R	   t   runR   t   FORM_EXIT_WIDGETR   t   FORM_EXIT_TIMERt   FORM_EXIT_FDREADYt   filemapRx   (   R   t   whatt   which(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR   L  s    c         C   s   |  i  i   d  S(   N(   R	   t   drawR   (   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR   W  s    c         C   s1   h  |  _  h  |  _ t i |  |  _ | |  _ d  S(   N(   R   R   R   t   formR	   t   helpArg(   R   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR   [  s    		c         C   s   |  i  i | i   d  S(   N(   R	   t
   setcurrent(   R   t   co(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR=   b  s    c         C   s   |  i  i |  d  S(   N(   R	   t   settimer(   R   t   timer(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   setTimere  s    c         C   s0   | |  i  | i   <|  i i | i   |  d  S(   N(   R   t   filenoR	   t   watchfd(   R   t   filet   flags(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt	   watchFileh  s    N(   R   R   R   Rz   R   R   R   R   R   R=   R   R   (    (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyRv   .  s   						t   Gridc           B   s>   e  Z d  Z d   Z d d d d d d d d  Z d   Z RS(   sy  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   |  i  i | |  S(   N(   t   gt   place(   R   t   xt   y(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR   x  s    i    c         C   s   |  i  i |  d } | o t i } n | o t i } n | o | t i B} n | o | t i B} n d } |	 o t i } n |
 o | t i B} n | i	 i
 d  o# |  i i | | | i | | |  S|  i i | | | i | |  Sd  S(   Ni    R   (   R{   R   R   t   ANCHOR_LEFTt   ANCHOR_RIGHTt
   ANCHOR_TOPt   ANCHOR_BOTTOMt
   GRID_GROWXt
   GRID_GROWYR|   R}   R   t   setfieldR	   (   R   R   t   colt   rowt   paddingt
   anchorLeftt	   anchorTopt   anchorRightt   anchorBottomt   growxt   growyt   anchorFlagst	   gridFlags(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   setField{  s&    c         G   s"   t  t i |  |  _ g  |  _ d  S(   N(   t   applyR   t   gridR   R{   (   R   t   args(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR     s    (   i    i    i    i    (   R   R   R   R   R   R   (    (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR   l  s   		t   ROOTt   BORDERt   WINDOWt   SHADOWt   TITLEt   BUTTONt	   ACTBUTTONt   CHECKBOXt   ACTCHECKBOXt   ENTRYt   LABELt   LISTBOXt
   ACTLISTBOXt   TEXTBOXt
   ACTTEXTBOXt   HELPLINEt   ROOTTEXTt
   EMPTYSCALEt	   FULLSCALEt   DISENTRYt   COMPACTBUTTONt   ACTSELLISTBOXt
   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(   s
  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  i   t  i   \ |  _ |  _ |  i d   d  S(   N(   R   t   initt   sizeRE   RB   t   pushHelpLineR   (   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR     s    
c         C   s
   t  i   S(   N(   R   t   finish(   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR     s    c         C   s   t  i   d  S(   N(   R   t   resume(   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR     s    c         C   s   t  i   d  S(   N(   R   t   suspend(   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR     s    c         C   s   |  i  |  |  d  S(   N(   t   helpCb(   R   t   arg(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   doHelpCallback  s    c         C   s   | |  _  t i |  i  S(   N(   R   R   t   helpcallbackR   (   R   t   cb(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   helpCallback  s    	c         C   s%   | o t  i | |  St  i |  S(   N(   R   t   suspendcallback(   R   R   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   suspendCallback  s    c         C   s   t  i | | | | |  S(   N(   R   t
   openwindow(   R   t   leftt   topRE   RB   t   title(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt
   openWindow  s    c         C   s&   | p t  i d  St  i |  Sd  S(   Ns	   *default*(   R   t   pushhelpline(   R   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR     s    c         C   s
   t  i   S(   N(   R   t   pophelpline(   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   popHelpLine  s    c         C   s   t  i | | |  S(   N(   R   t   drawroottext(   R   R   R   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   drawRootText  s    c         C   s   t  i | | |  S(   N(   R   t   centeredwindow(   R   RE   RB   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   centeredWindow  s    c         C   s;   | o! | o t  i | i | | |  St  i | i |  S(   N(   R   t   gridwrappedwindowR   (   R   R   R   R   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   gridWrappedWindow  s    c         C   s   | o t  i   St  i   S(   N(   R   t	   popwindowt   popwindownorefresh(   R   t   refresh(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt	   popWindow  s    c         C   s
   t  i   S(   N(   R   R   (   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR     s    c         C   s   t  i t | | |  S(   N(   R   t   setcolort	   colorsets(   R   t   colorsett   fgt   bg(    (    s)   /usr/lib/python2.6/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.6/dist-packages/snack.pyR     s"   												i   c         C   s   t  i |  | | |  S(   sR    returns a tuple of the wrapped text, the actual width, and the actual height
    (   R   RQ   (   R   RE   RR   RS   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyRQ     s    t
   RadioGroupc           B   s,   e  Z d  Z d   Z d d  Z d   Z RS(   s    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.6/dist-packages/snack.pyR     s    	c         C   sZ   |  i  o | d  j o
 d } n t | |  i  |  } | |  _  |  i i | | f  | S(   Ni   (   R   R   R&   R   R   (   R   R   R   t   defaultt   b(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR     s    
	c         C   s0   x) |  i  D] \ } } | i   o | Sq
 Wd  S(   N(   R   R   R   (   R   R   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR;   !  s
    
  	N(   R   R   R   R   R   R   R;   (    (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR   
  s   	
t   RadioBarc           B   s    e  Z d  Z d   Z d   Z RS(   s    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 i |  d t |   xq | D]i \ } } } |  i i | | |  } |  i  i | | f  |  i	 | d |  i d d |  i d |  _ q> Wd  S(   Ni    i   R   (
   R:   R/   R   R*   R   R   t   lenR   R   R   (   R   t   screenR   R   R   R   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR   0  s    		 c         C   s   |  i  i   S(   N(   R*   R;   (   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR;   ;  s    (   R   R   R   R   R;   (    (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR   '  s   	t	   ButtonBarc           B   s#   e  Z d  Z d d  Z d   Z RS(   s   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  |  _  h  |  _ d |  _ t i |  t |  d  x | D] } t |  t i j o | } t	 i
 |  } n@ t |  d j o | \ } } n | \ } } } | |  i | <| o t |  } n t |  } |  i  i | | f  |  i | |  i d d  |  i d |  _ q; Wd  S(   Ni    i   i   (   i   i    i   i    (   R:   Rx   R/   R   R   R   t   typet   typest
   StringTypet   stringt   lowerR   R   R   R   (	   R   R   R   t   compactt   blistR   R   t   hotkeyR   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR   J  s&    			 c         C   sO   |  i  i |  o |  i  | Sx) |  i D] \ } } | | j o | Sq) Wd  S(   N(   Rx   R}   R:   R   (   R   t   resultR   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   buttonPresseda  s    
 	(   R   R   R   R   R  (    (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR   A  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(   s=   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   sf   | |  _  | |  _ t |  |  _ g  |  _ d |  _ t |  } |  g | d *t t i	 t
 |   d  S(   Ni    (   R   R   Rv   R   t	   childListt   form_createdR:   R   R   R   t   tuple(   R   R   R   t   helpR   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR   }  s    				i    c         C   s<   |  i  | | | | | | | | |	 |
 
 |  i i |  d  S(   N(   R   R  R   (   R   R   R   R   R   R   R   R   R   R   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR     s    	
c         C   s#   |  i  | |  } |  i i   | S(   N(   R   R   R   (   R   R   R   R  (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   runOnce  s    c         C   s   |  i  i |  d  S(   N(   R   Rz   (   R   Ry   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyRz     s    c         C   s   |  i  i |  d  S(   N(   R   R   (   R   Ry   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR     s    c         C   sk   |  i  p] |  i d d  x! |  i D] } |  i i |  q$ W|  i i |  |  i | |  d |  _  n d  S(   Ni   (   R  R   R  R   R   R   R   R   (   R   R   R   t   child(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   create  s    

 c         C   s   |  i  | |  |  i i   S(   N(   R  R   R   (   R   R   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR     s    c         C   s   |  i    |  i i   S(   N(   R  R   R   (   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR     s    
c         C   s@   |  i    |  i i |  |  i  |  i i   } |  i i   | S(   N(   R  R   R   R   R   R   R   (   R   R  (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   runPopup  s
    
c         C   s   |  i  i |  d  S(   N(   R   R=   (   R   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR=     s    (   i    i    i    i    N(   R   R   R   R   R   R   R	  Rz   R   R  R   R   R  R=   (    (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR  k  s   	
					t   GridFormc           B   s   e  Z d  Z d   Z RS(   sh    GridForm class (extends GridFormHelp):

    methods:

     - GridForm(self, screen, title, *args):
    c         G   s*   |  | | d  f | } t t i |  d  S(   N(   R   R   R  R   (   R   R   R   R   t   myargs(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR     s    (   R   R   R   R   (    (    (    s)   /usr/lib/python2.6/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(   s   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!   |  i  | t d f | |  d  S(   NR   (   t   addItemt	   snackArgs(   R   R   R/   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR     s    c         C   sM   | d  j o
 | } n |  i i | | |  } | |  i | <| |  i | <d  S(   N(   R   R	   t   checkboxtreeAddItemR-   R.   (   R   R   t   pathR/   R   R'   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR    s
    
c         C   s   |  i  i   } |  i | S(   N(   R	   t   checkboxtreeGetCurrentR-   (   R   t   curr(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt
   getCurrent  s    c         C   sL   t  i | | | |  |  _ h  |  _ h  |  _ | o |  i i |  n d  S(   N(   R   t   checkboxtreeR	   R-   R.   t   checkboxtreeSetWidth(   R   RB   RC   RE   t   hide_checkboxt   unselectable(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR     s
    		c         C   s>   g  } |  i  i   } x" | D] } | i |  i |  q W| S(   N(   R	   t   checkboxtreeGetSelectionR   R-   (   R   R9   R:   R'   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR;     s     c         C   s   |  i  i |  i | |  d  S(   N(   R	   t   checkboxtreeSetEntryR.   (   R   R/   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   setEntry  s    c         C   s   |  i  i |  i |  d  S(   N(   R	   t   checkboxtreeSetCurrentR.   (   R   R/   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR=     s    i   c         C   s   |  i  i |  i | |  d  S(   N(   R	   t   checkboxtreeSetEntryValueR.   (   R   R/   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   setEntryValue  s    c         C   s   |  i  i |  i |  S(   N(   R	   t   checkboxtreeGetEntryValueR.   (   R   R/   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   getEntryValue  s    N(   R   R   R   R   R   R  R  R   R;   R  R=   R   R"  (    (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR    s   				t   Okt   Canceli(   c
         C   s  | d j o t  |  } n t |  |  }
 t | |  } t | d | d d } d } x | D] } t |  t i j o | \ } } n | } | } | | j o
 | } n | | j o
 | } n | i | |  | d } q` W| d
 j o | i	 |  n t
 |  | |	 d d  } | i | d d  | i | d d d d | i |
 d d d	 d | i   } |
 i |  | i   f S(   s   
    - ListboxChoiceWindow(screen, title, text, items, 
            buttons = ('Ok', 'Cancel'), 
            width = 40, scroll = 0, height = -1, default = None,
            help = None):
    iRC   RD   i   i    i   R   i   R   N(   i    i   i    i   (   R   R   RP   R+   R   R   t	   TupleTypeR   R   R=   R  R   R	  R  R7   (   R   R   R   t   itemst   buttonsRE   RC   RB   R   R  t   bbt   tt   lt   countR/   R'   R   t   rc(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   ListboxChoiceWindow  s4    
  

c      	   C   s   t  |  |  } t | | d |  i d }	 t |  | | d d  }
 |
 i |	 d d d d |
 i | d d d d | i |
 i | |   S(	   s   
     - ButtonChoiceWindow(screen, title, text, 
               buttons = [ 'Ok', 'Cancel' ], 
               width = 40, x = None, y = None, help = None):
    RT   i   i   i   i    R   R   (   i    i    i    i   (   R   RP   RB   R  R   R  R	  (   R   R   R   R'  RE   R   R   R  R(  R)  R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   ButtonChoiceWindow"  s    i   c	         C   s  t  |  |  }	 t | |  }
 d } x | D] } | d } q+ Wt d |  } d } g  } x | D] } t |  t i j o9 | \ } } t |  t i j o t | |  } q n t |  } | i t	 |  d | d d d d | i | d | d d | d } | i
 |  qa Wt |  | | d d  } | i |
 d d d d	 | i | d d d d
 | i |	 d d d d | i   } g  } d } x/ | D]' } | i
 | | i    | d } qW|	 i |  t |  f S(   s   
    EntryWindow(screen, title, text, prompts, allowCancel = 1, width = 40,
        entryWidth = 20, buttons = [ 'Ok', 'Cancel' ], help = None):
    i    i   i   R   R   i   R   (   i    i    i   i    (   i    i    i    i   (   i    i    i    i   (   R   RP   R   R   R   R%  t   StringTypesR_   R   RV   R   R  R   R	  R   R  R  (   R   R   R   t   promptst   allowCancelRE   t
   entryWidthR'  R  R(  R)  R+  t   nt   sgt	   entryListt   eR   R  t   entryValues(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   EntryWindow2  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(   sp  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  j o` t i |  d d  d } |  i |	 |
 d | } t |  |  _	 |  i
 |  i	 d d d d n t i |  d d  d } t | | | |  |  _ |  i
 |  i d | d d d  S(   Ni   i   t   adjust_widthi    R   R   (   t   colst
   col_widthst   col_padt   col_text_alignR   R   R   t   colFormTextRV   RX   R   R+   R@   (   R   RB   R;  R<  RC   RD   RE   R=  R>  t
   col_labelst   col_label_alignR:  t   box_yt   lstr(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR   q  s    	
			 c         C   s  d } d } t  |  } xy| |  i j  oh| | j  o[| | } t i |  } |  i | | j  o- | o | |  i | <q | |  i |  } n |  i | t i |  }	 |	 d j o | d  j o
 t }
 n | | }
 |
 t j o | d |	 } n |
 t j o& d |	 d | d |	 d d } n |
 t j o d |	 | } qOn | | d j o d |  i	 } n d } | | | } | d } q W| S(   Ni    Rd   Ru   i   i   (
   R   R;  R   t   wstrlenR<  R   t   LEFTt   CENTERt   RIGHTR=  (   R   t   col_textt   alignR:  t   it   strt   c_lent   cstrt   cstrlent   deltat   at   pstr(    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR?    s:     


c         C   sC   | d  j o |  i } n |  i | |  } |  i i | |  d  S(   N(   R   R>  R?  R@   R   (   R   RH  R/   R>  R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR     s    c         C   sF   | d  j o |  i } n |  i | |  } |  i i | | |  d  S(   N(   R   R>  R?  R@   R2   (   R   RH  R/   R1   R>  R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR2     s    c         C   s   |  i  i |  d  S(   N(   R@   R4   (   R   R/   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR4     s    c         C   sC   | d  j o |  i } n |  i | |  } |  i i | |  d  S(   N(   R   R>  R?  R@   R5   (   R   RH  R/   R>  R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR5     s    c         C   s   |  i  i   S(   N(   R@   R7   (   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR7     s    c         C   s   |  i  i |  d  S(   N(   R@   R=   (   R   R/   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR=     s    c         C   s   |  i  i   d  S(   N(   R@   R?   (   R   (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR?     s    N(   R   R   R   R   R   R?  R   R2   R4   R5   R7   R=   R?   (    (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyR9  `  s   	)			(   ii    (   ii(   i    i    (   i   i   (   i   i    (    (    (    (    (   R#  R$  (T   R   R   R   R   R    R   R   R   R   R   R   RE  t   DOWNRF  t   UPRG  R  R   R   R   R   R&   R+   RI   RP   RV   RY   R_   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   ordRx   R~   R3  Rv   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   RQ   R   R   R   R  R  R  R   R-  R.  R8  R9  (    (    (    s)   /usr/lib/python2.6/dist-packages/snack.pyt   <module>(   s   4

A	!$ >.




















Q*I9)	-