From 9c54898a97ee7e58e3b32cc3bbe4a924385fcba3 Mon Sep 17 00:00:00 2001 From: Agustin Zubiaga Date: Tue, 04 Sep 2012 01:54:18 +0000 Subject: activity icon sugarizated, fix resize --- 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 @@ - - - - - - - - - - - - + + +]> + + + + + + + + - - + + - - - - image/svg+xml - - + + + + image/svg+xml + + - - - - - - - + + + + + + + - - - - - + + + + + - - - - + + + + - + - + \ No newline at end of file diff --git a/game.py b/game.py index ad8d015..f24fda1 100755 --- a/game.py +++ b/game.py @@ -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 -- cgit v0.9.1