From f3dd2c2042ad5b3fd5256838c0ec201da9402406 Mon Sep 17 00:00:00 2001 From: Pro-Panda Date: Sat, 13 Jan 2018 09:18:45 +0530 Subject: [PATCH] TitleEntry - save title on activate (Enter) Learners have to use tab to finish editing, followed by clicking the activity icon to dismiss the dialog. A slow work flow and inconsistent with journal list view. The enter key is ignored. Add an activate signal handler to save the title. Force the focus to move by calling hide and show. Signed-off-by: James Cameron --- src/sugar3/activity/widgets.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/sugar3/activity/widgets.py b/src/sugar3/activity/widgets.py index b1b0e2d2..e8c5cd1d 100644 --- a/src/sugar3/activity/widgets.py +++ b/src/sugar3/activity/widgets.py @@ -177,6 +177,7 @@ class TitleEntry(Gtk.ToolItem): self.entry.set_text(activity.metadata['title']) self.entry.connect( 'focus-out-event', self.__title_changed_cb, activity) + self.entry.connect('activate', self.__on_activate, activity) self.entry.connect('button-press-event', self.__button_press_event_cb) self.entry.show() self.add(self.entry) @@ -184,6 +185,12 @@ class TitleEntry(Gtk.ToolItem): activity.metadata.connect('updated', self.__jobject_updated_cb) activity.connect('_closing', self.__closing_cb) + def __on_activate(self, widget, activity): + self.save_title(activity) + self.entry.hide() + self.entry.show() + return False + def modify_bg(self, state, color): Gtk.ToolItem.modify_bg(self, state, color) self.entry.modify_bg(state, color)