diff options
author | Manuel Kaufmann <humitos@gmail.com> | 2012-11-27 22:42:51 (GMT) |
---|---|---|
committer | Simon Schampijer <simon@laptop.org> | 2012-11-28 10:48:18 (GMT) |
commit | 7b8fa5e406d8ff5c66f05f8ab3961317f3744794 (patch) | |
tree | 978dd64d4b2a024fd2cc57797fa7700c3126f236 | |
parent | d87967303c87ff72c93769c8ba1345e89e531e39 (diff) |
Activity title entry: auto-select text when tap/click in the entry, SL #4036
When the user taps/clicks in the activity title entry, the text
is selected automatically to change the whole title of the activity
easily.
Signed-off-by: Manuel Kaufmann <humitos@gmail.com>
Acked-by: Simon Schampijer <simon@laptop.org>
-rw-r--r-- | src/sugar3/activity/widgets.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/sugar3/activity/widgets.py b/src/sugar3/activity/widgets.py index b60fc66..088e373 100644 --- a/src/sugar3/activity/widgets.py +++ b/src/sugar3/activity/widgets.py @@ -178,6 +178,7 @@ class TitleEntry(Gtk.ToolItem): self.entry.set_size_request(int(Gdk.Screen.width() / 3), -1) self.entry.set_text(activity.metadata['title']) self.entry.connect('focus-out-event', self.__title_changed_cb, activity) + self.entry.connect('button-press-event', self.__button_press_event_cb) self.entry.show() self.add(self.entry) @@ -203,6 +204,14 @@ class TitleEntry(Gtk.ToolItem): self.save_title(activity) return False + def __button_press_event_cb(self, widget, event): + if widget.is_focus(): + return False + else: + widget.grab_focus() + widget.select_region(0, -1) + return True + def save_title(self, activity): title = self.entry.get_text() if title == activity.metadata['title']: |