diff options
author | Walter Bender <walter.bender@gmail.com> | 2012-06-30 14:49:33 (GMT) |
---|---|---|
committer | Walter Bender <walter.bender@gmail.com> | 2012-06-30 14:49:33 (GMT) |
commit | ea576330818699e188d7226b8bc6643efc38af26 (patch) | |
tree | ba1b34347fbf3d201ec6386cda30c8e28d906f62 /TurtleArt/tawindow.py | |
parent | eefbc133c3d825b8f87979117af6a8eaaefa4e10 (diff) |
new copy button behavior
Diffstat (limited to 'TurtleArt/tawindow.py')
-rw-r--r-- | TurtleArt/tawindow.py | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py index 15a0b45..8f37de7 100644 --- a/TurtleArt/tawindow.py +++ b/TurtleArt/tawindow.py @@ -1268,6 +1268,10 @@ class TurtleArtWindow(): # From the sprite at x, y, look for a corresponding block blk = self.block_list.spr_to_block(spr) + ''' If we were copying and didn't click on a block... ''' + if self.running_sugar and self.activity.copying: + if blk is None or blk.type != 'block': + self.activity.restore_cursor() if blk is not None: if blk.type == 'block': self.selected_blk = blk @@ -1514,10 +1518,6 @@ class TurtleArtWindow(): self.lc.trace = 1 self.showblocks() self.run_button(3) - elif spr.name == 'debugoff': - self.lc.trace = 1 - self.showblocks() - self.run_button(6) elif spr.name == 'stopiton': self.stop_button() self.display_coordinates() @@ -1651,10 +1651,13 @@ class TurtleArtWindow(): self.drag_group = find_group(blk) (sx, sy) = blk.spr.get_xy() self.drag_pos = x - sx, y - sy - for blk in self.drag_group: - if blk.status != 'collapsed': - blk.spr.set_layer(TOP_LAYER) - blk.highlight() + if self.running_sugar and self.activity.copying: + for blk in self.drag_group: + if blk.status != 'collapsed': + blk.spr.set_layer(TOP_LAYER) + blk.highlight() + self.block_operation = 'copying' + self.activity.send_to_clipboard() if self.running_sugar and self._sharing and \ hasattr(self.activity, 'share_button'): self.activity.share_button.set_tooltip( @@ -2164,6 +2167,11 @@ class TurtleArtWindow(): abs(self.dx) < MOTION_THRESHOLD and \ abs(self.dy < MOTION_THRESHOLD))): self._click_block(x, y) + elif self.block_operation == 'copying': + self.drag_group = find_group(blk) + for gblk in self.drag_group: + gblk.unhighlight() + self.drag_group = None def remote_turtle(self, name): ''' Is this a remote turtle? ''' @@ -2839,7 +2847,7 @@ class TurtleArtWindow(): return True if keyname in ['KP_End', 'End']: - self.run_button(0) + self.run_button(self.step_time) elif self.selected_spr is not None: if not self.lc.running and block_flag: blk = self.block_list.spr_to_block(self.selected_spr) |