Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/sugar/presence
diff options
context:
space:
mode:
authorSascha Silbe <sascha@silbe.org>2009-08-25 17:55:48 (GMT)
committer Sascha Silbe <sascha@silbe.org>2009-08-25 17:55:48 (GMT)
commitecdaf6b795550158273ba3a0d582f7ff2bec3187 (patch)
tree11e289d68827c2db1851482efaa7f64da5af93cb /src/sugar/presence
parent6c3fd0346c1876ad501c3c91d50cdf42f7e0a9dc (diff)
trim EOL (end-of-line) spaces on source files
Diffstat (limited to 'src/sugar/presence')
-rw-r--r--src/sugar/presence/__init__.py2
-rw-r--r--src/sugar/presence/activity.py28
-rw-r--r--src/sugar/presence/buddy.py58
-rw-r--r--src/sugar/presence/presenceservice.py86
4 files changed, 87 insertions, 87 deletions
diff --git a/src/sugar/presence/__init__.py b/src/sugar/presence/__init__.py
index 1136c19..9756612 100644
--- a/src/sugar/presence/__init__.py
+++ b/src/sugar/presence/__init__.py
@@ -19,6 +19,6 @@
Provides a simplified API for accessing the dbus service
which coordinates native network presence and sharing
-information. This includes both "buddies" and "shared
+information. This includes both "buddies" and "shared
activities".
"""
diff --git a/src/sugar/presence/activity.py b/src/sugar/presence/activity.py
index 13abf5d..3102388 100644
--- a/src/sugar/presence/activity.py
+++ b/src/sugar/presence/activity.py
@@ -30,16 +30,16 @@ _logger = logging.getLogger('sugar.presence.activity')
class Activity(gobject.GObject):
"""UI interface for an Activity in the presence service
-
+
Activities in the presence service represent your and other user's
shared activities.
-
+
Properties:
- id
- color
- name
- type
- joined
+ id
+ color
+ name
+ type
+ joined
"""
__gsignals__ = {
'buddy-joined': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
@@ -74,7 +74,7 @@ class Activity(gobject.GObject):
self._ps_del_object = del_obj_cb
bobj = bus.get_object(self._PRESENCE_SERVICE, object_path)
self._activity = dbus.Interface(bobj, self._ACTIVITY_DBUS_INTERFACE)
- self._activity.connect_to_signal('BuddyHandleJoined',
+ self._activity.connect_to_signal('BuddyHandleJoined',
self._buddy_handle_joined_cb)
self._activity.connect_to_signal('BuddyLeft',
self._buddy_left_cb)
@@ -211,7 +211,7 @@ class Activity(gobject.GObject):
def _emit_buddy_left_signal(self, object_path):
"""Generate buddy-left GObject signal with presence Buddy object
-
+
XXX note use of _ps_new_object instead of _ps_del_object here
"""
self.emit('buddy-left', self._ps_new_object(object_path))
@@ -225,8 +225,8 @@ class Activity(gobject.GObject):
self._handle_to_buddy_path.pop(handle, None)
def _emit_new_channel_signal(self, object_path):
- """Generate new-channel GObject signal with channel object path
-
+ """Generate new-channel GObject signal with channel object path
+
New telepathy-python communications channel has been opened
"""
self.emit('new-channel', object_path)
@@ -255,7 +255,7 @@ class Activity(gobject.GObject):
def get_buddy_by_handle(self, handle):
"""Retrieve the Buddy object given a telepathy handle.
-
+
buddy object paths are cached in self._handle_to_buddy_path,
so we can get the buddy without calling PS.
"""
@@ -378,8 +378,8 @@ class Activity(gobject.GObject):
# GetChannels() wrapper
def get_channels(self):
- """Retrieve communications channel descriptions for the activity
-
+ """Retrieve communications channel descriptions for the activity
+
Returns a tuple containing:
- the D-Bus well-known service name of the connection
(FIXME: this is redundant; in Telepathy it can be derived
diff --git a/src/sugar/presence/buddy.py b/src/sugar/presence/buddy.py
index 877a798..f97682a 100644
--- a/src/sugar/presence/buddy.py
+++ b/src/sugar/presence/buddy.py
@@ -26,17 +26,17 @@ import dbus
class Buddy(gobject.GObject):
"""UI interface for a Buddy in the presence service
-
+
Each buddy interface tracks a set of activities and properties
- that can be queried to provide UI controls for manipulating
+ that can be queried to provide UI controls for manipulating
the presence interface.
-
+
Properties Dictionary:
- 'key': public key,
- 'nick': nickname ,
- 'color': color (XXX what format),
- 'current-activity': (XXX dbus path?),
- 'owner': (XXX dbus path?),
+ 'key': public key,
+ 'nick': nickname ,
+ 'color': color (XXX what format),
+ 'current-activity': (XXX dbus path?),
+ 'owner': (XXX dbus path?),
'icon': (XXX pixel data for an icon?)
See __gproperties__
"""
@@ -67,11 +67,11 @@ class Buddy(gobject.GObject):
def __init__(self, bus, new_obj_cb, del_obj_cb, object_path):
"""Initialise the reference to the buddy
-
- bus -- dbus bus object
- new_obj_cb -- callback to call when this buddy joins an activity
- del_obj_cb -- callback to call when this buddy leaves an activity
- object_path -- path to the buddy object
+
+ bus -- dbus bus object
+ new_obj_cb -- callback to call when this buddy joins an activity
+ del_obj_cb -- callback to call when this buddy leaves an activity
+ object_path -- path to the buddy object
"""
gobject.GObject.__init__(self)
self._object_path = object_path
@@ -104,7 +104,7 @@ class Buddy(gobject.GObject):
self._joined_activity_signal.remove()
self._left_activity_signal.remove()
self._property_changed_signal.remove()
-
+
def _get_properties_helper(self):
"""Retrieve the Buddy's property dictionary from the service object
"""
@@ -114,8 +114,8 @@ class Buddy(gobject.GObject):
return props
def do_get_property(self, pspec):
- """Retrieve a particular property from our property dictionary
-
+ """Retrieve a particular property from our property dictionary
+
pspec -- XXX some sort of GTK specifier object with attributes
including 'name', 'active' and 'icon-name'
"""
@@ -170,7 +170,7 @@ class Buddy(gobject.GObject):
def _joined_activity_cb(self, object_path):
"""Handle dbus signal by emitting a GObject signal
-
+
Stores the activity in activities dictionary as well
"""
if not self._activities.has_key(object_path):
@@ -179,7 +179,7 @@ class Buddy(gobject.GObject):
def _emit_left_activity_signal(self, object_path):
"""Emit activity left signal with Activity object
-
+
XXX this calls self._ps_new_object instead of self._ps_del_object,
which would seem to be the incorrect callback?
"""
@@ -188,7 +188,7 @@ class Buddy(gobject.GObject):
def _left_activity_cb(self, object_path):
"""Handle dbus signal by emitting a GObject signal
-
+
Also removes from the activities dictionary
"""
if self._activities.has_key(object_path):
@@ -196,9 +196,9 @@ class Buddy(gobject.GObject):
gobject.idle_add(self._emit_left_activity_signal, object_path)
def _handle_property_changed_signal(self, prop_list):
- """Emit property-changed signal with property dictionary
-
- Generates a property-changed signal with the results of
+ """Emit property-changed signal with property dictionary
+
+ Generates a property-changed signal with the results of
_get_properties_helper()
"""
self._properties = self._get_properties_helper()
@@ -212,7 +212,7 @@ class Buddy(gobject.GObject):
def get_icon_pixbuf(self):
"""Retrieve Buddy's icon as a GTK pixel buffer
-
+
XXX Why aren't the icons coming in as SVG?
"""
if self.props.icon and len(self.props.icon):
@@ -224,12 +224,12 @@ class Buddy(gobject.GObject):
return None
def get_joined_activities(self):
- """Retrieve the set of all activities which this buddy has joined
-
- Uses the GetJoinedActivities method on the service
- object to produce object paths, wraps each in an
- Activity object.
-
+ """Retrieve the set of all activities which this buddy has joined
+
+ Uses the GetJoinedActivities method on the service
+ object to produce object paths, wraps each in an
+ Activity object.
+
returns list of presence Activity objects
"""
try:
diff --git a/src/sugar/presence/presenceservice.py b/src/sugar/presence/presenceservice.py
index cc72800..f6bb875 100644
--- a/src/sugar/presence/presenceservice.py
+++ b/src/sugar/presence/presenceservice.py
@@ -40,8 +40,8 @@ _logger = logging.getLogger('sugar.presence.presenceservice')
class PresenceService(gobject.GObject):
- """UI-side interface to the dbus presence service
-
+ """UI-side interface to the dbus presence service
+
This class provides UI programmers with simplified access
to the dbus service of the same name. It allows for observing
various events from the presence service as GObject events,
@@ -68,7 +68,7 @@ class PresenceService(gobject.GObject):
_PS_BUDDY_OP = DBUS_PATH + "/Buddies/"
_PS_ACTIVITY_OP = DBUS_PATH + "/Activities/"
-
+
def __init__(self, allow_offline_iface=True):
"""Initialise the service and attempt to connect to events
@@ -99,30 +99,30 @@ class PresenceService(gobject.GObject):
_ps_ = None
def _get_ps(self):
- """Retrieve dbus interface to PresenceService
-
- Also registers for updates from various dbus events on the
+ """Retrieve dbus interface to PresenceService
+
+ Also registers for updates from various dbus events on the
interface.
-
- If unable to retrieve the interface, we will temporarily
- return an _OfflineInterface object to allow the calling
- code to continue functioning as though it had accessed a
+
+ If unable to retrieve the interface, we will temporarily
+ return an _OfflineInterface object to allow the calling
+ code to continue functioning as though it had accessed a
real presence service.
-
- If successful, caches the presence service interface
+
+ If successful, caches the presence service interface
for use by other methods and returns that interface
"""
if not self._ps_:
try:
# NOTE: We need to follow_name_owner_changes here
- # because we can not connect to a signal unless
+ # because we can not connect to a signal unless
# we follow the changes or we start the service
# before we connect. Starting the service here
# causes a major bottleneck during startup
ps = dbus.Interface(
self._bus.get_object(DBUS_SERVICE,
DBUS_PATH,
- follow_name_owner_changes=True),
+ follow_name_owner_changes=True),
DBUS_INTERFACE
)
except dbus.exceptions.DBusException, err:
@@ -135,7 +135,7 @@ class PresenceService(gobject.GObject):
return _OfflineInterface()
raise RuntimeError("Failed to connect to the presence service.")
else:
- self._ps_ = ps
+ self._ps_ = ps
ps.connect_to_signal('BuddyAppeared',
self._buddy_appeared_cb)
ps.connect_to_signal('BuddyDisappeared',
@@ -149,7 +149,7 @@ class PresenceService(gobject.GObject):
ps.connect_to_signal('PrivateInvitation',
self._private_invitation_cb)
return self._ps_
-
+
_ps = property(
_get_ps, None, None,
"""DBUS interface to the PresenceService
@@ -158,16 +158,16 @@ class PresenceService(gobject.GObject):
def _new_object(self, object_path):
"""Turn new object path into (cached) Buddy/Activity instance
-
+
object_path -- full dbus path of the new object, must be
prefixed with either of _PS_BUDDY_OP or _PS_ACTIVITY_OP
-
+
Note that this method is called throughout the class whenever
- the representation of the object is required, it is not only
+ the representation of the object is required, it is not only
called when the object is first discovered. The point is to only have
_one_ Python object for any D-Bus object represented by an object path,
effectively wrapping the D-Bus object in a single Python GObject.
-
+
returns presence Buddy or Activity representation
"""
obj = None
@@ -225,7 +225,7 @@ class PresenceService(gobject.GObject):
# we could use a LRU cache limited to some value.
del self._objcache[object_path]
obj.destroy()
-
+
return False
def _buddy_disappeared_cb(self, object_path):
@@ -282,7 +282,7 @@ class PresenceService(gobject.GObject):
def get_activities(self):
"""Retrieve set of all activities from service
-
+
returns list of Activity objects for all object paths
the service reports exist (using GetActivities)
"""
@@ -317,12 +317,12 @@ class PresenceService(gobject.GObject):
)
def get_activities_async(self, reply_handler=None, error_handler=None):
- """Retrieve set of all activities from service asyncronously
+ """Retrieve set of all activities from service asyncronously
"""
if not reply_handler:
logging.error('Function get_activities_async called without' \
- 'a reply handler. Can not run.')
+ 'a reply handler. Can not run.')
return
self._ps.GetActivities(
@@ -351,7 +351,7 @@ class PresenceService(gobject.GObject):
def get_buddies(self):
"""Retrieve set of all buddies from service
-
+
returns list of Buddy objects for all object paths
the service reports exist (using GetBuddies)
"""
@@ -386,12 +386,12 @@ class PresenceService(gobject.GObject):
)
def get_buddies_async(self, reply_handler=None, error_handler=None):
- """Retrieve set of all buddies from service asyncronously
+ """Retrieve set of all buddies from service asyncronously
"""
if not reply_handler:
logging.error('Function get_buddies_async called without' \
- 'a reply handler. Can not run.')
+ 'a reply handler. Can not run.')
return
self._ps.GetBuddies(
@@ -402,11 +402,11 @@ class PresenceService(gobject.GObject):
def get_buddy(self, key):
"""Retrieve single Buddy object for the given public key
-
+
key -- buddy's public encryption key
-
- returns single Buddy object or None if the activity
- is not found using GetBuddyByPublicKey on the
+
+ returns single Buddy object or None if the activity
+ is not found using GetBuddyByPublicKey on the
service
"""
try:
@@ -479,15 +479,15 @@ class PresenceService(gobject.GObject):
def share_activity(self, activity, properties=None, private=True):
"""Ask presence service to ask the activity to share itself publicly.
-
- Uses the AdvertiseActivity method on the service to ask for the
- sharing of the given activity. Arranges to emit activity-shared
+
+ Uses the AdvertiseActivity method on the service to ask for the
+ sharing of the given activity. Arranges to emit activity-shared
event with:
-
+
(success, Activity, err)
-
+
on success/failure.
-
+
returns None
"""
actid = activity.get_id()
@@ -528,16 +528,16 @@ class PresenceService(gobject.GObject):
class _OfflineInterface( object ):
"""Offline-presence-service interface
-
+
Used to mimic the behaviour of a real PresenceService sufficiently
to avoid crashing client code that expects the given interface.
-
- XXX we could likely return a "MockOwner" object reasonably
+
+ XXX we could likely return a "MockOwner" object reasonably
easily, but would it be worth it?
"""
def raiseException( self, *args, **named ):
"""Raise dbus.exceptions.DBusException"""
- raise dbus.exceptions.DBusException(
+ raise dbus.exceptions.DBusException(
"""PresenceService Interface not available"""
)
GetActivities = raiseException
@@ -546,7 +546,7 @@ class _OfflineInterface( object ):
GetBuddyByPublicKey = raiseException
GetOwner = raiseException
GetPreferredConnection = raiseException
- def ShareActivity(
+ def ShareActivity(
self, actid, atype, name, properties,
reply_handler, error_handler,
):
@@ -559,7 +559,7 @@ class _OfflineInterface( object ):
class _MockPresenceService(gobject.GObject):
"""Test fixture allowing testing of items that use PresenceService
-
+
See PresenceService for usage and purpose
"""
__gsignals__ = {