+
    QDbJ  c                   sZ   ^ RI t ^ RIt^ RIHt ^ RIHt ^ RIHt ^ RIt^ RIHt ^ RI	H
t
 ^ RI5 ]P                  ! R4        ! R	 R
4      t]R8X  d   ^ RIt^ RI5 ^ RIHt ]! R4       ]P$                  ! 4        ]P&                  ! 4       tR t]P,                  ! 4       t]P1                  4       tA]! 4       tRt] F  t]P9                  ]]4       K  	  ]'       d=   ]P:                  ! ^]P8                  ]]4       ]P:                  ! ^]P<                  4       ]P?                  4        R# R# )i    N)GLib)Gdk)Gtk)copyfileobj)NamedTemporaryFile)Z*z1.9.50c                   s\   a  ] tR t^!t o RR ltR tRR ltRR ltR tR t	R t
R	 tR
tV tR# )PPDCacheNc                s    R V n         R V n        \        4       V n        \        4       V n        Wn        W n        W0n        \        4       V n	        RV n
        \        RV ,          4       R # )NFz+%s)_cups_excZdict_cache	_modtimes_host_port_encryptionlist_queued_connecting
debugprint)selfhostport
encryption   &&&&,/usr/share/system-config-printer/ppdcache.py__init__ZPPDCache.__init__"   sO    
	f

%v EDL!    c                s    \        R V ,          4       V P                  '       d   V P                  P                  4        R# R# )z-%sN)r   r   Zdestroy)r   s   &r   __del__ZPPDCache.__del__.   s,    EDL!:::JJ! r   c           	     s  a aa V'       dc   SS P                   9   dR   \        S : R S: R24       S P                  P                  SS P                   S,          VVV 3R lVVV 3R lR7       R#  S P                  S,          pTP                  ^ 4       \        4       ;_uu_ 4       p\        YF4        \        P                   ! TP"                  4      pS P                  SSTR4       RRR4       R#   \
         d    pS P                  SSRT4        Rp?R# Rp?i\         d    S P                  '       gC   S P                  P                  SS34       S P                  '       g   S P                  4         R# \        S : RS: 24       S P                  P                  STTT 3R lTTT 3R lR	7        R# i ; i  \$         d   pS P                  SSRT4        Rp?LRp?ii ; i  + '       g   i     R# ; i)
z: check if z is up to datec                 ,   < SP                  V SVS4      # N	_got_ppd3cZrcallbacknamer      &&r   <lambda>$PPDCache.fetch_ppd.<locals>.<lambda>:       $(NNAtQ$Ir   c                 r   r   r   r   r"   r   r#   r$   <   r%   r   )modtimereply_handlererror_handlerNz: fetch PPD for c                 r   r   r   r   r"   r   r#   r$   O   r%   r   c                 r   r   r   r   r"   r   r#   r$   Q   r%   r   )r'   r(   )r	   r   r   ZgetPPD3r   ZRuntimeError_schedule_callbackZKeyErrorr   Zappendr   _connectZseekr   r   cupsZPPDZfile	Exception)r   r!   r    check_uptodateZfZeZtmpfZppds   fff&    r   	fetch_ppdZPPDCache.fetch_ppd3   s   ddnn4 4FGJJ(,t(</J/J	  K 	D!A. 	

""d!Bhh		*''4dC #"/  	##XtT1= 	:::##dH%56'''MM$$=>JJ/J/J  K
 	4  B''4qAAB #""sf   /C0 %G&24F:0F7;DF7"F75.F7$F77<F76F7:G#GG&G##G&&G7	c                s    R V n         \        P                  ! V P                  V P                  V P
                  V P                  V P                  R7       R# )T)r   r   r   r'   r(   N)r   	asyncconn
Connectionr
   r   r   
