ROOTPLOIT
Server: LiteSpeed
System: Linux server71.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User: niphet (1079)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: //lib64/python3.6/site-packages/__pycache__/snack.cpython-36.pyc
3

^y@sdZddlmZmZmZddlZddlZddlZddlmZm	Z	m
Z
mZmZm
Z
mZdFZdIZdJZdKZdLZddMiZGdddZGd	d
d
eZGdddeZGd
ddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZGdddeZej ej!ej"ej#ej$ej%ej&ej'ej(ej)ej*ej+ej,ej-ej.ej/ej0ej1ej2e3ddZ4x"e5e4j6D]Z7e7e4e4e7<qWx4dd ej8ej9DD]\Z:Z;e:e4e;<e;e4e:<qWGd!d"d"Z<Gd#d$d$Z=ej>ej?ej@ejAejBejCejDejEejFejGejHejIejJejKejLejMejNejOejPejQejRejSejTd%ZUGd&d'd'ZVdNd)d*ZWGd+d,d,eZXGd-d.d.e=ZYGd/d0d0e=ZZGd1d2d2e=Z[Gd3d4d4e[Z\Gd5d6d6eZ]dQd:d;Z^d7d8gd9dddfd<d=Z_dd9d>d7d8gdfd?d@Z`GdAdBdBe=ZadCdDZbdS)Ra
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
)absolute_importprint_functionunicode_literalsN)
FLAG_DISABLED	FLAGS_SETFLAGS_RESETFLAGS_TOGGLEFD_READFD_WRITE	FD_EXCEPTappendc@s"eZdZdZdddZddZdS)WidgetzBase 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.
    NcCs$|r|jj||n|jj|dS)N)wsetCallback)selfobjdatar/usr/lib64/python3.6/snack.pyrDszWidget.setCallbackcCstdS)N)NotImplementedError)rrrr__init__JszWidget.__init__)N)__name__
__module____qualname____doc__rrrrrrr:s	
rc@seZdZdZddZdS)ButtonzqBasic button class, takes button text as parameter

    method:

     - Button(self, text): returns a button
    cCstj||_dS)N)_snackbuttonr)rtextrrrrTszButton.__init__N)rrrrrrrrrrMsrc@seZdZdZddZdS)
CompactButtonzCompact Button class (less frilly button decoration).

    methods:

     - CompactButton(self,text) : create button, with text.
    cCstj||_dS)N)rZ
compactbuttonr)rrrrrr^szCompactButton.__init__N)rrrrrrrrrr Wsr c@s:eZdZdZddZddZddZdd	ZdddZd
S)CheckboxaA 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
    cCs|jjS)N)r
checkboxValue)rrrrvaluenszCheckbox.valuecCs|jjdkS)Nr)rr")rrrrselectedqszCheckbox.selectedcCs|jj||S)N)rZcheckboxSetFlags)rflagsenserrrsetFlagstszCheckbox.setFlagscCs|jj|S)N)rZcheckboxSetValue)rr#rrrsetValuexszCheckbox.setValuercCstj|||_dS)N)rZcheckboxr)rrisOnrrrr{szCheckbox.__init__N)r)	rrrrr#r$r'r(rrrrrr!asr!c@s"eZdZdZddZdddZdS)	SingleRadioButtonzSingle Radio Button.

    methods:
    
     -  SingleRadioButton(text, group, isOn = 0)  : create button
     -  selected(self)                            : returns bool, whether or not is selected.
    cCs|jj|jjkS)N)rkeyZ
radioValue)rrrrr$szSingleRadioButton.selectedrcCs,|rtj||j||_ntj|d||_dS)N)rZradiobuttonr)rrgroupr)rrrrszSingleRadioButton.__init__N)r)rrrrr$rrrrrr*~sr*c@sZeZdZdZddZddZddZdd	Zd
dZdd
Z	ddZ
ddZdddZdS)ListboxaListbox 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
    cCs$|jj|}||j|<||j|<dS)N)rZlistboxAddItemkey2itemitem2key)rritemr+rrrr
s
zListbox.appendcCs@|s|jj|d}n|jj||j|}||j|<||j|<dS)Nr)rlistboxInsertItemr/r.)rrr0beforer+rrrinserts

