Exemplo n.º 1
0
    def __init__(self,
                 service_name,
                 object_path,
                 bus=None,
                 ready_handler=None,
                 error_handler=default_error_handler):
        if not bus:
            bus = dbus.Bus()

        self.service_name = service_name
        self.object_path = object_path
        self._ready_handler = ready_handler
        self.error_cb = error_handler
        object = bus.get_object(service_name, object_path)
        InterfaceFactory.__init__(self, object, CHANNEL_INTERFACE)

        if ready_handler:
            self[CHANNEL_INTERFACE].GetChannelType(
                reply_handler=self.get_channel_type_reply_cb,
                error_handler=self.error_cb)
        else:
            type = self.GetChannelType()
            interfaces = self.GetInterfaces()
            self.get_valid_interfaces().add(type)
            self.get_valid_interfaces().update(interfaces)
Exemplo n.º 2
0
    def __init__(self,
                 service_name,
                 object_path=None,
                 bus=None,
                 ready_handler=None,
                 error_handler=default_error_handler):
        if not bus:
            self.bus = dbus.Bus()
        else:
            self.bus = bus

        if object_path is None:
            object_path = '/' + service_name.replace('.', '/')

        self.service_name = service_name
        self.object_path = object_path
        self._ready_handlers = []
        if ready_handler is not None:
            self._ready_handlers.append(ready_handler)
        self._error_handler = error_handler
        self._ready = False

        object = self.bus.get_object(service_name, object_path)
        InterfaceFactory.__init__(self, object, CONN_INTERFACE)

        # note: old dbus-python returns None from connect_to_signal
        self._status_changed_connection = \
            self[CONN_INTERFACE].connect_to_signal('StatusChanged',
                lambda status, reason: self._status_cb(status))
        self[CONN_INTERFACE].GetStatus(reply_handler=self._status_cb,
                                       error_handler=error_handler)
Exemplo n.º 3
0
    def __init__(self, service_name, object_path=None, bus=None,
            ready_handler=None, error_handler=default_error_handler):
        if not bus:
            self.bus = dbus.Bus()
        else:
            self.bus = bus

        if object_path is None:
            object_path = '/' + service_name.replace('.', '/')

        self.service_name = service_name
        self.object_path = object_path
        self._ready_handlers = []
        if ready_handler is not None:
            self._ready_handlers.append(ready_handler)
        self._error_handler = error_handler
        self._ready = False

        object = self.bus.get_object(service_name, object_path)
        InterfaceFactory.__init__(self, object, CONN_INTERFACE)

        # note: old dbus-python returns None from connect_to_signal
        self._status_changed_connection = \
            self[CONN_INTERFACE].connect_to_signal('StatusChanged',
                lambda status, reason: self._status_cb(status))
        self[CONN_INTERFACE].GetStatus(
            reply_handler=self._status_cb,
            error_handler=error_handler)
Exemplo n.º 4
0
    def __init__(self, service_name, object_path, bus=None):
        if not bus:
            bus = dbus.Bus()

        self.service_name = service_name
        self.object_path = object_path
        object = bus.get_object(service_name, object_path)
        InterfaceFactory.__init__(self, object, CONN_MGR_INTERFACE)
Exemplo n.º 5
0
    def __init__(self, service_name, object_path, bus=None):
        if not bus:
            bus = dbus.Bus()

        self.service_name = service_name
        self.object_path = object_path
        object = bus.get_object(service_name, object_path)
        InterfaceFactory.__init__(self, object, CONN_MGR_INTERFACE)
Exemplo n.º 6
0
    def __init__(self, object_path, bus=None):
        if not bus:
            bus = dbus.Bus()
        service_name = 'org.freedesktop.Telepathy.AccountManager'
        #service_name = object_path.replace('/', '.')[1:]

        object = bus.get_object(service_name, object_path)
        InterfaceFactory.__init__(self, object, ACCOUNT)

        # FIXME: make this async
        self.get_valid_interfaces().update(self[DBUS_PROPERTIES].Get(ACCOUNT, 'Interfaces'))
Exemplo n.º 7
0
    def __init__(self, bus=None, ready_handler=None,
            error_handler=default_error_handler):
        if not bus:
            bus = dbus.Bus()

        self.service_name = ACCOUNT_MANAGER
        self.object_path = '/org/freedesktop/Telepathy/AccountManager'
        self._ready_handler = ready_handler
        self._error_cb = error_handler
        object = bus.get_object(self.service_name, self.object_path)
        InterfaceFactory.__init__(self, object, ACCOUNT_MANAGER)

        self[dbus.PROPERTIES_IFACE].Get(
            ACCOUNT_MANAGER,
            'Interfaces',
            reply_handler=self._get_interfaces_cb,
            error_handler=self._error_cb)
Exemplo n.º 8
0
    def __init__(self, bus=None):
        if not bus:
            bus = dbus.Bus()

        try:
            object = bus.get_object(self.service_name, self.object_path)
        except:
            raise
            # try activating MissionControl5 (ugly work-around)
            mc5 = bus.get_object(self.MC5_name, self.MC5_path)
            import time
            time.sleep(1)
            object = bus.get_object(self.service_name, self.object_path)
        InterfaceFactory.__init__(self, object, ACCOUNT_MANAGER)

        # FIXME: make this async
        self.get_valid_interfaces().update(self[DBUS_PROPERTIES].Get(ACCOUNT_MANAGER, 'Interfaces'))
Exemplo n.º 9
0
    def __init__(self, object_path, bus=None, ready_handler=None,
            error_handler=default_error_handler):
        if not bus:
            bus = dbus.Bus()

        self.service_name = ACCOUNT_MANAGER
        self.object_path = object_path
        self._ready_handler = ready_handler
        self._error_cb = error_handler
        object = bus.get_object(self.service_name, self.object_path)
        InterfaceFactory.__init__(self, object, ACCOUNT)

        self[dbus.PROPERTIES_IFACE].Get(
                ACCOUNT,
                'Interfaces',
                reply_handler=self._get_interfaces_cb,
                error_handler=self._error_cb)
Exemplo n.º 10
0
    def __init__(self,
                 object_path,
                 bus=None,
                 ready_handler=None,
                 error_handler=default_error_handler):
        if not bus:
            bus = dbus.Bus()

        self.service_name = ACCOUNT_MANAGER
        self.object_path = object_path
        self._ready_handler = ready_handler
        self._error_cb = error_handler
        object = bus.get_object(self.service_name, self.object_path)
        InterfaceFactory.__init__(self, object, ACCOUNT)

        self[dbus.PROPERTIES_IFACE].Get(ACCOUNT,
                                        'Interfaces',
                                        reply_handler=self._get_interfaces_cb,
                                        error_handler=self._error_cb)
Exemplo n.º 11
0
    def __init__(self, service_name, object_path, bus=None, ready_handler=None,
                 error_handler=default_error_handler):
        if not bus:
            bus = dbus.Bus()

        self.service_name = service_name
        self.object_path = object_path
        self._ready_handler = ready_handler
        self.error_cb = error_handler
        object = bus.get_object(service_name, object_path)
        InterfaceFactory.__init__(self, object, CHANNEL_INTERFACE)

        if ready_handler:
            self[CHANNEL_INTERFACE].GetChannelType(
                reply_handler=self.get_channel_type_reply_cb,
                error_handler=self.error_cb)
        else:
            type = self.GetChannelType()
            interfaces = self.GetInterfaces()
            self.get_valid_interfaces().add(type)
            self.get_valid_interfaces().update(interfaces)