Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt/talogo.py
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2012-07-21 12:57:48 (GMT)
committer Walter Bender <walter.bender@gmail.com>2012-07-21 12:57:48 (GMT)
commitcbf23a55067bbe8864cca33873b1fbf30aa6cbce (patch)
treeab3d30c3ceec8815243d443e95c9d193d84ed791 /TurtleArt/talogo.py
parent536a25305119214d569dfc21afffbbd2b76c29c9 (diff)
Update labels on named boxes when running in debug mode
Diffstat (limited to 'TurtleArt/talogo.py')
-rw-r--r--TurtleArt/talogo.py31
1 files changed, 27 insertions, 4 deletions
diff --git a/TurtleArt/talogo.py b/TurtleArt/talogo.py
index 25bf44c..143f584 100644
--- a/TurtleArt/talogo.py
+++ b/TurtleArt/talogo.py
@@ -608,8 +608,9 @@ class LogoCode:
self.value_blocks_to_update[name] = \
self.tw.block_list.get_similar_blocks('block', name)
- def update_label_value(self, name, value=None):
+ def update_label_value(self, name, value=None, label=None):
""" Update the label of value blocks to reflect current value """
+ # If it is a named box, we need to match the label to the box
if not self.tw.interactive_mode:
return
if self.tw.hide:
@@ -618,7 +619,16 @@ class LogoCode:
if value is None:
for block in self.value_blocks_to_update[name]:
block.spr.set_label(block_names[name][0])
- block.resize()
+ if name == 'box':
+ argblk = block.connections[-2]
+ dx = block.dx
+ block.resize()
+ if argblk is not None:
+ # Move connections over...
+ dx = (block.dx - dx) * self.tw.block_scale
+ argblk.spr.move_relative((dx, 0))
+ else:
+ block.resize()
elif self.update_values:
if type(value) == float:
valstring = str(round_int(value)).replace('.',
@@ -626,8 +636,21 @@ class LogoCode:
else:
valstring = str(value)
for block in self.value_blocks_to_update[name]:
- block.spr.set_label(block_names[name][0] + ' = ' + valstring)
- block.resize()
+ if label is None:
+ block.spr.set_label(
+ block_names[name][0] + ' = ' + valstring)
+ block.resize()
+ else:
+ argblk = block.connections[-2]
+ # Only update if label matches
+ if argblk is not None and argblk.spr.labels[0] == label:
+ block.spr.set_label(
+ block_names[name][0] + ' = ' + valstring)
+ dx = block.dx
+ block.resize()
+ # Move connections over...
+ dx = (block.dx - dx) * self.tw.block_scale
+ argblk.spr.move_relative((dx, 0))
def push_file_data_to_heap(self, dsobject):
""" push contents of a data store object (assuming json encoding) """