509318396
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
ó
¿œ^c           @   sä  d  Z  d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z d d d f \ Z Z	 Z
 d „  Z d „  Z d	 „  Z i e e 6e e	 6e e
 6Z i d
 e 6d e	 6d e
 6Z i e d
 6e	 d 6e
 d 6Z i d e 6d e	 6d e
 6Z d „  Z d f  d „  ƒ  YZ d f  d „  ƒ  YZ d f  d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d „  Z d „  Z d „  Z d „  Z d d l Z d  f  d! „  ƒ  YZ d" „  Z  d# „  Z! e" d$ k ràe! ƒ  n  d S(%   s   SS1 -- a spreadsheet.iÿÿÿÿN(   t   expatt   LEFTt   CENTERt   RIGHTc         C   s   |  j  | ƒ S(   N(   t   ljust(   t   xt   n(    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR      s    c         C   s   |  j  | ƒ S(   N(   t   center(   R   R   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR      s    c         C   s   |  j  | ƒ S(   N(   t   rjust(   R   R   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR      s    t   leftR   t   rightt   wt   ec         C   s4   d } x' |  D] } | d  k	 r | | 7} q q W| S(   Ni    (   t   None(   t   seqt   totalR   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt   sum   s
    t   Sheetc           B   sÎ   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   sO   i  |  _  t j ƒ  |  _ |  j j d ƒ } |  j | _ |  j | _  t | _ d  S(   Nt   __main__(   t   cellst   rexect   RExect
   add_modulet	   cellvaluet   cellt   multicellvalueR   (   t   selft   m(    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt   __init__"   s    	c         C   s9   |  j  | | ƒ } t | d ƒ r1 | j |  j ƒ S| Sd  S(   Nt   recalc(   t   getcellt   hasattrR   R   (   R   R   t   yR   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR   *   s    c         C   s—   | | k r | | } } n  | | k r8 | | } } n  g  } xR t  | | d ƒ D]= } x4 t  | | d ƒ D] } | j |  j | | ƒ ƒ ql WqR W| S(   Ni   (   t   ranget   appendR   (   R   t   x1t   y1t   x2t   y2R   R    R   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR   1   s    !c         C   s   |  j  j | | f ƒ S(   N(   R   t   get(   R   R   R    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR   <   s    c         C   sJ   | d k r | d k s t  ‚ t | t ƒ s3 t  ‚ | |  j | | f <d  S(   Ni    (   t   AssertionErrort
   isinstancet   BaseCellR   (   R   R   R    R   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt   setcell?   s    c         C   s,   y |  j  | | f =Wn t k
 r' n Xd  S(   N(   R   t   KeyError(   R   R   R    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt	   clearcellD   s    c         C   s1   x* |  j  | | | | ƒ D] } |  j | =q Wd  S(   N(   t   selectcellsR   (   R   R#   R$   R%   R&   t   xy(    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
   clearcellsJ   s    c         C   s   |  j  d | t j | ƒ d  S(   Ni    (   R0   t   syst   maxint(   R   R$   R&   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt	   clearrowsN   s    c         C   s   |  j  | d | t j ƒ d  S(   Ni    (   R0   R1   R2   (   R   R#   R%   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt   clearcolumnsQ   s    c         C   s–   | | k r | | } } n  | | k r8 | | } } n  g  |  j  D]P \ } } | | k oe | k n rB | | k o� | k n rB | | f ^ qB S(   N(   R   (   R   R#   R$   R%   R&   R   R    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR.   T   s    c         C   sI  | d k r | d k r d  S| | k r8 | | } } n  | | k rT | | } } n  | | d k rt | | d k sz t  ‚ i  } x¹ |  j D]® \ } }	 |  j | |	 f }
 t |
 d ƒ rÙ |
 j | | | | | | ƒ }
 n  | | k oð | k n r(| |	 k o| k n r(| | 7} |	 | 7}	 n  |
 | | |	 f <qŠ W| |  _ d  S(   Ni    t   renumber(   R(   R   R   R5   (   R   R#   R$   R%   R&   t   dxt   dyt   newR   R    R   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt	   movecells\   s"    &!8
c         C   s8   | d k s t  ‚ |  j d | t j t j d | ƒ d  S(   Ni    (   R(   R9   R1   R2   (   R   R    R   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
   insertrowso   s    c         C   s^   | | k r | | } } n  |  j  | | ƒ |  j d | d t j t j d | | d ƒ d  S(   Ni    i   (   R3   R9   R1   R2   (   R   R$   R&   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
   deleterowss   s    c         C   s8   | d k s t  ‚ |  j | d t j t j | d ƒ d  S(   Ni    (   R(   R9   R1   R2   (   R   R   R   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt   insertcolumnsy   s    c         C   s^   | | k r | | } } n  |  j  | | ƒ |  j | d d t j t j | | d d ƒ d  S(   Ni   i    (   R0   R9   R1   R2   (   R   R#   R%   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt   deletecolumns}   s    c         C   sL   d } } x5 |  j  D]* \ } } t | | ƒ } t | | ƒ } q W| | f S(   Ni    (   R   t   max(   R   t   maxxt   maxyR   R    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt   getsizeƒ   s
    
c         C   s:   x3 |  j  j ƒ  D]" } t | d ƒ r | j ƒ  q q Wd  S(   Nt   reset(   R   t
   itervaluesR   RB   (   R   R   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRB   Š   s    c         C   sJ   |  j  ƒ  x9 |  j j ƒ  D]( } t | d ƒ r | j |  j ƒ q q Wd  S(   NR   (   RB   R   RC   R   R   R   (   R   R   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR   �   s    
c         C   sù  |  j  ƒ  \ } } | d | d } } d g | } i  } xZ t d | ƒ D]I } t | ƒ t f | | d f <\ } }	 t | | t | ƒ ƒ | | <qJ WxZ t d | ƒ D]I }
 t |
 ƒ t f | d |
 f <\ } }	 t | d t | ƒ ƒ | d <q§ Wx|  j j ƒ  D]\ \ } }
 } | d k s|
 d k r4qn  t	 | d ƒ rV| j
 |  j ƒ n  t	 | d ƒ rª| j ƒ  \ } }	 t | t ƒ sŒt ‚ |	 t t t f k sÔt ‚ n* t | ƒ } t | t ƒ rÎt }	 n t }	 | |	 f | | |
 f <t | | t | ƒ ƒ | | <qWd } x9 t | ƒ D]+ } | r7| d 7} n  | d | | 7} qWx¥ t | ƒ D]— }
 d } xo t | ƒ D]a } | j | |
 f ƒ p—d t f \ } }	 t |	 | | | ƒ } | rÊ| d 7} n  | | 7} qsW| GH|
 d k rZ| GHqZqZWd  S(	   Ni   i    R   t   formatt    t   +t   -t   |(   RA   R!   t   colnum2nameR   R>   t   lent   strR   t	   iteritemsR   R   R   RD   R)   R(   R   R   R'   t   align2action(   R   R?   R@   t   widtht   heightt   colwidtht   fullR   t   textt	   alignmentR    R   t   sept   line(    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt   display•   sR    &!&!"	!'c         C   s”   d g } xn |  j  j ƒ  D]] \ \ } } } t | d ƒ rI | j ƒ  } n d t j | ƒ } | j d | | | f ƒ q W| j d ƒ d j | ƒ S(   Ns   <spreadsheet>t   xmls   <value>%s</value>s%   <cell row="%s" col="%s">
  %s
</cell>s   </spreadsheet>s   
(   R   RL   R   RW   t   cgit   escapeR"   t   join(   R   t   outR   R    R   t   cellxml(    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRW   Ç   s    	"	c         C   s\   |  j  ƒ  } t | d ƒ } | j | ƒ | rN | j d ƒ rN | j d ƒ n  | j ƒ  d  S(   NR   s   
(   RW   t   opent   writet   endswitht   close(   R   t   filenameRR   t   f(    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt   saveÓ   s    c         C   s0   t  | d ƒ } t |  ƒ j | ƒ | j ƒ  d  S(   Nt   r(   R]   t   SheetParsert	   parsefileR`   (   R   Ra   Rb   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt   loadÛ   s    (   t   __name__t
   __module__R   R   R   R   R+   R-   R0   R3   R4   R.   R9   R:   R;   R<   R=   RA   RB   R   RV   RW   Rc   Rg   (    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR       s,   																			2		Re   c           B   s•   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z e Z	 d „  Z
 d „  Z d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s   | |  _  d  S(   N(   t   sheet(   R   Rj   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR   â   s    c         C   sA   t  j ƒ  } |  j | _ |  j | _ |  j | _ | j | ƒ d  S(   N(	   R    t   ParserCreatet   startelementt   StartElementHandlert
   endelementt   EndElementHandlert   datat   CharacterDataHandlert	   ParseFile(   R   Rb   t   parser(    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRf   å   s
    c         C   sc   t  |  d | d  ƒ } | rV x* | j ƒ  D] \ } } t | ƒ | | <q) W| | ƒ n  g  |  _ d  S(   Nt   start_(   t   getattrR   RL   RK   t   texts(   R   t   tagt   attrst   methodt   keyt   value(    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRl   ì   s    c         C   s    t  | ƒ } |  j j | ƒ d  S(   N(   RK   Rv   R"   (   R   RR   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRp   ô   s    c         C   s9   t  |  d | d  ƒ } | r5 | d j |  j ƒ ƒ n  d  S(   Nt   end_RE   (   Ru   R   RZ   Rv   (   R   Rw   Ry   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRn   ø   s    c         C   s4   t  | j d ƒ ƒ |  _ t  | j d ƒ ƒ |  _ d  S(   Nt   rowt   col(   t   intR'   R    R   (   R   Rx   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
   start_cellý   s    c         C   s1   | j  d ƒ |  _ t j  | j  d ƒ ƒ |  _ d  S(   NRD   t   align(   R'   t   fmtt	   xml2alignRS   (   R   Rx   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt   start_value  s    c         C   s*   y t  | ƒ |  _ Wn d  |  _ n Xd  S(   N(   R   R{   R   (   R   RR   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt   end_int  s    c         C   s*   y t  | ƒ |  _ Wn d  |  _ n Xd  S(   N(   t   longR{   R   (   R   RR   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt   end_long  s    c         C   s*   y t  | ƒ |  _ Wn d  |  _ n Xd  S(   N(   t   floatR{   R   (   R   RR   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
   end_double  s    c         C   s*   y t  | ƒ |  _ Wn d  |  _ n Xd  S(   N(   t   complexR{   R   (   R   RR   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt   end_complex  s    c         C   s$   y | |  _  Wn d  |  _  n Xd  S(   N(   R{   R   (   R   RR   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
   end_string  s    c         C   sŽ   t  |  j t ƒ r! |  j |  _ ni t  |  j t ƒ r` t |  j |  j pH d |  j pT t ƒ |  _ n* t	 |  j |  j pu d |  j p� t
 ƒ |  _ d  S(   Ns   %s(   R)   R{   R*   R   RK   t
   StringCellR‚   RS   R   t   NumericCellR   (   R   RR   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt	   end_value%  s    		c         C   s+   t  | |  j p d |  j p t ƒ |  _ d  S(   Ns   %s(   t   FormulaCellR‚   RS   R   R   (   R   RR   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt   end_formula1  s    c         C   s#   |  j  j |  j |  j |  j ƒ d  S(   N(   Rj   R+   R   R    R   (   R   RR   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt   end_cell6  s    (   Rh   Ri   R   Rf   Rl   Rp   Rn   R€   R„   t   start_formulaR…   R‡   R‰   R‹   RŒ   R�   R‘   R’   (    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRe   à   s    														R*   c           B   s   e  Z d  Z RS(   N(   Rh   Ri   R   R   (    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR*   9  s   	RŽ   c           B   sV   e  Z d  e d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 RS(	   s   %sc         C   s[   t  | t t t t f ƒ s! t ‚ | t t t f k s< t ‚ | |  _	 | |  _
 | |  _ d  S(   N(   R)   R   R†   Rˆ   RŠ   R(   R   R   R   R{   R‚   RS   (   R   R{   R‚   RS   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR   G  s
    !		c         C   s   |  j  S(   N(   R{   (   R   R   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR   N  s    c         C   s:   y |  j  |  j } Wn t |  j ƒ } n X| |  j f S(   N(   R‚   R{   RK   RS   (   R   RR   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRD   Q  s
    c         C   s=   t  |  d t |  j ƒ j ƒ } d t |  j |  j | ƒ  f S(   Nt   _xml_s(   <value align="%s" format="%s">%s</value>(   Ru   t   typeR{   Rh   t	   align2xmlRS   R‚   (   R   Ry   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRW   X  s
    
c         C   s8   d |  j  k o d k  n r* d |  j  S|  j ƒ  Sd  S(   Ni   i   s   <int>%s</int>I   €    i   €I   €    (   R{   t	   _xml_long(   R   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt   _xml_int_  s    c         C   s   d |  j  S(   Ns   <long>%s</long>(   R{   (   R   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR—   e  s    c         C   s   d t  |  j ƒ S(   Ns   <double>%s</double>(   t   reprR{   (   R   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
   _xml_floath  s    c         C   s   d t  |  j ƒ S(   Ns   <complex>%s</double>(   R™   R{   (   R   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt   _xml_complexk  s    (   Rh   Ri   R   R   R   RD   RW   R˜   R—   Rš   R›   (    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRŽ   E  s   						R�   c           B   s2   e  Z d  e d „ Z d „  Z d „  Z d „  Z RS(   s   %sc         C   sU   t  | t t f ƒ s t ‚ | t t t f k s6 t ‚ | |  _ | |  _ | |  _	 d  S(   N(
   R)   RK   t   unicodeR(   R   R   R   RR   R‚   RS   (   R   RR   R‚   RS   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR   p  s
    		c         C   s   |  j  S(   N(   RR   (   R   R   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR   w  s    c         C   s   |  j  |  j f S(   N(   RR   RS   (   R   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRD   z  s    c         C   s-   d } | t  |  j |  j t j |  j ƒ f S(   Ns9   <value align="%s" format="%s"><string>%s</string></value>(   R–   RS   R‚   RX   RY   RR   (   R   t   s(    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRW   }  s
    
(   Rh   Ri   R   R   R   RD   RW   (    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�   n  s   		R�   c           B   sD   e  Z d  e d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   s   %sc         C   sV   | t  t t f k s t ‚ | |  _ t |  j ƒ |  _ | |  _ | |  _ |  j	 ƒ  d  S(   N(
   R   R   R   R(   t   formulat	   translatet
   translatedR‚   RS   RB   (   R   Rž   R‚   RS   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR   †  s    			c         C   s   d  |  _ d  S(   N(   R   R{   (   R   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRB   Ž  s    c         C   s”   |  j  d  k r� y4 | j d d t |  j ƒ ƒ | j d ƒ |  _  Wq� t j ƒ  d } t | d ƒ rw | j	 |  _  qŠ t
 | ƒ |  _  q� Xn  |  j  S(   Ns    from __future__ import division
s   __value__ = eval(%s)t	   __value__i    Rh   (   R{   R   t   r_execR™   R    t   r_evalR1   t   exc_infoR   Rh   RK   (   R   R   t   exc(    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR   ‘  s    	c         C   s:   y |  j  |  j } Wn t |  j ƒ } n X| |  j f S(   N(   R‚   R{   RK   RS   (   R   RR   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRD      s
    c         C   s   d t  |  j |  j |  j f S(   Ns,   <formula align="%s" format="%s">%s</formula>(   R–   RS   R‚   Rž   (   R   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRW   §  s    
c         C   sï   g  } xÇ t  j d |  j ƒ D]° } t  j d | ƒ }	 |	 d  k	 r¿ |	 j ƒ  \ }
 } t |
 ƒ } t | ƒ } | | k o� | k n r¿ | | k o� | k n r¿ t | | | | ƒ } q¿ n  | j	 | ƒ q Wt
 d j | ƒ |  j |  j ƒ S(   Ns   (\w+)s   ^([A-Z]+)([1-9][0-9]*)$RE   (   t   ret   splitRž   t   matchR   t   groupst   colname2numR   t   cellnameR"   R�   RZ   R‚   RS   (   R   R#   R$   R%   R&   R6   R7   R[   t   partR   t   sxt   syR   R    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR5   ­  s    8(	   Rh   Ri   R   R   RB   R   RD   RW   R5   (    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR�   „  s   				c   	      C   sÐ   g  } xº t  j d |  ƒ D]¦ } t  j d | ƒ } | d k rM | j | ƒ q | j ƒ  \ } } } } t | ƒ } | d k r� d | | f } n" t | ƒ } d | | | | f } | j | ƒ q Wd j | ƒ 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)s   cells(%s, %s, %s, %s)RE   N(   R¦   R§   R¨   R   R"   R©   Rª   RZ   (	   Rž   R[   R¬   R   R#   R$   R%   R&   R�   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRŸ   º  s    c         C   s&   |  d k s t  ‚ t |  ƒ t | ƒ S(   sE   Translate a cell coordinate to a fancy cell name (e.g. (1, 1)->'A1').i    (   R(   RI   RK   (   R   R    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR«   Ñ  s    c         C   sk   |  j  ƒ  }  d } xR |  D]J } d | k o6 d k n sA t ‚ | d t | ƒ t d ƒ d } q W| S(   sC   Translate a column name to number (e.g. 'A'->1, 'Z'->26, 'AA'->27).i    t   At   Zi   i   (   t   upperR(   t   ord(   R�   R   t   c(    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRª   Ö  s    "&c         C   s\   |  d k s t  ‚ d } x= |  rW t |  d d ƒ \ }  } t | t d ƒ ƒ | } q W| S(   s6   Translate a column number to name (e.g. 1->'A', etc.).i    RE   i   i   R¯   (   R(   t   divmodt   chrR²   (   R   R�   R   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRI   ß  s    	t   SheetGUIc           B   sõ   e  Z d  Z d d d d „ Z d „  Z d „  Z d „  Z d „  Z d	 „  Z d
 „  Z	 d „  Z
 d „  Z d „  Z d „  Z d „  Z e Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   s7  Beginnings 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
   i   c         C   s*  | |  _  t ƒ  |  _ t j j | ƒ r: |  j j | ƒ n  |  j j ƒ  \ } } t | | ƒ } t | | ƒ } t	 j	 ƒ  |  _
 |  j
 j d |  j  ƒ t	 j |  j
 d d d d ƒ|  _ t	 j |  j
 ƒ |  _ t	 j |  j
 d d d	 |  j ƒ|  _ t	 j |  j
 ƒ |  _ |  j j d
 d d d d d ƒ |  j j d
 d ƒ |  j j d
 d ƒ |  j j d
 d d d d d ƒ |  j j d |  j ƒ |  j j d |  j ƒ |  j j d |  j ƒ |  j j d |  j ƒ |  j j d |  j ƒ |  j j d |  j ƒ |  j | | ƒ d |  _ d |  _  |  j! d d ƒ |  j" ƒ  d S(   sl   Constructor.

        Load the sheet from the filename argument.
        Set up the Tk widget tree.
        s   Spreadsheet: %sRR   t   A1t   fontt	   helveticai   t   boldt   Savet   commandt   sidet   bottomt   expandi   t   fillt   bothR	   R
   R   s   <Return>s   <Shift-Return>s   <Tab>s   <Shift-Tab>s   <Delete>s   <Escape>N(   R¹   i   Rº   (#   Ra   R   Rj   t   ost   patht   isfileRg   RA   R>   t   Tkt   roott   wm_titlet   Labelt   beacont   Entryt   entryt   ButtonRc   t
   savebuttont   Framet   cellgridt   packt   bindt   return_eventt   shift_return_eventt	   tab_eventt   shift_tab_eventt   delete_eventt   escape_eventt   makegridR   t	   currentxyt   cornerxyt
   setcurrentt   sync(   R   Ra   t   rowst   columnsR?   R@   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR   ú  s<    			c         C   sr   |  j  |  j k r> |  j  d  k	 r> |  j j |  j |  j  Œ  n |  j j |  j Œ  |  j ƒ  |  j j d d ƒ d S(   Ni    t   endt   break(	   RÚ   RÙ   R   Rj   R0   R-   RÜ   RË   t   delete(   R   t   event(    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRÖ   '  s    !
c         C   s#   |  j  \ } } |  j | | ƒ d  S(   N(   RÙ   t
   load_entry(   R   Râ   R   R    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR×   0  s    c         C   s˜   |  j  j | | ƒ } | d  k r* d } n1 t | t ƒ rI d | j } n | j ƒ  \ } } |  j j d d ƒ |  j j	 d | ƒ |  j j
 d d ƒ d  S(   NRE   t   =i    Rß   (   Rj   R   R   R)   R�   Rž   RD   RË   Rá   t   insertt   selection_range(   R   R   R    R   RR   RS   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRã   4  s    	c      
   C   s  | |  _  | |  _ i  |  _ t j |  j d d ƒ} | j d d d d d d ƒ | j d |  j ƒ xâ t	 d	 | d	 ƒ D]Í } |  j j
 | d
 d ƒt j |  j d t | ƒ d d ƒ} | j d | d d d d ƒ | |  j | d f <| | _ d | _ | j d |  j ƒ | j d |  j ƒ | j d |  j ƒ | j d |  j ƒ qv WxÌ t	 d	 | d	 ƒ D]· } t j |  j d t | ƒ d d ƒ} | j d d d | d d ƒ | |  j d | f <d | _ | | _ | j d |  j ƒ | j d |  j ƒ | j d |  j ƒ | j d |  j ƒ q[Wxê t	 d	 | d	 ƒ D]Õ } xÌ t	 d	 | d	 ƒ D]· } t j |  j d d d d d d ƒ} | j d | d | d d ƒ | |  j | | f <| | _ | | _ | j d |  j ƒ | j d |  j ƒ | j d |  j ƒ | j d |  j ƒ qDWq*Wd S(   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.
        t   relieft   raisedt   columni    R}   t   stickyt   NSWEs   <ButtonPress-1>i   t   minsizei@   RR   t   WEs   <B1-Motion>s   <ButtonRelease-1>s   <Shift-Button-1>t   sunkent   bgt   whitet   fgt   blackN(   RÝ   RÞ   t	   gridcellsRÅ   RÈ   RÏ   t   grid_configureRÑ   t	   selectallR!   t   grid_columnconfigureRI   t   _SheetGUI__xt   _SheetGUI__yt   selectcolumnt   extendcolumnRK   t	   selectrowt	   extendrowt   presst   motiont   release(   R   RÝ   RÞ   R   R   R    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRØ   @  sN    			$		$				c         C   s*   |  j  d d ƒ |  j t j t j ƒ d  S(   Ni   (   RÛ   t	   setcornerR1   R2   (   R   Râ   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRõ   r  s    c         C   s<   |  j  | ƒ \ } } |  j | d ƒ |  j | t j ƒ d  S(   Ni   (   t   whichxyRÛ   R   R1   R2   (   R   Râ   R   R    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRù   v  s    c         C   sR   |  j  | ƒ \ } } | d k rN |  j |  j d d ƒ |  j | t j ƒ n  d  S(   Ni    i   (   R  RÛ   RÙ   R   R1   R2   (   R   Râ   R   R    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRú   {  s    c         C   s<   |  j  | ƒ \ } } |  j d | ƒ |  j t j | ƒ d  S(   Ni   (   R  RÛ   R   R1   R2   (   R   Râ   R   R    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRû   �  s    c         C   sR   |  j  | ƒ \ } } | d k rN |  j d |  j d ƒ |  j t j | ƒ n  d  S(   Ni    i   (   R  RÛ   RÙ   R   R1   R2   (   R   Râ   R   R    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRü   †  s    c         C   sD   |  j  | ƒ \ } } | d k r@ | d k r@ |  j | | ƒ n  d  S(   Ni    (   R  RÛ   (   R   Râ   R   R    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRý   Œ  s    c         C   sD   |  j  | ƒ \ } } | d k r@ | d k r@ |  j | | ƒ n  d  S(   Ni    (   R  R   (   R   Râ   R   R    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRþ   ‘  s    c         C   sh   |  j  j | j | j ƒ } | d  k	 rd t | t j ƒ rd y | j | j	 f SWqd t
 k
 r` qd Xn  d S(   Ni    (   i    i    (   RÏ   t   winfo_containingt   x_roott   y_rootR   R)   RÅ   RÈ   R÷   Rø   t   AttributeError(   R   Râ   R   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR  ˜  s    c         C   s   |  j  j |  j ƒ d  S(   N(   Rj   Rc   Ra   (   R   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRc   ¡  s    c         C   s£   |  j  d k	 r |  j ƒ  n  |  j ƒ  t | | ƒ |  j d <|  j | | ƒ |  j j ƒ  | | f |  _  d |  _	 |  j
 j |  j  ƒ } | d k	 rŸ d | d <n  d S(   s   Make (x, y) the current cell.RR   t   yellowRï   N(   RÙ   R   t   change_cellt
   clearfocusR«   RÉ   Rã   RË   t	   focus_setRÚ   Ró   R'   (   R   R   R    t   gridcell(    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRÛ   ¤  s    
	c   	      C   sc  |  j  d  k s$ |  j  | | f k r8 |  j | | ƒ d  S|  j ƒ  | | f |  _ |  j  \ } } |  j po |  j  \ } } | | k r” | | } } n  | | k r° | | } } n  xh |  j j ƒ  D]W \ \ } } } | | k oé | k n rÀ | | k o| k n rÀ d | d <qÀ qÀ W|  j j |  j  ƒ } | d  k	 rId | d <n  |  j | | | | ƒ d  S(   Nt	   lightBlueRï   R  (	   RÙ   R   RÛ   R  RÚ   Ró   RL   R'   t	   setbeacon(	   R   R   R    R#   R$   R%   R&   R   R
  (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR   ²  s$    $
"8c         C   s#  | | k o d k n rD | | k o6 t  j k n rD d } nÎ | | f d t  j f k r‹ | | k rx d | } qd | | f } n‡ | | f d t  j f k rä | | k rÅ d t | ƒ } qd t | ƒ t | ƒ f } n. t |  j Œ  } t |  j Œ  } d | | f } | |  j d <d  S(   Ni   t   :s   %ds   %d:%ds   %ss   %s:%sRR   (   R1   R2   RI   R«   RÙ   RÚ   RÉ   (   R   R#   R$   R%   R&   t   namet   name1t   name2(    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR  Æ  s    ;	c         C   sà   |  j  d  k	 rÜ |  j  \ } } |  j p- |  j  \ } } | | k rR | | } } n  | | k rn | | } } n  xk |  j j ƒ  D]W \ \ } } } | | k o§ | k n r~ | | k oÃ | k n r~ d | d <q~ q~ Wn  d  S(   NRð   Rï   (   RÙ   R   RÚ   Ró   RL   (   R   R#   R$   R%   R&   R   R    R   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR  Ú  s    "8c         C   s1   |  j  ƒ  |  j \ } } |  j | | d ƒ d S(   s   Callback for the Return key.i   Rà   (   R  RÙ   RÛ   (   R   Râ   R   R    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRÒ   æ  s    
c         C   s:   |  j  ƒ  |  j \ } } |  j | t d | d ƒ ƒ d S(   s0   Callback for the Return key with Shift modifier.i   Rà   (   R  RÙ   RÛ   R>   (   R   Râ   R   R    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRÓ   í  s    
c         C   s1   |  j  ƒ  |  j \ } } |  j | d | ƒ d S(   s   Callback for the Tab key.i   Rà   (   R  RÙ   RÛ   (   R   Râ   R   R    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRÔ   ô  s    
c         C   s:   |  j  ƒ  |  j \ } } |  j t d | d ƒ | ƒ d S(   s-   Callback for the Tab key with Shift modifier.i   Rà   (   R  RÙ   RÛ   R>   (   R   Râ   R   R    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRÕ   û  s    
c         C   sô   |  j  \ } } |  j j ƒ  } d } | j d ƒ rF t | d ƒ } nG xD t t t t	 f D]0 } y | | ƒ } Wn
 qY qY Xt
 | ƒ } PqY W| d k r® | r® t | ƒ } n  | d k rÐ |  j j | | ƒ n |  j j | | | ƒ |  j ƒ  d S(   s+   Set the current cell from the entry widget.Rä   i   N(   RÙ   RË   R'   R   t
   startswithR�   R   R†   Rˆ   RŠ   RŽ   R�   Rj   R-   R+   RÜ   (   R   R   R    RR   R   t   clsR{   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR    s$    c         C   sÒ   |  j  j ƒ  x¾ |  j j ƒ  D]­ \ \ } } } | d k s | d k rM q n  |  j  j | | ƒ } | d k r{ d | d <q t | d ƒ rŸ | j ƒ  \ } } n t | ƒ t	 } } | | d <t
 | | d <q Wd S(   s(   Fill the GUI cells from the sheet cells.i    RE   RR   RD   t   anchorN(   Rj   R   Ró   RL   R   R   R   RD   RK   R   t   align2anchor(   R   R   R    R
  R   RR   RS   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyRÜ     s    "
(   Rh   Ri   t   __doc__R   RÖ   R×   Rã   RØ   Rõ   Rù   Rú   Rû   Rü   Rý   Rþ   Rÿ   R  Rc   RÛ   R   R  R  RÒ   RÓ   RÔ   RÕ   R  RÜ   (    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyR¶   ê  s4   -					2																			c          C   sç   d d l  }  t ƒ  } x´ t d d ƒ D]£ } xš t d d ƒ D]‰ } | d k r\ t | ƒ } nU | d k rw t | ƒ } n: t | d ƒ } t d | ƒ } d | | f } t | ƒ } | j | | | ƒ q; Wq% W| j ƒ  | j d ƒ d S(   s   Basic non-gui self-test.iÿÿÿÿNi   i   s   %s*%ss
   sheet1.xml(	   RÂ   R   R!   RŽ   R«   R�   R+   RV   Rc   (   RÂ   t   aR   R    R   t   c1t   c2Rž   (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt
   test_basic,  s    	
c          C   s@   t  j d r t  j d }  n d }  t |  ƒ } | j j ƒ  d S(   s	   GUI test.i   s
   sheet1.xmlN(   R1   t   argvR¶   RÆ   t   mainloop(   Ra   t   g(    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt   test_guiB  s
    R   (#   R  RÂ   R¦   R1   RX   R   t   xml.parsersR    R   R   R   R   R   R   RM   R–   Rƒ   R  R   R   Re   R*   RŽ   R�   R�   RŸ   R«   Rª   RI   t   TkinterRÅ   R¶   R  R  Rh   (    (    (    s.   /usr/lib64/python2.7/Demo/tkinter/guido/ss1.pyt   <module>   s@   				ÀY)6						ÿ C			