diff options
-rwxr-xr-x | activity/activity-chat.svg | 16 | ||||
-rwxr-xr-x | activity/activity.info | 8 | ||||
-rwxr-xr-x | chatactivity.py | 49 | ||||
-rwxr-xr-x | setup.py | 22 |
4 files changed, 95 insertions, 0 deletions
diff --git a/activity/activity-chat.svg b/activity/activity-chat.svg new file mode 100755 index 0000000..24dc3de --- /dev/null +++ b/activity/activity-chat.svg @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448) -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+ <!ENTITY ns_svg "http://www.w3.org/2000/svg">
+ <!ENTITY ns_xlink "http://www.w3.org/1999/xlink">
+ <!ENTITY fill_color "#FFFFFF">
+ <!ENTITY stroke_color "#000000">
+]>
+<svg version="1.1" id="Icon" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="76" height="76" viewBox="0 0 76 76"
+ overflow="visible" enable-background="new 0 0 76 76" xml:space="preserve">
+
+<path fill="&fill_color;" stroke="&stroke_color;" stroke-width="3.5" d="M19.888,59.896c0.682,1.152,6.027,0.059,8.246-1.463
+ c2.102-1.432,3.207-2.596,4.336-2.596c1.133,0,12.54,0.92,20.935-5.715c7.225-5.707,9.773-13.788,4.52-21.437
+ c-5.252-7.644-13.832-9.08-20.878-8.56c-9.615,0.717-22.197,8.285-21.744,19.688c0.264,6.711,3.357,9.143,4.922,10.703
+ c1.562,1.566,4.545,1.566,2.992,5.588C22.606,57.683,19.378,59.022,19.888,59.896z"/>
+</svg>
diff --git a/activity/activity.info b/activity/activity.info new file mode 100755 index 0000000..4e349ed --- /dev/null +++ b/activity/activity.info @@ -0,0 +1,8 @@ +[Activity] +name = GroupChat +activity_version = 1 +host_version = 1 +icon = activity-chat +service_name = org.laptop.ChatActivity +exec = sugar-activity-factory org.laptop.ChatActivity chatactivity.ChatActivity +show_launcher = 1 diff --git a/chatactivity.py b/chatactivity.py new file mode 100755 index 0000000..374351f --- /dev/null +++ b/chatactivity.py @@ -0,0 +1,49 @@ +# Copyright (C) 2006, Red Hat, Inc. +# +# 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +from gettext import gettext as _ + +from sugar.activity.Activity import Activity +from sugar.chat.Chat import Chat +from sugar.p2p.Stream import Stream + +class ChatActivity(Activity): + def __init__(self): + Activity.__init__(self) + + self._group_stream = None + + self.set_title(_('Group chat')) + + self._chat = Chat() + self.add(self._chat) + self._chat.show() + + def join(self, activity_ps): + Activity.join(self, activity_ps) + self._setup_stream() + + def share(self): + Activity.share(self) + self._setup_stream() + + def _setup_stream(self): + self._group_stream = Stream.new_from_service(self._service) + self._group_stream.set_data_listener(self._group_recv_message) + self._chat.set_stream_writer(self._group_stream.new_writer()) + + def _group_recv_message(self, address, msg): + self._chat.recv_message(msg) diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..876cd3f --- /dev/null +++ b/setup.py @@ -0,0 +1,22 @@ +#!/usr/bin/python + +# Copyright (C) 2006, Red Hat, Inc. +# +# 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +from sugar.activity import bundlebuilder + +bundlebuilder.start() + |