pep8'd sugar3.presence
This commit is contained in:
parent
edbc8f53b3
commit
69a7aa8f68
@ -257,9 +257,11 @@ class Activity(GObject.GObject):
|
|||||||
if not self._joined:
|
if not self._joined:
|
||||||
raise RuntimeError('Cannot invite a buddy to an activity that is'
|
raise RuntimeError('Cannot invite a buddy to an activity that is'
|
||||||
'not shared.')
|
'not shared.')
|
||||||
self.telepathy_text_chan.AddMembers([buddy.contact_handle], message,
|
self.telepathy_text_chan.AddMembers(
|
||||||
|
[buddy.contact_handle], message,
|
||||||
dbus_interface=CHANNEL_INTERFACE_GROUP,
|
dbus_interface=CHANNEL_INTERFACE_GROUP,
|
||||||
reply_handler=partial(self.__invite_cb, response_cb),
|
reply_handler=partial(
|
||||||
|
self.__invite_cb, response_cb),
|
||||||
error_handler=partial(self.__invite_cb, response_cb))
|
error_handler=partial(self.__invite_cb, response_cb))
|
||||||
|
|
||||||
def __invite_cb(self, response_cb, error=None):
|
def __invite_cb(self, response_cb, error=None):
|
||||||
@ -305,7 +307,8 @@ class Activity(GObject.GObject):
|
|||||||
|
|
||||||
def _resolve_handles(self, input_handles, reply_cb):
|
def _resolve_handles(self, input_handles, reply_cb):
|
||||||
def get_handle_owners_cb(handles):
|
def get_handle_owners_cb(handles):
|
||||||
self.telepathy_conn.InspectHandles(HANDLE_TYPE_CONTACT, handles,
|
self.telepathy_conn.InspectHandles(
|
||||||
|
HANDLE_TYPE_CONTACT, handles,
|
||||||
reply_handler=reply_cb,
|
reply_handler=reply_cb,
|
||||||
error_handler=self.__error_handler_cb,
|
error_handler=self.__error_handler_cb,
|
||||||
dbus_interface=CONNECTION)
|
dbus_interface=CONNECTION)
|
||||||
@ -564,14 +567,19 @@ class _JoinCommand(_BaseCommand):
|
|||||||
def __get_self_handle_cb(self, handle):
|
def __get_self_handle_cb(self, handle):
|
||||||
self._global_self_handle = handle
|
self._global_self_handle = handle
|
||||||
|
|
||||||
self._connection.RequestChannel(CHANNEL_TYPE_TEXT,
|
self._connection.RequestChannel(
|
||||||
HANDLE_TYPE_ROOM, self.room_handle, True,
|
CHANNEL_TYPE_TEXT,
|
||||||
|
HANDLE_TYPE_ROOM,
|
||||||
|
self.room_handle, True,
|
||||||
reply_handler=self.__create_text_channel_cb,
|
reply_handler=self.__create_text_channel_cb,
|
||||||
error_handler=self.__error_handler_cb,
|
error_handler=self.__error_handler_cb,
|
||||||
dbus_interface=CONNECTION)
|
dbus_interface=CONNECTION)
|
||||||
|
|
||||||
self._connection.RequestChannel(CHANNEL_TYPE_TUBES,
|
self._connection.RequestChannel(
|
||||||
HANDLE_TYPE_ROOM, self.room_handle, True,
|
CHANNEL_TYPE_TUBES,
|
||||||
|
HANDLE_TYPE_ROOM,
|
||||||
|
self.room_handle,
|
||||||
|
True,
|
||||||
reply_handler=self.__create_tubes_channel_cb,
|
reply_handler=self.__create_tubes_channel_cb,
|
||||||
error_handler=self.__error_handler_cb,
|
error_handler=self.__error_handler_cb,
|
||||||
dbus_interface=CONNECTION)
|
dbus_interface=CONNECTION)
|
||||||
@ -634,7 +642,8 @@ class _JoinCommand(_BaseCommand):
|
|||||||
_logger.debug('%r: We are in local pending - entering', self)
|
_logger.debug('%r: We are in local pending - entering', self)
|
||||||
group.AddMembers([self_handle], '',
|
group.AddMembers([self_handle], '',
|
||||||
reply_handler=lambda: None,
|
reply_handler=lambda: None,
|
||||||
error_handler=lambda e: self._join_failed_cb(e,
|
error_handler=lambda e: self._join_failed_cb(
|
||||||
|
e,
|
||||||
'got_all_members AddMembers'))
|
'got_all_members AddMembers'))
|
||||||
|
|
||||||
if members:
|
if members:
|
||||||
|
@ -52,7 +52,8 @@ class ConnectionManager(object):
|
|||||||
for account_path in account_paths:
|
for account_path in account_paths:
|
||||||
obj = bus.get_object(ACCOUNT_MANAGER_SERVICE, account_path)
|
obj = bus.get_object(ACCOUNT_MANAGER_SERVICE, account_path)
|
||||||
obj.connect_to_signal('AccountPropertyChanged',
|
obj.connect_to_signal('AccountPropertyChanged',
|
||||||
partial(self.__account_property_changed_cb, account_path))
|
partial(self.__account_property_changed_cb,
|
||||||
|
account_path))
|
||||||
connection_path = obj.Get(ACCOUNT, 'Connection')
|
connection_path = obj.Get(ACCOUNT, 'Connection')
|
||||||
if connection_path != '/':
|
if connection_path != '/':
|
||||||
self._track_connection(account_path, connection_path)
|
self._track_connection(account_path, connection_path)
|
||||||
@ -71,7 +72,8 @@ class ConnectionManager(object):
|
|||||||
bus = dbus.SessionBus()
|
bus = dbus.SessionBus()
|
||||||
connection = bus.get_object(connection_name, connection_path)
|
connection = bus.get_object(connection_name, connection_path)
|
||||||
connection.connect_to_signal('StatusChanged',
|
connection.connect_to_signal('StatusChanged',
|
||||||
partial(self.__status_changed_cb, account_path))
|
partial(self.__status_changed_cb,
|
||||||
|
account_path))
|
||||||
self._connections_per_account[account_path] = \
|
self._connections_per_account[account_path] = \
|
||||||
Connection(account_path, connection)
|
Connection(account_path, connection)
|
||||||
|
|
||||||
@ -112,6 +114,8 @@ class ConnectionManager(object):
|
|||||||
|
|
||||||
|
|
||||||
_connection_manager = None
|
_connection_manager = None
|
||||||
|
|
||||||
|
|
||||||
def get_connection_manager():
|
def get_connection_manager():
|
||||||
global _connection_manager
|
global _connection_manager
|
||||||
if not _connection_manager:
|
if not _connection_manager:
|
||||||
|
@ -157,7 +157,8 @@ class PresenceService(GObject.GObject):
|
|||||||
if connection_path == tp_conn_path:
|
if connection_path == tp_conn_path:
|
||||||
connection_name = connection_path.replace('/', '.')[1:]
|
connection_name = connection_path.replace('/', '.')[1:]
|
||||||
connection = bus.get_object(connection_name, connection_path)
|
connection = bus.get_object(connection_name, connection_path)
|
||||||
contact_ids = connection.InspectHandles(HANDLE_TYPE_CONTACT,
|
contact_ids = connection.InspectHandles(
|
||||||
|
HANDLE_TYPE_CONTACT,
|
||||||
[handle],
|
[handle],
|
||||||
dbus_interface=CONNECTION)
|
dbus_interface=CONNECTION)
|
||||||
return self.get_buddy(account_path, contact_ids[0])
|
return self.get_buddy(account_path, contact_ids[0])
|
||||||
|
@ -62,9 +62,11 @@ class TubeConnection(Connection):
|
|||||||
# pylint: disable=W0201
|
# pylint: disable=W0201
|
||||||
# Confused by __new__
|
# Confused by __new__
|
||||||
self.self_handle = handle
|
self.self_handle = handle
|
||||||
match = self._tubes_iface.connect_to_signal('DBusNamesChanged',
|
match = self._tubes_iface.connect_to_signal(
|
||||||
|
'DBusNamesChanged',
|
||||||
self._on_dbus_names_changed)
|
self._on_dbus_names_changed)
|
||||||
self._tubes_iface.GetDBusNames(self.tube_id,
|
self._tubes_iface.GetDBusNames(
|
||||||
|
self.tube_id,
|
||||||
reply_handler=self._on_get_dbus_names_reply,
|
reply_handler=self._on_get_dbus_names_reply,
|
||||||
error_handler=self._on_get_dbus_names_error)
|
error_handler=self._on_get_dbus_names_error)
|
||||||
self._dbus_names_changed_match = match
|
self._dbus_names_changed_match = match
|
||||||
|
Loading…
Reference in New Issue
Block a user