Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2012-07-19 20:44:40 (GMT)
committer Walter Bender <walter.bender@gmail.com>2012-07-19 20:44:40 (GMT)
commite350b3dd2ecaad2b08b6d3c5c62fd059cf675174 (patch)
treef898e8bfa1b6f306bd383f86866b73008e33b58d
parenta04bfea5aabfed5f07a0c70126afd891a5284808 (diff)
more robust error checking for load_blocks
-rw-r--r--plugins/turtle_blocks_extras/turtle_blocks_extras.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/plugins/turtle_blocks_extras/turtle_blocks_extras.py b/plugins/turtle_blocks_extras/turtle_blocks_extras.py
index d75e336..be44296 100644
--- a/plugins/turtle_blocks_extras/turtle_blocks_extras.py
+++ b/plugins/turtle_blocks_extras/turtle_blocks_extras.py
@@ -1447,8 +1447,11 @@ bullets'))
x, y = self.tw.active_turtle.get_xy()
if type(blkname) == type([]):
name = blkname[0]
- value = blkname[1:]
- dy = int(self._find_block(name, x, y, value))
+ if len(blkname) > 1:
+ value = blkname[1:]
+ dy = int(self._find_block(name, x, y, value))
+ else:
+ dy = int(self._find_block(name, x, y))
else:
name = blkname
if name == 'delete':
@@ -1466,10 +1469,13 @@ bullets'))
def _make_block(self, name, x, y, defaults):
x_pos = x + 20
y_pos = y + 20
- for i, v in enumerate(defaults):
- if type(v) == float and int(v) == v:
- defaults[i] = int(v)
- self.tw._new_block(name, x_pos, y_pos, defaults)
+ if defaults is None:
+ self.tw._new_block(name, x_pos, y_pos, defaults)
+ else:
+ for i, v in enumerate(defaults):
+ if type(v) == float and int(v) == v:
+ defaults[i] = int(v)
+ self.tw._new_block(name, x_pos, y_pos, defaults)
# Find the block we just created and attach it to a stack.
self.tw.drag_group = None