diff options
author | Gary Martin <gary@garycmartin.com> | 2009-11-12 15:54:26 (GMT) |
---|---|---|
committer | Gary Martin <gary@garycmartin.com> | 2009-11-12 15:54:26 (GMT) |
commit | 988074ae7bcbcc4bd7f2dd3246cac87dc63606f3 (patch) | |
tree | 6d304bb9de70a346612375d0ea070fd1bfd1c408 /labyrinthactivity.py | |
parent | 06382061e0be6c7cb4029dd8036bb03d54bb3b6e (diff) |
Paste tool button state changes based on ability to insert text (related to sl #770).
Diffstat (limited to 'labyrinthactivity.py')
-rw-r--r-- | labyrinthactivity.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/labyrinthactivity.py b/labyrinthactivity.py index 29025ce..4ff6601 100644 --- a/labyrinthactivity.py +++ b/labyrinthactivity.py @@ -73,6 +73,7 @@ class EditToolbar(activity.EditToolbar): self.clipboard = gtk.Clipboard() self.copy.child.set_sensitive(False) + self.paste.child.set_sensitive(False) def __undo_cb(self, button): self._parent._undo.undo_action(None) @@ -317,12 +318,19 @@ class LabyrinthActivity(activity.Activity): self.__change_copy_state(True) else: self.__change_copy_state(False) + + if self._mode == MMapArea.MODE_TEXT and len(self._main_area.selected) and \ + self._main_area.selected[0].editing: + self.__change_paste_state(True) + else: + self.__change_paste_state(False) - # TODO: implement copy/paste for a thought object or objects + # TODO: implement copy/paste for a whole thought or thoughts def __thought_selected_cb(self, arg, background_color, foreground_color): """Disable copy button if whole thought object is selected """ self.__change_copy_state(False) + self.__change_paste_state(False) def __change_copy_state(self, state): try: @@ -330,6 +338,12 @@ class LabyrinthActivity(activity.Activity): except AttributeError: self.edit_toolbar.copy.child.set_sensitive(state) + def __change_paste_state(self, state): + try: + self.edit_toolbar.props.page.paste.child.set_sensitive(state) + except AttributeError: + self.edit_toolbar.paste.child.set_sensitive(state) + def __expose(self, widget, event): """Create canvas hint message at start """ |