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-26 04:41:46 (GMT)
committer Walter Bender <walter@walter-laptop.(none)>2010-01-26 04:41:46 (GMT)
commit18a50f72447c28c82c6283d51ab52e9b153836bc (patch)
tree03619071243f6acb5d83dfb1e4ddfbffffe64034 /block.py
parentd55ff0e2c64ea5c90a8573ca97b969e09a143d2b (diff)
fixed most of the project-loading problems
Diffstat (limited to 'block.py')
-rw-r--r--block.py27
1 files changed, 14 insertions, 13 deletions
diff --git a/block.py b/block.py
index 9b0feb4..426c6ae 100644
--- a/block.py
+++ b/block.py
@@ -47,10 +47,10 @@ class Blocks:
if block in self.list:
self.list.remove(block)
- def print_list(self):
+ def print_list(self, block_type=None):
for i, block in enumerate(self.list):
- print "%d: %s" % (i, block.name)
-
+ if block_type is None or block_type == block.type:
+ print "%d: %s" % (i, block.name)
#
# sprite utilities
@@ -65,6 +65,12 @@ class Blocks:
# A class for the individual blocks
#
class Block:
+ #
+ # TODO:
+ # Logo code
+ # HTML code
+ # debug code
+ # etc.
def __init__(self, block_list, sprite_list, name, x, y, type='block',
labels=[], scale=2.0, colors=["#00FF00","#00A000"]):
self.spr = None
@@ -82,6 +88,9 @@ class Block:
self._left = 0
self._right = 0
+ if OLD_NAMES.has_key(self.name):
+ self.name = OLD_NAMES[self.name]
+
for i in range(len(self._font_size)):
self._font_size[i] *= self.scale
@@ -97,12 +106,6 @@ class Block:
self.primitive = PRIMITIVES[self.name]
block_list.append_to_list(self)
- #
- # TODO:
- # Logo code
- # HTML code
- # debug code
- # etc.
# We need to resize some blocks on the fly.
def resize(self):
@@ -126,7 +129,7 @@ class Block:
def _new_block_from_factory(self, sprite_list, labels, x, y):
- print "new block: %s (%d %d)" % (self.name, x, y)
+ # print "new block: %s (%d %d)" % (self.name, x, y)
self.svg = SVG()
self.svg.set_scale(self.scale)
@@ -144,12 +147,10 @@ class Block:
# If labels were passed, use them;
if len(labels) > 0:
- print labels
for i, l in enumerate(labels):
self._set_labels(i, l)
# otherwise use default values;
elif BLOCK_NAMES.has_key(self.name):
- print BLOCK_NAMES[self.name]
for i, l in enumerate(BLOCK_NAMES[self.name]):
self._set_labels(i, l)
# and make sure the labels fit.
@@ -206,7 +207,7 @@ class Block:
self._make_flow_style_boolean(e, svg)
else:
self._make_basic_style(e, svg)
- print "don't know how to create a %s block" % (self.name)
+ print ">>>>> I don't know how to create a %s block" % (self.name)
def _set_colors(self, svg):
for p in range(len(PALETTES)):