コード例 #1
0
ファイル: conn.py プロジェクト: epage/The-One-Ring
    def __init__(self):
        _ConnectionInterfaceRequests.__init__(self)
        DBusProperties.__init__(self)

        self._implement_property_get(CONNECTION_INTERFACE_REQUESTS,
            {'Channels': lambda: dbus.Array(self._get_channels(),
                signature='(oa{sv})'),
            'RequestableChannelClasses': lambda: dbus.Array(
                self._channel_manager.get_requestable_channel_classes(),
                signature='(a{sv}as)')})
コード例 #2
0
ファイル: debug.py プロジェクト: epage/telepathy-bluewire
    def __init__(self, conn_manager, root=''):
        self.enabled = False
        self._interfaces = set()
        self._messages = []
        object_path = '/org/freedesktop/Telepathy/debug'

        _Debug.__init__(self, conn_manager._name, object_path)
        DBusProperties.__init__(self)
        logging.Handler.__init__(self)

        self._implement_property_get(DEBUG, {'Enabled': lambda: self.enabled})
        self._implement_property_set(DEBUG, {'Enabled': self._set_enabled})
        logging.getLogger(root).addHandler(self)
        sys.stderr = StdErrWrapper(self, sys.stderr)
コード例 #3
0
ファイル: channel.py プロジェクト: epage/The-One-Ring
    def __init__(self):
        _ChannelInterfaceGroup.__init__(self)
        DBusProperties.__init__(self)

        self._implement_property_get(CHANNEL_INTERFACE_GROUP,
            {'GroupFlags': lambda: dbus.UInt32(self.GetGroupFlags()),
             'Members': lambda: dbus.Array(self.GetMembers(), signature='u'),
             'RemotePendingMembers': lambda: dbus.Array(self.GetRemotePendingMembers(), signature='u'),
             'SelfHandle': lambda: dbus.UInt32(self.GetSelfHandle())})

        self._group_flags = 0
        self._members = set()
        self._local_pending = set()
        self._remote_pending = set()
コード例 #4
0
ファイル: conn.py プロジェクト: epage/The-One-Ring
    def __init__(self, proto, account, manager=None):
        """
        Parameters:
        proto - the name of the protcol this conection should be handling.
        account - a protocol-specific account name
        manager - the name of the connection manager
        """

        if manager is None:
            import warnings
            warnings.warn('The manager parameter to Connection.__init__ '
                          'should be supplied', DeprecationWarning)
            manager = 'python'

        clean_account = _escape_as_identifier(account)
        bus_name = u'org.freedesktop.Telepathy.Connection.%s.%s.%s' % \
                (manager, proto, clean_account)
        bus_name = dbus.service.BusName(bus_name, bus=dbus.SessionBus())

        object_path = '/org/freedesktop/Telepathy/Connection/%s/%s/%s' % \
                (manager, proto, clean_account)
        _Connection.__init__(self, bus_name, object_path)

        # monitor clients dying so we can release handles
        dbus.SessionBus().add_signal_receiver(self.name_owner_changed_callback,
                                              'NameOwnerChanged',
                                              'org.freedesktop.DBus',
                                              'org.freedesktop.DBus',
                                              '/org/freedesktop/DBus')

        self._interfaces = set()

        DBusProperties.__init__(self)
        self._implement_property_get(CONN_INTERFACE, {
                'SelfHandle': lambda: dbus.UInt32(self.GetSelfHandle()),
                'Interfaces': lambda: dbus.Array(self.GetInterfaces(), signature='s'),
                'Status': lambda: dbus.UInt32(self.GetStatus())
                 })

        self._proto = proto

        self._status = CONNECTION_STATUS_DISCONNECTED

        self._handles = weakref.WeakValueDictionary()
        self._next_handle_id = 1
        self._client_handles = {}

        self._channels = set()
        self._next_channel_id = 0
コード例 #5
0
ファイル: channel.py プロジェクト: epage/The-One-Ring
    def __init__(self, connection, manager, props, object_path=None):
        """
        Initialise the base channel object.

        Parameters:
        connection - the parent Connection object
        props - initial channel properties
        """
        self._conn = connection
        self._chan_manager = manager

        object_path = self._conn.get_channel_path(object_path)
        _Channel.__init__(self, self._conn._name, object_path)

        self._type = props[CHANNEL_INTERFACE + '.ChannelType']
        self._requested = props[CHANNEL_INTERFACE + '.Requested']

        self._immutable_properties = dict()

        tht = props.get(CHANNEL_INTERFACE + '.TargetHandleType', HANDLE_TYPE_NONE)

        if tht == HANDLE_TYPE_NONE:
            self._handle = NoneHandle()
        else:
            self._handle = self._conn.get_handle_by_id(
                props[CHANNEL_INTERFACE + '.TargetHandleType'],
                props[CHANNEL_INTERFACE + '.TargetHandle'])

        self._interfaces = set()

        DBusProperties.__init__(self)
        self._implement_property_get(CHANNEL_INTERFACE,
            {'ChannelType': lambda: dbus.String(self.GetChannelType()),
             'Interfaces': lambda: dbus.Array(self.GetInterfaces(), signature='s'),
             'TargetHandle': lambda: dbus.UInt32(self._handle.get_id()),
             'TargetHandleType': lambda: dbus.UInt32(self._handle.get_type()),
             'TargetID': lambda: dbus.String(self._handle.get_name()),
             'Requested': lambda: self._requested})

        self._add_immutables({
            'ChannelType': CHANNEL_INTERFACE,
            'TargetHandle': CHANNEL_INTERFACE,
            'Interfaces': CHANNEL_INTERFACE,
            'TargetHandleType': CHANNEL_INTERFACE,
            'TargetID': CHANNEL_INTERFACE,
            'Requested': CHANNEL_INTERFACE
            })
コード例 #6
0
ファイル: channel.py プロジェクト: epage/telepathy-bluewire
    def __init__(self, connection, manager, props):
        """
        Initialise the base channel object.

        Parameters:
        connection - the parent Connection object
        props - initial channel properties
        """
        self._conn = connection
        self._chan_manager = manager
        object_path = self._conn.get_channel_path()
        _Channel.__init__(self, self._conn._name, object_path)

        self._type = props[CHANNEL_INTERFACE + ".ChannelType"]
        self._requested = props[CHANNEL_INTERFACE + ".Requested"]

        self._immutable_properties = dict()

        self._handle = self._conn.get_handle_by_id(
            props[CHANNEL_INTERFACE + ".TargetHandleType"], props[CHANNEL_INTERFACE + ".TargetHandle"]
        )
        self._interfaces = set()

        DBusProperties.__init__(self)
        self._implement_property_get(
            CHANNEL_INTERFACE,
            {
                "ChannelType": lambda: dbus.String(self.GetChannelType()),
                "Interfaces": lambda: dbus.Array(self.GetInterfaces(), signature="s"),
                "TargetHandle": lambda: dbus.UInt32(self._handle.get_id()),
                "TargetHandleType": lambda: dbus.UInt32(self._get_handle_type()),
                "TargetID": lambda: dbus.String(self._get_target_id()),
                "Requested": lambda: self._requested,
            },
        )

        self._add_immutables(
            {
                "ChannelType": CHANNEL_INTERFACE,
                "TargetHandle": CHANNEL_INTERFACE,
                "Interfaces": CHANNEL_INTERFACE,
                "TargetHandleType": CHANNEL_INTERFACE,
                "TargetID": CHANNEL_INTERFACE,
                "Requested": CHANNEL_INTERFACE,
            }
        )