ó »ÉD[c@s”dZddlmZddlZejdƒddlZyddlZeWnek rnddlZnXddlZddl Z ddl Z ddl Z ddl Z ddl m ZddlmZddd d gZdejejd „Zd ejejfd „ƒYZdejejfd „ƒYZeZdejejfd„ƒYZd ejfd„ƒYZd„Ze dkreƒndS(s:GObject-powered progress classes and a GTK+ status widget.iÿÿÿÿ(tprint_functionNs2.0(tgettext(tbasetGAcquireProgresstGInstallProgresst GOpProgresstGtkAptProgresscCs |||fS(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. ((tparamstruntrettype((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pytmksig1scBsYeZdZieeefƒd6eƒd6eƒd6Zd„Zdd„Z d„Z RS(sÂOperation 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.pyR KscCsStjj||ƒ|jd|j|jƒx |jjƒrN|jjƒq/WdS(s$Called to update the percentage donesstatus-changedN( RR tupdatetemittoptpercentRtpendingt iteration(RR((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRPscCs!tjj|ƒ|jdƒdS(s(Called when all operation have finished.sstatus-finishedN(RR tdoneR(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRWsN( t__name__t __module__t__doc__R tstrtintt __gsignals__R tNoneRR(((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyR<s     cBsËeZdZdZieeefƒd6eƒd6eƒd6eƒd6eƒd6eƒd6Zd „Zd „Z d „Z d „Z d „Z d„Z d„Zd„Zd„Zd„Zd„Zd„ZRS(sûInstallation 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-finishedcCsŒtjj|ƒtjj|ƒt|_d|_tjƒ|_ ||_ |j j d|j ƒd|j ddg|_tjƒ|_dS(Niÿÿÿÿs child-exitedsVTE_PTY_KEEP_FD=%ssDEBIAN_FRONTEND=gnomesAPT_LISTCHANGES_FRONTEND=gtk(RtInstallProgressR R RtFalsetfinishedt apt_statusttimettime_last_updatettermtconnectt child_exitedtwritefdtenvRRR(RR'((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyR ts     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.pyR)scCs|jdƒdS(sECalled when an error happens. Emits: status-error() s status-errorN(R(Rtpkgterrormsg((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyterror†scCs|jdƒdS(sBCalled during conffile. Emits: status-conffile() sstatus-conffileN(R(Rtcurrenttnew((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pytconffilescCs|jdƒdS(sHCalled when the update starts. Emits: status-started() sstatus-startedN(R(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyt start_update”scCst|_tjj||ƒS(sRun.(R"R#RR!R(Rtobj((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyR›s cCs|jdƒdS(sKCalled when the update finished. Emits: status-finished() sstatus-finishedN(R(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyt finish_update scCs|jdd|dƒdS(s)Called when entering a new stage in dpkg.sstatus-changedsInstalling %s...iÿÿÿÿN(R(RR.tstage((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyt processing§scCs&tjƒ|_|jd||ƒdS(sXCalled when the status changed. Emits: status-changed(status, percent) sstatus-changedN(R%R&R(RR.Rtstatus((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyt status_change¬scCsctjj|ƒx |jjƒr2|jjƒqW|j|jtjƒkr_|j dƒndS(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.pyR;´s cCs|jjd|jƒS(sFork the process.tenvv(R'tforkptyR+(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pytfork¿scCs.x$|js&|jƒtjdƒqW|jS(s#Wait for the child process to exit.g{®Gáz”?(R#R;R%tsleepR$(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyt wait_childÃs  i,(RRRR<R RRRR R)R0R3R4RR6R8R:R;R?RA(((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyR]s(               cBsheZdZieeefƒd6eƒd6eƒd6Zd„Zd„Zd„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. sstatus-changedsstatus-startedsstatus-finishedcCs<tjj|ƒtjj|ƒt|_tjƒ|_ dS(N( RtAcquireProgressR R RR-t _continueRRR(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyR Þs cCs!tjj|ƒ|jdƒdS(Nsstatus-started(RRBtstartR(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRDäscCs!tjj|ƒ|jdƒdS(Nsstatus-finished(RRBtstopR(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyREèscCs t|_dS(N(R"RC(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pytcancelìscCstjj||ƒ|jd}||jkr;|j}n|jdkrtdƒi|d6|jd6tj|jƒd6}n!tdƒi|d6|jd6}|j |jdt |j |jƒ}|j d ||ƒx |j jƒrÿ|j jƒqàW|jS( Niis<Downloading file %(current)li of %(total)li with %(speed)s/sR1ttotaltspeeds+Downloading file %(current)li of %(total)ligY@sstatus-changed(RRBtpulset current_itemst total_itemst current_cpst_tapt_pkgt size_to_strt current_bytestfloatt total_bytesRRRRRC(Rtownert current_itemttextR((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRIïs$       ( RRRR RRRR RDRERFRI(((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRÎs       cBs§eZdZd„Zd„Zed„ƒZed„ƒZed„ƒZed„ƒZ d„Z d„Z d „Z d „Z d „Zed „Zd „Zd„ZRS(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. cCsNtjj|ƒ|jdƒtjtdƒƒ|_tjƒ|_ |jj |j ƒtj ƒ|_ tj ƒ|_tjƒ}|jtjtjddƒƒ|jj|ƒ|jjtjƒ|jjddƒ|j|j tƒ|j|jtƒ|j|jtƒtƒ|_|jjd|jƒ|jjd|jƒ|jjd|jƒt ƒ|_!|j!jd|jƒ|j!jd|jƒ|j!jd|jƒd|_#t$|j ƒ|_%|j%jd|jƒ|j%jd|jƒ|j%jd|jƒ|j%jd|j&ƒ|j%jd |j&ƒ|j%jd |j&ƒdS( NitDetailsiiÿÿÿÿsstatus-changedsstatus-startedsstatus-finishedsstatus-timeouts status-errorsstatus-conffile('tgtktVBoxR t set_spacingtExpanderRMt _expandertvtetTerminalt _terminaltaddt ProgressBart _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.pyR sR                        cCs4|jjdƒ|jjdƒ|jjtƒdS(sReset all status information.tiN(Rct set_labelRat set_fractionR[t set_expandedR"(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pytclear?scCs|jS(s*Return the cache opening progress handler.(Rn(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pytopenEscCs|jS(s$Return the install progress handler.(Rt(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pytinstallJscCs|jS(s-Return the install progress handler for dpkg.(Rt(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyt dpkg_installOscCs|jS(s$Return the acquire progress handler.(Rr(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pytacquireTscCs:|j|tdƒdƒxtjƒr5tjƒqWdS(sCalled when something starts.s Starting...iN(RoRMRWtevents_pendingtmain_iteration(Rtprogress((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRpYscCs:|j|tdƒdƒxtjƒr5tjƒqWdS(sCalled when something finished.tCompleteidN(RoRMRWR€R(RR‚((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRq_scCsm|jj|ƒ|dks(|dkr8|jjƒn|jj|dƒxtjƒrhtjƒqOWdS(sCalled when the status changed.iÿÿÿÿgY@N( Rctset_textR RaRIRyRWR€R(RR‚R9R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRoes cCs1|jjtƒxtjƒr,tjƒqWdS(sCalled when timeout happens.N(R[RzR-RWR€R(RR‚((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRuoscCs|jjƒdS(s$Cancel a currently running download.N(RsRF(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pytcancel_downloaduscCsK|jjƒ|jjƒ|jj|ƒxtjƒrFtjƒq-WdS(sShow the expander for the terminal. Show an expander with a terminal widget which provides a way to interact with dpkg N(R[tshowR^RzRWR€R(Rtexpanded((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyt show_terminalys   cCs.|jjƒxtjƒr)tjƒqWdS(s+Hide the expander with the terminal widget.N(R[thideRWR€R(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyt hide_terminal…s cCsKtjj|ƒ|jjƒ|jjƒxtjƒrFtjƒq-WdS(s Show the BoxN(RWtHBoxR†RcRaR€R(R((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyR†‹s   (RRRR R{tpropertyR|R}R~RRpRqRoRuR…R"RˆRŠR†(((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyRs 1      c Cs\ddl}ddl}ddlm}tjƒ}tƒ}|jdƒ|j|ƒ|j ƒ|j ƒ|j j |j ƒ}|d}|j r |jƒn |jƒ|jtƒy|j|j|jƒWn)tk rü}td|d|jƒnXt|jƒdkr;||jd|ƒ}|j|jƒn|jd tjƒtjƒdS( s Test functioniÿÿÿÿN(t DebPackagesGtkAptProgress DemotxtermsException happened:tfileitdestroy(tsystaptt apt.debfileRRWtWindowRt set_titleR_R†tcachetCacheR|t is_installedt mark_deletet mark_installRˆR-tcommitRR}t ExceptiontprinttstderrtlentargvR~R(t main_quittmain( R‘R’Rtwint apt_progressR–R.texctdeb((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyt_test”s0             t__main__((!Rt __future__RtpygtktrequireRWRt ImportErrorR RdR%R\RNRRMt apt.progressRt__all__tSIGNAL_RUN_FIRSTt TYPE_NONER RR RR!RtGDpkgInstallProgressRBRRXRR§R(((s5/usr/lib/python2.7/dist-packages/apt/progress/gtk2.pyts6             !n9