diff options
author | Cristhofer Travieso <cristhofert97@gmail.com> | 2012-09-28 23:46:30 (GMT) |
---|---|---|
committer | Cristhofer Travieso <cristhofert97@gmail.com> | 2012-09-28 23:46:30 (GMT) |
commit | 14602527f1f5938d93cabe2f846dea343f4b7b8b (patch) | |
tree | 1a6fbc8c688fb5a664c9a1211077407b47aedc9f |
Add main file
-rw-r--r-- | activity.py | 82 | ||||
-rw-r--r-- | activity/activity.info | 7 | ||||
-rw-r--r-- | activity/icon.svg | 144 | ||||
-rw-r--r-- | game.py | 1 | ||||
-rwxr-xr-x | setup.py | 21 |
5 files changed, 255 insertions, 0 deletions
diff --git a/activity.py b/activity.py new file mode 100644 index 0000000..66b7c41 --- /dev/null +++ b/activity.py @@ -0,0 +1,82 @@ +# Copyright (C) 2012 Cristhofer Travieso <cristhofert97@gmail.com> + +# 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 St, Fifth Floor, Boston, MA 02110-1301 USA + +from gi.repository import Gtk + +from sugar3.activity import activity +from sugar3.activity.widgets import StopButton +from sugar3.activity.widgets import ActivityToolbarButton +from sugar3.graphics.toolbarbox import ToolbarBox +from sugar3.graphics.toolbutton import ToolButton + +import game + + +class Activity(activity.Activity): + def __init__(self, handle): + activity.Activity.__init__(self, handle, True) + + # Toolbar + toolbarbox = ToolbarBox() + + activity_button = ActivityToolbarButton(self) + toolbarbox.toolbar.insert(activity_button, 0) + + separator = Gtk.SeparatorToolItem() + activity_button.page.insert(separator, -1) + + score_btn = ToolButton() + score_btn.props.icon_name = 'score' + activity_button.page.insert(score_btn, -1) + score_btn.show() + + separator = Gtk.SeparatorToolItem() + toolbarbox.toolbar.insert(separator, -1) + + # ToolButtons + new_game_btn = ToolButton() + new_game_btn.connect('clicked', lambda w: self._new_game) + new_game_btn.set_tooltip(_('New Game')) + new_game_btn.props.icon_name = 'new-game' + toolbarbox.toolbar.insert(new_game_btn, -1) + + separator = Gtk.SeparatorToolItem() + separator.set_expand(False) + separator.set_draw(True) + toolbarbox.toolbar.insert(separator, -1) + + help_btn = ToolButton() + help_btn.set_tooltip(_('Help')) + help_btn.props.icon_name = 'help-icon' + help_btn.connect('clicked', self.help_cb) + toolbarbox.toolbar.insert(help_btn, -1) + + separator = Gtk.SeparatorToolItem() + separator.set_expand(True) + separator.set_draw(False) + toolbarbox.toolbar.insert(separator, -1) + + stopbtn = StopButton(self) + toolbarbox.toolbar.insert(stopbtn, -1) + + self.set_toolbar_box(toolbarbox) + self.show_all() + + def help_cb(self, widget): + pass + + def _new_game(self, widget): + pass diff --git a/activity/activity.info b/activity/activity.info new file mode 100644 index 0000000..4efd33c --- /dev/null +++ b/activity/activity.info @@ -0,0 +1,7 @@ +[Activity] +name = Snake +activity_version = 1 +bundle_id = org.sugarlabs.Snake +exec = sugar-activity activity.SnakeActivity -s +icon = icon +license = GPLv3+ diff --git a/activity/icon.svg b/activity/icon.svg new file mode 100644 index 0000000..a707d86 --- /dev/null +++ b/activity/icon.svg @@ -0,0 +1,144 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + height="55" + id="svg2" + inkscape:version="0.48.2 r9819" + sodipodi:docname="icon.svg" + version="1.1" + width="55"> + <defs + id="defs4"> + <inkscape:perspective + id="perspective10" + inkscape:persp3d-origin="372.04724 : 350.78739 : 1" + inkscape:vp_x="0 : 526.18109 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="744.09448 : 526.18109 : 1" + sodipodi:type="inkscape:persp3d" /> + <inkscape:perspective + id="perspective3636" + inkscape:persp3d-origin="0.5 : 0.33333333 : 1" + inkscape:vp_x="0 : 0.5 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="1 : 0.5 : 1" + sodipodi:type="inkscape:persp3d" /> + <inkscape:perspective + id="perspective3658" + inkscape:persp3d-origin="0.5 : 0.33333333 : 1" + inkscape:vp_x="0 : 0.5 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="1 : 0.5 : 1" + sodipodi:type="inkscape:persp3d" /> + <inkscape:perspective + id="perspective3658-9" + inkscape:persp3d-origin="0.5 : 0.33333333 : 1" + inkscape:vp_x="0 : 0.5 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="1 : 0.5 : 1" + sodipodi:type="inkscape:persp3d" /> + <inkscape:perspective + id="perspective3697" + inkscape:persp3d-origin="0.5 : 0.33333333 : 1" + inkscape:vp_x="0 : 0.5 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="1 : 0.5 : 1" + sodipodi:type="inkscape:persp3d" /> + <inkscape:perspective + id="perspective3725" + inkscape:persp3d-origin="0.5 : 0.33333333 : 1" + inkscape:vp_x="0 : 0.5 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="1 : 0.5 : 1" + sodipodi:type="inkscape:persp3d" /> + <inkscape:perspective + id="perspective3749" + inkscape:persp3d-origin="0.5 : 0.33333333 : 1" + inkscape:vp_x="0 : 0.5 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="1 : 0.5 : 1" + sodipodi:type="inkscape:persp3d" /> + </defs> + <sodipodi:namedview + bordercolor="#666666" + borderopacity="1.0" + id="base" + inkscape:current-layer="layer1" + inkscape:cx="100.93097" + inkscape:cy="24.216625" + inkscape:document-units="px" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:window-height="804" + inkscape:window-maximized="1" + inkscape:window-width="1200" + inkscape:window-x="0" + inkscape:window-y="30" + inkscape:zoom="3.77" + pagecolor="#ffffff" + showgrid="false" /> + <metadata + id="metadata7"> + <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> + <g + id="layer1" + inkscape:groupmode="layer" + inkscape:label="Capa 1" + transform="translate(0,-997.36218)"> + <g + id="g3019" + transform="matrix(0.7394877,0,0,0.73847121,8.78588,276.0256)"> + <path + sodipodi:nodetypes="ccc" + transform="translate(0,997.36218)" + inkscape:connector-curvature="0" + id="path2993" + d="m 10.079576,35.371353 c 13.431071,-54.631164 29.04277,-31.6422183 37.40053,3.97878 -5.124739,18.8852 -41.2816688,14.309172 -37.40053,-3.97878 z" + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + <path + transform="matrix(0.12439345,0,0,0.23088078,12.935451,1010.9586)" + d="m 35.278513,25.954906 c 0,4.321592 -0.296893,7.824934 -0.66313,7.824934 -0.366236,0 -0.66313,-3.503342 -0.66313,-7.824934 0,-4.321591 0.296894,-7.824933 0.66313,-7.824933 0.366237,0 0.66313,3.503342 0.66313,7.824933 z" + sodipodi:ry="7.8249335" + sodipodi:rx="0.66312999" + sodipodi:cy="25.954906" + sodipodi:cx="34.615383" + id="path2999" + style="fill:none;stroke:#000000;stroke-width:20;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" + sodipodi:type="arc" /> + <path + transform="matrix(0.12439345,0,0,0.23088078,34.420864,1010.0302)" + d="m 35.278513,25.954906 c 0,4.321592 -0.296893,7.824934 -0.66313,7.824934 -0.366236,0 -0.66313,-3.503342 -0.66313,-7.824934 0,-4.321591 0.296894,-7.824933 0.66313,-7.824933 0.366237,0 0.66313,3.503342 0.66313,7.824933 z" + sodipodi:ry="7.8249335" + sodipodi:rx="0.66312999" + sodipodi:cy="25.954906" + sodipodi:cx="34.615383" + id="path2999-0" + style="fill:none;stroke:#000000;stroke-width:20;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" + sodipodi:type="arc" /> + </g> + <path + style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 26.790451,17.864721 0.803752,-6.64867 -1.334256,-9.7969529 2.65252,4.5092839 2.65252,-3.4482759 0.822533,8.4688469 -0.292029,6.915768" + id="path3024" + inkscape:connector-curvature="0" + transform="translate(0,997.36218)" + sodipodi:nodetypes="ccccccc" /> + </g> +</svg> @@ -0,0 +1 @@ +# diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..530f97c --- /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 sugar.activity import bundlebuilder + +bundlebuilder.start() |