_connected)r   r    s   &&r   r*   ZPPDCache._connectb   s;    4::DJJ)-)9)9,0OO,0OO	=r   c                s   \        V\        4      '       d   V P                  WB\        V4       R#  \	        VR 4      V P
                  V&   \        RWV P
                  V,          P                  4       3,          4       \        P                  ! V4       T P                  Y$4       R#   \         d   pT P                  YBRT4        Rp?R# Rp?ii ; i)rbz%s: caching %s (fd %d)N)
isinstancer,   r)   Znoneopenr   r   filenoosunlinkIOErrorr.   )r   
connectionr!   resultr    exc   &&&&& r   _got_ppdZPPDCache._got_ppdi   s    vy))##XT6B$(&$$7D!4!![[.55799 : 		6"
 NND+	  ''sCs   A"B& &C1C

Cc                s   Vw  rVpV\         P                  \         P                  39   d   V\         P                  8X  d    \        P                  ! V4       MV\         P                  8X  ds    \        VR 4      V P                  V&   \        RWV P                  V,          P                  4       We3,          4       \        P                  ! V4       W`P                  V&   V P                  W$RR7       R# V P                  WBR\         P                  ! V4      4       R#   \
         d     LKi ; i  \         d2   p\        T : RT: R24       T P                  YBRT4        Rp?R# Rp?ii ; i)r2   z %s: caching %s (fd %d) (%s) - %sz: file z  disappeared? Unable to cache itNF)r-   )r+   ZHTTP_OKZHTTP_NOT_MODIFIEDr6   r7   ZOSErrorr4   r   r   r5   r	   r8   r)   r.   Z	HTTPError)	r   r9   r!   r:   r    Zstatusr&   Zfilenamer;   s	   &&&&&    r   r   ZPPDCache._got_ppd3{   s6   &,#(dllD$:$:;;///
IIx( 4<<'(,h(=DKK% !,/3/3{{4/@/G/G/J/6/@!@ A IIx(+2NN4( NND5NA##X%)4>>6+BD7  "  #'!3 4++XT3Gs+   D .A1D. D+*D+.E*9&E%%E*c                s    R V n         \        V\        4      '       d   RV n        W n        MWn        V P
                  p\        4       V n        V F  w  rEV P                  WE4       K  	  R# )FN)r   r3   r,   r   r   r   r   r.   )r   r9   r;   Zqueuedr!   r    s   &&&   r   r1   ZPPDCache._connected   sR     sI&&DJI#Jv$NDNND+ %r   c                s<    R  p\         P                  ! WQW#V4       R# )c                 sl    \         P                  ! 4        V ! WV4       \         P                  ! 4        R # )F)r   Zthreads_enterZthreads_leave)r    r!   r:   r;   r   r   cb_funcZ,PPDCache._schedule_callback.<locals>.cb_func   s'     dC( r   N)r    Zidle_add)r   r    r!   r:   r;   r>   r<   r   r)   ZPPDCache._schedule_callback   s    	 	w$<r   )	r   r   r   r   r   r
   r	   r   r   )NNN)Tr   )__name__Z
__module__Z__qualname__Z__firstlineno__r   r   r.   r*   r=   r   r1   r)   Z__static_attributes__Z__classdictcell__)Z__classdict__s   @r   r   r   !   s6     
""
-B^=,$&DP,= =r   r   Z__main__)GObjectTc                 sz    \        R V ,          4       \        \        V4      4       \        \        V4      4       R# )z**** %sN)r   Zrepr)r!   r:   r;   s   &&&r   signalrA      s'    I$%D&M"D#Jr   ) r/   r+   Zgi.repositoryr    r   r   r6   Zshutilr   Ztempfiler   ZdebugZrequirer   r?   Zsysr@   Zset_debuggingZthreads_initZMainLoopZlooprA   r0   r   ZgetPrintersZprintersZcacheZpr.   Ztimeout_add_secondsZquitZrun) r   r   <module>rB      s   *      	  '  h V= V=p z%4D 
 	A}}H	KEAF#  	  !U__a@  !TYY/HHK3 r   