From 28be0714a4db06bb82f643d4218b9cfca0eb1914 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Tue, 31 Jul 2012 17:50:58 +0000 Subject: add restore from trash to edit toolbar --- diff --git a/TurtleArt/tawindow.py b/TurtleArt/tawindow.py index 6e11a3a..a8b23fa 100644 --- a/TurtleArt/tawindow.py +++ b/TurtleArt/tawindow.py @@ -1297,7 +1297,7 @@ class TurtleArtWindow(): if blk.name == 'restoreall': self._restore_all_from_trash() elif blk.name == 'restore': - self._restore_latest_from_trash() + self.restore_latest_from_trash() elif blk.name == 'empty': self._empty_trash() elif blk.name == 'trashall': @@ -1686,7 +1686,7 @@ class TurtleArtWindow(): if blk.type == 'trash': self._restore_from_trash(blk) - def _restore_latest_from_trash(self): + def restore_latest_from_trash(self): ''' Restore most recent blocks from the trash can. ''' if len(self.trash_stack) == 0: return diff --git a/TurtleArtActivity.py b/TurtleArtActivity.py index 18375a2..a039f4a 100644 --- a/TurtleArtActivity.py +++ b/TurtleArtActivity.py @@ -523,6 +523,8 @@ class TurtleArtActivity(activity.Activity): edit_toolbar, 'c') self._add_button('edit-paste', _('Paste'), self._paste_cb, edit_toolbar, 'v') + self._add_button('edit-undo', _('Restore blocks from trash'), + self._undo_cb, edit_toolbar) self._add_button('view-fullscreen', _('Fullscreen'), self.do_fullscreen_cb, view_toolbar, 'Return') self._add_button('view-Cartesian', _('Cartesian coordinates'), @@ -1157,6 +1159,10 @@ in order to use the plugin.')) self.tw.paste_offset) self.tw.paste_offset += 20 + def _undo_cb(self, button): + ''' Restore most recent item added to the trash ''' + self.tw.restore_latest_from_trash() + def _share_cb(self, button): ''' Share a stack of blocks. ''' if self.sharing_blocks: -- cgit v0.9.1