From 5fb4e26f2329c8522047fb13a9f4975b309ce7d8 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Thu, 21 Jan 2010 15:05:11 +0000 Subject: fixed findsprite bug --- (limited to 'block.py') 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 # -- cgit v0.9.1