diff options
Diffstat (limited to 'TurtleArt')
-rw-r--r-- | TurtleArt/tablock.py | 8 | ||||
-rw-r--r-- | TurtleArt/talogo.py | 3 | ||||
-rw-r--r-- | TurtleArt/tawindow.py | 3 |
3 files changed, 3 insertions, 11 deletions
diff --git a/TurtleArt/tablock.py b/TurtleArt/tablock.py index 5f61b5e..0ad00fa 100644 --- a/TurtleArt/tablock.py +++ b/TurtleArt/tablock.py @@ -113,13 +113,7 @@ class Blocks: i += 1 return None - def get_block_of_same_type_and_name(self, type, name): - for block in self.list: - if block.type == type and block.name == name: - return block - return None - - def get_all_blocks_of_same_type_and_name(self, type, name): + def get_similar_blocks(self, type, name): block_list = [] for block in self.list: if block.type == type and block.name == name: diff --git a/TurtleArt/talogo.py b/TurtleArt/talogo.py index cbd839b..3776c93 100644 --- a/TurtleArt/talogo.py +++ b/TurtleArt/talogo.py @@ -274,8 +274,7 @@ def update_label_value(tw, name, value=None): """ Update the label of value blocks to reflect current value """ if tw.hide or not tw.interactive_mode: return - list = tw.block_list.get_all_blocks_of_same_type_and_name( - 'block', name) + list = tw.block_list.get_similar_blocks('block', name) if value is None: for block in list: block.spr.set_label(BLOCK_NAMES[name][0]) diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py index 2853bbd..b0db7ac 100644 --- a/TurtleArt/tawindow.py +++ b/TurtleArt/tawindow.py @@ -784,8 +784,7 @@ class TurtleArtWindow(): else: # You can only have one instance of some blocks if blk.name in ['start', 'hat1', 'hat2']: - if self.block_list.get_block_of_same_type_and_name( - 'block', blk.name) is not None: + if len(self.block_list.get_all_blocks_of_same_type_and_name('block', blk.name)) > 0: return True blk.highlight() self._new_block(blk.name, x, y) |