diff options
author | Walter Bender <walter@sugarlabs.org> | 2010-09-16 20:52:29 (GMT) |
---|---|---|
committer | Walter Bender <walter@sugarlabs.org> | 2010-09-16 20:52:29 (GMT) |
commit | 7f262d557ecd676ea595e8a7287aae28c03850cb (patch) | |
tree | ace74cc9474821e974105a27c04a2c63f00992bb /TurtleArt/tawindow.py | |
parent | aab4c5d6ec4e31b1270eef7df74d1a4f7b39fc9d (diff) |
expandable math blocks
Diffstat (limited to 'TurtleArt/tawindow.py')
-rw-r--r-- | TurtleArt/tawindow.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py index 2a8732f..2e1f974 100644 --- a/TurtleArt/tawindow.py +++ b/TurtleArt/tawindow.py @@ -49,7 +49,7 @@ from taconstants import HORIZONTAL_PALETTE, VERTICAL_PALETTE, BLOCK_SCALE, \ DEAD_DICTS, DEAD_KEYS, TEMPLATES, PYTHON_SKIN, \ PALETTE_HEIGHT, STATUS_LAYER, OLD_DOCK, OLD_NAMES, \ BOOLEAN_STYLE, BLOCK_NAMES, DEFAULT_TURTLE, \ - TURTLE_LAYER + TURTLE_LAYER, EXPANDABLE_MATH from talogo import LogoCode, stop_logo from tacanvas import TurtleGraphics from tablock import Blocks, Block @@ -1415,6 +1415,23 @@ class TurtleArtWindow(): if gblk != blk: gblk.spr.move_relative((0, dy * blk.scale)) grow_stack_arm(find_sandwich_top(blk)) + elif blk.name in EXPANDABLE_MATH: + if hide_button_hit(blk.spr, x, y): + dy = blk.reset_y() + elif show_button_hit(blk.spr, x, y): + dy = 20 + blk.expand_in_y(dy) + else: + dy = 0 + if blk.connections[1] is not None: + group = find_group(blk.connections[1]) + group.append(blk) + else: + group = [blk] + for gblk in find_group(blk): + if gblk not in group: + gblk.spr.move_relative((0, dy * blk.scale)) + grow_stack_arm(find_sandwich_top(blk)) elif blk.name in EXPANDABLE or blk.name == 'nop': if show_button_hit(blk.spr, x, y): n = len(blk.connections) @@ -2014,7 +2031,7 @@ class TurtleArtWindow(): if value is not None: self.block_scale = value elif btype in EXPANDABLE or btype == 'nop': - if btype == 'vspace': + if btype == 'vspace' or btype in EXPANDABLE_MATH: if value is not None: blk.expand_in_y(value) elif btype == 'hspace' or btype == 'identity2': |