diff options
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | activity.py | 82 | ||||
-rw-r--r-- | game.py | 1 | ||||
-rw-r--r-- | icons/help-icon.svg | 14 | ||||
-rw-r--r-- | icons/new-game.svg | 103 | ||||
-rw-r--r-- | icons/score.svg | 133 | ||||
-rwxr-xr-x | setup.py | 21 |
7 files changed, 359 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..568ed0e --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +*.pyc +*.pyo +*.mo +*~ +*.txt diff --git a/activity.py b/activity.py new file mode 100644 index 0000000..3ff1d71 --- /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 @@ -0,0 +1 @@ +# diff --git a/icons/help-icon.svg b/icons/help-icon.svg new file mode 100644 index 0000000..f6c92bf --- /dev/null +++ b/icons/help-icon.svg @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="55px" height="55px"> + <path + style="fill:none;stroke:#ffffff;stroke-width:3;stroke-linejoin:round" + d="M 48,28 A 20,20 0 1 1 8,28 A 20,20 0 1 1 48,28 z"/> + <path + style="fill:none;stroke:#ffffff;stroke-width:6;stroke-linecap:round;stroke-linejoin:round" + d="M 22,20 C 22,20 25,17 29,17 C 33,17 36,19 36,23 C 36,27 31,29 28,29 L 28,32" /> + <path + style="fill:#ffffff" + d="M 25,40 + a 3,3 0 1 1 6,0 + a 3,3 0 1 1 -6,0 z" /> +</svg> diff --git a/icons/new-game.svg b/icons/new-game.svg new file mode 100644 index 0000000..cbc1d85 --- /dev/null +++ b/icons/new-game.svg @@ -0,0 +1,103 @@ +<?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" + version="1.1" + width="56" + height="56" + id="svg2" + inkscape:version="0.48.2 r9819" + sodipodi:docname="new-game.svg"> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1198" + inkscape:window-height="801" + id="namedview21" + showgrid="false" + inkscape:zoom="4.2909091" + inkscape:cx="11.268662" + inkscape:cy="35.928207" + inkscape:window-x="0" + inkscape:window-y="30" + inkscape:window-maximized="0" + inkscape:current-layer="svg2" /> + <metadata + id="metadata9"> + <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="defs10" /> + <g + id="g3006" + style="stroke:#ffffff;fill:#ffffff"> + <path + d="m 28.898305,12.069916 a 3.4957626,4.5444913 0 1 1 -6.991525,0 3.4957626,4.5444913 0 1 1 6.991525,0 z" + sodipodi:ry="4.5444913" + sodipodi:rx="3.4957626" + sodipodi:cy="12.069916" + sodipodi:cx="25.402542" + id="path2994" + style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" + sodipodi:type="arc" /> + <path + d="m 28.665255,23.605932 a 3.7288136,7.9237289 0 1 1 -7.457627,0 3.7288136,7.9237289 0 1 1 7.457627,0 z" + sodipodi:ry="7.9237289" + sodipodi:rx="3.7288136" + sodipodi:cy="23.605932" + sodipodi:cx="24.936441" + id="path2996" + style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" + sodipodi:type="arc" /> + <path + d="m 31.461864,41.317795 a 6.1758475,11.419492 0 1 1 -12.351695,0 6.1758475,11.419492 0 1 1 12.351695,0 z" + sodipodi:ry="11.419492" + sodipodi:rx="6.1758475" + sodipodi:cy="41.317795" + sodipodi:cx="25.286016" + id="path2998" + style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" + sodipodi:type="arc" /> + <path + inkscape:connector-curvature="0" + id="path3000" + d="M 38.45339,27.567797 34.957627,22.207627 14.915255,22.440678 11.186441,28.5" + style="fill:#ffffff;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + <path + inkscape:connector-curvature="0" + id="path3002" + d="m 13.283898,31.529661 3.029661,-6.292373 15.614407,-0.233051 3.029661,6.292373" + style="fill:#ffffff;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + <path + inkscape:connector-curvature="0" + id="path3004" + d="m 12.118644,14.75 3.495763,4.661017 18.177966,-0.932204 3.728814,-5.59322" + style="fill:#ffffff;stroke:#ffffff;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + </g> + <path + d="m 40.602453,28.747722 c -1.237077,0 -2.252361,1.033402 -2.252361,2.292537 l 0,5.257541 -3.663838,-3.729187 c -0.875669,-0.889397 -2.279493,-0.891288 -3.153298,0 -0.87381,0.891291 -0.875637,2.35072 0,3.240113 l 3.693863,3.729188 -5.225475,0 c -1.237073,0 -2.252361,1.033401 -2.252361,2.292537 0,1.259135 1.015288,2.261965 2.252361,2.261965 l 5.195448,0 -3.663836,3.729188 c -0.87381,0.891293 -0.875637,2.35072 0,3.240115 0.875666,0.889391 2.309528,0.860724 3.183334,-0.03061 l 3.633802,-3.729185 0,5.318675 c 0,1.259138 1.015284,2.261968 2.252361,2.261968 1.237073,0 2.222332,-1.00283 2.222332,-2.261968 l 0,-5.349241 3.723901,3.759751 c 0.875667,0.889394 2.279492,0.891293 3.153298,0 0.873809,-0.89129 0.875682,-2.320152 0,-3.209542 l -3.693863,-3.729191 5.195433,0 c 1.237074,0 2.222344,-1.002832 2.222344,-2.261964 0,-1.259138 -0.98527,-2.292538 -2.222344,-2.292538 l -5.225472,0 3.693879,-3.790322 c 0.873807,-0.891292 0.875668,-2.289586 0,-3.17898 -0.875681,-0.889392 -2.279506,-0.921863 -3.153312,-0.0306 l -3.693864,3.790319 0,-5.288104 c 0,-1.259138 -0.985259,-2.292538 -2.222332,-2.292538 z" + id="rect3894" + style="fill:#ffffff;fill-opacity:1;stroke:#282828;stroke-width:1.93908417;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + inkscape:connector-curvature="0" /> +</svg> diff --git a/icons/score.svg b/icons/score.svg new file mode 100644 index 0000000..bfd8e1f --- /dev/null +++ b/icons/score.svg @@ -0,0 +1,133 @@ +<?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" + version="1.0" + width="84.862267" + height="78.095123" + id="svg4502" + style="display:inline" + inkscape:version="0.48.3.1 r9886" + sodipodi:docname="score.svg"> + <metadata + id="metadata20"> + <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> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1280" + inkscape:window-height="744" + id="namedview18" + showgrid="false" + inkscape:zoom="2.3150307" + inkscape:cx="103.52923" + inkscape:cy="41.700533" + inkscape:window-x="0" + inkscape:window-y="27" + inkscape:window-maximized="1" + inkscape:current-layer="g4395" + fit-margin-top="2" + fit-margin-left="2" + fit-margin-right="2" + fit-margin-bottom="2" /> + <defs + id="defs4504"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 100 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="200 : 100 : 1" + inkscape:persp3d-origin="100 : 66.666667 : 1" + id="perspective22" /> + </defs> + <g + transform="translate(-10.082352,65.657527)" + id="terron" + style="display:inline"> + <g + id="g4395"> + <rect + style="fill:none;stroke:#ffffff;stroke-width:5.34319830000000007;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" + id="rect3049" + width="75.519066" + height="36.633076" + x="14.753951" + y="-30.1754" /> + <rect + style="fill:none;stroke:#ffffff;stroke-width:5.35777044000000036;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" + id="rect3819" + width="38.422394" + height="30.206703" + x="33.302288" + y="-60.54668" /> + <text + xml:space="preserve" + style="font-size:19.42981148000000147px;font-style:normal;font-weight:bold;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:#ffffff;font-family:Sans;-inkscape-font-specification:Sans Bold;stroke-opacity:1" + x="49.897705" + y="-35.294449" + id="text3821" + sodipodi:linespacing="125%" + transform="scale(0.92818218,1.0773747)"><tspan + sodipodi:role="line" + id="tspan3823" + x="49.897705" + y="-35.294449">1</tspan></text> + <text + xml:space="preserve" + style="font-size:19.42981148000000147px;font-style:normal;font-weight:bold;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-opacity:1;display:inline;font-family:Sans;-inkscape-font-specification:Sans Bold" + x="28.97287" + y="-4.3726034" + id="text3821-4" + sodipodi:linespacing="125%" + transform="scale(0.92818218,1.0773747)"><tspan + sodipodi:role="line" + id="tspan3823-1" + x="28.97287" + y="-4.3726034" + style="stroke-width:1;stroke:#ffffff;stroke-opacity:1">2</tspan></text> + <text + xml:space="preserve" + style="font-size:19.42981148000000147px;font-style:normal;font-weight:bold;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:#ffffff;display:inline;font-family:Sans;-inkscape-font-specification:Sans Bold;stroke-opacity:1" + x="73.573051" + y="-5.0112777" + id="text3821-4-1" + sodipodi:linespacing="125%" + transform="scale(0.92818218,1.0773747)"><tspan + sodipodi:role="line" + id="tspan3823-1-2" + x="73.573051" + y="-5.0112777">3</tspan><tspan + sodipodi:role="line" + x="73.573051" + y="19.275986" + id="tspan3879" /></text> + <path + style="fill:none;stroke:#ffffff;stroke-width:4.88154649999999979;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 53.67775,-28.217139 0,32.7603728 z" + id="path3881" + inkscape:connector-curvature="0" /> + </g> + </g> +</svg> 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() |