From a6a0abae9ae1da08dddd2058836164cdd05198b8 Mon Sep 17 00:00:00 2001 From: Alan Aguiar Date: Tue, 09 Apr 2013 21:11:41 +0000 Subject: only import the just and necessary --- diff --git a/activity.py b/activity.py index bb5ded1..e60ef8c 100755 --- a/activity.py +++ b/activity.py @@ -19,10 +19,8 @@ import gtk from sugar.activity import activity from sugar.graphics.toolbarbox import ToolbarBox -from sugar.graphics.toolbutton import ToolButton from sugar.activity.widgets import ActivityToolbarButton from sugar.activity.widgets import StopButton -from sugar.graphics.toolbarbox import ToolbarButton import sugargame.canvas import cells diff --git a/cells.py b/cells.py index 269326e..217cda1 100755 --- a/cells.py +++ b/cells.py @@ -20,11 +20,10 @@ import gtk import math import pygame -from pygame.locals import * -from pieces import * -from sprites import * -from colors import * -from random import * +from random import randint, shuffle +from pieces import EscapeArea, Cell, Hideout +from sprites import Text, Group, Guard +from colors import blue, yellow, black, white from gettext import gettext as _ @@ -190,18 +189,18 @@ class Game(): # Handle Input Events for event in pygame.event.get(): # this one is for the box in the top right marked X - if event.type == QUIT: + if event.type == pygame.QUIT: playing, self.running = False, False # and this one is for the "ESC" key - if event.type == KEYDOWN: - if event.key == K_ESCAPE: + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_ESCAPE: self.move_count = 0 playing = False self.makeMenu() self.cell_count = 1 - if event.key == K_r: + if event.key == pygame.K_r: self.resetGame() - elif event.key == K_h: + elif event.key == pygame.K_h: self.help() # update sprites @@ -269,10 +268,10 @@ class Game(): for event in pygame.event.get(): # this one is for the box in the top right marked X - if event.type == QUIT: + if event.type == pygame.QUIT: self.running = False # and this one is for the "ESC" key - if event.type == KEYDOWN and event.key == K_ESCAPE: + if event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE: helping = False pygame.display.flip() @@ -292,11 +291,11 @@ class Game(): for event in pygame.event.get(): # this one is for the box in the top right marked X - if event.type == QUIT: + if event.type == pygame.QUIT: self.running = False # and this one is for the "ESC" key - if event.type == KEYDOWN: - if event.key == K_ESCAPE: + if event.type == pygame.KEYDOWN: + if event.key == pygame.K_ESCAPE: self.running = False elif self.cell_count == 2 and not self.new_game: self.new_game = True diff --git a/pieces.py b/pieces.py index d34b242..4dfb6c8 100755 --- a/pieces.py +++ b/pieces.py @@ -14,12 +14,9 @@ # You should have received a copy of the GNU General Public License # along with Cells. If not, see . -import math import pygame -from pygame.locals import * -from sprites import * -from colors import * -from random import * +from sprites import Group, Text, Prisoner +from colors import red, green, black, white ################################################################################ # The Cells diff --git a/sprites.py b/sprites.py index 5d50fa4..a5564ae 100755 --- a/sprites.py +++ b/sprites.py @@ -16,9 +16,8 @@ import math import pygame -from pygame.locals import * -from colors import * -from random import * +from colors import red, yellow, black, grey, white +from random import randint ################################################################################ # the Super Group... because regular groups aren't good enough @@ -36,8 +35,8 @@ class Text(pygame.sprite.Sprite): def __init__(self, text, size, color = black): pygame.sprite.Sprite.__init__(self) default = pygame.font.get_default_font() - font = pygame.font.Font(default, size) - self.original = font.render(text, True, color) + font = pygame.font.Font(default, size) + self.original = font.render(text, True, color) self.image = self.original.copy() self.rect = self.image.get_rect() -- cgit v0.9.1