From 01460af4ef727708314c4e3341f00f37a33217fc Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Thu, 17 Jan 2008 23:15:08 +0000 Subject: [PATCH] 2008-01-18 Benny Malengier * src/Editors/_EditNote.py: focus on text field on start * src/Editors/_EditChildRef.py: add usability: name of child, edit btn * src/Editors/_EditFamily.py: grab Errors.WindowActiveError * src/glade/gramps.glade: add usability to childref, see #1462 svn: r9873 --- ChangeLog | 5 + src/Editors/_EditChildRef.py | 42 ++++++++- src/Editors/_EditFamily.py | 7 +- src/Editors/_EditNote.py | 3 + src/glade/gramps.glade | 176 ++++++++++++++++++++++++++--------- 5 files changed, 184 insertions(+), 49 deletions(-) diff --git a/ChangeLog b/ChangeLog index fc2c6a289..95fb5edf4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-01-18 Benny Malengier + * src/Editors/_EditNote.py: focus on text field on start + * src/Editors/_EditChildRef.py: add usability: name of child, edit btn + * src/Editors/_EditFamily.py: grab Errors.WindowActiveError + * src/glade/gramps.glade: add usability to childref, see #1462 2008-01-17 Benny Malengier * src/Editors/_EditChildRef.py: set focus on OK button for quick work diff --git a/src/Editors/_EditChildRef.py b/src/Editors/_EditChildRef.py index 76cdbc635..c8154dbb5 100644 --- a/src/Editors/_EditChildRef.py +++ b/src/Editors/_EditChildRef.py @@ -37,7 +37,7 @@ from gettext import gettext as _ # GTK/Gnome modules # #------------------------------------------------------------------------- -import gtk.glade +import gtk #------------------------------------------------------------------------- # @@ -47,9 +47,20 @@ import gtk.glade import const from _EditSecondary import EditSecondary from gen.lib import NoteType +import Errors from DisplayTabs import SourceEmbedList, NoteTab -from GrampsWidgets import * +from GrampsWidgets import MonitoredDataType, PrivacyButton +from BasicUtils import name_displayer + +#------------------------------------------------------------------------- +# +# Constants +# +#------------------------------------------------------------------------- + +_RETURN = gtk.gdk.keyval_from_name("Return") +_KP_ENTER = gtk.gdk.keyval_from_name("KP_Enter") #------------------------------------------------------------------------- # @@ -78,6 +89,9 @@ class EditChildRef(EditSecondary): self.name, _('Child Reference Editor')) self.ok_button = self.top.get_widget('ok') + self.edit_button = self.top.get_widget('edit') + self.name_label = self.top.get_widget('name') + self.name_label.set_text(self.name) def _setup_fields(self): @@ -106,6 +120,9 @@ class EditChildRef(EditSecondary): self.define_help_button(self.top.get_widget('help'), 'adv-ad') self.define_cancel_button(self.top.get_widget('cancel')) self.define_ok_button(self.ok_button, self.save) + self.edit_button.connect('button-press-event', self.edit_child) + self.edit_button.connect('key-press-event', self.edit_child) + self._add_db_signal('person-update', self.person_change) def _create_tabbed_pages(self): """ @@ -135,6 +152,27 @@ class EditChildRef(EditSecondary): def build_menu_names(self,obj): return (_('Child Reference'),_('Child Reference Editor')) + def edit_child(self,obj,event): + if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1 \ + or event.keyval in (_RETURN, _KP_ENTER): + from _EditPerson import EditPerson + handle = self.obj.ref + try: + person = self.db.get_person_from_handle(handle) + EditPerson(self.dbstate, self.uistate, + self.track, person) + except Errors.WindowActiveError: + pass + + def person_change(self, handles): + # check to see if the handle matches the current object + print handles + if self.obj.ref in handles: + p = self.dbstate.db.get_person_from_handle(self.obj.ref) + self.name = name_displayer.display(p) + print 'changed label' + self.name_label.set_text(self.name) + def save(self,*obj): """ Called when the OK button is pressed. Gets data from the diff --git a/src/Editors/_EditFamily.py b/src/Editors/_EditFamily.py index 66bd529af..bc7cf2fb6 100644 --- a/src/Editors/_EditFamily.py +++ b/src/Editors/_EditFamily.py @@ -80,7 +80,7 @@ class ChildEmbedList(EmbeddedList): _MSG = { 'add' : _('Create a new person and add the child to the family'), 'del' : _('Remove the child from the family'), - 'edit' : _('Edit the child'), + 'edit' : _('Edit the child reference'), 'share' : _('Add an existing person as a child of the family'), 'up' : _('Move the child up in the childrens list'), 'down' : _('Move the child down in the childrens list'), @@ -277,8 +277,11 @@ class ChildEmbedList(EmbeddedList): for ref in self.family.get_child_ref_list(): if ref.ref == handle: p = self.dbstate.db.get_person_from_handle(handle) - EditPerson(self.dbstate, self.uistate, self.track, + try: + EditPerson(self.dbstate, self.uistate, self.track, p, self.child_ref_edited) + except Errors.WindowActiveError: + pass break def up_button_clicked(self, obj): diff --git a/src/Editors/_EditNote.py b/src/Editors/_EditNote.py index 77ac3488e..bc8ed3e42 100644 --- a/src/Editors/_EditNote.py +++ b/src/Editors/_EditNote.py @@ -353,6 +353,9 @@ class EditNote(EditPrimary): """ return (_('Edit Note'), self.get_menu_title()) + def _post_init(self): + self.text.grab_focus() + def on_textview_key_press_event(self, textview, event): """Handle shortcuts in the TextView.""" return textview.get_buffer().on_key_press_event(textview, event) diff --git a/src/glade/gramps.glade b/src/glade/gramps.glade index b1f284f31..d31347dd3 100644 --- a/src/glade/gramps.glade +++ b/src/glade/gramps.glade @@ -14078,41 +14078,12 @@ Very High 12 True - 2 + 3 7 False 6 12 - - - True - Relationship to _Father: - True - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - frel - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - - True @@ -14132,6 +14103,52 @@ Very High False 0 + + 0 + 1 + 2 + 3 + fill + + + + + + + True + False + True + True + + + 1 + 6 + 2 + 3 + fill + fill + + + + + + True + Relationship to _Father: + True + False + GTK_JUSTIFY_CENTER + False + False + 0 + 0.5 + 0 + 0 + frel + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + 0 1 @@ -14142,6 +14159,22 @@ Very High + + + True + False + True + True + + + 1 + 6 + 1 + 2 + fill + + + True @@ -14166,43 +14199,96 @@ Very High 6 7 - 1 - 2 + 2 + 3 - + True - False - True - True + Name Child: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 1 6 0 1 - fill + fill + - + True - False - True + Open person editor of this child + True + GTK_RELIEF_NONE True + + + + True + gtk-edit + 1 + 0.5 + 0.5 + 0 + 0 + + - 1 - 6 - 1 - 2 + 6 + 7 + 0 + 1 fill - fill +