From 9d88c67484dad057410ec7d5fe8bf2b7cdedba45 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Mon, 02 Jul 2012 21:08:09 +0000 Subject: Add box and stack proto blocks to palette on load/copy; Don't create duplicate start or action blocks with copy/paste --- (limited to 'TurtleArt/tautils.py') diff --git a/TurtleArt/tautils.py b/TurtleArt/tautils.py index 862554b..6871f35 100644 --- a/TurtleArt/tautils.py +++ b/TurtleArt/tautils.py @@ -1,4 +1,4 @@ -#Copyright (c) 2007-8, Playful Invention Company. +#copyright (c) 2007-8, Playful Invention Company. #Copyright (c) 2008-12, Walter Bender #Permission is hereby granted, free of charge, to any person obtaining a copy @@ -766,6 +766,8 @@ def find_top_block(blk): ''' Find the top block in a stack. ''' if blk is None: return None + if blk.connections is None: + return blk if len(blk.connections) == 0: return blk while blk.connections[0] is not None: @@ -777,6 +779,8 @@ def find_bot_block(blk): ''' Find the bottom block in a stack. ''' if blk is None: return None + if blk.connections is None: + return blk if len(blk.connections) == 0: return blk while blk.connections[-1] is not None: -- cgit v0.9.1