9nLc@sddddfZdZddkZddkZddkZddkZyddkZWnej oddkZnXddk Z ddk l Z l Z l Z lZlZlZlZddklZlZdd klZlZlZdd klZlZlZdd klZeid Z d e!fdYZ"de!fdYZ#dZ$dZ%dZ&de'fdYZ(de!fdYZ)e!Z*de)fdYZ+de+fdYZ,dS(tBusNametObjecttmethodtsignaltrestructuredtextiN(t SessionBust SignaturetStructtvalidate_bus_nametvalidate_object_pathtINTROSPECTABLE_IFACEt ObjectPath(RR(t DBusExceptiontNameExistsExceptiontUnknownMethodException(t ErrorMessagetMethodReturnMessagetMethodCallMessage(t LOCAL_PATHs dbus.servicet_VariantSignaturecBs eZdZdZdZRS(sA fake method signature which, when iterated, yields an endless stream of 'v' characters representing variants (handy with zip()). It has no string representation. cCs|S(s Return self.((tself((s0/usr/lib/python2.6/site-packages/dbus/service.pyt__iter__:scCsdS(sReturn 'v' whenever called.tv((R((s0/usr/lib/python2.6/site-packages/dbus/service.pytnext>s(t__name__t __module__t__doc__RR(((s0/usr/lib/python2.6/site-packages/dbus/service.pyR4s cBsVeZdZdeeedZdZdZdZdZ dZ e Z RS(s^A base class for exporting your own Named Services across the Bus. When instantiated, objects of this class attempt to claim the given well-known name on the given bus for the current process. The name is released when the BusName object becomes unreferenced. If a well-known name is requested multiple times, multiple references to the same BusName object will be returned. Caveats ------- - Assumes that named services are only ever requested using this class - if you request names from the bus directly, confusion may occur. - Does not handle queueing. c Cset|dtdt|djo/ddk}|idtddt}n||ijo |i|S|o t i pd|o t i pdB|o t i pdB}|i ||}|t ijon_|t ijonK|t ijot|n+|t ijontd ||fti|} || _|| _| |i|<| S( sSConstructor, which may either return an existing cached object or a new object. :Parameters: `name` : str The well-known name to be advertised `bus` : dbus.Bus A Bus on which this service will be advertised. Omitting this parameter or setting it to None has been deprecated since version 0.82.1. For backwards compatibility, if this is done, the global shared connection to the session bus will be used. `allow_replacement` : bool If True, other processes trying to claim the same well-known name will take precedence over this one. `replace_existing` : bool If True, this process can take over the well-known name from other processes already holding it. `do_not_queue` : bool If True, this service will not be placed in the queue of services waiting for the requested name if another service already holds it. tallow_well_knownt allow_uniqueiNsKOmitting the "bus" parameter to dbus.service.BusName.__init__ is deprecatedt stackleveliis3requesting bus name %s returned unexpected value %s(RtTruetFalsetNonetwarningstwarntDeprecationWarningRt _bus_namest_dbus_bindingstNAME_FLAG_ALLOW_REPLACEMENTtNAME_FLAG_REPLACE_EXISTINGtNAME_FLAG_DO_NOT_QUEUEt request_namet REQUEST_NAME_REPLY_PRIMARY_OWNERtREQUEST_NAME_REPLY_IN_QUEUEtREQUEST_NAME_REPLY_EXISTSR t REQUEST_NAME_REPLY_ALREADY_OWNERt RuntimeErrortobjectt__new__t_bust_name( tclstnametbustallow_replacementtreplace_existingt do_not_queueR!t name_flagstretvaltbus_name((s0/usr/lib/python2.6/site-packages/dbus/service.pyR0Rs2      )   cOsdS(N((Rtargstkeywords((s0/usr/lib/python2.6/site-packages/dbus/service.pyt__init__scCs|ii|idS(N(R1t release_nameR2(R((s0/usr/lib/python2.6/site-packages/dbus/service.pyt__del__scCs|iS(sGet the Bus this Service is on(R1(R((s0/usr/lib/python2.6/site-packages/dbus/service.pytget_busscCs|iS(sGet the name of this service(R2(R((s0/usr/lib/python2.6/site-packages/dbus/service.pytget_namescCsd|i|it|fS(Ns&(R2R1tid(R((s0/usr/lib/python2.6/site-packages/dbus/service.pyt__repr__sN( RRRR RR0R>R@RARBRDt__str__(((s0/usr/lib/python2.6/site-packages/dbus/service.pyRBsO     cCsd}d}t}|ox|iiD]}| o||ijoqd|i|ijoPd|i|ijo9|i|i|jo|}|i|}t}Pqq|}n|om||ijo]d|i|ijoFd|i|ijo/|i|i|jo|i|}t}Pq&q&Wnx||iiD]n}| o||ijo |}n|o?||ijo/d|i|ijo|i|}t}Pq>q>W|o|i||fS|otd||fntd|dS(sWalks the Python MRO of the given class to find the method to invoke. Returns two methods, the one to call, and the one it inherits from which defines its D-Bus interface name, signature, and attributes. t_dbus_is_methodt_dbus_interfaces(%s is not a valid method of interface %ss%s is not a valid methodN(R Rt __class__t__mro__t__dict__RGRR(Rt method_nametdbus_interfacet parent_methodtcandidate_classt successfulR3((s0/usr/lib/python2.6/site-packages/dbus/service.pyt_method_lookupsJ         c Gst|}y|id||Wntj o}ti|djoOy|i|d}Wqtj o%}tid||i |qXntid|||i |nX|i |dS(Nt signatures (guessed)s2Unable to guess signature for arguments %r: %s: %ss8Unable to append %r to message with signature %s: %s: %s( Rtappendt Exceptiontloggingt basicConfigR tguess_signaturet_loggerterrorRHt send_message(t connectiontmessageRKRQR:treplyte((s0/usr/lib/python2.6/site-packages/dbus/service.pyt_method_reply_returns       c Cst|dd}|dj onGt|dddjod|ii}nd|i|iif}ti\}}}t|to|i o|i }nN||jo"di t i |||}ndi t i|i|}t|||}|i|dS(Nt_dbus_error_nameRtt__main__sorg.freedesktop.DBus.Python.%ss!org.freedesktop.DBus.Python.%s.%s(R`s__main__(tgetattrR RHRRtsystexc_infot isinstanceR tinclude_tracebacktget_dbus_messagetjoint tracebacktformat_exceptiontformat_exception_onlyRRY( RZR[t exceptionR4tettevtetbtcontentsR\((s0/usr/lib/python2.6/site-packages/dbus/service.pyt_method_reply_error s  " t InterfaceTypecBs#eZdZdZdZRS(c Cs t|dh}||_h}||id|( R3R4tbasestdctt class_tabletinterface_tabletbt base_namet interfacet method_tabletour_method_tabletfunc((s0/usr/lib/python2.6/site-packages/dbus/service.pyR>*s"   cCs|i}|iott|i}n t}|iot|i}ng}d|i}x%t||D]}|d|7}quWx|D]}|d|7}qW|d7}|S(Ns s2 s( s (t _dbus_argst_dbus_in_signaturettupleRRt_dbus_out_signatureRtzip(R3RR<tin_sigtout_sigtreflection_datatpairttype((s0/usr/lib/python2.6/site-packages/dbus/service.pyt_reflect_on_methodDs       cCsx|i}|iott|i}n t}d|i}x%t||D]}|d|}qRW|d}|S(Ns s" s (Rt_dbus_signatureRRRRR(R3RR<tsigRR((s0/usr/lib/python2.6/site-packages/dbus/service.pyt_reflect_on_signalas     (RRR>RR(((s0/usr/lib/python2.6/site-packages/dbus/service.pyRr)s  t InterfacecBseZeZRS((RRRrt __metaclass__(((s0/usr/lib/python2.6/site-packages/dbus/service.pyRssc BseZdZeZeZddddZedZ edZ edZ dZ dddZ dZdZeed d d d d ddddZdZeZRS(sA base class for exporting your own Objects across the Bus. Just inherit from Object and mark exported methods with the @\ `dbus.service.method` or @\ `dbus.service.signal` decorator. Example:: class Example(dbus.service.object): def __init__(self, object_path): dbus.service.Object.__init__(self, dbus.SessionBus(), path) self._last_input = None @dbus.service.method(interface='com.example.Sample', in_signature='v', out_signature='s') def StringifyVariant(self, var): self.LastInputChanged(var) # emits the signal return str(var) @dbus.service.signal(interface='com.example.Sample', signature='v') def LastInputChanged(self, var): # run just before the signal is actually emitted # just put "pass" if nothing should happen self._last_input = var @dbus.service.method(interface='com.example.Sample', in_signature='', out_signature='v') def GetLastInput(self): return self._last_input cCs|dj ot|nt|to|}|i}n/|djo!|dj o|i}qond|_d|_g|_ti |_ t |_ ||_ |djo|dj otdn|dj o!|dj o|i||ndS(sConstructor. Either conn or bus_name is required; object_path is also required. :Parameters: `conn` : dbus.connection.Connection or None The connection on which to export this object. If None, use the Bus associated with the given ``bus_name``. If there is no ``bus_name`` either, the object is not initially available on any Connection. For backwards compatibility, if an instance of dbus.service.BusName is passed as the first parameter, this is equivalent to passing its associated Bus as ``conn``, and passing the BusName itself as ``bus_name``. `object_path` : str or None A D-Bus object path at which to make this Object available immediately. If this is not None, a `conn` or `bus_name` must also be provided. `bus_name` : dbus.service.BusName or None Represents a well-known name claimed by this process. A reference to the BusName object will be held by this Object, preventing the name from being released during this Object's lifetime (unless it's released manually). s<If object_path is given, either conn or bus_name is requiredN(R R ReRRAt _object_patht _connectiont _locationstthreadt allocate_lockt_locations_lockRt _fallbackR2t TypeErrortadd_to_connection(Rtconnt object_pathR;((s0/usr/lib/python2.6/site-packages/dbus/service.pyR>s$        cCsS|itjotd|n,|idjotd|n|iSdS(sThe object-path at which this object is available. Access raises AttributeError if there is no object path, or more than one object path. Changed in 0.82.0: AttributeError can be raised. sEObject %r has more than one object path: use Object.locations insteads Object %r has no object path yetN(Rt_MANYtAttributeErrorR (R((s0/usr/lib/python2.6/site-packages/dbus/service.pyt__dbus_object_path__s cCsS|itjotd|n,|idjotd|n|iSdS(sThe Connection on which this object is available. Access raises AttributeError if there is no Connection, or more than one Connection. Changed in 0.82.0: AttributeError can be raised. sFObject %r is on more than one Connection: use Object.locations insteadsObject %r has no Connection yetN(RRRR (R((s0/usr/lib/python2.6/site-packages/dbus/service.pyRZs cCs t|iS(seAn iterable over tuples representing locations at which this object is available. Each tuple has at least two items, but may have more in future versions of dbus-python, so do not rely on their exact length. The first two items are the dbus.connection.Connection and the object path. :Since: 0.82.0 (titerR(R((s0/usr/lib/python2.6/site-packages/dbus/service.pyt locationss cCs|tjotdtn|iizC|idj o8|i|j o(|i otd||ifn|idj o8|i o-|i|jotd||ifn|i ||i |i |i |idjo ||_n|i|j o t |_n|idjo ||_n|i|jo t |_n|ii|||i fWd|iiXdS(sNMake this object accessible via the given D-Bus connection and object path. :Parameters: `connection` : dbus.connection.Connection Export the object on this connection. If the class attribute SUPPORTS_MULTIPLE_CONNECTIONS is False (default), this object can only be made available on one connection; if the class attribute is set True by a subclass, the object can be made available on more than one connection. `path` : dbus.ObjectPath or other str Place the object at this object path. If the class attribute SUPPORTS_MULTIPLE_OBJECT_PATHS is False (default), this object can only be made available at one object path; if the class attribute is set True by a subclass, the object can be made available with more than one object path. :Raises ValueError: if the object's class attributes do not allow the object to be exported in the desired way. :Since: 0.82.0 s3Objects may not be exported on the reserved path %ss'%r is already exported on connection %rs(%r is already exported at object path %sN(Rt ValueErrorRtacquireRR tSUPPORTS_MULTIPLE_CONNECTIONSRtSUPPORTS_MULTIPLE_OBJECT_PATHSt_register_object_patht _message_cbt_unregister_cbRRRRRtrelease(RRZtpath((s0/usr/lib/python2.6/site-packages/dbus/service.pyRs8          cCs|iizk|idjp|idjotd|n|dj p |dj okg}xt|iD]S}|djp|d|jo/|djp|d|jo|i|qnqnWn|i}g|_|ptd|||fnxu|D]m}y|di|dWntj onX|io.y|ii |Wqst j oqsXqqWWd|ii XdS(sMake this object inaccessible via the given D-Bus connection and object path. If no connection or path is specified, the object ceases to be accessible via any connection or path. :Parameters: `connection` : dbus.connection.Connection or None Only remove the object from this Connection. If None, remove from all Connections on which it's exported. `path` : dbus.ObjectPath or other str, or None Only remove the object from this object path. If None, remove from all object paths. :Raises LookupError: if the object was not exported on the requested connection or path, or (if both are None) was not exported at all. :Since: 0.81.1 s%r is not exportediis1%r is not exported at a location matching (%r,%r)N( RRRR Rt LookupErrorRRRt_unregister_object_pathtremoveRR(RRZRtdroppedtlocation((s0/usr/lib/python2.6/site-packages/dbus/service.pytremove_from_connectionKs8      cCstid||dS(Ns5Unregistering exported object %r from some path on %r(RWtinfo(RRZ((s0/usr/lib/python2.6/site-packages/dbus/service.pyR|s c sttpdSygii}t||\}}i|i}h}|idj ot |ind|i oE|i \}} fd||<fd|| scst|S((Rq(Rl(R[RZ(s0/usr/lib/python2.6/site-packages/dbus/service.pyRsiit/s8%s has an empty output signature but did not return NonesK%s has multiple output values in signature %s but did not return a sequence((( ReRt get_membert get_interfaceRPt get_args_listt_dbus_get_args_optionsRR Rt_dbus_async_callbackst_dbus_sender_keywordt get_sendert_dbus_path_keywordtget_patht_dbus_rel_path_keywordRt startswithtlenR t_dbus_destination_keywordtget_destinationt_dbus_message_keywordt_dbus_connection_keywordRRtoperatortisSequenceTypeRR^RSRq(RRZR[tinterface_nametcandidate_methodRMR<R=treturn_callbackterror_callbackRtrel_pathtexptsuffixR:tsignature_tupleRl((R[RKRZRQs0/usr/lib/python2.6/site-packages/dbus/service.pyRs                     t in_signatureR`t out_signaturetst path_keywordRtconnection_keywordRZcCsti}|d|7}|i|iid|ii}x|iD]\}}|d|7}xn|iD]`}t|dt o||ii |7}qlt|dt o||ii |7}qlqlW|d7}qEWx%|i |D]}|d|7}qW|d7}|S( siReturn a string of XML encoding this object's supported interfaces, methods and signals. s Rts RFt_dbus_is_signals s s ( R%t)DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODERsRHRRRuRxRbRRRtlist_exported_child_objects(RRRZRt interfacesR4tfuncsR((s0/usr/lib/python2.6/site-packages/dbus/service.pyt Introspects$ !   cCs]d}|itj o!|idj od|i}nd|ii|ii|t|fS(NR`s at %ss<%s.%s%s at %#x>(RRR RHRRRC(Rtwhere((s0/usr/lib/python2.6/site-packages/dbus/service.pyRD s  N(RRRRRRR R>tpropertyRRZRRRRRRR RRDRE(((s0/usr/lib/python2.6/site-packages/dbus/service.pyRzs= ;1  m tFallbackObjectcBs#eZdZeZdddZRS(saAn object that implements an entire subtree of the object-path tree. :Since: 0.82.0 cCs{tt|it|_|djo!|dj otdqwn.|djotdn|i||dS(sHConstructor. Note that the superclass' ``bus_name`` __init__ argument is not supported here. :Parameters: `conn` : dbus.connection.Connection or None The connection on which to export this object. If this is not None, an `object_path` must also be provided. If None, the object is not initially available on any Connection. `object_path` : str or None A D-Bus object path at which to make this Object available immediately. If this is not None, a `conn` must also be provided. This object will implements all object-paths in the subtree starting at this object-path, except where a more specific object has been added. s)If object_path is given, conn is requireds)If conn is given, object_path is requiredN(RyRR>RRR RR(RRR((s0/usr/lib/python2.6/site-packages/dbus/service.pyR>s    N(RRRRRR R>(((s0/usr/lib/python2.6/site-packages/dbus/service.pyRs(-t__all__t __docformat__RcRTRRiRt ImportErrort dummy_threadR%tdbusRRRRR R R tdbus.decoratorsRRtdbus.exceptionsR R Rt dbus.lowlevelRRRt dbus.proxiesRt getLoggerRWR/RRRPR^RqRRrRRRR(((s0/usr/lib/python2.6/site-packages/dbus/service.pyts6     4u B  J