2008-01-01 Gary Burton <gary.burton@zen.co.uk>

* src/Selectors/_SelectPerson.py: the select person dialog now allows a
	person to be selected by using the keyboard. This dialog really needs an
	overhaul so that it can use the BaseSelector class as SelectFamily does.
	However a PeopleModel based on BaseModel is required for this as the
	existing PeopleModel is a custom built class. bug #1456



svn: r9695
This commit is contained in:
Gary Burton 2008-01-03 13:39:57 +00:00
parent d54e05c41e
commit 424665ee39
2 changed files with 42 additions and 13 deletions

View File

@ -1,3 +1,10 @@
2008-01-01 Gary Burton <gary.burton@zen.co.uk>
* src/Selectors/_SelectPerson.py: the select person dialog now allows a
person to be selected by using the keyboard. This dialog really needs an
overhaul so that it can use the BaseSelector class as SelectFamily does.
However a PeopleModel based on BaseModel is required for this as the
existing PeopleModel is a custom built class. bug #1456
2008-01-03 Jérôme Rapinat <romjerome@yahoo.fr> 2008-01-03 Jérôme Rapinat <romjerome@yahoo.fr>
* src/configure.in : add bulgarian * src/configure.in : add bulgarian

View File

@ -79,6 +79,10 @@ class SelectPerson(ManagedWindow.ManagedWindow):
self.plist = self.glade.get_widget('plist') self.plist = self.glade.get_widget('plist')
self.showall = self.glade.get_widget('showall') self.showall = self.glade.get_widget('showall')
self.notebook = self.glade.get_widget('notebook') self.notebook = self.glade.get_widget('notebook')
self.plist.connect('row-activated', self._on_row_activated)
self.plist.connect('key-press-event', self._key_press)
self.selection = self.plist.get_selection()
self.selection.set_mode(gtk.SELECTION_SINGLE)
window = self.glade.get_widget('select_person') window = self.glade.get_widget('select_person')
title_label = self.glade.get_widget('title') title_label = self.glade.get_widget('title')
@ -168,3 +172,21 @@ class SelectPerson(ManagedWindow.ManagedWindow):
elif val != gtk.RESPONSE_DELETE_EVENT: elif val != gtk.RESPONSE_DELETE_EVENT:
self.close() self.close()
return None return None
def _key_press(self, obj, event):
if not event.state or event.state in (gtk.gdk.MOD2_MASK, ):
if event.keyval in (gtk.keysyms.Return, gtk.keysyms.KP_Enter):
store, paths = self.selection.get_selected_rows()
if paths and len(paths[0]) == 1 :
if self.plist.row_expanded(paths[0]):
self.plist.collapse_row(paths[0])
else:
self.plist.expand_row(paths[0], 0)
return True
else:
self.window.response(gtk.RESPONSE_OK)
return True
return False
def _on_row_activated(self, treeview, path, view_col):
self.window.response(gtk.RESPONSE_OK)