Wrap lines with more than 80 chars

This commit is contained in:
Tomeu Vizoso 2010-08-12 16:03:40 +02:00
parent ead42a6945
commit fab271ac9c
3 changed files with 43 additions and 22 deletions

View File

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

View File

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

View File

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