Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/block.py
diff options
context:
space:
mode:
authorWalter Bender <walter@walter-laptop.(none)>2010-01-21 15:05:11 (GMT)
committer Walter Bender <walter@walter-laptop.(none)>2010-01-21 15:05:11 (GMT)
commit5fb4e26f2329c8522047fb13a9f4975b309ce7d8 (patch)
treec8f6a5509eb7ee7ccaece0e074cfe0fc24ba0c18 /block.py
parente072a53788f8f4b738f54d85565ac2377cfa2893 (diff)
fixed findsprite bug
Diffstat (limited to 'block.py')
-rw-r--r--block.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/block.py b/block.py
index f88dd27..02fcaf4 100644
--- a/block.py
+++ b/block.py
@@ -93,7 +93,7 @@ class Block:
else:
print "%s %s (%d %d)" % (name, labels[0], x, y)
- svg = block_factory.SVG()
+ svg = sprite_factory.SVG()
if name in TURTLE_PALETTE:
svg.set_colors(TURTLE_COLORS)
elif name in PEN_PALETTE:
@@ -167,6 +167,24 @@ class Block:
for label in labels:
self.spr.set_label(label, labels.index(label))
+ self.type = 'block'
+
+class Turtle:
+ def __init__(self, blocks, orientation=0, scale=1.0):
+ self.blocks = blocks
+ self.spr = None
+ self._new_turtle_from_prototype(orientation, scale)
+ self.blocks.append_to_list(self)
+ self.orientation = orientation
+
+ def _new_turtle_from_prototype(self, orientation, scale):
+ svg = sprite_factory.SVG()
+ svg.set_scale(scale)
+ svg.set_orientation(orientation)
+ self.spr = sprites.Sprite(self.blocks.sprites, 0, 0,
+ svg_str_to_pixbuf(svg.turtle()))
+ self.type = 'turtle'
+
#
# Load pixbuf from SVG string
#