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 <quozl@laptop.org>
This commit is contained in:
parent
aaea86066d
commit
f3dd2c2042
@ -177,6 +177,7 @@ class TitleEntry(Gtk.ToolItem):
|
|||||||
self.entry.set_text(activity.metadata['title'])
|
self.entry.set_text(activity.metadata['title'])
|
||||||
self.entry.connect(
|
self.entry.connect(
|
||||||
'focus-out-event', self.__title_changed_cb, activity)
|
'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.connect('button-press-event', self.__button_press_event_cb)
|
||||||
self.entry.show()
|
self.entry.show()
|
||||||
self.add(self.entry)
|
self.add(self.entry)
|
||||||
@ -184,6 +185,12 @@ class TitleEntry(Gtk.ToolItem):
|
|||||||
activity.metadata.connect('updated', self.__jobject_updated_cb)
|
activity.metadata.connect('updated', self.__jobject_updated_cb)
|
||||||
activity.connect('_closing', self.__closing_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):
|
def modify_bg(self, state, color):
|
||||||
Gtk.ToolItem.modify_bg(self, state, color)
|
Gtk.ToolItem.modify_bg(self, state, color)
|
||||||
self.entry.modify_bg(state, color)
|
self.entry.modify_bg(state, color)
|
||||||
|
Loading…
Reference in New Issue
Block a user