diff options
author | Daniel Francis <francis@sugarlabs.org> | 2012-10-21 21:59:13 (GMT) |
---|---|---|
committer | Daniel Francis <francis@sugarlabs.org> | 2012-10-21 21:59:13 (GMT) |
commit | aceafbadbc68b47d222d741af4b63887f2f1ef8e (patch) | |
tree | a9ab65890865ecc4e7384a296169a08fb569f47f |
Initial commit
Signed-off-by: Daniel Francis <francis@sugarlabs.org>
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | activity/activity-chat-online.svg | 16 | ||||
-rw-r--r-- | activity/activity.info | 9 | ||||
-rw-r--r-- | canvas.py | 29 | ||||
-rw-r--r-- | chatonline.py | 54 | ||||
-rwxr-xr-x | setup.py | 21 | ||||
-rw-r--r-- | toolbars.py | 46 |
7 files changed, 179 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..33f265f --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.mo +*.pyc +*.xo +*~ diff --git a/activity/activity-chat-online.svg b/activity/activity-chat-online.svg new file mode 100644 index 0000000..8b86180 --- /dev/null +++ b/activity/activity-chat-online.svg @@ -0,0 +1,16 @@ +<?xml version="1.0" ?><!-- Created with Inkscape (http://www.inkscape.org/) --><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd' [ + <!ENTITY stroke_color "#010101"> + <!ENTITY fill_color "#ffffff"> +]><svg height="55" id="svg2" version="1.1" viewBox="0 0 55 55" width="55" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg"><metadata id="metadata25"><rdf:RDF><cc:Work rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/><dc:title/></cc:Work></rdf:RDF></metadata><defs id="defs23"/><g id="activity-chat" style="display:block" transform="translate(0.82352081,-1.4359169)"> + <path d="m 9.263,48.396 c 0.682,1.152 6.027,0.059 8.246,-1.463 2.102,-1.432 3.207,-2.596 4.336,-2.596 1.133,0 12.54,0.92 20.935,-5.715 C 50.005,32.915 52.553,24.834 47.3,17.185 42.048,9.541 33.468,8.105 26.422,8.625 16.806,9.342 4.224,16.91 4.677,28.313 c 0.264,6.711 3.357,9.143 4.922,10.703 1.562,1.566 4.545,1.566 2.992,5.588 -0.61,1.579 -3.838,2.918 -3.328,3.792 z" id="path3054" style="fill:&fill_color;;stroke:&stroke_color;;stroke-width:3.5;display:inline"/> +</g><g id="activity-browse" style="display:block" transform="matrix(0.6130279,0,0,0.65469601,11.292513,6.9323004)"> + <circle cx="27.375" cy="27.5" id="circle5" r="19.903" style="fill:&fill_color;;stroke:&stroke_color;;stroke-width:3.5;display:inline"/> + <g id="g7" style="display:inline"> + <path d="m 27.376,7.598 c 0,0 -11.205,8.394 -11.205,19.976 0,11.583 11.205,19.829 11.205,19.829" id="path9" style="fill:&fill_color;;stroke:&stroke_color;;stroke-width:3.5"/> + <path d="m 27.376,7.598 c 0,0 11.066,9.141 11.066,19.976 0,10.839 -11.066,19.829 -11.066,19.829" id="path11" style="fill:&fill_color;;stroke:&stroke_color;;stroke-width:3.5"/> + <line id="line13" style="fill:&fill_color;;stroke:&stroke_color;;stroke-width:3.5" x1="27.375999" x2="27.375999" y1="7.598" y2="47.402"/> + <line id="line15" style="fill:&fill_color;;stroke:&stroke_color;;stroke-width:3.5" x1="27.375999" x2="27.375999" y1="7.598" y2="47.402"/> + <line id="line17" style="fill:&fill_color;;stroke:&stroke_color;;stroke-width:3.5" x1="27.375999" x2="27.375999" y1="7.598" y2="47.402"/> + <line id="line19" style="fill:&fill_color;;stroke:&stroke_color;;stroke-width:3.5" x1="7.4720001" x2="47.278" y1="27.5" y2="27.5"/> + </g> +</g></svg>
\ No newline at end of file diff --git a/activity/activity.info b/activity/activity.info new file mode 100644 index 0000000..54f8de3 --- /dev/null +++ b/activity/activity.info @@ -0,0 +1,9 @@ +[Activity] +name = Chat Online +summary = Talk and meet friends. +activity_version = 1 +show_launcher = 1 +bundle_id = org.sugarlabs.ChatOnline +exec = sugar-activity chatonline.ChatOnlineActivity -s +icon = activity-chat-online +license = GPLv3 diff --git a/canvas.py b/canvas.py new file mode 100644 index 0000000..b0307ff --- /dev/null +++ b/canvas.py @@ -0,0 +1,29 @@ +# Copyright 2012 S. Daniel Francis <francis@sugarlabs.org> +# +# 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 3 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 Street, Fifth Floor, Boston, +# MA 02110-1301, USA. + +import logging +logger = logging.getLogger('canvas') +from gi.repository import Gtk + + +class Canvas(Gtk.Box): + def __init__(self, toolbar_box, activity): + Gtk.Box.__init__(self) + self.activity = activity + + def new(self): + pass diff --git a/chatonline.py b/chatonline.py new file mode 100644 index 0000000..7855370 --- /dev/null +++ b/chatonline.py @@ -0,0 +1,54 @@ +# Copyright (C) 2012 S. Daniel Francis <francis@sugarlabs.org> +# +# 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 3 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 Street, Fifth Floor, Boston, +# MA 02110-1301, USA. + +# -------------- +# Don't lose your time editing me. +# This file is very abstract, see toolbars.py for toolbars +# and canvas.py for the other content. + +import logging +logging.basicConfig(level=logging.DEBUG) +logger = logging.getLogger('chatonline') +from gettext import gettext as _ + +from gi.repository import Gtk +from sugar3.activity import activity +from toolbars import ToolbarBox +from canvas import Canvas + + +class ChatOnlineActivity(activity.Activity): + def __init__(self, handle): + activity.Activity.__init__(self, handle) + self.options = ToolbarBox(self) + self.options.show() + self.set_toolbar_box(self.options) + self.canvas = Canvas(self.options, self) + self.canvas.show() + self.set_canvas(self.canvas) + + def read_file(self, path): + try: + return self.canvas.read_file(path) + except: + pass + + def write_file(self, path): + try: + return self.canvas.write_file(path) + except: + pass diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..c60f4d0 --- /dev/null +++ b/setup.py @@ -0,0 +1,21 @@ +#!/usr/bin/env 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 sugar3.activity import bundlebuilder + +bundlebuilder.start() diff --git a/toolbars.py b/toolbars.py new file mode 100644 index 0000000..58ea897 --- /dev/null +++ b/toolbars.py @@ -0,0 +1,46 @@ +# Copyright 2012 S. Daniel Francis <francis@sugarlabs.org> +# +# 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 3 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 Street, Fifth Floor, Boston, +# MA 02110-1301, USA. + +from gettext import gettext as _ +from gi.repository import GObject +from gi.repository import Gtk +from sugar3.activity.widgets import ActivityToolbarButton +from sugar3.activity.widgets import StopButton +from sugar3.graphics.toolbarbox import ToolbarBox as SugarToolbarBox + + +class ToolbarBox(SugarToolbarBox): + def __init__(self, activity): + SugarToolbarBox.__init__(self) + self.activity = activity + self._start_toolbar() + self._end_toolbar() + + def _start_toolbar(self): + activity_button = ActivityToolbarButton(self.activity) + activity_button.show() + self.toolbar.insert(activity_button, -1) + + def _end_toolbar(self): + separator = Gtk.SeparatorToolItem.new() + separator.set_draw(False) + separator.set_expand(True) + self.toolbar.insert(separator, -1) + separator.show() + stopbutton = StopButton(self.activity) + stopbutton.show() + self.toolbar.insert(stopbutton, -1) |