zListbox.insertcCs,|jj|j||j|j|=|j|=dS)N)rlistboxDeleteItemr/r.)rr0rrrdeleteszListbox.deletecCsL|jj||j|}|jj|j||j|j|=||j|<||j|<dS)N)rr1r/r4r.)rrr0r+rrrreplaces

zListbox.replacecCs|j|jjS)N)r.rZlistboxGetCurrent)rrrrcurrentszListbox.currentcCs0g}|jj}x|D]}|j|j|qW|S)N)rZlistboxGetSelectionr
r.)r	selectionlistr+rrrgetSelections


zListbox.getSelectioncCs|jj|j|dS)N)rZlistboxSetCurrentr/)rr0rrr
setCurrentszListbox.setCurrentcCsi|_i|_|jjdS)N)r.r/rZlistboxClear)rrrrclearsz
Listbox.clearrcCs6tj|||||||_i|_i|_|r2|jj|dS)N)rlistboxrr.r/ZlistboxSetWidth)rheightscroll
returnExitwidthZ
showCursorZmultipleZborderrrrrs
zListbox.__init__N)rrrrrr)
rrrrr
r3r5r6r7r:r;r<rrrrrr-s
r-c@s*eZdZdZddZddZd
ddZd	S)TextboxaTextbox, 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.
    cCs|jj|dS)N)rZtextboxText)rrrrrsetTextszTextbox.setTextcCs|jj|dS)N)rZ
textboxHeight)rr>rrr	setHeightszTextbox.setHeightrcCstj||||||_dS)N)rZtextboxr)rrAr>rr?ZwraprrrrszTextbox.__init__N)rr)rrrrrCrDrrrrrrBs	rBc@seZdZdddZdS)	TextboxReflowed
rcCsNt||||\}}}|dkr8||kr8tj||||dntj||||ddS)Nrr)reflowrBr)rrArflexDownflexUp	maxHeightZnewtextr>rrrrszTextboxReflowed.__init__NrH)rFrGrH)rrrrrrrrrEsrEc@s(eZdZdZddZddZddZdS)	LabelzA Label (simple text).

    methods:

     - Label(self,text)   : create label
     - setText(self,text) : change text.
     - setColors(self, colorset) : change individual colors
    cCs|jj|dS)N)rZ	labelText)rrrrrrCsz
Label.setTextcCstj||_dS)N)rlabelr)rrrrrrszLabel.__init__cCs|jj|dS)N)rZlabelSetColors)rcolorsetrrr	setColorsszLabel.setColorsN)rrrrrCrrPrrrrrMsrMc@s eZdZdZddZddZdS)ScalezA Scale (progress bar).

    methods:

     - Scale(self,width, total) : create scale; width: size on screen, fullamount: integer.
     - set(self,amount)         : set amount to integer.
    cCs|jj|dS)N)rZscaleSet)rZamountrrrsetsz	Scale.setcCstj|||_dS)N)rZscaler)rrAZtotalrrrrszScale.__init__N)rrrrrRrrrrrrQsrQc@s4eZdZdZddZdddZddZdddZd
S)EntryaEntry 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
    cCs|jjS)N)rZ
entryValue)rrrrr#szEntry.valuercCs|jj||S)N)rZ
entrySetValue)rrZcursorAtEndrrrrRsz	Entry.setcCs|jj||S)N)rZ
entrySetFlags)rr%r&rrrr'"szEntry.setFlagsrcCstj|||||||_dS)N)rentryr)rrArZhiddenZpasswordr?r@rrrr%szEntry.__init__N)r)rTrrrr)rrrrr#rRr'rrrrrrSs

rS )ZF1ZF2ZF3ZF4ZF5ZF6ZF7ZF8ZF9ZF10ZF11ZF12ZESCZENTERZSUSPENDZ	BACKSPACEZDELETEZINSERTZRESIZErVcCsg|]}t||fqSr)ord).0crrr
<listcomp>7srZc@sReZdZdZddZddZddZdd	ZdddZd
dZ	ddZ
ddZd
S)Forma 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
    cCs|jjt|dS)N)rZ	addhotkeyhotkeys)rkeynamerrr	addHotKeyIszForm.addHotKeycCsxd|jkr(x|jjD]}|j|qWd|jkrNx@|jD]}|j|q:Wn&d|jkrt||j|jj<|jj|jSdS)Nr\gridmembersr)	__dict__r\keysr^r_addtransrr+)rwidgetr+rrrrrbLs


