diff options
author | Walter Bender <walter.bender@gmail.com> | 2012-07-06 16:40:14 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2012-07-06 16:40:14 (GMT) |
commit | ea90a80c03a0d784e6423e79c78003ad465434f0 (patch) | |
tree | 0b1b8a97e272d339f0fd985a1eeccc95cf56d388 | |
parent | ecb658d21e059f796fdad983b75eeb43abbb50e6 (diff) |
convert old-style sandwich blocks into clamps
-rw-r--r-- | TurtleArt/tawindow.py | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py index d3e891c..5b250c3 100644 --- a/TurtleArt/tawindow.py +++ b/TurtleArt/tawindow.py @@ -1801,11 +1801,15 @@ class TurtleArtWindow(): blocks = [] for blk in self._process_block_data: if not self._found_a_turtle(blk): - blocks.append(self.load_block(blk, offset)) + newblk = self.load_block(blk, offset) + if newblk is not None: + blocks.append(newblk) # Some extra blocks may have been added by load_block for blk in self._extra_block_data: self._process_block_data.append(blk) - blocks.append(self.load_block(blk, offset)) + newblk = self.load_block(blk, offset) + if newblk is not None: + blocks.append(newblk) # Make the connections. for i in range(len(blocks)): @@ -3351,6 +3355,29 @@ class TurtleArtWindow(): elif type(btype) == list: btype, value = btype[0], btype[1] + # Replace old-style sandwich blocks + if btype == 'sandwichtop_no_label': + debug_output('swapping out old sandwich top', True) + btype = 'sandwichclamp' + docks = [] + for d in b[4]: + docks.append(d) + docks.append(None) + b[4] = docks + elif btype == 'sandwichtop_no_arm_no_label': + debug_output('swapping out old sandwich collapsed', True) + btype = 'sandwichclampcollapsed' + docks = [] + for d in b[4]: + docks.append(d) + docks.append(None) + b[4] = docks + # FIXME: blocks after sandwich bottom must be attached to + # sandwich top dock[2], currently set to None + elif btype in ['sandwichbottom', 'sandwichcollapsed']: + debug_output('swapping out old sandwich bottom', True) + btype = 'vspace' + # Some blocks can only appear once... if btype in ['start', 'hat1', 'hat2']: if self._check_for_duplicate(btype): |