Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/memosonoactivity.py
diff options
context:
space:
mode:
Diffstat (limited to 'memosonoactivity.py')
-rwxr-xr-xmemosonoactivity.py45
1 files changed, 23 insertions, 22 deletions
diff --git a/memosonoactivity.py b/memosonoactivity.py
index 3bdc63f..47b60a8 100755
--- a/memosonoactivity.py
+++ b/memosonoactivity.py
@@ -39,12 +39,13 @@ from infopanel import InfoPanel
from controller import Controller
+_logger = logging.getLogger('activity')
class MemosonoActivity(Activity):
def __init__(self, handle):
Activity.__init__(self, handle)
- logging.debug('Starting Memosono activity...')
+ _logger.debug('Starting Memosono activity...')
self.set_title(_('Memsosono Activity'))
@@ -114,19 +115,19 @@ class MemosonoActivity(Activity):
def _get_buddy(self, cs_handle):
"""Get a Buddy from a channel specific handle."""
- logging.debug('Trying to find owner of handle %u...', cs_handle)
+ _logger.debug('Trying to find owner of handle %u...', cs_handle)
group = self.text_chan[telepathy.CHANNEL_INTERFACE_GROUP]
my_csh = group.GetSelfHandle()
- logging.debug('My handle in that group is %u', my_csh)
+ _logger.debug('My handle in that group is %u', my_csh)
if my_csh == cs_handle:
handle = self.conn.GetSelfHandle()
- logging.debug('CS handle %u belongs to me, %u', cs_handle, handle)
+ _logger.debug('CS handle %u belongs to me, %u', cs_handle, handle)
elif group.GetGroupFlags() & telepathy.CHANNEL_GROUP_FLAG_CHANNEL_SPECIFIC_HANDLES:
handle = group.GetHandleOwners([cs_handle])[0]
- logging.debug('CS handle %u belongs to %u', cs_handle, handle)
+ _logger.debug('CS handle %u belongs to %u', cs_handle, handle)
else:
handle = cs_handle
- logging.debug('non-CS handle %u belongs to itself', handle)
+ _logger.debug('non-CS handle %u belongs to itself', handle)
# XXX: deal with failure to get the handle owner
assert handle != 0
@@ -137,7 +138,7 @@ class MemosonoActivity(Activity):
self.tp_conn_path, handle)
def _shared_cb(self, activity):
- logging.debug('My Memosono activity was shared')
+ _logger.debug('My Memosono activity was shared')
self.initiating = True
self._setup()
@@ -147,17 +148,17 @@ class MemosonoActivity(Activity):
self._shared_activity.connect('buddy-joined', self._buddy_joined_cb)
self._shared_activity.connect('buddy-left', self._buddy_left_cb)
- logging.debug('This is my activity: making a tube...')
+ _logger.debug('This is my activity: making a tube...')
id = self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].OfferTube(
telepathy.TUBE_TYPE_DBUS, 'org.fredektop.Telepathy.Tube.Memosono', {})
- logging.debug('Tube address: %s', self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].GetDBusServerAddress(id))
+ _logger.debug('Tube address: %s', self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].GetDBusServerAddress(id))
self.info_panel.show('Waiting for another player to join')
# FIXME: presence service should be tubes-aware and give us more help
# with this
def _setup(self):
if self._shared_activity is None:
- logging.error('Failed to share or join activity')
+ _logger.error('Failed to share or join activity')
return
bus_name, conn_path, channel_paths = self._shared_activity.get_channels()
@@ -170,27 +171,27 @@ class MemosonoActivity(Activity):
channel = telepathy.client.Channel(bus_name, channel_path)
htype, handle = channel.GetHandle()
if htype == telepathy.HANDLE_TYPE_ROOM:
- logging.debug('Found our room: it has handle#%d "%s"',
+ _logger.debug('Found our room: it has handle#%d "%s"',
handle, self.conn.InspectHandles(htype, [handle])[0])
room = handle
ctype = channel.GetChannelType()
if ctype == telepathy.CHANNEL_TYPE_TUBES:
- logging.debug('Found our Tubes channel at %s', channel_path)
+ _logger.debug('Found our Tubes channel at %s', channel_path)
tubes_chan = channel
elif ctype == telepathy.CHANNEL_TYPE_TEXT:
- logging.debug('Found our Text channel at %s', channel_path)
+ _logger.debug('Found our Text channel at %s', channel_path)
text_chan = channel
if room is None:
- logging.error("Presence service didn't create a room")
+ _logger.error("Presence service didn't create a room")
return
if text_chan is None:
- logging.error("Presence service didn't create a text channel")
+ _logger.error("Presence service didn't create a text channel")
return
# Make sure we have a Tubes channel - PS doesn't yet provide one
if tubes_chan is None:
- logging.debug("Didn't find our Tubes channel, requesting one...")
+ _logger.debug("Didn't find our Tubes channel, requesting one...")
tubes_chan = self.conn.request_channel(telepathy.CHANNEL_TYPE_TUBES,
telepathy.HANDLE_TYPE_ROOM, room, True)
@@ -205,7 +206,7 @@ class MemosonoActivity(Activity):
self._new_tube_cb(*tube_info)
def _list_tubes_error_cb(self, e):
- logging.error('ListTubes() failed: %s', e)
+ _logger.error('ListTubes() failed: %s', e)
def _joined_cb(self, activity):
if self.ctrl is not None:
@@ -217,18 +218,18 @@ class MemosonoActivity(Activity):
for buddy in self._shared_activity.get_joined_buddies():
self.buddies_panel.add_watcher(buddy)
- logging.debug('Joined an existing Memosono game')
+ _logger.debug('Joined an existing Memosono game')
self.info_panel.show('Joined a game. Waiting for my turn...')
self.initiating = False
self._setup()
- logging.debug('This is not my activity: waiting for a tube...')
+ _logger.debug('This is not my activity: waiting for a tube...')
self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].ListTubes(
reply_handler=self._list_tubes_reply_cb,
error_handler=self._list_tubes_error_cb)
def _new_tube_cb(self, id, initiator, type, service, params, state):
- logging.debug('New tube: ID=%d initator=%d type=%d service=%s '
+ _logger.debug('New tube: ID=%d initator=%d type=%d service=%s '
'params=%r state=%d', id, initiator, type, service,
params, state)
@@ -245,11 +246,11 @@ class MemosonoActivity(Activity):
self._get_buddy, self)
def _buddy_joined_cb(self, activity, buddy):
- logging.debug('buddy joined')
+ _logger.debug('buddy joined')
self.buddies_panel.add_watcher(buddy)
def _buddy_left_cb(self, activity, buddy):
- logging.debug('buddy left')
+ _logger.debug('buddy left')
self.buddies_panel.remove_watcher(buddy)