zForm.addcCsb|jj\}}|tjkr"|j|S|tjkr0dS|tjkrD|j|S|tjkrVt	|St
ddS)NZTIMERzEOF or IO error)rrunrZFORM_EXIT_WIDGETrcZFORM_EXIT_TIMERZFORM_EXIT_FDREADYfilemapZFORM_EXIT_HOTKEYr\RuntimeError)rwhatZwhichrrrreYs





zForm.runcCs|jjdS)N)rdraw)rrrrries
z	Form.drawNcCs"i|_i|_tj||_||_dS)N)rcrfrformrhelpArg)rrkrrrrisz
Form.__init__cCs|jj|jdS)N)rZ
setcurrent)rcorrrr;pszForm.setCurrentcCs|jj|dS)N)rZsettimer)rZtimerrrrsetTimerssz
Form.setTimercCs$||j|j<|jj|j|dS)N)rffilenorZwatchfd)rfileflagsrrr	watchFilevszForm.watchFile)N)rrrrr^rbrerirr;rmrqrrrrr[;s


r[c@s*eZdZdZddZdddZddZd	S)GridayGrid 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
    cCs|jj||S)N)gplace)rxyrrrrtsz
Grid.placerc
Cs|jj|d}|rtj}n
|r&tj}|r6|tjB}n|rD|tjB}d}|	rRtj}|
r`|tjB}d|j	kr|j
j|||j
|||S|j
j|||j||SdS)Nrrs)
r_r
rZANCHOR_LEFTZANCHOR_RIGHTZ
ANCHOR_TOPZ
ANCHOR_BOTTOMZ
GRID_GROWXZ
GRID_GROWYr`rsZsetfieldr)
rrhcolrowpadding
anchorLeft	anchorTopanchorRightanchorBottomgrowxgrowyZanchorFlagsZ	gridFlagsrrrsetFields&


z
Grid.setFieldcGstj||_g|_dS)N)rgridrsr_)rargsrrrrsz
Grid.__init__Nrrrr)rrrrrrr)rrrrrtrrrrrrrrzs
rr)ZROOTZBORDERZWINDOWZSHADOWZTITLEZBUTTONZ	ACTBUTTONZCHECKBOXZACTCHECKBOXZENTRYZLABELZLISTBOXZ
ACTLISTBOXZTEXTBOXZ
ACTTEXTBOXZHELPLINEZROOTTEXTZ
EMPTYSCALEZ	FULLSCALEZDISENTRYZ
COMPACTBUTTONZ
ACTSELLISTBOXZ
SELLISTBOXc@seZdZdZddZddZddZdd	Zd
dZdd
Z	d$ddZ
ddZddZddZ
ddZddZd%ddZd&ddZd d!Zd"d#ZdS)'SnackScreena
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)
    cCs&tjtj\|_|_|jddS)N)rZinitsizerAr>pushHelpLine)rrrrrszSnackScreen.__init__cCstjS)N)rfinish)rrrrrszSnackScreen.finishcCstjdS)N)rresume)rrrrrszSnackScreen.resumecCstjdS)N)rsuspend)rrrrrszSnackScreen.suspendcCs|j||dS)N)helpCb)rargrrrdoHelpCallbackszSnackScreen.doHelpCallbackcCs||_tj|jS)N)rrZhelpcallbackr)rcbrrrhelpCallbackszSnackScreen.helpCallbackNcCs|rtj||Stj|S)N)rZsuspendcallback)rrrrrrsuspendCallbackszSnackScreen.suspendCallbackcCstj|||||S)N)rZ
