Your IP : 18.216.105.248


Current Path : /lib64/python2.7/Demo/tkinter/guido/
Upload File :
Current File : //lib64/python2.7/Demo/tkinter/guido/ss1.pyc

�
V
�Qc@s�dZddlZddlZddlZddlZddlZddlmZdddf\ZZ	Z
d�Zd�Zd	�Z
iee6ee	6e
e
6Zid
e6de	6de
6Zied
6e	d6e
d6Zid
e6de	6de
6Zd�Zdfd��YZdfd��YZdfd��YZdefd��YZdefd��YZdefd��YZd�Zd�Zd�Zd�ZddlZd fd!��YZd"�Z d#�Z!e"d$kr�e!�ndS(%sSS1 -- a spreadsheet.i����N(texpattLEFTtCENTERtRIGHTcCs
|j|�S(N(tljust(txtn((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRscCs
|j|�S(N(tcenter(RR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRscCs
|j|�S(N(trjust(RR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRstleftRtrighttwtecCs4d}x'|D]}|dk	r
||7}q
q
W|S(Ni(tNone(tseqttotalR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytsums

tSheetcBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCsOi|_tj�|_|jjd�}|j|_|j|_t|_dS(Nt__main__(tcellstrexectRExect
add_modulet	cellvaluetcelltmulticellvalueR(tselftm((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt__init__"s	cCs9|j||�}t|d�r1|j|j�S|SdS(Ntrecalc(tgetcellthasattrRR(RRtyR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR*scCs�||kr||}}n||kr8||}}ng}xRt||d�D]=}x4t||d�D]}|j|j||��qlWqRW|S(Ni(trangetappendR(Rtx1ty1tx2ty2RR R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR1s!cCs|jj||f�S(N(Rtget(RRR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR<scCsJ|dkr|dkst�t|t�s3t�||j||f<dS(Ni(tAssertionErrort
isinstancetBaseCellR(RRR R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytsetcell?scCs,y|j||f=Wntk
r'nXdS(N(RtKeyError(RRR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt	clearcellDs
cCs1x*|j||||�D]}|j|=qWdS(N(tselectcellsR(RR#R$R%R&txy((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
clearcellsJscCs|jd|tj|�dS(Ni(R0tsystmaxint(RR$R&((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt	clearrowsNscCs|j|d|tj�dS(Ni(R0R1R2(RR#R%((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytclearcolumnsQscCs�||kr||}}n||kr8||}}ng|jD]P\}}||koe|knrB||ko�|knrB||f^qBS(N(R(RR#R$R%R&RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR.Tsc
CsI|dkr|dkrdS||kr8||}}n||krT||}}n||dkrt||dkszt�i}x�|jD]�\}}	|j||	f}
t|
d�r�|
j||||||�}
n||ko�|knr(||	ko|knr(||7}|	|7}	n|
|||	f<q�W||_dS(Nitrenumber(R(RRR5(RR#R$R%R&tdxtdytnewRR R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt	movecells\s"&!8

cCs8|dkst�|jd|tjtjd|�dS(Ni(R(R9R1R2(RR R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
insertrowsoscCs^||kr||}}n|j||�|jd|dtjtjd||d�dS(Nii(R3R9R1R2(RR$R&((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
deleterowssscCs8|dkst�|j|dtjtj|d�dS(Ni(R(R9R1R2(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
insertcolumnsyscCs^||kr||}}n|j||�|j|ddtjtj||dd�dS(Nii(R0R9R1R2(RR#R%((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
deletecolumns}scCsLd}}x5|jD]*\}}t||�}t||�}qW||fS(Ni(Rtmax(RtmaxxtmaxyRR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytgetsize�s

cCs:x3|jj�D]"}t|d�r|j�qqWdS(Ntreset(Rt
itervaluesRRB(RR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRB�scCsJ|j�x9|jj�D](}t|d�r|j|j�qqWdS(NR(RBRRCRRR(RR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�s
cCs�|j�\}}|d|d}}dg|}i}xZtd|�D]I}t|�tf||df<\}}	t||t|��||<qJWxZtd|�D]I}
t|
�tf|d|
f<\}}	t|dt|��|d<q�Wx|jj�D]\\}}
}|dks|
dkr4qnt	|d�rV|j
|j�nt	|d�r�|j�\}}	t
|t�s�t�|	tttfks�t�n*t|�}t
|t�r�t}	nt}	||	f|||
f<t||t|��||<qWd}x9t|�D]+}|r7|d7}n|d||7}qWx�t|�D]�}
d}
xot|�D]a}|j||
f�p�dtf\}}	t|	|||�}|
r�|
d7}
n|
|7}
qsW|
GH|
dkrZ|GHqZqZWdS(	NiiRtformattt+t-t|(RAR!tcolnum2nameRR>tlentstrRt	iteritemsRRRRDR)R(RRR'talign2action(RR?R@twidththeighttcolwidthtfullRttextt	alignmentR Rtseptline((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytdisplay�sR
&!&!"	!
'
cCs�dg}xn|jj�D]]\\}}}t|d�rI|j�}ndtj|�}|jd|||f�qW|jd�dj|�S(Ns
<spreadsheet>txmls<value>%s</value>s%<cell row="%s" col="%s">
  %s
</cell>s</spreadsheet>s
(RRLRRWtcgitescapeR"tjoin(RtoutRR Rtcellxml((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRW�s	"	
cCs\|j�}t|d�}|j|�|rN|jd�rN|jd�n|j�dS(NRs
(RWtopentwritetendswithtclose(RtfilenameRRtf((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytsave�s
cCs0t|d�}t|�j|�|j�dS(Ntr(R]tSheetParsert	parsefileR`(RRaRb((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytload�s(t__name__t
__module__RRRRR+R-R0R3R4R.R9R:R;R<R=RARBRRVRWRcRg(((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR s,																			2		RecBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�ZeZ	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�ZRS(cCs
||_dS(N(tsheet(RRj((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�scCsAtj�}|j|_|j|_|j|_|j|�dS(N(	RtParserCreatetstartelementtStartElementHandlert
endelementtEndElementHandlertdatatCharacterDataHandlert	ParseFile(RRbtparser((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRf�s
cCsct|d|d�}|rVx*|j�D]\}}t|�||<q)W||�ng|_dS(Ntstart_(tgetattrR
RLRKttexts(Rttagtattrstmethodtkeytvalue((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRl�s
cCs t|�}|jj|�dS(N(RKRvR"(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRp�scCs9t|d|d�}|r5|dj|j��ndS(Ntend_RE(RuR
RZRv(RRwRy((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRn�scCs4t|jd��|_t|jd��|_dS(Ntrowtcol(tintR'R R(RRx((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
start_cell�scCs1|jd�|_tj|jd��|_dS(NRDtalign(R'tfmtt	xml2alignRS(RRx((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytstart_valuescCs*yt|�|_Wnd|_nXdS(N(RR{R
(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytend_intscCs*yt|�|_Wnd|_nXdS(N(tlongR{R
(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytend_long
scCs*yt|�|_Wnd|_nXdS(N(tfloatR{R
(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
end_doublescCs*yt|�|_Wnd|_nXdS(N(tcomplexR{R
(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytend_complexscCs$y
||_Wnd|_nXdS(N(R{R
(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
end_strings
cCs�t|jt�r!|j|_nit|jt�r`t|j|jpHd|jpTt�|_n*t	|j|jpud|jp�t
�|_dS(Ns%s(R)R{R*RRKt
StringCellR�RSRtNumericCellR(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt	end_value%s		cCs+t||jpd|jpt�|_dS(Ns%s(tFormulaCellR�RSRR(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytend_formula1scCs#|jj|j|j|j�dS(N(RjR+RR R(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pytend_cell6s(RhRiRRfRlRpRnR�R�t
start_formulaR�R�R�R�R�R�R�R�(((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRe�s 														R*cBseZdZRS(N(RhRiR
R(((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR*9s	R�cBsVeZded�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(	s%scCs[t|ttttf�s!t�|tttfks<t�||_	||_
||_dS(N(R)RR�R�R�R(RRRR{R�RS(RR{R�RS((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRGs
!		cCs|jS(N(R{(RR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRNscCs:y|j|j}Wnt|j�}nX||jfS(N(R�R{RKRS(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRDQs
cCs=t|dt|j�j�}dt|j|j|�fS(Nt_xml_s(<value align="%s" format="%s">%s</value>(RuttypeR{Rht	align2xmlRSR�(RRy((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRWXs

cCs8d|jkodknr*d|jS|j�SdS(Niis
<int>%s</int>I�i�I�(R{t	_xml_long(R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt_xml_int_scCsd|jS(Ns<long>%s</long>(R{(R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�escCsdt|j�S(Ns<double>%s</double>(treprR{(R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
_xml_floathscCsdt|j�S(Ns<complex>%s</double>(R�R{(R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt_xml_complexks(RhRiRRRRDRWR�R�R�R�(((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�Es						R�cBs2eZded�Zd�Zd�Zd�ZRS(s%scCsUt|ttf�st�|tttfks6t�||_||_||_	dS(N(
R)RKtunicodeR(RRRRRR�RS(RRRR�RS((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRps
		cCs|jS(N(RR(RR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRwscCs|j|jfS(N(RRRS(R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRDzscCs-d}|t|j|jtj|j�fS(Ns9<value align="%s" format="%s"><string>%s</string></value>(R�RSR�RXRYRR(Rts((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRW}s

(RhRiRRRRDRW(((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�ns		R�cBsDeZded�Zd�Zd�Zd�Zd�Zd�ZRS(s%scCsV|tttfkst�||_t|j�|_||_||_|j	�dS(N(
RRRR(tformulat	translatet
translatedR�RSRB(RR�R�RS((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�s			cCs
d|_dS(N(R
R{(R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRB�scCs�|jdkr�y4|jddt|j��|jd�|_Wq�tj�d}t|d�rw|j	|_q�t
|�|_q�Xn|jS(Ns from __future__ import division
s__value__ = eval(%s)t	__value__iRh(R{R
tr_execR�R�tr_evalR1texc_infoRRhRK(RRtexc((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�s	cCs:y|j|j}Wnt|j�}nX||jfS(N(R�R{RKRS(RRR((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRD�s
cCsdt|j|j|jfS(Ns,<formula align="%s" format="%s">%s</formula>(R�RSR�R�(R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRW�s
cCs�g}x�tjd|j�D]�}tjd|�}	|	dk	r�|	j�\}
}t|
�}t|�}
||ko�|knr�||
ko�|knr�t|||
|�}q�n|j	|�qWt
dj|�|j|j
�S(Ns(\w+)s^([A-Z]+)([1-9][0-9]*)$RE(tretsplitR�tmatchR
tgroupstcolname2numRtcellnameR"R�RZR�RS(RR#R$R%R&R6R7R[tpartRtsxtsyRR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR5�s8(	RhRiRRRBRRDRWR5(((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s				c	Cs�g}x�tjd|�D]�}tjd|�}|dkrM|j|�q|j�\}}}}t|�}|dkr�d||f}n"t|�}d||||f}|j|�qWdj|�S(s�Translate a formula containing fancy cell names to valid Python code.

    Examples:
        B4 -> cell(2, 4)
        B4:Z100 -> cells(2, 4, 26, 100)
    s(\w+(?::\w+)?)s2^([A-Z]+)([1-9][0-9]*)(?::([A-Z]+)([1-9][0-9]*))?$scell(%s, %s)scells(%s, %s, %s, %s)REN(R�R�R�R
R"R�R�RZ(	R�R[R�RR#R$R%R&R�((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��scCs&|dkst�t|�t|�S(sETranslate a cell coordinate to a fancy cell name (e.g. (1, 1)->'A1').i(R(RIRK(RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��scCsk|j�}d}xR|D]J}d|ko6dknsAt�|dt|�td�d}qW|S(sCTranslate a column name to number (e.g. 'A'->1, 'Z'->26, 'AA'->27).itAtZii(tupperR(tord(R�Rtc((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s
"&cCs\|dkst�d}x=|rWt|dd�\}}t|td��|}qW|S(s6Translate a column number to name (e.g. 1->'A', etc.).iREiiR�(R(tdivmodtchrR�(RR�R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRI�s	tSheetGUIcBs�eZdZdddd�Zd�Zd�Zd�Zd�Zd	�Zd
�Z	d�Z
d�Zd
�Zd�Z
d�ZeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(s7Beginnings of a GUI for a spreadsheet.

    TO DO:
    - clear multiple cells
    - Insert, clear, remove rows or columns
    - Show new contents while typing
    - Scroll bars
    - Grow grid when window is grown
    - Proper menus
    - Undo, redo
    - Cut, copy and paste
    - Formatting and alignment
    s
sheet1.xmli
icCs*||_t�|_tjj|�r:|jj|�n|jj�\}}t||�}t||�}t	j	�|_
|j
jd|j�t	j|j
dddd�|_
t	j|j
�|_t	j|j
ddd	|j�|_t	j|j
�|_|jjd
ddd
dd�|j
jd
d�|jjd
d�|jjd
ddd
dd�|jjd|j�|jjd|j�|jjd|j�|jjd|j�|jjd|j�|jjd|j�|j||�d|_d|_ |j!d
d
�|j"�dS(slConstructor.

        Load the sheet from the filename argument.
        Set up the Tk widget tree.
        sSpreadsheet: %sRRtA1tfontt	helveticaitboldtSavetcommandtsidetbottomtexpanditfilltbothR	R
Rs<Return>s<Shift-Return>s<Tab>s<Shift-Tab>s<Delete>s<Escape>N(R�iR�(#RaRRjtostpathtisfileRgRAR>tTktroottwm_titletLabeltbeacontEntrytentrytButtonRct
savebuttontFrametcellgridtpacktbindtreturn_eventtshift_return_eventt	tab_eventtshift_tab_eventtdelete_eventtescape_eventtmakegridR
t	currentxytcornerxyt
setcurrenttsync(RRatrowstcolumnsR?R@((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�s<			cCsr|j|jkr>|jdk	r>|jj|j|j�n|jj|j�|j�|jjdd�dS(Nitendtbreak(	R�R�R
RjR0R-R�R�tdelete(Rtevent((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�'s!
cCs#|j\}}|j||�dS(N(R�t
load_entry(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�0scCs�|jj||�}|dkr*d}n1t|t�rId|j}n|j�\}}|jjdd�|jj	d|�|jj
dd�dS(NREt=iR�(RjRR
R)R�R�RDR�R�tinserttselection_range(RRR RRRRS((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�4s	c
Cs||_||_i|_tj|jdd�}|jdddddd�|jd|j�x�t	d	|d	�D]�}|jj
|d
d�tj|jdt|�dd�}|jd|dddd
�||j|df<||_d|_
|jd|j�|jd|j�|jd|j�|jd|j�qvWx�t	d	|d	�D]�}tj|jdt|�dd�}|jddd|dd
�||jd|f<d|_||_
|jd|j�|jd|j�|jd|j�|jd|j�q[Wx�t	d	|d	�D]�}x�t	d	|d	�D]�}tj|jdddddd�}|jd|d|dd�||j||f<||_||_
|jd|j�|jd|j�|jd|j�|jd|j�qDWq*WdS(s�Helper to create the grid of GUI cells.

        The edge (x==0 or y==0) is filled with labels; the rest is real cells.
        trelieftraisedtcolumniR}tstickytNSWEs<ButtonPress-1>itminsizei@RRtWEs<B1-Motion>s<ButtonRelease-1>s<Shift-Button-1>tsunkentbgtwhitetfgtblackN(R�R�t	gridcellsR�R�R�tgrid_configureR�t	selectallR!tgrid_columnconfigureRIt_SheetGUI__xt_SheetGUI__ytselectcolumntextendcolumnRKt	selectrowt	extendrowtpresstmotiontrelease(RR�R�RRR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�@sN			$		$				cCs*|jdd�|jtjtj�dS(Ni(R�t	setcornerR1R2(RR�((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�rscCs<|j|�\}}|j|d�|j|tj�dS(Ni(twhichxyR�RR1R2(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�vscCsR|j|�\}}|dkrN|j|jdd�|j|tj�ndS(Nii(RR�R�RR1R2(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�{scCs<|j|�\}}|jd|�|jtj|�dS(Ni(RR�RR1R2(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��scCsR|j|�\}}|dkrN|jd|jd�|jtj|�ndS(Nii(RR�R�RR1R2(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��scCsD|j|�\}}|dkr@|dkr@|j||�ndS(Ni(RR�(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��scCsD|j|�\}}|dkr@|dkr@|j||�ndS(Ni(RR(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��scCsh|jj|j|j�}|dk	rdt|tj�rdy|j|j	fSWqdt
k
r`qdXndS(Ni(ii(R�twinfo_containingtx_rootty_rootR
R)R�R�R�R�tAttributeError(RR�R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�s
cCs|jj|j�dS(N(RjRcRa(R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRc�scCs�|jdk	r|j�n|j�t||�|jd<|j||�|jj�||f|_d|_	|j
j|j�}|dk	r�d|d<ndS(sMake (x, y) the current cell.RRtyellowR�N(R�R
tchange_cellt
clearfocusR�R�R�R�t	focus_setR�R�R'(RRR tgridcell((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s


	c		Csc|jdks$|j||fkr8|j||�dS|j�||f|_|j\}}|jpo|j\}}||kr�||}}n||kr�||}}nxh|jj�D]W\\}}}||ko�|knr�||ko|knr�d|d<q�q�W|jj|j�}|dk	rId|d<n|j||||�dS(Nt	lightBlueR�R(	R�R
R�RR�R�RLR't	setbeacon(	RRR R#R$R%R&RR
((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�s$$
"8
cCs#||kodknrD||ko6tjknrDd}n�||fdtjfkr�||krxd|}qd||f}n�||fdtjfkr�||kr�dt|�}qdt|�t|�f}n.t|j�}t|j�}d||f}||jd<dS(Nit:s%ds%d:%ds%ss%s:%sRR(R1R2RIR�R�R�R�(RR#R$R%R&tnametname1tname2((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�s;	
cCs�|jdk	r�|j\}}|jp-|j\}}||krR||}}n||krn||}}nxk|jj�D]W\\}}}||ko�|knr~||ko�|knr~d|d<q~q~WndS(NR�R�(R�R
R�R�RL(RR#R$R%R&RR R((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�s"8cCs1|j�|j\}}|j||d�dS(sCallback for the Return key.iR�(RR�R�(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s
cCs:|j�|j\}}|j|td|d��dS(s0Callback for the Return key with Shift modifier.iR�(RR�R�R>(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s
cCs1|j�|j\}}|j|d|�dS(sCallback for the Tab key.iR�(RR�R�(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s
cCs:|j�|j\}}|jtd|d�|�dS(s-Callback for the Tab key with Shift modifier.iR�(RR�R�R>(RR�RR ((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s
cCs�|j\}}|jj�}d}|jd�rFt|d�}nGxDtttt	fD]0}y||�}Wn
qYqYXt
|�}PqYW|dkr�|r�t|�}n|dkr�|jj
||�n|jj|||�|j�dS(s+Set the current cell from the entry widget.R�iN(R�R�R'R
t
startswithR�RR�R�R�R�R�RjR-R+R�(RRR RRRtclsR{((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRs$cCs�|jj�x�|jj�D]�\\}}}|dks|dkrMqn|jj||�}|dkr{d|d<qt|d�r�|j�\}}nt|�t	}}||d<t
||d<qWdS(s(Fill the GUI cells from the sheet cells.iRERRRDtanchorN(RjRR�RLRR
RRDRKRtalign2anchor(RRR R
RRRRS((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�s
"

(RhRit__doc__RR�R�R�R�R�R�R�R�R�R�R�R�RRcR�RRRR�R�R�R�RR�(((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR��s4-					2																			cCs�ddl}t�}x�tdd�D]�}x�tdd�D]�}|dkr\t|�}nU|dkrwt|�}n:t|d�}td|�}d||f}t|�}|j|||�q;Wq%W|j�|jd�dS(sBasic non-gui self-test.i����Niis%s*%ss
sheet1.xml(	R�RR!R�R�R�R+RVRc(R�taRR Rtc1tc2R�((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
test_basic,s	
cCs@tjdrtjd}nd}t|�}|jj�dS(s	GUI test.is
sheet1.xmlN(R1targvR�R�tmainloop(Ratg((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyttest_guiBs

R(#RR�R�R1RXRtxml.parsersRRRRRRRRMR�R�RRRReR*R�R�R�R�R�R�RItTkinterR�R�RRRh(((s./usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt<module>s@				�Y)6						�C