ó
æö/Nc           @   sF   d Z  d Z d d l m Z d d l m Z d  e f d „  ƒ  YZ d S(   t   Servert   reStructuredTextiÿÿÿÿ(   t   _Server(   t
   Connectionc           B   sq   e  Z d  Z e d d d „ Z d „  Z d „  Z d „  Z d „  Z	 e
 e j ƒ Z e
 e j ƒ Z e
 e j ƒ Z RS(   s%  An opaque object representing a server that listens for connections from
    other applications.

    This class is not useful to instantiate directly: you must subclass it and
    either extend the method connection_added, or append to the
    list on_connection_added.

    :Since: 0.83
    c         C   s"   t  t |  ƒ j |  | | | | ƒ S(   s   Construct a new Server.

        :Parameters:
            `address` : str
                Listen on this address.
            `connection_class` : type
                When new connections come in, instantiate this subclass
                of dbus.connection.Connection to represent them.
                The default is Connection.
            `mainloop` : dbus.mainloop.NativeMainLoop or None
                The main loop with which to associate the new connections.
            `auth_mechanisms` : sequence of str
                Authentication mechanisms to allow. The default is to allow
                any authentication mechanism supported by ``libdbus``.
        (   t   superR    t   __new__(   t   clst   addresst   connection_classt   mainloopt   auth_mechanisms(    (    s/   /usr/lib/python2.7/dist-packages/dbus/server.pyR   )   s    c         O   s   i  |  _  g  |  _ g  |  _ d  S(   N(   t   _Server__connectionst   on_connection_addedt   on_connection_removed(   t   selft   argst   kwargs(    (    s/   /usr/lib/python2.7/dist-packages/dbus/server.pyt   __init__=   s    			c         C   s!   | j  |  j ƒ |  j | ƒ d  S(   N(   t   call_on_disconnectiont   connection_removedt   connection_added(   R   t   conn(    (    s/   /usr/lib/python2.7/dist-packages/dbus/server.pyt   _on_new_connectionL   s    c         C   s.   |  j  r* x |  j  D] } | | ƒ q Wn  d S(   s´  Respond to the creation of a new Connection.

        This base-class implementation just invokes the callbacks in
        the on_connection_added attribute.

        :Parameters:
            `conn` : dbus.connection.Connection
                A D-Bus connection which has just been added.

                The type of this parameter is whatever was passed
                to the Server constructor as the ``connection_class``.
        N(   R   (   R   R   t   cb(    (    s/   /usr/lib/python2.7/dist-packages/dbus/server.pyR   P   s    	c         C   s.   |  j  r* x |  j  D] } | | ƒ q Wn  d S(   sÀ  Respond to the disconnection of a Connection.

        This base-class implementation just invokes the callbacks in
        the on_connection_removed attribute.

        :Parameters:
            `conn` : dbus.connection.Connection
                A D-Bus connection which has just become disconnected.

                The type of this parameter is whatever was passed
                to the Server constructor as the ``connection_class``.
        N(   R   (   R   R   R   (    (    s/   /usr/lib/python2.7/dist-packages/dbus/server.pyR   a   s    	N(   t   __name__t
   __module__t   __doc__R   t   NoneR   R   R   R   R   t   propertyR   t   get_addressR   t   get_idt   idt   get_is_connectedt   is_connected(    (    (    s/   /usr/lib/python2.7/dist-packages/dbus/server.pyR       s   					N(   s   Server(   t   __all__t   __docformat__t   _dbus_bindingsR   t   dbus.connectionR   R    (    (    (    s/   /usr/lib/python2.7/dist-packages/dbus/server.pyt   <module>   s   