diff options
author | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2008-11-17 21:30:52 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2008-11-17 21:30:52 (GMT) |
commit | 781944d236cd995a7418c9dd75e4233351c934f0 (patch) | |
tree | 77f8a0e56764c4b63ec7ef85db3d2398529fbe27 /labyrinthactivity.py | |
parent | 3bc98abc173c63e1e7383611e76bce324b974f0a (diff) |
First try at adding a "New thought" button
Diffstat (limited to 'labyrinthactivity.py')
-rw-r--r-- | labyrinthactivity.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/labyrinthactivity.py b/labyrinthactivity.py index ee03030..fb060ad 100644 --- a/labyrinthactivity.py +++ b/labyrinthactivity.py @@ -10,6 +10,7 @@ import gobject import gtk from sugar.activity import activity +from sugar.graphics.toolbutton import ToolButton # labyrinth sources are shipped inside the 'src' subdirectory sys.path.append(os.path.join(activity.get_bundle_path(), 'src')) @@ -38,6 +39,12 @@ class LabyrinthActivity(activity.Activity): edit_toolbar.redo.child) self._undo.block () + self._add_text_thought = ToolButton('go-next-paired') + self._add_text_thought.set_tooltip(_('Add idea as text')) + self._add_text_thought.connect('clicked', self.__add_text_thought_cb) + edit_toolbar.insert(self._add_text_thought, -1) + self._add_text_thought.show() + self._save_file = None self._mode = MMapArea.MODE_EDITING @@ -55,6 +62,11 @@ class LabyrinthActivity(activity.Activity): self._undo.unblock() + def __add_text_thought_cb(self, button): + coords = (100, 100) + thought = self._main_area.create_new_thought(coords, MMapArea.TYPE_TEXT) + self._main_area.begin_editing(thought) + def __undo_cb(self, button): self._undo.undo_action(None) |