openwindow)rlefttoprAr>titlerrr
openWindowszSnackScreen.openWindowcCs|stjdStj|SdS)Nz	*default*)rZpushhelpline)rrrrrrs
zSnackScreen.pushHelpLinecCstjS)N)rZpophelpline)rrrrpopHelpLineszSnackScreen.popHelpLinecCstj|||S)N)rZdrawroottext)rrrrrrrdrawRootTextszSnackScreen.drawRootTextcCstj|||S)N)rZcenteredwindow)rrAr>rrrrcenteredWindowszSnackScreen.centeredWindowcCs(|r|rtj|j|||Stj|j|S)N)rZgridwrappedwindowrs)rrrrurvrrrgridWrappedWindowszSnackScreen.gridWrappedWindowTcCs|rtjStjS)N)rZ	popwindowZpopwindownorefresh)rrefreshrrr	popWindowszSnackScreen.popWindowcCstjS)N)rr)rrrrrszSnackScreen.refreshcCs,|tkrtjt|||Stj|||SdS)N)	colorsetsrZsetcolor)rrOZfgZbgrrrsetColorszSnackScreen.setColor)N)NN)T)rrrrrrrrrrrrrrrrrrrrrrrrrs"


rrFcCstj||||S)zR returns a tuple of the wrapped text, the actual width, and the actual height
    )rrI)rrArJrKrrrrIsrIc@s*eZdZdZddZd	ddZddZdS)

RadioGroupz 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    
    cCsd|_g|_dS)N)prev
buttonlist)rrrrr%szRadioGroup.__init__NcCs<|jr|dkrd}t||j|}||_|jj||f|S)Nr)rr*rr
)rrr#defaultbrrrrb)szRadioGroup.addcCs$x|jD]\}}|jr|SqWdS)N)rr$)rrr#rrrr:3szRadioGroup.getSelection)N)rrrrrrbr:rrrrrs

rc@s eZdZdZddZddZdS)RadioBarz Bar of Radio buttons, based on Grid.

    methods:

    - RadioBar(self, screen, buttonlist) : constructor.
    - getSelection(self): return value of selected button 
    cCs~g|_d|_t|_tj|dt|xR|D]J\}}}|jj|||}|jj||f|j	|d|jdd|jd|_q,WdS)Nrr)rz)
r9r0rr,rrrlenrbr
r)rscreenrrr#rrrrrrBszRadioBar.__init__cCs
|jjS)N)r,r:)rrrrr:MszRadioBar.getSelectionN)rrrrrr:rrrrr9src@s"eZdZdZdddZddZdS)		ButtonBara 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.
    rc		Csg|_i|_d|_tj|t|dx|D]}t|tjdkr@t	nt
rT|}|j}n*t|dkrj|\}}n|\}}}||j|<|rt|}nt
|}|jj||f|j||jdd|jd|_q*WdS)Nrr3)rrrr)r9r\r0rrrr
isinstancesysversionstr
basestringlowerr rr
r)	rrrZcompactZblistrr#Zhotkeyrrrrr\s$





zButtonBar.__init__cCs8||jkr|j|Sx|jD]\}}||kr|SqWdS)N)r\r9)rresultrr#rrr
buttonPressedss

zButtonBar.buttonPressedN)r)rrrrrrrrrrrSs
rc@sheZdZdZddZdddZddd	Zd
dZdd
ZdddZ	dddZ
ddZddZddZ
dS)GridFormHelpa= 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):
    cGsJ||_||_t||_g|_d|_t|}|g|dd<tjt	|dS)Nr)
rrr[rj	childListform_createdr9rrrtuple)rrrhelprrrrrs
zGridFormHelp.__init__rcCs,|j|||||||||	|

|jj|dS)N)rrr
)rrdrwrxryrzr{r|r}r~rrrrrbszGridFormHelp.addNcCs|j||}|jj|S)N)rerr)rrurvrrrrrunOnces
zGridFormHelp.runOncecCs|jj|dS)N)rjr^)rr]rrrr^szGridFormHelp.addHotKeycCs|jj|dS)N)rjrm)rr]rrrrmszGridFormHelp.setTimercCsL|jsH|jddx|jD]}|jj|qW|jj||j||d|_dS)Nr)rrtrrjrbrrr)rrurvZchildrrrcreateszGridFormHelp.createcCs|j|||jjS)N)rrjre)rrurvrrrreszGridFormHelp.runcCs|j|jjS)N)rrjri)rrrrriszGridFormHelp.drawcCs0|j|jj||j|jj}|jj|S)N)rrrrrjrer)rrrrrrunPopups


