diff options
author | Agustin Zubiaga <aguz@sugarlabs.org> | 2012-09-04 01:54:18 (GMT) |
---|---|---|
committer | Agustin Zubiaga <aguz@sugarlabs.org> | 2012-09-04 01:54:18 (GMT) |
commit | 9c54898a97ee7e58e3b32cc3bbe4a924385fcba3 (patch) | |
tree | 57e5a5fa538a7f0e9bef9db162a7b1ecc3b26e3f | |
parent | e8c4d5611c1d2d84c70315a8a3efdd678965afce (diff) |
activity icon sugarizated, fix resize
-rw-r--r-- | activity/icon.svg | 244 | ||||
-rwxr-xr-x | game.py | 29 |
2 files changed, 52 insertions, 221 deletions
diff --git a/activity/icon.svg b/activity/icon.svg index b9572e9..754a8b2 100644 --- a/activity/icon.svg +++ b/activity/icon.svg @@ -1,218 +1,50 @@ -<?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" - style="" - version="1.1" - width="55"> - <defs - id="defs4" - style=""> - <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" - style="" /> - <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" - style="" /> - <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" - style="" /> - <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" - style="" /> - <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" - style="" /> - <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" - style="" /> - <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" - style="" /> +<?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 "#282828"> + <!ENTITY fill_color "#ffffff"> +]><svg height="55" id="svg2" inkscape:version="0.48.2 r9819" sodipodi:docname="icon.svg" style="" version="1.1" width="55" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg"> + <defs id="defs4" style=""> + <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" style=""/> + <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" style=""/> + <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" style=""/> + <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" style=""/> + <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" style=""/> + <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" style=""/> + <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" style=""/> </defs> - <sodipodi:namedview - bordercolor="#666666" - borderopacity="1.0" - id="base" - inkscape:current-layer="layer1" - inkscape:cx="24.095831" - inkscape:cy="26.577885" - 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="8.7055056" - pagecolor="#ffffff" - showgrid="false" - style="" - showguides="true" - inkscape:guide-bbox="true"> - <sodipodi:guide - orientation="0,1" - position="20.217091,58.239007" - id="guide3152" /> + <sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:current-layer="layer1" inkscape:cx="24.095831" inkscape:cy="26.577885" inkscape:document-units="px" inkscape:guide-bbox="true" 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="8.7055056" pagecolor="#ffffff" showgrid="false" showguides="true" style=""> + <sodipodi:guide id="guide3152" orientation="0,1" position="20.217091,58.239007"/> </sodipodi:namedview> - <metadata - id="metadata7" - style=""> - <rdf:RDF - style=""> - <cc:Work - rdf:about="" - style=""> - <dc:format - style="">image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" - style="" /> - <dc:title - style="" /> + <metadata id="metadata7" style=""> + <rdf:RDF style=""> + <cc:Work rdf:about="" style=""> + <dc:format style="">image/svg+xml</dc:format> + <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" style=""/> + <dc:title style=""/> </cc:Work> </rdf:RDF> </metadata> - <g - id="layer1" - inkscape:groupmode="layer" - inkscape:label="Capa 1" - style="" - transform="translate(0,-997.36218)"> - <rect - style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:0.89300000000000002;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-linejoin:round;stroke-linecap:round" - id="rect3853" - width="14.475993" - height="14.343013" - x="20.617939" - y="1017.0385" /> - <path - d="m 18.860727,1000.3897 0,48.9451" - id="path2993" - inkscape:connector-curvature="0" - style="fill:none;stroke:#282828;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" /> - <path - d="m 37.174524,1000.3703 0,48.984" - id="path2993-8" - inkscape:connector-curvature="0" - style="fill:none;stroke:#282828;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" /> - <g - id="g3034" - style="fill:none;stroke:#282828;stroke-opacity:1;stroke-linecap:round;stroke-linejoin:round;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none" - transform="matrix(0,-1,1,0,-997.56221,1081.2543)"> - <path - d="m 47.75287,1001.0896 0,48.9451" - id="path2993-83" - inkscape:connector-curvature="0" - style="fill:none;stroke:#282828;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" /> - <path - d="m 66.066667,1001.0702 0,48.984" - id="path2993-8-4" - inkscape:connector-curvature="0" - style="fill:none;stroke:#282828;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none" /> + <g id="layer1" inkscape:groupmode="layer" inkscape:label="Capa 1" style="" transform="translate(0,-997.36218)"> + <rect height="14.343013" id="rect3853" style="fill:&fill_color;;fill-opacity:1;stroke:&fill_color;;stroke-width:0.89300000000000002;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-linejoin:round;stroke-linecap:round" width="14.475993" x="20.617939" y="1017.0385"/> + <path d="m 18.860727,1000.3897 0,48.9451" id="path2993" inkscape:connector-curvature="0" style="fill:none;stroke:&stroke_color;;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"/> + <path d="m 37.174524,1000.3703 0,48.984" id="path2993-8" inkscape:connector-curvature="0" style="fill:none;stroke:&stroke_color;;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"/> + <g id="g3034" style="fill:none;stroke:&stroke_color;;stroke-opacity:1;stroke-linecap:round;stroke-linejoin:round;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none" transform="matrix(0,-1,1,0,-997.56221,1081.2543)"> + <path d="m 47.75287,1001.0896 0,48.9451" id="path2993-83" inkscape:connector-curvature="0" style="fill:none;stroke:&stroke_color;;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"/> + <path d="m 66.066667,1001.0702 0,48.984" id="path2993-8-4" inkscape:connector-curvature="0" style="fill:none;stroke:&stroke_color;;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"/> </g> - <g - id="g3060" - style="stroke:#282828;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" - transform="translate(17.296,-0.22898977)"> - <path - d="m 5.2,1019.2622 10.7,10.7" - id="path3038" - inkscape:connector-curvature="0" - style="fill:none;stroke:#282828;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> - <g - id="g3056" - style="stroke:#282828;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"> - <g - id="g3053" - style="stroke:#282828;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"> - <path - d="M 16.2,21.7 5.05,32.85" - id="path3040" - inkscape:connector-curvature="0" - style="fill:none;stroke:#282828;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" - transform="translate(0,997.36218)" /> + <g id="g3060" style="stroke:&stroke_color;;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" transform="translate(17.296,-0.22898977)"> + <path d="m 5.2,1019.2622 10.7,10.7" id="path3038" inkscape:connector-curvature="0" style="fill:none;stroke:&stroke_color;;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"/> + <g id="g3056" style="stroke:&stroke_color;;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"> + <g id="g3053" style="stroke:&stroke_color;;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"> + <path d="M 16.2,21.7 5.05,32.85" id="path3040" inkscape:connector-curvature="0" style="fill:none;stroke:&stroke_color;;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" transform="translate(0,997.36218)"/> </g> </g> </g> - <path - d="m 34.400001,27.450001 a 6.1999998,6.1500001 0 1 1 -12.4,0 6.1999998,6.1500001 0 1 1 12.4,0 z" - id="path3864" - sodipodi:cx="28.200001" - sodipodi:cy="27.450001" - sodipodi:rx="6.1999998" - sodipodi:ry="6.1500001" - sodipodi:type="arc" - style="fill:#ffffff;fill-opacity:1;stroke:#282828;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" - transform="matrix(0.95247294,0,0,0.9147305,-16.821347,1016.7772)" /> - <g - id="g3060-9-4" - style="stroke:#282828;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" - transform="translate(35.675,17.625)"> - <g - id="g3056-9-6" - style="stroke:#282828;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"> - <g - id="g3053-8-0" - style="stroke:#282828;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> + <path d="m 34.400001,27.450001 a 6.1999998,6.1500001 0 1 1 -12.4,0 6.1999998,6.1500001 0 1 1 12.4,0 z" id="path3864" sodipodi:cx="28.200001" sodipodi:cy="27.450001" sodipodi:rx="6.1999998" sodipodi:ry="6.1500001" sodipodi:type="arc" style="fill:&fill_color;;fill-opacity:1;stroke:&stroke_color;;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" transform="matrix(0.95247294,0,0,0.9147305,-16.821347,1016.7772)"/> + <g id="g3060-9-4" style="stroke:&stroke_color;;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" transform="translate(35.675,17.625)"> + <g id="g3056-9-6" style="stroke:&stroke_color;;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"> + <g id="g3053-8-0" style="stroke:&stroke_color;;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"/> </g> </g> - <path - d="m 34.400001,27.450001 a 6.1999998,6.1500001 0 1 1 -12.4,0 6.1999998,6.1500001 0 1 1 12.4,0 z" - id="path3864-7" - sodipodi:cx="28.200001" - sodipodi:cy="27.450001" - sodipodi:rx="6.1999998" - sodipodi:ry="6.1500001" - sodipodi:type="arc" - style="fill:#ffffff;fill-opacity:1;stroke:#282828;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" - transform="matrix(0.95247294,0,0,0.9147305,19.432806,981.33718)" /> + <path d="m 34.400001,27.450001 a 6.1999998,6.1500001 0 1 1 -12.4,0 6.1999998,6.1500001 0 1 1 12.4,0 z" id="path3864-7" sodipodi:cx="28.200001" sodipodi:cy="27.450001" sodipodi:rx="6.1999998" sodipodi:ry="6.1500001" sodipodi:type="arc" style="fill:&fill_color;;fill-opacity:1;stroke:&stroke_color;;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" transform="matrix(0.95247294,0,0,0.9147305,19.432806,981.33718)"/> </g> -</svg> +</svg>
\ No newline at end of file @@ -18,16 +18,13 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA import cairo -import random from gi.repository import Gtk from gi.repository import Gdk from sugar3.graphics import style -from sugar3 import profile +LINE_WIDTH = 12 SIZE = style.zoom(150) BETWEEN_LINE_SPACE = style.zoom(200) -SIZE_FACTOR = 4.5 * 200 / BETWEEN_LINE_SPACE -SIZE_FACTOR_2 = 3.5 * 200 / BETWEEN_LINE_SPACE MODE_CIRCLE = 0 MODE_CROSS = 1 @@ -68,7 +65,7 @@ class Canvas(Gtk.DrawingArea): def _draw_cb(self, widget, context): alloc = self.get_allocation() - + # Background context.rectangle(0, 0, alloc.width, alloc.height) context.set_source_rgb(*BACKGROUND_COLOR) @@ -76,14 +73,14 @@ class Canvas(Gtk.DrawingArea): # Tic-Tac-Toe context.set_source_rgb(*TICTACTOE_COLOR) - context.set_line_width(12) + context.set_line_width(LINE_WIDTH) context.set_line_cap(cairo.LINE_CAP_ROUND) x = (alloc.width - BETWEEN_LINE_SPACE * 3) / 2 y = (alloc.height - BETWEEN_LINE_SPACE * 3) / 2 y += BETWEEN_LINE_SPACE - lx = BETWEEN_LINE_SPACE * SIZE_FACTOR + lx = (BETWEEN_LINE_SPACE + (LINE_WIDTH * 8.2)) * 3 context.move_to(x, y) context.line_to(lx, y) @@ -95,7 +92,9 @@ class Canvas(Gtk.DrawingArea): x += BETWEEN_LINE_SPACE y -= BETWEEN_LINE_SPACE - ly = BETWEEN_LINE_SPACE * SIZE_FACTOR_2 + screen_width = Gdk.Screen.width() + infactor = 1.5 + ((screen_width - 1024) / 100.0) + ly = (BETWEEN_LINE_SPACE + (LINE_WIDTH * infactor)) * 3 context.move_to(x, y) context.line_to(x, ly) @@ -113,7 +112,7 @@ class Canvas(Gtk.DrawingArea): context.move_to(x, y) context.line_to(x, ly) context.stroke() - + # Save center squares coords if not cx1 < 0: self.squares = [] @@ -157,7 +156,7 @@ class Canvas(Gtk.DrawingArea): self.cursor = self.get_pos(event.x, event.y) self.queue_draw() - def _click_cb(self, widget, event): + def _click_cb(self, widget, event): pos = self.get_pos(event.x, event.y) if self._mode == MODE_CIRCLE and pos: @@ -186,14 +185,14 @@ class Canvas(Gtk.DrawingArea): next_x = all_x[count] if mx >= (x - size) and mx <= (next_x - size): xpos = x - + elif mx < all_x[0]: xpos = all_x[0] elif mx > all_x[-1]: - xpos = all_x[-1] + xpos = all_x[-1] - if my > all_y[0] and not my > all_y[-1]: + if my > all_y[0] and not my > all_y[-1]: count = 0 for y in all_y: if not ypos: @@ -206,8 +205,8 @@ class Canvas(Gtk.DrawingArea): ypos = all_y[0] elif my > all_y[-1]: - ypos = all_y[-1] - + ypos = all_y[-1] + pos = xpos, ypos if pos in self.crosses and pos in self.circles: pos = None |