From d251bbe7c122c4ed1d41284e3b480095abe745d4 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Wed, 1 Mar 2006 23:27:45 +0000 Subject: [PATCH] * src/EditPerson.py: fix focus_out_event signal handling * src/DisplayTabs.py: provide double click/edit button handling for back references. svn: r6018 --- gramps2/ChangeLog | 5 ++++ gramps2/src/DisplayTabs.py | 51 +++++++++++++++++++++++++++++++++++--- gramps2/src/EditPerson.py | 9 ++++--- 3 files changed, 58 insertions(+), 7 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 3c2241a9d..61632285c 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,8 @@ +2006-03-01 Don Allingham + * src/EditPerson.py: fix focus_out_event signal handling + * src/DisplayTabs.py: provide double click/edit button handling + for back references. + 2006-02-28 Alex Roitman * src/Exporter.py (Exporter): Callback support, busy cursor. * src/ViewManager.py (ViewManager): Move progress bar handling diff --git a/gramps2/src/DisplayTabs.py b/gramps2/src/DisplayTabs.py index a33f536bc..f4c684c2c 100644 --- a/gramps2/src/DisplayTabs.py +++ b/gramps2/src/DisplayTabs.py @@ -712,10 +712,55 @@ class BackRefList(EmbeddedList): def column_order(self): return ((1,0),(1,1),(1,2)) + def find_node(self): + (model,node) = self.selection.get_selected() + try: + return (model.get_value(node,0),model.get_value(node,3)) + except: + return (None,None) + def edit_button_clicked(self,obj): - ref = self.get_selected() - if ref: - print ref + (reftype, ref) = self.find_node() + if reftype == 'Person': + try: + import EditPerson + + person = self.dbstate.db.get_person_from_handle(ref) + EditPerson.EditPerson(self.dbstate, self.uistate, [], person) + except Errors.WindowActiveError: + pass + elif reftype == 'Family': + try: + import EditFamily + + family = self.dbstate.db.get_family_from_handle(ref) + EditFamily.EditFamily(self.dbstate, self.uistate, [], family) + except Errors.WindowActiveError: + pass + elif reftype == 'Source': + try: + import EditFamily + + source = self.dbstate.db.get_source_from_handle(ref) + EditSource.EditSource(self.dbstate, self.uistate, [], source) + except Errors.WindowActiveError: + pass + elif reftype == 'Place': + try: + import EditPlace + + place = self.dbstate.db.get_place_from_handle(ref) + EditPlace.EditPlace(self.dbstate,self.uistate,[],place) + except Errors.WindowActiveError: + pass + elif reftype == 'Media': + try: + import EditMedia + + obj = self.dbstate.db.get_object_from_handle(ref) + EditMedia.EditMedia(self.dbstate,self.uistate, [], obj) + except Errors.WindowActiveError: + pass class SourceBackRefList(BackRefList): diff --git a/gramps2/src/EditPerson.py b/gramps2/src/EditPerson.py index a32bb7a01..613359b8c 100644 --- a/gramps2/src/EditPerson.py +++ b/gramps2/src/EditPerson.py @@ -114,8 +114,7 @@ class EditPerson(EditPrimary.EditPrimary): self.define_ok_button(self.top.get_widget("ok"), self.save) self.define_help_button(self.top.get_widget("button134"),'adv-pers') -# self.top.get_widget("given_name").connect("focus_out_event", -# self.given_focus_out_event) + self.given.connect("focus_out_event",self.given_focus_out_event) self.top.get_widget("button177").connect("clicked", self.edit_name_clicked) self.eventbox.connect('button-press-event',self.image_button_press) @@ -342,9 +341,11 @@ class EditPerson(EditPrimary.EditPrimary): def given_focus_out_event (self, entry, event): if not self.should_guess_gender: - return + return False - self.gender.force(self.db.genderStats.guess_gender(self.given.get_value())) + gender = self.given.get_value() + self.gender.force(self.db.genderStats.guess_gender()) + return False def load_photo(self,photo): """loads, scales, and displays the person's main photo"""