From d0d56570ac006a388ae350a5213d6e37ec9aff96 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Sun, 02 Sep 2012 03:57:51 +0000 Subject: one more corner case re renaming action blocks --- (limited to 'TurtleArt') diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py index dcb43a5..3f1f4ca 100644 --- a/TurtleArt/tawindow.py +++ b/TurtleArt/tawindow.py @@ -1320,7 +1320,21 @@ class TurtleArtWindow(): elif blk.name in ['hat']: similars = self.block_list.get_similar_blocks( 'block', blk.name) - if len(similars) > 0: + # First look for a hat with _('action') as its label + found_the_action_block = False + bname = _('action') + if type(bname) == unicode: + bname = bname.encode('ascii', 'replace') + for sblk in similars: + cblk = sblk.connections[1] + if cblk is not None: + blabel = cblk.spr.labels[0] + if type(blabel) == unicode: + blabel = blabel.encode('ascii', 'replace') + if bname == blabel: + found_the_action_block = True + # If there is an action block in use, change the name + if len(similars) > 0 and found_the_action_block: defaults = [_('action')] if self._find_proto_name('stack', defaults[0]): defaults[0] = increment_name(defaults[0]) -- cgit v0.9.1