Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter@sugarlabs.org>2010-07-07 04:15:38 (GMT)
committer Walter Bender <walter@sugarlabs.org>2010-07-07 04:15:38 (GMT)
commit009bf01b5d3a9730f363d47b960efd590c660be3 (patch)
tree470e741286d43660a6001051143a92c83e4c94b8
parent92f9b7401f1bfa8d54b0aa75d12f35f976edf4b7 (diff)
pep8
-rw-r--r--card.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/card.py b/card.py
index a1d4303..53fd783 100644
--- a/card.py
+++ b/card.py
@@ -14,11 +14,9 @@
import pygtk
pygtk.require('2.0')
import gtk
-import gobject
-import os.path
-from constants import *
-from sprites import *
+from constants import SELECTMASK, MATCHMASK, COLORS, NUMBER, FILLS
+from sprites import Sprite
#
# class for defining individual cards
@@ -31,8 +29,13 @@ from sprites import *
# for fill in range(0,FILLS):
# if shape == SELECTMASK then generate special card-selected overlay
#
+
+
class Card:
+ """ Individual cards """
+
def __init__(self, sprites, svg_string, attributes):
+ """ Create the card and store its attributes """
if attributes[0] == SELECTMASK:
self.spr = Sprite(sprites, 0, 0, svg_str_to_pixbuf(svg_string))
self.index = SELECTMASK
@@ -44,23 +47,23 @@ class Card:
self.color = attributes[1]
self.num = attributes[2]
self.fill = attributes[3]
- self.index = self.shape*COLORS*NUMBER*FILLS+\
- self.color*NUMBER*FILLS+\
- self.num*FILLS+\
+ self.index = self.shape * COLORS * NUMBER * FILLS+\
+ self.color * NUMBER * FILLS +\
+ self.num * FILLS +\
self.fill
self.spr = Sprite(sprites, 0, 0, svg_str_to_pixbuf(svg_string))
def show_card(self):
+ """ Show the care """
self.spr.set_layer(2000)
self.spr.draw()
def hide_card(self):
self.spr.hide()
-#
-# Load pixbuf from SVG string
-#
+
def svg_str_to_pixbuf(svg_string):
+ """ Load pixbuf from SVG string """
pl = gtk.gdk.PixbufLoader('svg')
pl.write(svg_string)
pl.close()