[XMc@sdZddlZddlZddlZddlZddlmZddlmZddl m Z ddl m Z m Z ddlmZddlmZdd lmZmZddlZd d d !Zejd ede jfdYZde jfdYZdefdYZde fdYZdefdYZdefdYZdefdYZdefdYZdefdYZddl Z x'e!e j"fD]Z#e ee#eqWx$e$e%fD]Z#e ee#eqWx$e&e'fD]Z#e ee#eqWd ej(fd!YZ)d"d,d#YZ*d$ej+fd%YZ,d&ej-fd'YZ.d(d-d)YZ/d*Z0e1d+krddl2Z2ej3e2j4e0ndS(.s8An input/output window for the glade reactor inspector. iN(tsibpath(treflect(t gtk2manhole(tAdaptertregisterAdapter(tlog(tpolicies(t implementst Interfaces$Revision: 1.1 $i isgladereactor Inspectort ConsoleOutputcBseZdZdZRS(cCs/tjtj|d|_|jjdS(NR(RtFileLogObserverRt _Notafiletfobststart(tself((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyt_captureLocalLogscCs|jj|`dS(N(R tstop(R((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyRs (t__name__t __module__RR(((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR s t ConsoleInputcBseZdZdZRS(cCsG|jj}|j\}}|j||t}|j|dS(N(ttextViewt get_buffert get_boundstget_texttFalsetdo(Rtbuffertiter1titer2ttext((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyt sendMessage$scCs|jj|dS(N(ttoplevelR(RR((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR*s(RRRR(((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR#s tINodecBseZdZdZRS(s(A node in the inspector tree model. cCs#t|drt|St|S(Nt__dict__(thasattrt InstanceNodetAttributesNode(t adaptabletdefault((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyt __adapt__1s (RRt__doc__R'(((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR -st InspectorNodecBs?eZeedZdZdZdZdZRS(cCs||_||_||_dS(N(toffsettparenttslot(RR*R+R,((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pytpostInit9s  cCsIg}|}x,|jdk r:|j|j|j}qW|j|S(N(R+tNonetappendR*treverse(RtLtx((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pytgetPath>s  cCs>|j|\}}t|dt}|j||||S(Ntpersist(tgetR RR-(RtindexR,totn((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyt __getitem__GscCs t|jS(N(tstrtoriginal(R((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pytorigstrMscCs|j|jfS(N(R,R<(R((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pytformatPs( RRRR R-R3R9R<R=(((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR)6s     t ConstantNodecBseZdZRS(cCsdS(Ni((R((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyt__len__Us(RRR?(((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR>TstDictionaryNodecBs#eZdZdZdZRS(cCs!|jj}|j||S(N(R;titemstsort(RR6R1((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR5Ys cCs t|jS(N(tlenR;(R((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR?^scCsdS(Nt Dictionary((R((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR<as(RRR5R?R<(((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR@Xs  tListNodecBs#eZdZdZdZRS(cCs||j|fS(N(R;(RR6((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR5escCsdS(NtList((R((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR<hscCs t|jS(N(RCR;(R((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR?ks(RRR5R<R?(((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyREds  R$cBseZdZdZRS(cCstt|jS(N(RCtdirR;(R((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR?oscCs7t|j}|j||t|j||fS(N(RGR;RBtgetattr(RR6R1((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR5rs (RRR?R5(((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR$ns R#cBseZdZdZRS(cCst|jjdS(Ni(RCR;R!(R((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR?xscCsx|dkrFt|jdr-|jj}nt|j}d|fS|d8}|jjj}|j||SdS(Nit __class__i(R"R;RIttypeR!RARB(RR6tvR1((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR5{s    (RRR?R5(((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR#ws tInspectorTreeModelcBs}eZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d ZRS( cCs?tjj|t|dt|_|jjddddS(NR4itroot(tgtktGenericTreeModelt__init__R RRMR-R.(RRM((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyRPscCsdS(Ni((R((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyt on_get_flagsscCsdS(Ni((R((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyton_get_n_columnsscCstjS(N(tgobjectt TYPE_STRING(RR6((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyton_get_column_typescCs |jS(N(R3(Rtnode((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyt on_get_pathscCs(|j}x|D]}||}qW|S(N(RM(RtpathR2telem((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyt on_get_iters  cCs|j|S(N(R=(RRVtcolumn((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyt on_get_valuescCs/y|j|jdSWntk r*dSXdS(Ni(R+R*t IndexErrorR.(RRV((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyt on_iter_nexts cCs|dS(Ni((RRV((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyton_iter_childrenscCs t|S(N(RC(RRV((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyton_iter_has_childscCs t|S(N(RC(RRV((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyton_iter_n_childrenscCs|dkrdS||S(N(R.(RRVR8((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyton_iter_nth_childs cCs|jS(N(R+(RRV((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyton_iter_parents(RRRPRQRRRURWRZR\R^R_R`RaRbRc(((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyRLs            t InspectrocBsPeZdZddZdZdZdZdZdZ dZ RS(cCsWtjjttd|_}|jd|_ddg}xFtt |D]2}|jj tj ||tj d|qSWi}x*t j|dD]}|||jj/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyRPs&"  !  cCsR||_||jd<|jjdjt||jjdjddS(Ntittitnametitpaths???(tselectedRzRpRqtset_texttrepr(RR7((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pytselects  cCs/t||_|jj|j||_dS(N(RLtmodelRrt set_modelt inspected(RR7((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyRiscCsd}yt|GHyt||d}Wnt||d}nXt||j|j}|dk rxt|GHn||jdtevaltsinglet_(RtcompileRRzR.Rterr(Rtcommandtfilenametcodetval((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyRs  cGs|j|jdS(N(RiR(Rta((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyt on_inspectscGst|jdS(N(RdR(RR((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyton_inspect_newscCs |j|jj|jdS(N(RRRZR;(RttvRXR[((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyton_row_activatedsN( RRR.RRPRRiRRRR(((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyRds      tLoggingProtocolcBs>eZdZeZdZdZdZdZ dZ RS(sLog network traffic.cGs)tjj||g|_g|_dS(N(RtProtocolWrapperRPtinLogtoutLog(Rtargs((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyRPs cCsb|jrK|jjtj|f|jrK|jj|jdqKntjj||dS(Ni( tloggingRR/ttimet logViewert updateOutRRtwrite(Rtdata((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR s   cCsb|jrK|jjtj|f|jrK|jj|jdqKntjj||dS(Ni( RRR/RRtupdateInRRt dataReceived(RR((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyRs   cCs-dt|j}|jr)|d7}n|S(Nswrapped s (logging)(RtwrappedProtocolR(Rtr((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyt__repr__s  N( RRR(tTrueRR.RRPRRR(((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyRs   tLoggingFactorycBs,eZdZeZeZdZdZRS(s%Wrap protocols with logging wrappers.cCs.|j||jj|}|j|_|S(N(tprotocoltwrappedFactoryt buildProtocolR(Rtaddrtp((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR&s cCs-dt|j}|jr)|d7}n|S(Nswrapped s (logging)(RRR(RR((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR+s  ( RRR(RRRRRR(((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR s  t LogViewercBs2eZdZdZdZdZdZRS(sDisplay log of network traffic.c CsR||_tjg}|jr<|j|jddn|jr`|j|jddnt||_||_tj j t t d|_ }|j j||j jd|_tjttt|_|jj|j|jjd|jjdx|tjdtjddtjdtjddtjdtjdd gD]#}|jj||jdqbWg}xG|jD]<\}}|jt||jd t|dd !fqWxG|jD]<\}}|jt||jd t|dd !fqW|jx|D]}|jj|q4WdS( Nis logview.gladetloglistitTimeRtDtDataitRitS(RRRR/Rtmint startTimeRRNRmRnRRoRpRyRqRt ListStoreR:RRtset_reorderabletset_headers_clickableRuRvRtt set_resizableRRB( RRtvalsR2tcolRttRR~((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyRP5sF    "      44  cCsC|\}}|jjt||jdt|dd!fdS(NRii(RR/R:RR(Rt.1RR((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR]s cCsC|\}}|jjt||jdt|dd!fdS(NRii(RR/R:RR(RRRR((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR`s cCsd|j_|`dS(N(R.RR(Rtw((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyton_logview_destroycs (RRR(RPRRR(((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyR2s  (  cCs$t}|j|tjdS(N(RdRiRNtmain(R2((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pyRhs  t__main__(((5R(RRNRSt gtk.gladettwisted.python.utilRttwisted.pythonRttwisted.manhole.uiRttwisted.python.componentsRRRttwisted.protocolsRtzope.interfaceRRtgnometversiontinitR RR R)R>R@RER$R#ttypestdictt DictProxyTypeR2tlistttupletintR:RORLRdRRtWrappingFactoryRRRRtsyst startLoggingtstdout(((s>/usr/lib/python2.7/dist-packages/twisted/manhole/_inspectro.pytsP             3; 6