mò
7úCc           @   s§   d  k  Z  e  i d ƒ d  k Z d  k Z e d ƒ \ Z Z Z Z d e i	 f d „  ƒ  YZ
 e i d e
 e i e i e i f ƒ e i d e
 e i e i e i f ƒ d  S(   Ns   2.0i   t   SpanSelectorc           B   s­   t  Z d  Z d Z g  Z e Z e 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 d „  Z d „  Z d „  Z RS(   sª   Encapsulates creation and functionality of widgets used for changing
    highlight spans.
    
    Note that calling any activate_* methods will emit "span-changed".
    i   i   c         C   s·   t  i i |  | | ƒ |  i ƒ  |  _ |  i |  i ƒ |  _	 |  i
 ƒ  |  _ t  i d ƒ } | i ƒ  |  i | d t d t ƒ|  i |  i	 d t d t ƒ|  i |  i d t d t ƒd  S(   Ns   Highlighting spans:t   expandt   fill(   t   gtkt   HBoxt   __init__t   selft   homogeneoust   spacingt   _create_modelt   modelt   _create_comboboxt   combot   _create_custom_entryt   entryt   Labelt   labelt   showt
   pack_startt   Falset   True(   R   R   R   R   (    (    t6   /home/jelmer/.bazaar/plugins/gannotate/spanselector.pyR   +   s    
c         C   s   |  i i |  i t | ƒ d S(   s<   Set the span associated with the "to Oldest Revision" entry.N(   R   R
   t	   set_valuet   oldest_itert   SPAN_DAYS_COLt   span(   R   R   (    (    R   t   set_to_oldest_span9   s     c         C   s   |  i i |  i t | ƒ d S(   s:   Set the span associated with the "Newest to Oldset" entry.N(   R   R
   R   t   newest_iterR   R   (   R   R   (    (    R   t   set_newest_to_oldest_span=   s     c         C   s   | |  _ d S(   s3   Store up to n custom span entries in the combo box.N(   t   nR   t   max_custom_spans(   R   R   (    (    R   t   set_max_custom_spansA   s     c         C   s#   |  i | ƒ } |  i i | ƒ d S(   s1   Activate the row pointed to by gtk.TreeIter iter.N(   R   t   _get_index_from_itert   itert   indexR   t
   set_active(   R   R!   R"   (    (    R   t   activateE   s     c         C   s"   |  i o |  i |  i ƒ n d S(   s‡   Activate the previously selected row.

        Expected to be used when cancelling custom entry or revieved bad
        input.
        N(   R   t   last_selectedR$   (   R   (    (    R   t   activate_last_selectedJ   s     
c         C   s   |  i |  i ƒ d S(   s   Activate the default row.N(   R   R$   R   (   R   (    (    R   t   activate_defaultS   s     c         C   s   t  |  i i | ƒ ƒ S(   s*   Returns a row index integer from iterator.N(   t   intR   R
   t   get_string_from_iterR!   (   R   R!   (    (    R   R    X   s     c         C   sb   | i ƒ  } | i ƒ  } | i | t ƒ o |  i ƒ  n& | |  _	 |  i
 d | i | t ƒ ƒ d  S(   Ns   span-changed(   t   wt	   get_modelR
   t   get_active_iterR!   t	   get_valuet   SPAN_IS_CUSTOM_COLR   t   _request_custom_spanR%   t   emitR   (   R   R*   R!   R
   (    (    R   t   _combo_changed_cb\   s    	c         C   s|   |  i i ƒ  |  i i ƒ  t | i ƒ  ƒ } | d j o |  i	 ƒ  d  Sn |  i
 | ƒ |  i d | ƒ |  i |  i ƒ d  S(   Ni    s   custom-span-added(   R   R   t   hide_allR   R   t   floatR*   t   get_textR   R&   t   add_custom_spanR0   R$   t   custom_iter(   R   R*   R   (    (    R   t   _activate_custom_span_cbf   s    
c         C   sÏ   t  |  i ƒ p4 |  i i |  i |  i ƒ |  _ |  i i ƒ  |  _ n t  |  i ƒ |  i	 j o3 |  i i
 d ƒ |  i i |  i i |  i ƒ ƒ n |  i i | ƒ |  i i |  i | d | t t g ƒ |  _ d  S(   Ni    s	   %.2f Days(   t   lenR   t   custom_spansR
   t   insert_afterR6   t	   separatort   copyt   custom_iter_topR   t   popt   removet	   iter_nextt   appendR   R   (   R   R   (    (    R   R5   w   s    #c         C   s   |  i i ƒ  |  i i ƒ  d  S(   N(   R   R   t   hideR   t   show_all(   R   (    (    R   R/   …   s    c         C   s  t  i t i t i t i t i ƒ } d d t t g |  _
 | i d d t t g ƒ |  _ | i d d t t g ƒ |  _ | i |  i
 ƒ | i d d t t g ƒ | i d d t t g ƒ | i d	 d
 t t g ƒ | i d d t t g ƒ |  _ | i |  i
 ƒ | i d d t t g ƒ | S(   Nf0.0t    s   to Oldest Revisions   Newest to Oldestf1.0s   1 Dayf7.0s   1 Weekf30.0s   1 Monthf365.0s   1 Years	   Custom...(   R   t	   ListStoret   gobjectt
   TYPE_FLOATt   TYPE_STRINGt   TYPE_BOOLEANt   mR   R   R   R;   RA   R   R   R6   (   R   RJ   (    (    R   R	   ‰   s    c         C   so   t  i | ƒ } | i d „  ƒ t  i ƒ  } | i | t ƒ | i	 | d t
 ƒ | i d |  i ƒ | i ƒ  | S(   Nc         C   s   |  i | t ƒ S(   N(   RJ   R-   t   it   SPAN_IS_SEPARATOR_COL(   RJ   RK   (    (    R   t   <lambda>¢   s    t   textt   changed(   R   t   ComboBoxR
   t   cbt   set_row_separator_funct   CellRendererTextt   cellR   R   t   add_attributet   SPAN_STR_COLt   connectR   R1   R   (   R   R
   RQ   RT   (    (    R   R   Ÿ   s    
c         C   sÀ   t  i t d ƒ } t  i d d ƒ } | i t ƒ | i d d ƒ | i	 d d d ƒ | i
 d	 |  i ƒ | i
 d
 d „  ƒ t  i d ƒ } | i | d t d t ƒ| i | d t d t ƒ| S(   Ni   t   digitsi   f1.0f10.0f0.0id   im  R$   R   c         C   s
   |  i ƒ  S(   N(   R*   t
   grab_focus(   R*   (    (    R   RM   ³   s    t   DaysR   R   (   R   R   R   R   t
   SpinButtont   spint   set_numericR   t   set_incrementst	   set_rangeRW   R   R7   R   R   R   (   R   R   R   R\   (    (    R   R   «   s    (   t   __name__t
   __module__t   __doc__R   R9   t   NoneR%   R   R   R   R   R   R$   R&   R'   R    R1   R7   R5   R/   R	   R   R   (    (    (    R   R        s&    									
					s   span-changeds   custom-span-added(   t   pygtkt   requireRF   R   t   rangeR   RV   RL   R.   R   R    t
   signal_newt   SIGNAL_RUN_LASTt	   TYPE_NONERG   (   R    RV   R   R   Rd   R.   RF   RL   (    (    R   t   ?   s   			¡  