Ñò
óˆNc           @   sñ  d  Z  d d k Z d d k Z d d k Z e i d ƒ d d k Z y d d k Z Wn e j
 o d d k Z n Xd d k Z d d k	 Z	 d d k
 Z
 d d k Z d d k l Z d d k l Z l Z d d k l Z e i o d d k l Z n d d	 d
 d g Z d e i e i d „ Z d
 e i e i f d „  ƒ  YZ d	 e i e i f d „  ƒ  YZ e Z d e i e i f d „  ƒ  YZ  e i o# d e i e i! f d „  ƒ  YZ" n d e i# f d „  ƒ  YZ$ d „  Z% e& d j o e% ƒ  n d S(   s:   GObject-powered progress classes and a GTK+ status widget.iÿÿÿÿNs   2.0(   t   gettext(   t   function_deprecated_byt   AttributeDeprecatedBy(   t   base(   t   oldt   GAcquireProgresst   GInstallProgresst   GOpProgresst   GtkAptProgressc         C   s   | | |  f S(   sé   Simplified Create a gobject signal.

    This allows us to write signals easier, because we just need to define the
    type of the parameters (in most cases).

    ``params`` is a tuple which defines the types of the arguments.
    (    (   t   paramst   runt   rettype(    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyt   mksig4   s    c           B   s   e  Z d  Z h e e e f ƒ d 6e ƒ  d 6e ƒ  d 6Z d „  Z d	 d „ Z	 d „  Z
 e i o e d ƒ Z e d ƒ Z n RS(
   sÂ   Operation progress with GObject signals.

    Signals:

        * status-changed(str: operation, int: percent)
        * status-started()  - Not Implemented yet
        * status-finished()

    s   status-changeds   status-starteds   status-finishedc         C   s3   t  i i |  ƒ t i i |  ƒ t i ƒ  |  _ d  S(   N(   R   t
   OpProgresst   __init__t   gobjectt   GObjectt   glibt   main_context_defaultt   _context(   t   self(    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyR   N   s    c         C   sU   t  i i |  | ƒ |  i d |  i |  i ƒ x" |  i i ƒ  o |  i i ƒ  q/ Wd S(   s$   Called to update the percentage dones   status-changedN(	   R   R   t   updatet   emitt   opt   percentR   t   pendingt	   iteration(   R   R   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyR   S   s
     c         C   s!   t  i i |  ƒ |  i d ƒ d S(   s(   Called when all operation have finished.s   status-finishedN(   R   R   t   doneR   (   R   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyR   Z   s    t   subopR   N(   t   __name__t
   __module__t   __doc__R   t   strt   intt   __gsignals__R   t   NoneR   R   t   apt_pkgt   _COMPAT_0_7R   t   subOpt   Op(    (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyR   ?   s   	
		
c           B   s!  e  Z d  Z d Z h e e e f ƒ d 6e ƒ  d 6e ƒ  d 6e ƒ  d 6e ƒ  d 6e ƒ  d 6Z 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 i oL e e ƒ Z e e ƒ Z e e ƒ Z e e ƒ Z e e ƒ Z e e	 ƒ Z n RS(   sû   Installation progress with GObject signals.

    Signals:

        * status-changed(str: status, int: percent)
        * status-started()
        * status-finished()
        * status-timeout()
        * status-error()
        * status-conffile()

    i   i<   s   status-changeds   status-starteds   status-timeouts   status-errors   status-conffiles   status-finishedc         C   s•   t  i i |  ƒ t i i |  ƒ t |  _ d |  _ t i ƒ  |  _	 | |  _
 t i ƒ  } | i d |  i ƒ d |  i d d g |  _ t i ƒ  |  _ d  S(   Niÿÿÿÿs   child-exiteds   VTE_PTY_KEEP_FD=%ss   DEBIAN_FRONTEND=gnomes   APT_LISTCHANGES_FRONTEND=gtk(   R   t   InstallProgressR   R   R   t   Falset   finishedt
   apt_statust   timet   time_last_updatet   termt   vtet
   reaper_gett   connectt   child_exitedt   writefdt   envR   R   R   (   R   R.   t   reaper(    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyR   {   s    			
c         C   s   t  i | ƒ |  _ t |  _ d S(   s!   Called when a child process exitsN(   t   ost   WEXITSTATUSR+   t   TrueR*   (   R   R.   t   pidt   status(    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyR2   ‰   s    c         C   s   |  i  d ƒ d S(   sE   Called when an error happens.

        Emits: status-error()
        s   status-errorN(   R   (   R   t   pkgt   errormsg(    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyt   errorŽ   s    c         C   s   |  i  d ƒ d S(   sB   Called during conffile.

        Emits: status-conffile()
        s   status-conffileN(   R   (   R   t   currentt   new(    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyt   conffile•   s    c         C   s   |  i  d ƒ d S(   sH   Called when the update starts.

        Emits: status-started()
        s   status-startedN(   R   (   R   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyt   start_updateœ   s    c         C   s   t  |  _ t i i |  | ƒ S(   s   Run.(   R)   R*   R   R(   R
   (   R   t   obj(    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyR
   £   s    	c         C   s   |  i  d ƒ d S(   sK   Called when the update finished.

        Emits: status-finished()
        s   status-finishedN(   R   (   R   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyt   finish_update¨   s    c         C   s   |  i  d d | d ƒ d S(   s)   Called when entering a new stage in dpkg.s   status-changeds   Installing %s...iÿÿÿÿN(   R   (   R   R;   t   stage(    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyt
   processing¯   s    c         C   s&   t  i  ƒ  |  _ |  i d | | ƒ d S(   sX   Called when the status changed.

        Emits: status-changed(status, percent)
        s   status-changedN(   R,   R-   R   (   R   R;   R   R:   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyt   status_change´   s    c         C   sg   t  i i |  ƒ x" |  i i ƒ  o |  i i ƒ  q W|  i |  i t i ƒ  j  o |  i	 d ƒ n d S(   so   Called periodically to update the interface.

        Emits: status-timeout() [When a timeout happens]
        s   status-timeoutN(
   R   R(   t   update_interfaceR   R   R   R-   t   INSTALL_TIMEOUTR,   R   (   R   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyRG   ¼   s     c         C   s   |  i  i d |  i ƒ S(   s   Fork the process.t   envv(   R.   t   forkptyR4   (   R   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyt   forkÇ   s    c         C   s#   x |  i  p |  i ƒ  q W|  i S(   s#   Wait for the child process to exit.(   R*   RG   R+   (   R   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyt
   wait_childË   s     
i,  (   R   R   R   RH   R   R    R!   R"   R   R2   R=   R@   RA   R
   RC   RE   RF   RG   RK   RL   R$   R%   R   t   updateInterfacet   startUpdatet   finishUpdatet   statusChanget	   waitChildt   childExited(    (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyR   d   s6   



												
c           B   sh   e  Z d  Z h e e e f ƒ d 6e ƒ  d 6e ƒ  d 6Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z RS(	   s»   A Fetch Progress with GObject signals.

    Signals:

        * status-changed(str: description, int: percent)
        * status-started()
        * status-finished()

    DEPRECATED.
    s   status-changeds   status-starteds   status-finishedc         C   s<   t  i i |  ƒ t i i |  ƒ t |  _ t i ƒ  |  _	 d  S(   N(
   R   t   AcquireProgressR   R   R   R8   t	   _continueR   R   R   (   R   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyR   í   s    	c         C   s!   t  i i |  ƒ |  i d ƒ d  S(   Ns   status-started(   R   RS   t   startR   (   R   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyRU   ó   s    c         C   s!   t  i i |  ƒ |  i d ƒ d  S(   Ns   status-finished(   R   RS   t   stopR   (   R   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyRV   ÷   s    c         C   s   t  |  _ d  S(   N(   R)   RT   (   R   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyt   cancelû   s    c         C   s  t  i i |  | ƒ |  i d } | |  i j o |  i } n |  i d j o8 t d ƒ h | d 6|  i d 6t i |  i ƒ d 6} n" t d ƒ h | d 6|  i d 6} |  i	 |  i d t
 |  i |  i ƒ } |  i d	 | | ƒ x" |  i i ƒ  o |  i i ƒ  qä W|  i S(
   Ni   i    s<   Downloading file %(current)li of %(total)li with %(speed)s/sR>   t   totalt   speeds+   Downloading file %(current)li of %(total)lig      Y@s   status-changed(   R   RS   t   pulset   current_itemst   total_itemst   current_cpst   _R$   t   size_to_strt   current_bytest   floatt   total_bytesR   R   R   R   RT   (   R   t   ownert   current_itemt   textR   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyRZ   þ   s&    	

	
 (   R   R   R   R   R    R!   R"   R   RU   RV   RW   RZ   (    (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyR   Ý   s   

				t   GFetchProgressc           B   sh   e  Z d  Z h e e e f ƒ d 6e ƒ  d 6e ƒ  d 6Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z RS(	   sÓ   A Fetch Progress with GObject signals.

        Signals:

            * status-changed(str: description, int: percent)
            * status-started()
            * status-finished()

        DEPRECATED.
        s   status-changeds   status-starteds   status-finishedc         C   s<   t  i i |  ƒ t i i |  ƒ t |  _ t i ƒ  |  _	 d  S(   N(
   R   t   FetchProgressR   R   R   R8   RT   R   R   R   (   R   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyR   '  s    	c         C   s   |  i  d ƒ d  S(   Ns   status-started(   R   (   R   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyRU   -  s    c         C   s   |  i  d ƒ d  S(   Ns   status-finished(   R   (   R   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyRV   0  s    c         C   s   t  |  _ d  S(   N(   R)   RT   (   R   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyRW   3  s    c         C   så   t  i i |  ƒ |  i d } | |  i j o |  i } n |  i d j o8 t d ƒ h | d 6|  i d 6t i |  i	 ƒ d 6} n" t d ƒ h | d 6|  i d 6} |  i
 d | |  i ƒ x" |  i i ƒ  o |  i i ƒ  q¼ W|  i S(	   Ni   i    s<   Downloading file %(current)li of %(total)li with %(speed)s/sR>   RX   RY   s+   Downloading file %(current)li of %(total)lis   status-changed(   R   Rg   RZ   t   currentItemst
   totalItemsR]   R^   R$   R_   t
   currentCPSR   R   R   R   R   RT   (   R   Rd   Re   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyRZ   6  s"    	

	
 (   R   R   R   R   R    R!   R"   R   RU   RV   RW   RZ   (    (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyRf     s   

				c           B   sÄ   e  Z d  Z d „  Z d „  Z e d „  ƒ Z e d „  ƒ Z e d „  ƒ Z e	 i
 o e d „  ƒ Z n e d „  ƒ Z d „  Z d	 „  Z d
 „  Z d „  Z d „  Z e d „ Z d „  Z d „  Z RS(   s¼   Graphical progress for installation/fetch/operations.

    This widget provides a progress bar, a terminal and a status bar for
    showing the progress of package manipulation tasks.
    c         C   sN  t  i i |  ƒ |  i d ƒ t  i t d ƒ ƒ |  _ t i ƒ  |  _	 |  i i
 |  i	 ƒ t  i ƒ  |  _ t  i ƒ  |  _ t i ƒ  } | i t i t i d d ƒ ƒ |  i i | ƒ |  i i t i ƒ |  i i d d ƒ |  i |  i t ƒ |  i |  i t ƒ |  i |  i t ƒ t ƒ  |  _ |  i i d |  i ƒ |  i i d |  i ƒ |  i i d |  i ƒ t  ƒ  |  _! |  i! i d |  i ƒ |  i! i d |  i ƒ |  i! i d |  i ƒ d  |  _# t$ |  i	 ƒ |  _% |  i% i d |  i ƒ |  i% i d |  i ƒ |  i% i d |  i ƒ |  i% i d |  i& ƒ |  i% i d	 |  i& ƒ |  i% i d
 |  i& ƒ d  S(   Ni   t   Detailsi    iÿÿÿÿs   status-changeds   status-starteds   status-finisheds   status-timeouts   status-errors   status-conffile('   t   gtkt   VBoxR   t   set_spacingt   ExpanderR^   t	   _expanderR/   t   Terminalt	   _terminalt   addt   ProgressBart   _progressbart   Labelt   _labelt   pangot   AttrListt   insertt	   AttrStylet   STYLE_ITALICt   set_attributest   set_ellipsizet   ELLIPSIZE_ENDt   set_alignmentt
   pack_startR)   R   t   _progress_openR1   t   _on_status_changedt   _on_status_startedt   _on_status_finishedR   t   _progress_acquireR#   t   _progress_fetchR   t   _progress_installt   _on_status_timeout(   R   t	   attr_list(    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyR   R  sR    



	




c         C   s4   |  i  i d ƒ |  i i d ƒ |  i i t ƒ d S(   s   Reset all status information.t    i    N(   Rw   t	   set_labelRu   t   set_fractionRp   t   set_expandedR)   (   R   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyt   clearƒ  s    c         C   s   |  i  S(   s*   Return the cache opening progress handler.(   R‚   (   R   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyt   open‰  s    c         C   s   |  i  S(   s$   Return the install progress handler.(   Rˆ   (   R   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyt   installŽ  s    c         C   s   |  i  S(   s-   Return the install progress handler for dpkg.(   Rˆ   (   R   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyt   dpkg_install“  s    c         C   si   |  i  d j oR t ƒ  |  _  |  i  i d |  i ƒ |  i  i d |  i ƒ |  i  i d |  i ƒ n |  i  S(   s"   Return the fetch progress handler.s   status-changeds   status-starteds   status-finishedN(   R‡   R#   Rf   R1   Rƒ   R„   R…   (   R   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyt   fetchš  s    

c         C   s   |  i  S(   s$   Return the acquire progress handler.(   R†   (   R   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyt   acquire§  s    c         C   s<   |  i  | t d ƒ d ƒ x t i ƒ  o t i ƒ  q Wd S(   s   Called when something starts.s   Starting...i    N(   Rƒ   R^   Rl   t   events_pendingt   main_iteration(   R   t   progress(    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyR„   ¬  s     c         C   s<   |  i  | t d ƒ d ƒ x t i ƒ  o t i ƒ  q Wd S(   s   Called when something finished.t   Completeid   N(   Rƒ   R^   Rl   R•   R–   (   R   R—   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyR…   ²  s     c         C   sr   |  i  i | ƒ | d j p | d j o |  i i ƒ  n |  i i | d ƒ x t i ƒ  o t i ƒ  qR Wd S(   s   Called when the status changed.iÿÿÿÿg      Y@N(	   Rw   t   set_textR#   Ru   RZ   R   Rl   R•   R–   (   R   R—   R:   R   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyRƒ   ¸  s     c         C   s3   |  i  i t ƒ x t i ƒ  o t i ƒ  q Wd S(   s   Called when timeout happens.N(   Rp   RŽ   R8   Rl   R•   R–   (   R   R—   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyR‰   Â  s     c         C   s   |  i  i ƒ  d S(   s$   Cancel a currently running download.N(   R‡   RW   (   R   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyt   cancel_downloadÈ  s    c         C   sM   |  i  i ƒ  |  i i ƒ  |  i  i | ƒ x t i ƒ  o t i ƒ  q- Wd S(   s   Show the expander for the terminal.

        Show an expander with a terminal widget which provides a way
        to interact with dpkg
        N(   Rp   t   showRr   RŽ   Rl   R•   R–   (   R   t   expanded(    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyt   show_terminalÌ  s     c         C   s0   |  i  i ƒ  x t i ƒ  o t i ƒ  q Wd S(   s+   Hide the expander with the terminal widget.N(   Rp   t   hideRl   R•   R–   (   R   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyt   hide_terminalØ  s     c         C   sM   t  i i |  ƒ |  i i ƒ  |  i i ƒ  x t  i ƒ  o t  i ƒ  q- Wd S(   s   Show the BoxN(   Rl   t   HBoxR›   Rw   Ru   R•   R–   (   R   (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyR›   Þ  s     (   R   R   R   R   R   t   propertyR   R‘   R’   R$   R%   R“   R”   R„   R…   Rƒ   R‰   Rš   R)   R   RŸ   R›   (    (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyR   K  s"   	1	
			
			c    	   	   C   s_  d d k  }  d d k } d d k l } t i ƒ  } t ƒ  } | i d ƒ | i | ƒ | i	 ƒ  | i	 ƒ  | i
 i | i ƒ } | d } | i o | i ƒ  n | i ƒ  | i t ƒ y | i | i | i ƒ Wn( t j
 o } |  i d I| IJn Xt |  i ƒ d j o* | |  i d | ƒ } | i | i ƒ n | i d t i ƒ t i ƒ  d S(	   s   Test functioniÿÿÿÿN(   t
   DebPackages   GtkAptProgress Demot   xterms   Exception happened:i   t   destroy(   t   syst   aptt   apt.debfileR¢   Rl   t   WindowR   t	   set_titleRs   R›   t   cachet   CacheR   t   is_installedt   mark_deletet   mark_installR   R8   t   commitR”   R‘   t	   Exceptiont   stderrt   lent   argvR’   R1   t	   main_quitt   main(	   R¥   R¦   R¢   t   wint   apt_progressRª   R;   t   exct   deb(    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyt   _testç  s0    	




t   __main__(    ('   R   R6   R,   t   pygtkt   requireRl   R   t   ImportErrorR   Rx   R/   R$   R    R^   t   apt.deprecationR   R   t   apt.progressR   R%   R   t   __all__t   SIGNAL_RUN_FIRSTt	   TYPE_NONER   R   R   R   R(   R   t   GDpkgInstallProgressRS   R   Rg   Rf   Rm   R   Rº   R   (    (    (    s5   /usr/lib/python2.6/dist-packages/apt/progress/gtk2.pyt   <module>   s>   
		%v8
#4œ	