Wrap lines with more than 80 chars

master
Tomeu Vizoso 14 years ago
parent ead42a6945
commit fab271ac9c

@ -80,7 +80,8 @@ class Activity(gobject.GObject):
'joined': (bool, None, None, False, gobject.PARAM_READABLE),
}
def __init__(self, account_path, connection, room_handle=None, properties=None):
def __init__(self, account_path, connection, room_handle=None,
properties=None):
if room_handle is None and properties is None:
raise ValueError('Need to pass one of room_handle or properties')
@ -286,7 +287,8 @@ class Activity(gobject.GObject):
channel.connect_to_signal('Closed', self.__text_channel_closed_cb)
def __get_all_members_cb(self, members, local_pending, remote_pending):
_logger.debug('__get_all_members_cb %r %r', members, self._text_channel_group_flags)
_logger.debug('__get_all_members_cb %r %r', members,
self._text_channel_group_flags)
if self._channel_self_handle in members:
members.remove(self._channel_self_handle)
@ -395,7 +397,8 @@ class Activity(gobject.GObject):
self.telepathy_text_chan = share_command.text_channel
self.telepathy_tubes_chan = share_command.tubes_channel
self._channel_self_handle = share_command.channel_self_handle
self._text_channel_group_flags = share_command.text_channel_group_flags
self._text_channel_group_flags = \
share_command.text_channel_group_flags
self._publish_properties()
self._start_tracking_properties()
self._start_tracking_buddies()
@ -417,7 +420,6 @@ class Activity(gobject.GObject):
properties['tags'] = self._tags
properties['private'] = self._private
logging.debug('_publish_properties calling SetProperties %r', properties)
self.telepathy_conn.SetProperties(
self.room_handle,
properties,
@ -601,7 +603,8 @@ class _JoinCommand(_BaseCommand):
self._add_self_to_channel()
def __text_channel_group_flags_changed_cb(self, added, removed):
_logger.debug('__text_channel_group_flags_changed_cb %r %r', added, removed)
_logger.debug('__text_channel_group_flags_changed_cb %r %r', added,
removed)
self.text_channel_group_flags |= added
self.text_channel_group_flags &= ~removed
@ -612,7 +615,10 @@ class _JoinCommand(_BaseCommand):
group = self.text_channel[CHANNEL_INTERFACE_GROUP]
def got_all_members(members, local_pending, remote_pending):
_logger.debug('got_all_members members %r local_pending %r remote_pending %r', members, local_pending, remote_pending)
_logger.debug('got_all_members members %r local_pending %r '
'remote_pending %r', members, local_pending,
remote_pending)
if self.text_channel_group_flags & \
CHANNEL_GROUP_FLAG_CHANNEL_SPECIFIC_HANDLES:
self_handle = self.channel_self_handle
@ -654,7 +660,11 @@ class _JoinCommand(_BaseCommand):
def __text_channel_members_changed_cb(self, message, added, removed,
local_pending, remote_pending,
actor, reason):
_logger.debug('__text_channel_members_changed_cb added %r removed %r local_pending %r remote_pending %r channel_self_handle %r', added, removed, local_pending, remote_pending, self.channel_self_handle)
_logger.debug('__text_channel_members_changed_cb added %r removed %r '
'local_pending %r remote_pending %r channel_self_handle '
'%r', added, removed, local_pending, remote_pending,
self.channel_self_handle)
if self.text_channel_group_flags & \
CHANNEL_GROUP_FLAG_CHANNEL_SPECIFIC_HANDLES:
self_handle = self.channel_self_handle

@ -131,7 +131,8 @@ class BaseBuddy(gobject.GObject):
return activity
return None
current_activity = gobject.property(type=object, getter=get_current_activity)
current_activity = gobject.property(type=object,
getter=get_current_activity)
def get_owner(self):
return self._owner
@ -139,7 +140,8 @@ class BaseBuddy(gobject.GObject):
def set_owner(self, owner):
self._owner = owner
owner = gobject.property(type=bool, getter=get_owner, setter=set_owner, default=False)
owner = gobject.property(type=bool, getter=get_owner, setter=set_owner,
default=False)
def get_ip4_address(self):
return self._ip4_address
@ -147,7 +149,8 @@ class BaseBuddy(gobject.GObject):
def set_ip4_address(self, ip4_address):
self._ip4_address = ip4_address
ip4_address = gobject.property(type=str, getter=get_ip4_address, setter=set_ip4_address)
ip4_address = gobject.property(type=str, getter=get_ip4_address,
setter=set_ip4_address)
def get_tags(self):
return self._tags
@ -333,8 +336,8 @@ class Buddy(BaseBuddy):
def do_get_property(self, pspec):
if pspec.name == 'nick' and self._get_attributes_call is not None:
_logger.debug('%r: Blocking on GetContactAttributes() because someone '
'wants property nick', self)
_logger.debug('%r: Blocking on GetContactAttributes() because '
'someone wants property nick', self)
self._get_attributes_call.block()
elif pspec.name != 'nick' and self._get_properties_call is not None:
_logger.debug('%r: Blocking on GetProperties() because someone '

@ -264,7 +264,8 @@ class PresenceService(gobject.GObject):
return self._activity_cache
else:
connection_manager = get_connection_manager()
connections_per_account = connection_manager.get_connections_per_account()
connections_per_account = \
connection_manager.get_connections_per_account()
for account_path, connection in connections_per_account.items():
if not connection.connected:
continue
@ -272,8 +273,10 @@ class PresenceService(gobject.GObject):
try:
room_handle = connection.connection.GetActivity(activity_id)
except dbus.exceptions.DBusException, e:
if e.get_dbus_name() == 'org.freedesktop.Telepathy.Error.NotAvailable':
logging.debug("There's no shared activity with the id %s", activity_id)
name = 'org.freedesktop.Telepathy.Error.NotAvailable'
if e.get_dbus_name() == name:
logging.debug("There's no shared activity with the id "
"%s", activity_id)
else:
raise
else:
@ -292,7 +295,8 @@ class PresenceService(gobject.GObject):
return self._activity_cache
else:
connection_manager = get_connection_manager()
account_path = connection_manager.get_account_for_connection(connection_path)
account_path = \
connection_manager.get_account_for_connection(connection_path)
connection_name = connection_path.replace('/', '.')[1:]
bus = dbus.SessionBus()
@ -386,11 +390,12 @@ class PresenceService(gobject.GObject):
connection_name = connection_path.replace('/', '.')[1:]
connection = bus.get_object(connection_name, connection_path)
contact_ids = connection.InspectHandles(HANDLE_TYPE_CONTACT,
[handle],
dbus_interface=CONNECTION)
[handle],
dbus_interface=CONNECTION)
return self.get_buddy(account_path, contact_ids[0])
raise ValueError('Unknown buddy in connection %s with handle %d', tp_conn_path, handle)
raise ValueError('Unknown buddy in connection %s with handle %d',
tp_conn_path, handle)
def get_owner(self):
"""Retrieves the laptop Buddy object."""
@ -425,11 +430,14 @@ class PresenceService(gobject.GObject):
properties['private'] = private
if self._activity_cache is not None:
raise ValueError('Activity %s is already tracked', activity.get_id())
raise ValueError('Activity %s is already tracked',
activity.get_id())
connection_manager = get_connection_manager()
account_path, connection = connection_manager.get_preferred_connection()
shared_activity = Activity(account_path, connection, properties=properties)
account_path, connection = \
connection_manager.get_preferred_connection()
shared_activity = Activity(account_path, connection,
properties=properties)
self._activity_cache = shared_activity
"""

Loading…
Cancel
Save