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/gtk2.pyc


WRc@sdZddlZejdddlZyddlZWnek
rZddlZnXddlZddlZddlZddl	Z	ddl
Z
ddl
mZddl
mZmZddlmZe
jrddlmZndd	d
dgZdejejdZd
ejejfd
YZd	ejejfdYZeZdejejfdYZe
jrdejej fdYZ!ndej"fdYZ#dZ$e%dkre$ndS(s:GObject-powered progress classes and a GTK+ status widget.iNs2.0(tgettext(tfunction_deprecated_bytAttributeDeprecatedBy(tbase(toldtGAcquireProgresstGInstallProgresstGOpProgresstGtkAptProgresscCs
|||fS(sSimplified 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.
    ((tparamstruntrettype((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pytmksig2scBs}eZdZieeefd6ed6ed6ZdZd	dZ	dZ
ejr{e
dZe
dZnRS(
sOperation progress with GObject signals.

    Signals:

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

    sstatus-changedsstatus-startedsstatus-finishedcCs3tjj|tjj|tj|_dS(N(Rt
OpProgresst__init__tgobjecttGObjecttglibtmain_context_defaultt_context(tself((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRLscCsStjj|||jd|j|jx |jjrN|jjq/WdS(s$Called to update the percentage donesstatus-changedN(	RR
tupdatetemittoptpercentRtpendingt	iteration(RR((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRQscCs!tjj||jddS(s(Called when all operation have finished.sstatus-finishedN(RR
tdoneR(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRXstsubopRN(t__name__t
__module__t__doc__Rtstrtintt__gsignals__RtNoneRRtapt_pkgt_COMPAT_0_7RtsubOptOp(((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyR=s	

			cBseZdZdZieeefd6ed6ed6ed6ed6ed6Zd	Zd
Z	dZ
dZd
ZdZ
dZdZdZdZdZdZejreeZeeZeeZeeZeeZee	ZnRS(sInstallation progress with GObject signals.

    Signals:

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

    ii<sstatus-changedsstatus-startedsstatus-timeoutsstatus-errorsstatus-conffilesstatus-finishedcCstjj|tjj|t|_d|_tj|_	||_
|j
jd|jd|j
ddg|_tj|_dS(Nischild-exitedsVTE_PTY_KEEP_FD=%ssDEBIAN_FRONTEND=gnomesAPT_LISTCHANGES_FRONTEND=gtk(RtInstallProgressRRRtFalsetfinishedt
apt_statusttimettime_last_updatettermtconnecttchild_exitedtwritefdtenvRRR(RR.((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRys			
cCs|j|_t|_dS(s!Called when a child process exitsN(tget_child_exit_statusR+tTrueR*(RR.((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyR0scCs|jddS(sECalled when an error happens.

        Emits: status-error()
        sstatus-errorN(R(Rtpkgterrormsg((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyterrorscCs|jddS(sBCalled during conffile.

        Emits: status-conffile()
        sstatus-conffileN(R(Rtcurrenttnew((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pytconffilescCs|jddS(sHCalled when the update starts.

        Emits: status-started()
        sstatus-startedN(R(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pytstart_updatescCst|_tjj||S(sRun.(R)R*RR(R
(Rtobj((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyR
s	cCs|jddS(sKCalled when the update finished.

        Emits: status-finished()
        sstatus-finishedN(R(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyt
finish_updatescCs|jdd|ddS(s)Called when entering a new stage in dpkg.sstatus-changedsInstalling %s...iN(R(RR5tstage((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyt
processingscCs&tj|_|jd||dS(sXCalled when the status changed.

        Emits: status-changed(status, percent)
        sstatus-changedN(R,R-R(RR5Rtstatus((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyt
status_changescCsctjj|x |jjr2|jjqW|j|jtjkr_|j	dndS(soCalled periodically to update the interface.

        Emits: status-timeout() [When a timeout happens]
        sstatus-timeoutN(
RR(tupdate_interfaceRRRR-tINSTALL_TIMEOUTR,R(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRBs
cCs|jjd|jS(sFork the process.tenvv(R.tforkptyR2(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pytforkscCs.x$|js&|jtjdqW|jS(s#Wait for the child process to exit.g{Gz?(R*RBR,tsleepR+(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyt
wait_childs
i,(RRRRCRR R!R"RR0R7R:R;R
R=R?RARBRFRHR$R%RtupdateInterfacetstartUpdatetfinishUpdatetstatusChanget	waitChildtchildExited(((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRbs6




	
												cBsheZdZieeefd6ed6ed6ZdZdZdZ	dZ
dZRS(	sA Fetch Progress with GObject signals.

    Signals:

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

    DEPRECATED.
    sstatus-changedsstatus-startedsstatus-finishedcCs<tjj|tjj|t|_tj|_	dS(N(
RtAcquireProgressRRRR4t	_continueRRR(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRs	cCs!tjj||jddS(Nsstatus-started(RROtstartR(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRQscCs!tjj||jddS(Nsstatus-finished(RROtstopR(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRRscCs
t|_dS(N(R)RP(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pytcancelscCstjj|||jd}||jkr;|j}n|jdkrtdi|d6|jd6tj|jd6}n!tdi|d6|jd6}|j	|jdt
|j|j}|jd	||x |j
jr|j
jqW|jS(
Niis<Downloading file %(current)li of %(total)li with %(speed)s/sR8ttotaltspeeds+Downloading file %(current)li of %(total)ligY@sstatus-changed(RROtpulset
current_itemsttotal_itemstcurrent_cpst_R$tsize_to_strt
current_bytestfloatttotal_bytesRRRRRP(Rtownertcurrent_itemttextR((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRVs$
	

	
(RRRRR R!R"RRQRRRSRV(((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRs


				tGFetchProgresscBsheZdZieeefd6ed6ed6ZdZdZdZ	dZ
dZRS(	sA Fetch Progress with GObject signals.

        Signals:

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

        DEPRECATED.
        sstatus-changedsstatus-startedsstatus-finishedcCs<tjj|tjj|t|_tj|_	dS(N(
Rt
FetchProgressRRRR4RPRRR(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyR%s	cCs|jddS(Nsstatus-started(R(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRQ+scCs|jddS(Nsstatus-finished(R(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRR.scCs
t|_dS(N(R)RP(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRS1scCstjj||jd}||jkr8|j}n|jdkr~tdi|d6|jd6tj|j	d6}n!tdi|d6|jd6}|j
d||jx |jj
r|jjqW|jS(	Niis<Downloading file %(current)li of %(total)li with %(speed)s/sR8RTRUs+Downloading file %(current)li of %(total)lisstatus-changed(RRcRVtcurrentItemst
totalItemsRYRZR$R[t
currentCPSRRRRRRP(RR`Ra((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRV4s 
	

	
(RRRRR R!R"RRQRRRSRV(((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRbs


				cBseZdZdZdZedZedZedZe	j
rfedZnedZdZ
d	Zd
ZdZdZed
ZdZdZRS(sGraphical 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.
    cCsNtjj||jdtjtd|_tj|_	|jj
|j	tj|_tj
|_tj}|jtjtjdd|jj||jjtj|jjdd|j|jt|j|jt|j|jtt|_|jjd|j|jjd|j|jjd|jt |_!|j!jd|j|j!jd|j|j!jd|jd|_#t$|j	|_%|j%jd|j|j%jd|j|j%jd|j|j%jd|j&|j%jd	|j&|j%jd
|j&dS(NitDetailsiisstatus-changedsstatus-startedsstatus-finishedsstatus-timeoutsstatus-errorsstatus-conffile('tgtktVBoxRtset_spacingtExpanderRZt	_expandertvtetTerminalt	_terminaltaddtProgressBart_progressbartLabelt_labeltpangotAttrListtinsertt	AttrStyletSTYLE_ITALICtset_attributest
set_ellipsizet
ELLIPSIZE_ENDt
set_alignmentt
pack_startR)Rt_progress_openR/t_on_status_changedt_on_status_startedt_on_status_finishedRt_progress_acquireR#t_progress_fetchRt_progress_installt_on_status_timeout(Rt	attr_list((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRPsR




	




cCs4|jjd|jjd|jjtdS(sReset all status information.tiN(Rtt	set_labelRrtset_fractionRltset_expandedR)(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pytclearscCs|jS(s*Return the cache opening progress handler.(R(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pytopenscCs|jS(s$Return the install progress handler.(R(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pytinstallscCs|jS(s-Return the install progress handler for dpkg.(R(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pytdpkg_installscCsg|jdkr`t|_|jjd|j|jjd|j|jjd|jn|jS(s"Return the fetch progress handler.sstatus-changedsstatus-startedsstatus-finishedN(RR#RbR/RRR(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pytfetchs


cCs|jS(s$Return the acquire progress handler.(R(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pytacquirescCs:|j|tddxtjr5tjqWdS(sCalled when something starts.sStarting...iN(RRZRhtevents_pendingtmain_iteration(Rtprogress((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRscCs:|j|tddxtjr5tjqWdS(sCalled when something finished.tCompleteidN(RRZRhRR(RR((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRscCsm|jj||dks(|dkr8|jjn|jj|dxtjrhtjqOWdS(sCalled when the status changed.igY@N(	Rttset_textR#RrRVRRhRR(RRR@R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRscCs1|jjtxtjr,tjqWdS(sCalled when timeout happens.N(RlRR4RhRR(RR((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRscCs|jjdS(s$Cancel a currently running download.N(RRS(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pytcancel_downloadscCsK|jj|jj|jj|xtjrFtjq-WdS(sShow the expander for the terminal.

        Show an expander with a terminal widget which provides a way
        to interact with dpkg
        N(RltshowRoRRhRR(Rtexpanded((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyt
show_terminals


cCs.|jjxtjr)tjqWdS(s+Hide the expander with the terminal widget.N(RlthideRhRR(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyt
hide_terminals
cCsKtjj||jj|jjxtjrFtjq-WdS(sShow the BoxN(RhtHBoxRRtRrRR(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRs


(RRRRRtpropertyRRRR$R%RRRRRRRR)RRR(((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRIs"	1		
			
			c	CsYddl}ddl}ddlm}tj}t}|jd|j||j	|j	|j
j|j}|d}|j
r|jn
|j|jty|j|j|jWn&tk
r}|jdI|IJnXt|jdkr8||jd|}|j|jn|jdtjtjdS(	s
Test functioniN(t
DebPackagesGtkAptProgress DemotxtermsException happened:itdestroy(tsystapttapt.debfileRRhtWindowRt	set_titleRpRtcachetCacheRtis_installedtmark_deletetmark_installRR4tcommitRRt	ExceptiontstderrtlentargvRR/t	main_quittmain(	RRRtwintapt_progressRR5texctdeb((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyt_tests0	




	


t__main__((&RtpygtktrequireRhRtImportErrorRRuR,RmR$RRZtapt.deprecationRRtapt.progressRR%Rt__all__tSIGNAL_RUN_FIRSTt	TYPE_NONERRR
RR(RtGDpkgInstallProgressRORRcRbRiRRR(((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyt<module>s<

			%v8	"4