zGridFormHelp.runPopupcCs|jj|dS)N)rjr;)rrlrrrr;szGridFormHelp.setCurrentrrrr)rrrrrrr)NN)NN)NN)rrrrrrbrr^rmrrerirr;rrrrr}s




rc@seZdZdZddZdS)GridFormzh GridForm class (extends GridFormHelp):

    methods:

     - GridForm(self, screen, title, *args):
    cGs|||df|}tj|dS)N)rr)rrrrZmyargsrrrrszGridForm.__init__N)rrrrrrrrrrsrc@s`eZdZdZdddZdddZdd	Zdd
dZdd
ZddZ	ddZ
dddZddZdS)CheckboxTreea 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):
    NrcCs|j|tdf||dS)Nr
)addItem	snackArgs)rrr0r$rrrr
szCheckboxTree.appendcCs4|dkr|}|jj|||}||j|<||j|<dS)N)rZcheckboxtreeAddItemr.r/)rrpathr0r$r+rrrrs

zCheckboxTree.addItemcCs|jj}|j|S)N)rZcheckboxtreeGetCurrentr.)rZcurrrrr
getCurrents
zCheckboxTree.getCurrentcCs2tj|||||_i|_i|_|r.|jj|dS)N)rZcheckboxtreerr.r/ZcheckboxtreeSetWidth)rr>r?rAZ
hide_checkboxZunselectablerrrrs
zCheckboxTree.__init__cCs0g}|jj}x|D]}|j|j|qW|S)N)rZcheckboxtreeGetSelectionr
r.)rr8r9r+rrrr:s


zCheckboxTree.getSelectioncCs|jj|j||dS)N)rZcheckboxtreeSetEntryr/)rr0rrrrsetEntryszCheckboxTree.setEntrycCs|jj|j|dS)N)rZcheckboxtreeSetCurrentr/)rr0rrrr;szCheckboxTree.setCurrentrcCs|jj|j||dS)N)rZcheckboxtreeSetEntryValuer/)rr0r$rrr
setEntryValueszCheckboxTree.setEntryValuecCs|jj|j|S)N)rZcheckboxtreeGetEntryValuer/)rr0rrr
getEntryValueszCheckboxTree.getEntryValue)Nr)Nr)rNrr)r)
rrrrr
rrrr:rr;rrrrrrrs



rOkCancel(c
Cs|d	krt|}t||}
t||}t||dd}d}
xX|D]P}t|tkrV|\}}n|}|
}||
krl|}n||krx|}|j|||
d}
q<W|dkr|j|t|||	dd}|j	|dd|j	|ddd
d|j	|
dddd|j
}|
j||jfS)z
    - ListboxChoiceWindow(screen, title, text, items, 
            buttons = ('Ok', 'Cancel'), 
            width = 40, scroll = 0, height = -1, default = None,
            help = None):
    r)r?r@rN)ryr)r~rH)rrrr)
rrrEr-typerr
r;rrbrrr7)rrritemsbuttonsrAr?r>rrbbtlcountr0r+rsZrcrrrListboxChoiceWindow	s2





rcCsdt||}t|||jdd}	t|||dd}
|
j|	dddd|
j|dddd|j|
j||S)	z
     - ButtonChoiceWindow(screen, title, text, 
               buttons = [ 'Ok', 'Cancel' ], 
               width = 40, x = None, y = None, help = None):
    )rLrrr)ry)r~)rrrr)rrEr>rrbrr)rrrrrArurvrrrrsrrrButtonChoiceWindow4s
rc		Cs\t||}	t||}
d}x|D]}|d}qWtd|}
d}g}x|D]}t|tkr|\}}t|tjdkrptnt	rt
||}nt
|}|
jt|d|d
dd|
j|d|dd|d}|j
|qFWt|||dd}|j|
dddd|j|
dddd|j|	dddd	|j}g}d}x(|D] }|j
||j|d}q&W|	j|t|fS)
z
    EntryWindow(screen, title, text, prompts, allowCancel = 1, width = 40,
        entryWidth = 20, buttons = [ 'Ok', 'Cancel' ], help = None):
    rrrr)ryrz)rzr)ry)r~)rrrr)rrrr)rrrr)rrErrrrrrrrrrSrrMr
rrbrr#r)rrrZpromptsZallowCancelrAZ
entryWidthrrrrrnZsgZ	entryListersrZentryValuesrrrEntryWindowDs:





rc@sbeZdZdZdddZdddZdd	d
ZdddZd
dZdddZ	ddZ
ddZddZdS)CListboxapClistbox 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
    rrNcCs||_|dd|_||_||_|	dkrjtj|ddd}|j|	|
|d}
t|
|_|j	|jddddntj|ddd}t
|||||_|j	|jd|dddS)Nrr)adjust_widthr)rz)r|)cols
col_widthscol_padcol_text_alignrrrcolFormTextrMrNrr-r=)rr>rrr?r@rArrZ
col_labelsZcol_label_alignrZbox_yZlstrrrrrs
zCListbox.__init__cCs&d}d}t|}x||jko$||kr ||}tj|}|j||krj|rX||j|<n|d|j|}|j|tj|}	|	dkr|dkrt}
n||}
|
tkr|d|	}|
tkrd|	d|d|	dd}|
tkrd|	|}||dkrd|j}nd}|||}|d}qW|S)NrrTrVrr)	rrrZwstrlenrLEFTCENTERRIGHTr)rcol_textZalignrirZc_lenZcstrZcstrlenZdeltaaZpstrrrrrs8
zCListbox.colFormTextcCs,|dkr|j}|j||}|jj||dS)N)rrr=r
)rrr0rrrrrr
szCListbox.appendcCs.|dkr|j}|j||}|jj|||dS)N)rrr=r3)rrr0r2rrrrrr3szCListbox.insertcCs|jj|dS)N)r=r5)rr0rrrr5szCListbox.deletecCs,|dkr|j}|j||}|jj||dS)N)rrr=r6)rrr0rrrrrr6szCListbox.replacecCs
|jjS)N)r=r7)rrrrr7szCListbox.currentcCs|jj|dS)N)r=r;)rr0rrrr;szCListbox.setCurrentcCs|jjdS)N)r=r<)rrrrr<szCListbox.clear)rrrrNNNr)Nr)N)N)N)
rrrrrrr
r3r5r6r7r;r<rrrrrrs

)


rcCsd|S)Nr)rurrrcustomColorsetsrrH)rHrrHrH)rHrH)rr)rr)rrrH)rFrFrrrH)rrrrHNN)crZ
__future__rrrrstringrrrrrr	r
rrZDOWNrZUPrrrrr r!r*r-rBrErMrQrSZKEY_F1ZKEY_F2ZKEY_F3ZKEY_F4ZKEY_F5ZKEY_F6ZKEY_F7ZKEY_F8ZKEY_F9ZKEY_F10ZKEY_F11ZKEY_F12ZKEY_ESCZ	KEY_ENTERZKEY_SUSPENDZ
KEY_BACKSPACEZ
KEY_DELETEZ
KEY_INSERTZ
KEY_RESIZErWr\r9rarZ
ascii_lettersZdigitsorYr[rrZ
COLORSET_ROOTZCOLORSET_BORDERZCOLORSET_WINDOWZCOLORSET_SHADOWZCOLORSET_TITLEZCOLORSET_BUTTONZCOLORSET_ACTBUTTONZCOLORSET_CHECKBOXZCOLORSET_ACTCHECKBOXZCOLORSET_ENTRYZCOLORSET_LABELZCOLORSET_LISTBOXZCOLORSET_ACTLISTBOXZCOLORSET_TEXTBOXZCOLORSET_ACTTEXTBOXZCOLORSET_HELPLINEZCOLORSET_ROOTTEXTZCOLORSET_EMPTYSCALEZCOLORSET_FULLSCALEZCOLORSET_DISENTRYZCOLORSET_COMPACTBUTTONZCOLORSET_ACTSELLISTBOXZCOLORSET_SELLISTBOXrrrIrrrrrrrrrrrrrrr<module>(s$

A	 ?.
U
*I9
)-s