Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu.vizoso@collabora.co.uk>2010-08-12 15:07:42 (GMT)
committer Tomeu Vizoso <tomeu.vizoso@collabora.co.uk>2010-08-20 13:02:28 (GMT)
commit5964998376e57ca9831a8c7228d01386a49ec270 (patch)
tree29c6c9c0af7295d55e14a09e67e87409a5af7527
parentc9363eb150064d848b3af81a23fb59b8a1ca0683 (diff)
Misc. pylint fixes
-rw-r--r--src/jarabe/desktop/meshbox.py12
-rw-r--r--src/jarabe/frame/activitiestray.py13
-rw-r--r--src/jarabe/frame/friendstray.py5
-rw-r--r--src/jarabe/model/buddy.py19
-rw-r--r--src/jarabe/model/invites.py19
-rw-r--r--src/jarabe/model/neighborhood.py126
-rw-r--r--src/jarabe/model/shell.py4
-rw-r--r--src/jarabe/model/telepathyclient.py8
-rw-r--r--src/jarabe/view/buddymenu.py3
9 files changed, 124 insertions, 85 deletions
diff --git a/src/jarabe/desktop/meshbox.py b/src/jarabe/desktop/meshbox.py
index 57e7386..cf72053 100644
--- a/src/jarabe/desktop/meshbox.py
+++ b/src/jarabe/desktop/meshbox.py
@@ -1,6 +1,7 @@
# Copyright (C) 2006-2007 Red Hat, Inc.
# Copyright (C) 2009 Tomeu Vizoso, Simon Schampijer
# Copyright (C) 2009-2010 One Laptop per Child
+# Copyright (C) 2010 Collabora Ltd. <http://www.collabora.co.uk/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,19 +32,15 @@ from sugar.graphics import style
from sugar.graphics import palette
from sugar.graphics import iconentry
from sugar.graphics.menuitem import MenuItem
-from sugar.activity.activityhandle import ActivityHandle
-from sugar.activity import activityfactory
from jarabe.model import neighborhood
-from jarabe.model import buddy
+from jarabe.model.buddy import get_owner_instance
from jarabe.view.buddyicon import BuddyIcon
-from jarabe.view import launcher
from jarabe.desktop.snowflakelayout import SnowflakeLayout
from jarabe.desktop.spreadlayout import SpreadLayout
from jarabe.desktop.networkviews import WirelessNetworkView
from jarabe.desktop.networkviews import OlpcMeshView
from jarabe.desktop.networkviews import SugarAdhocView
-from jarabe.model import bundleregistry
from jarabe.model import network
from jarabe.model.network import AccessPoint
from jarabe.model.olpcmesh import OlpcMeshManager
@@ -102,7 +99,7 @@ class ActivityView(hippo.CanvasBox):
icon=p_icon)
private = self._model.props.private
- joined = buddy.get_owner_instance() in self._model.props.buddies
+ joined = get_owner_instance() in self._model.props.buddies
if joined:
item = MenuItem(_('Resume'), 'activity-start')
@@ -498,7 +495,8 @@ class MeshBox(gtk.VBox):
icon.destroy()
def __buddy_notify_current_activity_cb(self, buddy_model, pspec):
- logging.debug('MeshBox.__buddy_notify_current_activity_cb %s', buddy_model.props.current_activity)
+ logging.debug('MeshBox.__buddy_notify_current_activity_cb %s',
+ buddy_model.props.current_activity)
if buddy_model.props.current_activity is None:
if not buddy_model.props.key in self._buddies:
self._add_buddy(buddy_model)
diff --git a/src/jarabe/frame/activitiestray.py b/src/jarabe/frame/activitiestray.py
index ba4c8fd..dd42467 100644
--- a/src/jarabe/frame/activitiestray.py
+++ b/src/jarabe/frame/activitiestray.py
@@ -1,5 +1,6 @@
# Copyright (C) 2006-2007 Red Hat, Inc.
# Copyright (C) 2008 One Laptop Per Child
+# Copyright (C) 2010 Collabora Ltd. <http://www.collabora.co.uk/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,20 +34,16 @@ from sugar.graphics.toolbutton import ToolButton
from sugar.graphics.icon import Icon, get_icon_file_name
from sugar.graphics.palette import Palette, WidgetInvoker
from sugar.graphics.menuitem import MenuItem
-from sugar.activity.activityhandle import ActivityHandle
-from sugar.activity import activityfactory
from sugar.datastore import datastore
from sugar import mime
from sugar import env
from jarabe.model import shell
-from jarabe.model import neighborhood
from jarabe.model import invites
from jarabe.model import bundleregistry
from jarabe.model import filetransfer
from jarabe.view.palettes import JournalPalette, CurrentActivityPalette
from jarabe.view.pulsingicon import PulsingIcon
-from jarabe.view import launcher
from jarabe.frame.frameinvoker import FrameWidgetInvoker
from jarabe.frame.notification import NotificationIcon
import jarabe.frame
@@ -197,9 +194,9 @@ class InvitePalette(Palette):
self._invite.join()
def __decline_activate_cb(self, menu_item):
- invites = invites.get_instance()
+ invites_model = invites.get_instance()
activity_id = self._activity_model.get_id()
- invites.remove_activity(activity_id)
+ invites_model.remove_activity(activity_id)
class ActivitiesTray(HTray):
@@ -284,10 +281,10 @@ class ActivitiesTray(HTray):
def __invite_clicked_cb(self, icon, invite):
self._invites.remove_invite(invite)
- def __invite_added_cb(self, invites, invite):
+ def __invite_added_cb(self, invites_model, invite):
self._add_invite(invite)
- def __invite_removed_cb(self, invites, invite):
+ def __invite_removed_cb(self, invites_model, invite):
self._remove_invite(invite)
def _add_invite(self, invite):
diff --git a/src/jarabe/frame/friendstray.py b/src/jarabe/frame/friendstray.py
index 0e4d391..141505b 100644
--- a/src/jarabe/frame/friendstray.py
+++ b/src/jarabe/frame/friendstray.py
@@ -21,7 +21,7 @@ from sugar.graphics.tray import VTray, TrayIcon
from jarabe.view.buddymenu import BuddyMenu
from jarabe.frame.frameinvoker import FrameWidgetInvoker
from jarabe.model import shell
-from jarabe.model.buddy import BuddyModel, get_owner_instance
+from jarabe.model.buddy import get_owner_instance
from jarabe.model import neighborhood
class FriendIcon(TrayIcon):
@@ -70,7 +70,8 @@ class FriendsTray(VTray):
item.destroy()
self._buddies = {}
- def __neighborhood_activity_added_cb(self, neighborhood, shared_activity):
+ def __neighborhood_activity_added_cb(self, neighborhood_model,
+ shared_activity):
logging.debug('FriendsTray.__neighborhood_activity_added_cb')
self.clear()
diff --git a/src/jarabe/model/buddy.py b/src/jarabe/model/buddy.py
index 3deb2cf..6cf7be9 100644
--- a/src/jarabe/model/buddy.py
+++ b/src/jarabe/model/buddy.py
@@ -1,4 +1,5 @@
# Copyright (C) 2006-2007 Red Hat, Inc.
+# Copyright (C) 2010 Collabora Ltd. <http://www.collabora.co.uk/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -109,13 +110,15 @@ class OwnerBuddyModel(BaseBuddyModel):
client = gconf.client_get_default()
self.props.nick = client.get_string('/desktop/sugar/user/nick')
- self.props.color = XoColor(client.get_string('/desktop/sugar/user/color'))
+ color = client.get_string('/desktop/sugar/user/color')
+ self.props.color = XoColor(color)
self.props.key = get_profile().pubkey
self.connect('notify::nick', self.__property_changed_cb)
self.connect('notify::color', self.__property_changed_cb)
- self.connect('notify::current-activity', self.__current_activity_changed_cb)
+ self.connect('notify::current-activity',
+ self.__current_activity_changed_cb)
bus = dbus.SessionBus()
bus.add_signal_receiver(
@@ -123,8 +126,9 @@ class OwnerBuddyModel(BaseBuddyModel):
signal_name='NameOwnerChanged',
dbus_interface='org.freedesktop.DBus')
- bus_object = bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus')
- for service in bus_object.ListNames(dbus_interface='org.freedesktop.DBus'):
+ bus_object = bus.get_object(dbus.BUS_DAEMON_NAME, dbus.BUS_DAEMON_PATH)
+ for service in bus_object.ListNames(
+ dbus_interface=dbus.BUS_DAEMON_IFACE):
if service.startswith('org.freedesktop.Telepathy.Connection.'):
path = '/%s' % service.replace('.', '/')
Connection(service, path, bus,
@@ -136,8 +140,7 @@ class OwnerBuddyModel(BaseBuddyModel):
def __name_owner_changed_cb(self, name, old, new):
if name.startswith(CONNECTION) and not old and new:
path = '/' + name.replace('.', '/')
- connection = Connection(name, path,
- ready_handler=self.__connection_ready_cb)
+ Connection(name, path, ready_handler=self.__connection_ready_cb)
def __property_changed_cb(self, pspec):
self._sync_properties()
@@ -193,7 +196,7 @@ class OwnerBuddyModel(BaseBuddyModel):
return True
def get_buddy(self):
- return None
+ raise NotImplementedError
_owner_instance = None
@@ -243,3 +246,5 @@ class FriendBuddyModel(BuddyModel):
def __init__(self, nick, key):
BuddyModel.__init__(self, nick=nick, key=key)
+ def get_buddy(self):
+ raise NotImplementedError
diff --git a/src/jarabe/model/invites.py b/src/jarabe/model/invites.py
index 64a6277..cdb28cf 100644
--- a/src/jarabe/model/invites.py
+++ b/src/jarabe/model/invites.py
@@ -1,4 +1,5 @@
# Copyright (C) 2006-2007 Red Hat, Inc.
+# Copyright (C) 2010 Collabora Ltd. <http://www.collabora.co.uk/>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -37,7 +38,8 @@ from jarabe.model import bundleregistry
from jarabe.model import neighborhood
from jarabe.journal import misc
-CONNECTION_INTERFACE_ACTIVITY_PROPERTIES = 'org.laptop.Telepathy.ActivityProperties'
+CONNECTION_INTERFACE_ACTIVITY_PROPERTIES = \
+ 'org.laptop.Telepathy.ActivityProperties'
class ActivityInvite(object):
@@ -84,7 +86,8 @@ class ActivityInvite(object):
activity_id=activity_id)
def __name_owner_changed_cb(self, name, old_owner, new_owner):
- logging.debug('ActivityInvite.__name_owner_changed_cb %r %r %r', name, new_owner, old_owner)
+ logging.debug('ActivityInvite.__name_owner_changed_cb %r %r %r', name,
+ new_owner, old_owner)
if name == self._handler and new_owner and not old_owner:
self._call_handle_with()
@@ -131,7 +134,8 @@ class Invites(gobject.GObject):
if handle_type == HANDLE_TYPE_ROOM and \
channel_type == CHANNEL_TYPE_TEXT:
logging.debug('May be an activity, checking its properties')
- connection_path = properties[CHANNEL_DISPATCH_OPERATION + '.Connection']
+ connection_path = properties[CHANNEL_DISPATCH_OPERATION +
+ '.Connection']
connection_name = connection_path.replace('/', '.')[1:]
bus = dbus.Bus()
@@ -159,7 +163,8 @@ class Invites(gobject.GObject):
def __error_handler_cb(self, handle, channel_properties,
dispatch_operation_path, error):
logging.debug('__error_handler_cb %r', error)
- if error.get_dbus_name() == 'org.freedesktop.Telepathy.Error.NotAvailable':
+ exception_name = 'org.freedesktop.Telepathy.Error.NotAvailable'
+ if error.get_dbus_name() == exception_name:
self._dispatch_non_sugar_invitation(handle,
channel_properties,
dispatch_operation_path)
@@ -177,7 +182,8 @@ class Invites(gobject.GObject):
elif channel_type == CHANNEL_TYPE_STREAMED_MEDIA:
handler = CLIENT + '.org.laptop.VideoChat'
elif channel_type == CHANNEL_TYPE_DBUS_TUBE:
- handler = channel_properties[CHANNEL_TYPE_DBUS_TUBE + '.ServiceName']
+ handler = channel_properties[CHANNEL_TYPE_DBUS_TUBE +
+ '.ServiceName']
elif channel_type == CHANNEL_TYPE_STREAM_TUBE:
handler = channel_properties[CHANNEL_TYPE_STREAM_TUBE + '.Service']
else:
@@ -204,7 +210,8 @@ class Invites(gobject.GObject):
def _add_invite(self, dispatch_operation_path, handle, handler,
activity_properties=None):
- logging.debug('_add_invite %r %r %r', dispatch_operation_path, handle, handler)
+ logging.debug('_add_invite %r %r %r', dispatch_operation_path, handle,
+ handler)
if dispatch_operation_path in self._dispatch_operations:
# there is no point to have more than one invite for the same
# dispatch operation
diff --git a/src/jarabe/model/neighborhood.py b/src/jarabe/model/neighborhood.py
index 018179e..3a17ba2 100644
--- a/src/jarabe/model/neighborhood.py
+++ b/src/jarabe/model/neighborhood.py
@@ -25,14 +25,7 @@ from telepathy.interfaces import ACCOUNT, \
ACCOUNT_MANAGER, \
CHANNEL, \
CHANNEL_INTERFACE_GROUP, \
- CHANNEL_DISPATCHER, \
- CHANNEL_REQUEST, \
CHANNEL_TYPE_CONTACT_LIST, \
- CHANNEL_TYPE_DBUS_TUBE, \
- CHANNEL_TYPE_STREAMED_MEDIA, \
- CHANNEL_TYPE_STREAM_TUBE, \
- CHANNEL_TYPE_TEXT, \
- CLIENT, \
CONNECTION, \
CONNECTION_INTERFACE_ALIASING, \
CONNECTION_INTERFACE_CONTACTS, \
@@ -45,7 +38,6 @@ from telepathy.constants import HANDLE_TYPE_LIST, \
from telepathy.client import Connection, Channel
from sugar.graphics.xocolor import XoColor
-from sugar import activity
from sugar.profile import get_profile
from jarabe.model.buddy import BuddyModel, get_owner_instance
@@ -59,7 +51,8 @@ SUGAR_CLIENT_SERVICE = 'org.freedesktop.Telepathy.Client.Sugar'
SUGAR_CLIENT_PATH = '/org/freedesktop/Telepathy/Client/Sugar'
CONNECTION_INTERFACE_BUDDY_INFO = 'org.laptop.Telepathy.BuddyInfo'
-CONNECTION_INTERFACE_ACTIVITY_PROPERTIES = 'org.laptop.Telepathy.ActivityProperties'
+CONNECTION_INTERFACE_ACTIVITY_PROPERTIES = \
+ 'org.laptop.Telepathy.ActivityProperties'
class ActivityModel(gobject.GObject):
__gsignals__ = {
@@ -79,6 +72,8 @@ class ActivityModel(gobject.GObject):
self.room_handle = room_handle
self._bundle = None
self._color = None
+ self._private = True
+ self._name = None
self._current_buddies = []
self._buddies = []
@@ -112,7 +107,8 @@ class ActivityModel(gobject.GObject):
def set_private(self, private):
self._private = private
- private = gobject.property(type=object, getter=is_private, setter=set_private)
+ private = gobject.property(type=object, getter=is_private,
+ setter=set_private)
def get_buddies(self):
return self._buddies
@@ -178,6 +174,7 @@ class _Account(gobject.GObject):
self._connection = None
self._buddy_handles = {}
self._activity_handles = {}
+ self._self_handle = None
self._buddies_per_activity = {}
self._activities_per_buddy = {}
@@ -217,14 +214,14 @@ class _Account(gobject.GObject):
self._prepare_connection(properties['Connection'])
def _prepare_connection(self, connection_path):
- self._connection_path = connection_path
connection_name = connection_path.replace('/', '.')[1:]
self._connection = Connection(connection_name, connection_path,
ready_handler=self.__connection_ready_cb)
def __connection_ready_cb(self, connection):
- logging.debug('_Account.__connection_ready_cb %r', connection.object_path)
+ logging.debug('_Account.__connection_ready_cb %r',
+ connection.object_path)
connection.connect_to_signal('StatusChanged',
self.__status_changed_cb)
@@ -235,7 +232,8 @@ class _Account(gobject.GObject):
'Connection.GetStatus'))
def __get_status_cb(self, status):
- logging.debug('_Account.__get_status_cb %r %r', self._connection.object_path, status)
+ logging.debug('_Account.__get_status_cb %r %r',
+ self._connection.object_path, status)
self._update_status(status)
def __status_changed_cb(self, status, reason):
@@ -294,7 +292,8 @@ class _Account(gobject.GObject):
'properties', self._connection.object_path)
if CONNECTION_INTERFACE_ACTIVITY_PROPERTIES in self._connection:
- connection = self._connection[CONNECTION_INTERFACE_ACTIVITY_PROPERTIES]
+ connection = self._connection[
+ CONNECTION_INTERFACE_ACTIVITY_PROPERTIES]
connection.connect_to_signal(
'ActivityPropertiesChanged',
self.__activity_properties_changed_cb)
@@ -326,7 +325,8 @@ class _Account(gobject.GObject):
logging.debug('_Account.__aliases_changed_cb')
for handle, alias in aliases:
if handle in self._buddy_handles:
- logging.debug('Got handle %r with nick %r, going to update', handle, alias)
+ logging.debug('Got handle %r with nick %r, going to update',
+ handle, alias)
def __presences_changed_cb(self, presences):
logging.debug('_Account.__presences_changed_cb %r', presences)
@@ -338,23 +338,29 @@ class _Account(gobject.GObject):
self.emit('buddy-removed', handle)
def __buddy_info_updated_cb(self, handle, properties):
- logging.debug('_Account.__buddy_info_updated_cb %r %r', handle, properties)
+ logging.debug('_Account.__buddy_info_updated_cb %r %r', handle,
+ properties)
- def __current_activity_changed_cb(self, contact_handle, activity_id, room_handle):
- logging.debug('_Account.__current_activity_changed_cb %r %r %r', contact_handle, activity_id, room_handle)
+ def __current_activity_changed_cb(self, contact_handle, activity_id,
+ room_handle):
+ logging.debug('_Account.__current_activity_changed_cb %r %r %r',
+ contact_handle, activity_id, room_handle)
if contact_handle in self._buddy_handles:
contact_id = self._buddy_handles[contact_handle]
if not activity_id and room_handle:
activity_id = self._activity_handles.get(room_handle, '')
self.emit('current-activity-updated', contact_id, activity_id)
- def __get_current_activity_cb(self, contact_handle, activity_id, room_handle):
- logging.debug('_Account.__get_current_activity_cb %r %r %r', contact_handle, activity_id, room_handle)
+ def __get_current_activity_cb(self, contact_handle, activity_id,
+ room_handle):
+ logging.debug('_Account.__get_current_activity_cb %r %r %r',
+ contact_handle, activity_id, room_handle)
contact_id = self._buddy_handles[contact_handle]
self.emit('current-activity-updated', contact_id, activity_id)
def __buddy_activities_changed_cb(self, buddy_handle, activities):
- logging.debug('_Account.__buddy_activities_changed_cb %r %r', buddy_handle, activities)
+ logging.debug('_Account.__buddy_activities_changed_cb %r %r',
+ buddy_handle, activities)
self._update_buddy_activities(buddy_handle, activities)
def _update_buddy_activities(self, buddy_handle, activities):
@@ -370,9 +376,11 @@ class _Account(gobject.GObject):
self._activity_handles[room_handle] = activity_id
self.emit('activity-added', room_handle, activity_id)
- connection = self._connection[CONNECTION_INTERFACE_ACTIVITY_PROPERTIES]
+ connection = self._connection[
+ CONNECTION_INTERFACE_ACTIVITY_PROPERTIES]
connection.GetProperties(room_handle,
- reply_handler=partial(self.__get_properties_cb, room_handle),
+ reply_handler=partial(self.__get_properties_cb,
+ room_handle),
error_handler=partial(self.__error_handler_cb,
'ActivityProperties.GetProperties'))
@@ -382,7 +390,8 @@ class _Account(gobject.GObject):
connection = self._connection[CONNECTION_INTERFACE_BUDDY_INFO]
connection.GetCurrentActivity(
buddy_handle,
- reply_handler=partial(self.__get_current_activity_cb, buddy_handle),
+ reply_handler=partial(self.__get_current_activity_cb,
+ buddy_handle),
error_handler=partial(self.__error_handler_cb,
'BuddyInfo.GetCurrentActivity'))
@@ -396,13 +405,15 @@ class _Account(gobject.GObject):
self._buddy_handles[buddy_handle],
activity_id)
- current_activity_ids = [activity_id for activity_id, room_handle in activities]
+ current_activity_ids = \
+ [activity_id for activity_id, room_handle in activities]
for activity_id in self._activities_per_buddy[buddy_handle].copy():
if not activity_id in current_activity_ids:
self._remove_buddy_from_activity(buddy_handle, activity_id)
def __get_properties_cb(self, room_handle, properties):
- logging.debug('_Account.__get_properties_cb %r %r', room_handle, properties)
+ logging.debug('_Account.__get_properties_cb %r %r', room_handle,
+ properties)
if properties:
self._update_activity(room_handle, properties)
@@ -429,7 +440,8 @@ class _Account(gobject.GObject):
self.emit('activity-removed', activity_id)
def __activity_properties_changed_cb(self, room_handle, properties):
- logging.debug('_Account.__activity_properties_changed_cb %r %r', room_handle, properties)
+ logging.debug('_Account.__activity_properties_changed_cb %r %r',
+ room_handle, properties)
self._update_activity(room_handle, properties)
def _update_activity(self, room_handle, properties):
@@ -437,7 +449,8 @@ class _Account(gobject.GObject):
self.emit('activity-updated', self._activity_handles[room_handle],
properties)
else:
- logging.debug('_Account.__activity_properties_changed_cb unknown activity')
+ logging.debug('_Account.__activity_properties_changed_cb unknown '
+ 'activity')
# We don't get ActivitiesChanged for the owner of the connection,
# so we query for its activities in order to find out.
if CONNECTION_INTERFACE_BUDDY_INFO in self._connection:
@@ -476,26 +489,33 @@ class _Account(gobject.GObject):
self.emit('buddy-updated', self._buddy_handles[handle], properties)
def __get_contact_attributes_cb(self, attributes):
- logging.debug('_Account.__get_contact_attributes_cb %r', attributes.keys())
+ logging.debug('_Account.__get_contact_attributes_cb %r',
+ attributes.keys())
for handle in attributes.keys():
nick = attributes[handle][CONNECTION_INTERFACE_ALIASING + '/alias']
- if handle in self._buddy_handles and not self._buddy_handles[handle] is None:
- logging.debug('Got handle %r with nick %r, going to update', handle, nick)
- self.emit('buddy-updated', self._buddy_handles[handle], attributes[handle])
+ if handle in self._buddy_handles and \
+ not self._buddy_handles[handle] is None:
+ logging.debug('Got handle %r with nick %r, going to update',
+ handle, nick)
+ self.emit('buddy-updated', self._buddy_handles[handle],
+ attributes[handle])
else:
- logging.debug('Got handle %r with nick %r, going to add', handle, nick)
+ logging.debug('Got handle %r with nick %r, going to add',
+ handle, nick)
contact_id = attributes[handle][CONNECTION + '/contact-id']
self._buddy_handles[handle] = contact_id
if CONNECTION_INTERFACE_BUDDY_INFO in self._connection:
- connection = self._connection[CONNECTION_INTERFACE_BUDDY_INFO]
+ connection = \
+ self._connection[CONNECTION_INTERFACE_BUDDY_INFO]
connection.GetProperties(
handle,
- reply_handler=partial(self.__got_buddy_info_cb, handle, nick),
+ reply_handler=partial(self.__got_buddy_info_cb, handle,
+ nick),
error_handler=partial(self.__error_handler_cb,
'BuddyInfo.GetProperties'),
byte_arrays=True)
@@ -508,14 +528,16 @@ class _Account(gobject.GObject):
connection.GetCurrentActivity(
handle,
- reply_handler=partial(self.__get_current_activity_cb, handle),
+ reply_handler=partial(self.__get_current_activity_cb,
+ handle),
error_handler=partial(self.__error_handler_cb,
'BuddyInfo.GetCurrentActivity'))
else:
self.emit('buddy-added', contact_id, nick, None)
def __got_activities_cb(self, buddy_handle, activities):
- logging.debug('_Account.__got_activities_cb %r %r', buddy_handle, activities)
+ logging.debug('_Account.__got_activities_cb %r %r', buddy_handle,
+ activities)
self._update_buddy_activities(buddy_handle, activities)
def enable(self):
@@ -569,7 +591,8 @@ class Neighborhood(gobject.GObject):
error_handler=self.__error_handler_cb)
def __got_accounts_cb(self, account_paths):
- self._link_local_account = self._ensure_link_local_account(account_paths)
+ self._link_local_account = \
+ self._ensure_link_local_account(account_paths)
self._connect_to_account(self._link_local_account)
self._server_account = self._ensure_server_account(account_paths)
@@ -635,7 +658,8 @@ class Neighborhood(gobject.GObject):
obj = bus.get_object(ACCOUNT_MANAGER_SERVICE, ACCOUNT_MANAGER_PATH)
account_manager = dbus.Interface(obj, ACCOUNT_MANAGER)
account_path = account_manager.CreateAccount('salut', 'local-xmpp',
- 'salut', params, properties)
+ 'salut', params,
+ properties)
return _Account(account_path)
def _ensure_server_account(self, account_paths):
@@ -701,7 +725,8 @@ class Neighborhood(gobject.GObject):
def __buddy_updated_cb(self, account, contact_id, properties):
logging.debug('__buddy_updated_cb %r %r', contact_id, properties)
if contact_id not in self._buddies:
- logging.debug('__buddy_updated_cb Unknown buddy with contact_id %r', contact_id)
+ logging.debug('__buddy_updated_cb Unknown buddy with contact_id %r',
+ contact_id)
return
buddy = self._buddies[contact_id]
@@ -711,7 +736,8 @@ class Neighborhood(gobject.GObject):
def __buddy_removed_cb(self, account, contact_id):
logging.debug('Neighborhood.__buddy_removed_cb %r', contact_id)
if contact_id not in self._buddies:
- logging.debug('Neighborhood.__buddy_removed_cb Unknown buddy with contact_id %r', contact_id)
+ logging.debug('Neighborhood.__buddy_removed_cb Unknown buddy with '
+ 'contact_id %r', contact_id)
return
buddy = self._buddies[contact_id]
@@ -730,7 +756,8 @@ class Neighborhood(gobject.GObject):
def __activity_updated_cb(self, account, activity_id, properties):
logging.debug('__activity_updated_cb %r %r', activity_id, properties)
if activity_id not in self._activities:
- logging.debug('__activity_updated_cb Unknown activity with activity_id %r', activity_id)
+ logging.debug('__activity_updated_cb Unknown activity with '
+ 'activity_id %r', activity_id)
return
registry = bundleregistry.get_registry()
@@ -762,7 +789,8 @@ class Neighborhood(gobject.GObject):
self.emit('activity-removed', activity)
def __current_activity_updated_cb(self, account, contact_id, activity_id):
- logging.debug('__current_activity_updated_cb %r %r', contact_id, activity_id)
+ logging.debug('__current_activity_updated_cb %r %r', contact_id,
+ activity_id)
if contact_id not in self._buddies:
logging.debug('__current_activity_updated_cb Unknown buddy with '
'contact_id %r', contact_id)
@@ -787,22 +815,26 @@ class Neighborhood(gobject.GObject):
def __buddy_joined_activity_cb(self, account, contact_id, activity_id):
if contact_id not in self._buddies:
- logging.debug('__buddy_joined_activity_cb Unknown buddy with contact_id %r', contact_id)
+ logging.debug('__buddy_joined_activity_cb Unknown buddy with '
+ 'contact_id %r', contact_id)
return
if activity_id not in self._activities:
- logging.debug('__buddy_joined_activity_cb Unknown activity with activity_id %r', activity_id)
+ logging.debug('__buddy_joined_activity_cb Unknown activity with '
+ 'activity_id %r', activity_id)
return
self._activities[activity_id].add_buddy(self._buddies[contact_id])
def __buddy_left_activity_cb(self, account, contact_id, activity_id):
if contact_id not in self._buddies:
- logging.debug('__buddy_left_activity_cb Unknown buddy with contact_id %r', contact_id)
+ logging.debug('__buddy_left_activity_cb Unknown buddy with '
+ 'contact_id %r', contact_id)
return
if activity_id not in self._activities:
- logging.debug('__buddy_left_activity_cb Unknown activity with activity_id %r', activity_id)
+ logging.debug('__buddy_left_activity_cb Unknown activity with '
+ 'activity_id %r', activity_id)
return
self._activities[activity_id].remove_buddy(self._buddies[contact_id])
diff --git a/src/jarabe/model/shell.py b/src/jarabe/model/shell.py
index f5a1ab9..db0e050 100644
--- a/src/jarabe/model/shell.py
+++ b/src/jarabe/model/shell.py
@@ -27,7 +27,6 @@ import dbus
from sugar import wm
from sugar import dispatch
from sugar.graphics.xocolor import XoColor
-from sugar.presence import presenceservice
from jarabe.model.bundleregistry import get_registry
from jarabe.model import neighborhood
@@ -146,8 +145,6 @@ class Activity(gobject.GObject):
have an entry (implying that this is not a Sugar-shared application)
uses the local user's profile colour for the icon.
"""
- pservice = presenceservice.get_instance()
-
# HACK to suppress warning in logs when activity isn't found
# (if it's locally launched and not shared yet)
activity = None
@@ -358,7 +355,6 @@ class ShellModel(gobject.GObject):
self._activities = []
self._active_activity = None
self._tabbing_activity = None
- self._pservice = presenceservice.get_instance()
self._launchers = {}
self._screen.toggle_showing_desktop(True)
diff --git a/src/jarabe/model/telepathyclient.py b/src/jarabe/model/telepathyclient.py
index 7554743..f4eccc3 100644
--- a/src/jarabe/model/telepathyclient.py
+++ b/src/jarabe/model/telepathyclient.py
@@ -63,8 +63,9 @@ class TelepathyClient(dbus.service.Object, DBusProperties):
in_signature='ooa(oa{sv})aota{sv}', out_signature='')
def HandleChannels(self, account, connection, channels, requests_satisfied,
user_action_time, handler_info):
- logging.debug('HandleChannels\n%r\n%r\n%r\n%r\n%r\n%r\n', account, connection,
- channels, requests_satisfied, user_action_time, handler_info)
+ logging.debug('HandleChannels\n%r\n%r\n%r\n%r\n%r\n%r\n', account,
+ connection, channels, requests_satisfied,
+ user_action_time, handler_info)
for channel in channels:
self.got_channel.send(self, account=account,
connection=connection, channel=channel)
@@ -81,7 +82,8 @@ class TelepathyClient(dbus.service.Object, DBusProperties):
properties, success_cb, error_cb_):
success_cb()
try:
- logging.debug('AddDispatchOperation\n%r\n%r\n%r', channels, dispatch_operation_path, properties)
+ logging.debug('AddDispatchOperation\n%r\n%r\n%r', channels,
+ dispatch_operation_path, properties)
self.got_dispatch_operation.send(self, channels=channels,
dispatch_operation_path=dispatch_operation_path,
diff --git a/src/jarabe/view/buddymenu.py b/src/jarabe/view/buddymenu.py
index 9d74aa0..76cca9a 100644
--- a/src/jarabe/view/buddymenu.py
+++ b/src/jarabe/view/buddymenu.py
@@ -155,7 +155,8 @@ class BuddyMenu(Palette):
service.InviteContact(self._buddy.props.account,
self._buddy.props.contact_id)
except dbus.DBusException, e:
- expected_exceptions = ['org.freedesktop.DBus.Error.UnknownMethod',
+ expected_exceptions = [
+ 'org.freedesktop.DBus.Error.UnknownMethod',
'org.freedesktop.DBus.Python.NotImplementedError']
if e.get_dbus_name() in expected_exceptions:
logging.warning('Trying deprecated Activity.Invite')