Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/apt/progress/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/apt/progress/text.pyc


WRc@sdZddlZddlZddlZddlmZdddgZdZdefd	YZ	dej
e	fd
YZ
deje	fdYZdeje	fdYZdS(
s'Progress reporting for text interfaces.iN(tbasetAcquireProgresst
CdromProgresst
OpProgresscCs4tj|}||kr0tj|d}n|S(s>Translate the message, also try apt if translation is missing.tapt(tapt_pkgtgettext(tmsgtres((s5/usr/lib/python2.7/dist-packages/apt/progress/text.pyt_stTextProgresscBs)eZdZddZeedZRS(s.Internal Base class for text progress classes.cCs|ptj|_d|_dS(Ni(tsyststdoutt_filet_width(tselftoutfile((s5/usr/lib/python2.7/dist-packages/apt/progress/text.pyt__init__&scCs|jjd|jj||jt|krY|jj|jt|dn$|r}t|jt||_n|r|jjdn
|jjdS(s8Write the message on the terminal, fill remaining space.s
t s
N(R
twriteRtlentmaxtflush(RRtnewlinetmaximize((s5/usr/lib/python2.7/dist-packages/apt/progress/text.pyt_write*s$N(t__name__t
__module__t__doc__tNoneRtTruetFalseR(((s5/usr/lib/python2.7/dist-packages/apt/progress/text.pyR
#scBs/eZdZddZddZdZRS(s\Operation progress reporting.

    This closely resembles OpTextProgress in libapt-pkg.
    cCs-tj||tjj|d|_dS(Nt(R
RRRtold_op(RR((s5/usr/lib/python2.7/dist-packages/apt/progress/text.pyRAscCsktjj|||jr8|jr8|j|jn|jd|j|jftt	|j|_dS(s1Called periodically to update the user interface.s%s... %i%%
N(
RRtupdatetmajor_changeR!RtoptpercentRR(RR%((s5/usr/lib/python2.7/dist-packages/apt/progress/text.pyR"Fs
#cCsOtjj||jrB|jtdd|jfttnd|_dS(s,Called once an operation has been completed.s%c%s... Dones
R N(RRtdoneR!RR	R(R((s5/usr/lib/python2.7/dist-packages/apt/progress/text.pyR&Ns	)N(RRRRRR"R&(((s5/usr/lib/python2.7/dist-packages/apt/progress/text.pyR;scBsbeZdZd
dZdZdZdZdZdZ	dZ
dZd	ZRS(s'AcquireProgress for the text interface.cCs?tj||tjj|d|_d|_d|_dS(NiPi(R
RRRRt_signalRt_id(RR((s5/usr/lib/python2.7/dist-packages/apt/progress/text.pyRYs
		cCsNtjj|ddl}|j|j|j|_|jd|_dS(sStart an Acquire progress.

        In this case, the function sets up a signal handler for SIGWINCH, i.e.
        window resize signals. And it also sets id to 1.
        iNl(RRtstarttsignaltSIGWINCHt_winchR'R((RR*((s5/usr/lib/python2.7/dist-packages/apt/progress/text.pyR)`s

cGst|jdrtj|jjrddl}ddl}ddl}|j|j|j	d}|j
d|\}}}}|d|_ndS(	s)Signal handler for window resize signals.tfilenoiNiRthhhhis        (thasattrR
tostisattyR-tfcntlttermioststructtioctlt
TIOCGWINSZtunpackR(RtdummyR2R3R4tbuftcol((s5/usr/lib/python2.7/dist-packages/apt/progress/text.pyR,ms*cCsctjj||td|j}|jjrR|dtj|jj7}n|j	|dS(s@Called when an item is update (e.g. not modified on the server).sHit s [%sB]N(
RRtims_hitR	tdescriptiontownertfilesizeRtsize_to_strR(Rtitemtline((s5/usr/lib/python2.7/dist-packages/apt/progress/text.pyR;ws
 cCs}tjj|||jj|jjkrH|jtd|jn1|jtd|j|jd|jj	dS(sCalled when an item is failed.sIgn sErr s  %sN(
RRtfailR=tstatust	STAT_DONERR	R<t
error_text(RR@((s5/usr/lib/python2.7/dist-packages/apt/progress/text.pyRBs
cCstjj|||jjr#dS|j|j_|jd7_tdd|jj|jf}|jj	r|dt
j|jj	7}n|j|dS(s/Called when some of the item's data is fetched.NisGet:s%s %ss [%sB](
RRtfetchR=tcompleteR(tidR	R<R>RR?R(RR@RA((s5/usr/lib/python2.7/dist-packages/apt/progress/text.pyRFs# c	Cstjj|||j|jdt|j|j}t}d|}d}|j	rt
t|j|j|j	}dtj|j	tj
|f}nx|jD]}d}|js |jrd|j}t|t|t||jkrPn||7}t}qqnt}|jjjr[|d|jjj|jjf7}n|d|jj7}|jjjr|d|jjj7}n|d	tj|j7}|jr|jjjr|d
tj|j|jd|jf7}n|d7}t|t|t||jkr3Pq||7}qW|sZ|td7}n|j	r||jt|t|d
|7}n|j|ttS(sPeriodically invoked while the Acquire process is underway.

        Return False if the user asked to cancel the whole Acquire process.gY@s%i%%R s	 %sB/s %ss [%s]s [%i %ss [%ss %ss %sBs	/%sB %i%%t]s
 [Working]R(RRtpulset
current_bytest
current_itemstfloatttotal_bytesttotal_itemsRtcurrent_cpstlongRR?ttime_to_strtworkerstcurrent_itemRCRRRR=RHt	shortdescR<tmodetcurrent_sizet
total_sizeRGR	R(	RR=R%tshownttvaltendtetatworkertval((s5/usr/lib/python2.7/dist-packages/apt/progress/text.pyRJsT
	
		
)
	
)	,cCs@tjj||||jtd||ftdkS(s7Prompt the user to change the inserted removable media.sUMedia change: please insert the disc labeled
 '%s'
in the drive '%s' and press enter
tctC(R_R`(RRtmedia_changeRR	t	raw_input(Rtmediumtdrive((s5/usr/lib/python2.7/dist-packages/apt/progress/text.pyRascCstjj||jtdtj|jtj|j	tj|j
fjdddl}|j|j
|jdS(s/Invoked when the Acquire process stops running.sFetched %sB in %s (%sB/s)
s
iN(RRtstopRR	RR?t
fetched_bytesRRtelapsed_timeRPtrstripR*R+R'(RR*((s5/usr/lib/python2.7/dist-packages/apt/progress/text.pyRes N(
RRRRRR)R,R;RBRFRJRaRe(((s5/usr/lib/python2.7/dist-packages/apt/progress/text.pyRVs	
	
					=	cBs)eZdZdZdZdZRS(sText CD-ROM progress.cCsMtjj||jtdtytdSWntk
rHdSXdS(s,Ask the user to provide a name for the disc.sBPlease provide a name for this Disc, such as 'Debian 2.1r1 Disk 1't:N(RRtask_cdrom_nameRR	RRbtKeyboardInterrupt(R((s5/usr/lib/python2.7/dist-packages/apt/progress/text.pyRjs
cCs3tjj||||r/|j|tndS(sSet the current progress.N(RRR"RR(Rttexttcurrent((s5/usr/lib/python2.7/dist-packages/apt/progress/text.pyR"scCsPtjj||jtdtytdkSWntk
rKtSXdS(s"Ask the user to change the CD-ROM.s1Please insert a Disc in the drive and press enterR N(RRtchange_cdromRR	RRbRk(R((s5/usr/lib/python2.7/dist-packages/apt/progress/text.pyRns
(RRRRjR"Rn(((s5/usr/lib/python2.7/dist-packages/apt/progress/text.pyRs	
	(
RR0RRtapt.progressRt__all__R	tobjectR
RRR(((s5/usr/lib/python2.7/dist-packages/apt/progress/text.pyt<module>s