Use two different activity types

This commit is contained in:
Dan Williams 2006-09-24 23:12:09 -04:00
parent f83567ba32
commit 07c0ffbb7d

View File

@ -8,19 +8,19 @@ import os, random, gobject
class KiuBot(Bot): class KiuBot(Bot):
def __init__(self): def __init__(self):
Bot.__init__(self, 'kiu', IconColor('#5E4505,#0F8A0F')) Bot.__init__(self, 'kiu', IconColor('#5E4505,#0F8A0F'))
self._olpc_channel_service = None self._olpc_chat_service = None
self._sugar_channel_service = None self._web_activity_service = None
self._activity_switch_timeout = None self._activity_switch_timeout = None
self._curact = None self._curact = None
action = ShareActivityAction('OLPC channel', action = ShareActivityAction('OLPC channel',
'_GroupChatActivity_Sugar_redhat_com._udp', '_GroupChatActivity_Sugar_redhat_com._udp',
self.__share_olpc_channel_cb) self.__share_olpc_chat_cb)
self.add_action(action, 10) self.add_action(action, 10)
action = ShareActivityAction('Sugar channel', action = ShareActivityAction('All About Giraffes',
'_GroupChatActivity_Sugar_redhat_com._udp', '_BrowserActivity_Sugar_redhat_com._udp',
self.__share_sugar_channel_cb) self.__share_web_activity_cb)
self.add_action(action, 20) self.add_action(action, 20)
self._icon_file = os.path.abspath("kiu.jpg") self._icon_file = os.path.abspath("kiu.jpg")
@ -29,9 +29,9 @@ class KiuBot(Bot):
self._activity_switch_timeout = None self._activity_switch_timeout = None
which = random.randint(1, 2) which = random.randint(1, 2)
if which == 1: if which == 1:
actid = self._olpc_channel_activity.get_id() actid = self._olpc_chat_activity.get_id()
elif which == 2: elif which == 2:
actid = self._sugar_channel_activity.get_id() actid = self._web_activity.get_id()
else: else:
raise RuntimeError("WTF? unexpected value") raise RuntimeError("WTF? unexpected value")
if actid != self._curact: if actid != self._curact:
@ -48,14 +48,14 @@ class KiuBot(Bot):
self._activity_switch_timeout = gobject.timeout_add(interval, self._activity_switch_timeout = gobject.timeout_add(interval,
self.__activity_switch_cb) self.__activity_switch_cb)
def __share_olpc_channel_cb(self, sim_activity, service): def __share_olpc_chat_cb(self, sim_activity, service):
self._olpc_channel_service = service self._olpc_chat_service = service
self._olpc_channel_activity = sim_activity self._olpc_chat_activity = sim_activity
self._schedule_activity_switch_timeout() self._schedule_activity_switch_timeout()
def __share_sugar_channel_cb(self, sim_activity, service): def __share_web_activity_cb(self, sim_activity, service):
self._sugar_channel_service = service self._web_activity_service = service
self._sugar_channel_activity = sim_activity self._web_activity = sim_activity
self._schedule_activity_switch_timeout() self._schedule_activity_switch_timeout()
def main(): def main():