Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt/tawindow.py
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2013-01-04 21:45:16 (GMT)
committer Walter Bender <walter.bender@gmail.com>2013-01-04 21:45:16 (GMT)
commit06e1ef7405bb886b5579b1bc7eacdcc6aec8fdc4 (patch)
treef98c7e846a50d2489d99989a97025d5f15fdd90b /TurtleArt/tawindow.py
parent048eff67da178741b712940c476088d4841379c1 (diff)
increment my_box name by default
Diffstat (limited to 'TurtleArt/tawindow.py')
-rw-r--r--TurtleArt/tawindow.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py
index 6e21109..078ef55 100644
--- a/TurtleArt/tawindow.py
+++ b/TurtleArt/tawindow.py
@@ -1321,7 +1321,7 @@ class TurtleArtWindow():
return True
# We need to check to see if there is already a
# similarly default named stack
- elif blk.name in ['hat']:
+ elif blk.name == 'hat':
similars = self.block_list.get_similar_blocks(
'block', blk.name)
# First look for a hat with _('action') as its label
@@ -1362,6 +1362,16 @@ class TurtleArtWindow():
elif blk.name[0:8] == 'storein_':
defaults = [blk.name[8:], 100]
name = 'storein'
+ # storein my_box gets incremented
+ elif blk.name == 'storein':
+ defaults = [_('my box'), 100]
+ defaults[0] = increment_name(defaults[0])
+ while self._find_proto_name('storein_%s' % (
+ defaults[0]), defaults[0]):
+ defaults[0] = increment_name(defaults[0])
+ self._new_storein_block(defaults[0])
+ self._new_box_block(defaults[0])
+ name = 'storein'
# You cannot mix and match sensor blocks
elif blk.name in ['sound', 'volume', 'pitch']:
if len(self.block_list.get_similar_blocks(
@@ -4022,6 +4032,11 @@ class TurtleArtWindow():
blk_label = blk_label.encode('ascii', 'replace')
if blk.name == name and blk_label == label:
return True
+ # Check labels[1] too (e.g., store in block)
+ if len(blk.spr.labels) > 1:
+ blk_label = blk.spr.labels[1]
+ if blk.name == name and blk_label == label:
+ return True
return False
def _new_stack_block(self, name):