diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index d02fddae0..9dc8637cc 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,19 @@ +2004-02-20 Alex Roitman + * src/EditPerson.py: Corrections. + * src/EditSource.py: Use parent class. Use windows menu. + * src/ImageSelect.py: Corrections. + * src/Sources.py: Corrections. + * src/gramps.glade: Add handlers. + * src/NoteEdit.py: Corrections. + * src/dialog.glade: Add handler. + * src/Witness.py: Corrections. + * src/RelLib.py: Include witnesses in comparing events. + * src/FamilyView.py: Pass parent on to child classes. + * src/AddSpouse.py: Pass parent on to EditPerson. + * src/ChooseParents.py: Pass parent on to EditPerson. + * src/gramps_main.py: Pass Gramps class to child classes. + * src/MergeData.py: Pass parent on to EditPerson. + 2004-02-19 Alex Roitman * src/EditPerson.py: Use parent class. Add/remove itself from/to the Windows menu. diff --git a/gramps2/src/AddSpouse.py b/gramps2/src/AddSpouse.py index e9052c555..2b2d39b40 100644 --- a/gramps2/src/AddSpouse.py +++ b/gramps2/src/AddSpouse.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2003 Donald N. Allingham +# Copyright (C) 2000-2004 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -65,7 +65,7 @@ class AddSpouse: family with the passed person as one spouse, and another person to be selected. """ - def __init__(self,db,person,update,addperson,family=None): + def __init__(self,parent,db,person,update,addperson,family=None): """ Displays the AddSpouse dialog box. @@ -74,6 +74,7 @@ class AddSpouse: update - function that updates the family display addperson - function that adds a person to the person view """ + self.parent = parent self.db = db self.update = update self.person = person @@ -152,7 +153,7 @@ class AddSpouse: person = RelLib.Person() person.set_gender(gen) - EditPerson.EditPerson(person,self.db,self.update_list) + EditPerson.EditPerson(self.parent,person,self.db,self.update_list) def update_list(self,epo): """ diff --git a/gramps2/src/ChooseParents.py b/gramps2/src/ChooseParents.py index e1f43f63d..32011306e 100644 --- a/gramps2/src/ChooseParents.py +++ b/gramps2/src/ChooseParents.py @@ -66,7 +66,7 @@ class ChooseParents: Displays the Choose Parents dialog box, allowing the parents to be edited. """ - def __init__(self,db,person,family,family_update,full_update): + def __init__(self,parent,db,person,family,family_update,full_update): """ Creates a ChoosePerson dialog box. @@ -76,6 +76,7 @@ class ChooseParents: family_update - task that updates the family display full_update - task that updates the main display """ + self.parent = parent self.db = db self.person = person self.family = family @@ -85,7 +86,11 @@ class ChooseParents: self.type = "" self.parent_selected = 0 - self.date = person.get_birth().get_date_object() + birth_event = self.db.find_event_from_id(person.get_birth_id()) + if birth_event: + self.date = birth_event.get_date_object() + else: + self.date = None if self.family: self.father = self.family.get_father_id() @@ -166,8 +171,16 @@ class ChooseParents: else: father_id = None - bday = self.person.get_birth().get_date_object() - dday = self.person.get_death().get_date_object() + birth_event = self.db.find_event_from_id(self.person.get_birth_id()) + if birth_event: + bday = birth_event.get_date_object() + else: + bday = None + death_event = self.db.find_event_from_id(self.person.get_death_id()) + if death_event: + dday = death_event.get_date_object() + else: + dday = None person_list = [] for key in self.db.sort_person_keys(): @@ -180,11 +193,20 @@ class ChooseParents: if not self.showallf.get_active(): - pdday = person.get_death().get_date_object() - pbday = person.get_birth().get_date_object() - - if bday.getYearValid(): - if pbday.getYearValid(): + birth_event = self.db.find_event_from_id(person.get_birth_id()) + if birth_event: + pbday = birth_event.get_date_object() + else: + pbday = None + + death_event = self.db.find_event_from_id(person.get_death_id()) + if death_event: + pdday = death_event.get_date_object() + else: + pdday = None + + if bday and bday.getYearValid(): + if pbday and pbday.getYearValid(): # reject if parents birthdate + 10 > child birthdate if pbday.getLowYear()+10 > bday.getHighYear(): continue @@ -193,18 +215,18 @@ class ChooseParents: if pbday.getHighYear()+90 < bday.getLowYear(): continue - if pdday.getYearValid(): + if pdday and pdday.getYearValid(): # reject if parents birthdate + 10 > child deathdate - if pbday.getLowYear()+10 > dday.getHighYear(): + if dday and pbday.getLowYear()+10 > dday.getHighYear(): continue - if dday.getYearValid(): - if pbday.getYearValid(): + if dday and dday.getYearValid(): + if pbday and pbday.getYearValid(): # reject if parents deathday + 3 < childs birth date - if pdday.getHighYear()+3 < bday.getLowYear(): + if pdday and bday and pdday.getHighYear()+3 < bday.getLowYear(): continue - if pdday.getYearValid(): + if pdday and pdday.getYearValid(): # reject if parents deathday + 150 < childs death date if pdday.getHighYear() + 150 < dday.getLowYear(): continue @@ -240,8 +262,16 @@ class ChooseParents: else: mid = None - bday = self.person.get_birth().get_date_object() - dday = self.person.get_death().get_date_object() + birth_event = self.db.find_event_from_id(self.person.get_birth_id()) + if birth_event: + bday = birth_event.get_date_object() + else: + bday = None + death_event = self.db.find_event_from_id(self.person.get_death_id()) + if death_event: + dday = death_event.get_date_object() + else: + dday = None person_list = [] for key in self.db.sort_person_keys(): @@ -256,11 +286,20 @@ class ChooseParents: if not self.showallm.get_active(): - pdday = person.get_death().get_date_object() - pbday = person.get_birth().get_date_object() + birth_event = self.db.find_event_from_id(person.get_birth_id()) + if birth_event: + pbday = birth_event.get_date_object() + else: + pbday = None + + death_event = self.db.find_event_from_id(person.get_death_id()) + if death_event: + pdday = death_event.get_date_object() + else: + pdday = None - if bday.getYearValid(): - if pbday.getYearValid(): + if bday and bday.getYearValid(): + if pbday and pbday.getYearValid(): # reject if parents birthdate + 10 > child birthdate if pbday.getLowYear()+10 > bday.getHighYear(): continue @@ -269,18 +308,18 @@ class ChooseParents: if pbday.getHighYear()+90 < bday.getLowYear(): continue - if pdday.getYearValid(): + if pdday and pdday.getYearValid(): # reject if parents birthdate + 10 > child deathdate if pbday.getLowYear()+10 > dday.getHighYear(): continue - if dday.getYearValid(): - if pbday.getYearValid(): + if dday and dday.getYearValid(): + if pbday and pbday.getYearValid(): # reject if parents deathday + 3 < childs birth date - if pdday.getHighYear()+3 < bday.getLowYear(): + if pdday and bday and pdday.getHighYear()+3 < bday.getLowYear(): continue - if pdday.getYearValid(): + if pdday and pdday.getYearValid(): # reject if parents deathday + 150 < childs death date if pdday.getHighYear() + 150 < dday.getLowYear(): continue @@ -463,7 +502,7 @@ class ChooseParents: try: import EditPerson - EditPerson.EditPerson(person,self.db,self.add_new_parent) + EditPerson.EditPerson(self.parent, person,self.db,self.add_new_parent) except: import DisplayTrace DisplayTrace.DisplayTrace() diff --git a/gramps2/src/EditPerson.py b/gramps2/src/EditPerson.py index ea11352e8..392e6157a 100644 --- a/gramps2/src/EditPerson.py +++ b/gramps2/src/EditPerson.py @@ -528,11 +528,14 @@ class EditPerson: flist = [self.person.get_main_parents_family_id()] for (fam,mrel,frel) in self.person.get_parent_family_id_list(): flist.append(fam) - for fam in flist: + for fam_id in flist: + fam = self.db.find_family_from_id(fam_id) if fam == None: continue - f = fam.get_father_id() - m = fam.get_mother_id() + f_id = fam.get_father_id() + m_id = fam.get_mother_id() + f = self.db.find_person_from_id(f_id) + m = self.db.find_person_from_id(m_id) if f and m: name = _("%(father)s and %(mother)s") % { 'father' : GrampsCfg.nameof(f), @@ -1223,10 +1226,11 @@ class EditPerson: self.event_cause_field.set_text(event.get_cause()) self.event_descr_field.set_text(short(event.get_description())) if len(event.get_source_references()) > 0: - psrc_id = event.get_source_references()[0].get_base_id() + psrc_ref = event.get_source_references()[0] + psrc_id = psrc_ref.get_base_id() psrc = self.db.find_source_from_id(psrc_id) - self.event_src_field.set_text(short(psrc.get_base_id().get_title())) - self.event_conf_field.set_text(const.confidence[psrc.get_confidence_level()]) + self.event_src_field.set_text(short(psrc.get_title())) + self.event_conf_field.set_text(const.confidence[psrc_ref.get_confidence_level()]) else: self.event_src_field.set_text('') self.event_conf_field.set_text('') @@ -1255,10 +1259,11 @@ class EditPerson: self.addr_postal.set_text(addr.get_postal_code()) self.addr_phone.set_text(addr.get_phone()) if len(addr.get_source_references()) > 0: - psrc_id = addr.get_source_references()[0].get_base_id() + psrc_ref = addr.get_source_references()[0] + psrc_id = psrc_ref.get_base_id() psrc = self.db.find_source_from_id(psrc_id) - self.addr_conf_field.set_text(const.confidence[psrc.get_confidence_level()]) - self.addr_src_field.set_text(short(psrc.get_base_id().get_title())) + self.addr_conf_field.set_text(const.confidence[psrc_ref.get_confidence_level()]) + self.addr_src_field.set_text(short(psrc.get_title())) else: self.addr_src_field.set_text('') self.addr_conf_field.set_text('') @@ -1335,10 +1340,11 @@ class EditPerson: self.attr_type.set_text(const.display_pattr(attr.get_type())) self.attr_value.set_text(short(attr.get_value())) if len(attr.get_source_references()) > 0: - psrc_id = attr.get_source_references()[0].get_base_id() + psrc_ref = attr.get_source_references()[0] + psrc_id = psrc_ref.get_base_id() psrc = self.db.find_source_from_id(psrc_id) - self.attr_src_field.set_text(short(psrc.get_base_id().get_title())) - self.attr_conf_field.set_text(const.confidence[psrc.get_confidence_level()]) + self.attr_src_field.set_text(short(psrc.get_title())) + self.attr_conf_field.set_text(const.confidence[psrc_ref.get_confidence_level()]) else: self.attr_src_field.set_text('') self.attr_conf_field.set_text('') diff --git a/gramps2/src/EditSource.py b/gramps2/src/EditSource.py index 3810ea0dd..e15576ffa 100644 --- a/gramps2/src/EditSource.py +++ b/gramps2/src/EditSource.py @@ -49,15 +49,17 @@ from gettext import gettext as _ class EditSource: - def __init__(self,source,db,parent_window=None,func=None): + def __init__(self,source,db,parent,parent_window=None,func=None): self.source = source self.db = db + self.parent = parent + self.child_windows = [] self.callback = func self.path = db.get_save_path() self.not_loaded = 1 self.ref_not_loaded = 1 self.lists_changed = 0 - self.gallery_ok = 0 + self.gallery_ok = 0 self.top_window = gtk.glade.XML(const.gladeFile,"sourceEditor","gramps") self.top = self.top_window.get_widget("sourceEditor") @@ -90,7 +92,7 @@ class EditSource: self.notes_buffer.set_text(source.get_note()) Utils.bold_label(self.notes_label) if source.get_note_format() == 1: - self.preform.set_active(1) + self.preform.set_active(1) else: self.flowed.set_active(1) @@ -105,6 +107,9 @@ class EditSource: "on_editphoto_clicked" : self.gallery.on_edit_photo_clicked, "on_edit_properties_clicked": self.gallery.popup_change_description, "on_sourceEditor_help_clicked" : self.on_help_clicked, + "on_sourceEditor_ok_clicked" : self.on_source_apply_clicked, + "on_sourceEditor_cancel_clicked" : self.close, + "on_sourceEditor_delete_event" : self.on_delete_event, }) if self.source.get_id() == "": @@ -115,21 +120,57 @@ class EditSource: self.top.set_transient_for(parent_window) self.display_references() + if parent_window: + self.top.set_transient_for(parent_window) + self.parent.child_windows.append(self) + self.add_itself_to_menu() self.top.show() - self.val = self.top.run() - if self.val == gtk.RESPONSE_OK: - self.on_source_apply_clicked() - self.top.destroy() + + def on_delete_event(self,obj,b): + self.close_child_windows() + self.remove_itself_from_menu() def on_help_clicked(self,obj): """Display the relevant portion of GRAMPS manual""" gnome.help_display('gramps-manual','gramps-edit-complete') - self.val = self.top.run() def close(self,obj): self.gallery.close(self.gallery_ok) + self.close_child_windows() + self.remove_itself_from_menu() self.top.destroy() + def close_child_windows(self): + for child_window in self.child_windows: + child_window.close(None) + self.child_windows = [] + + def add_itself_to_menu(self): + if not self.source: + label = _("New Source") + else: + label = self.source.get_title() + if not label.strip(): + label = _("New Source") + label = "%s: %s" % (_('Source'),label) + self.parent_menu_item = gtk.MenuItem(label) + self.parent_menu_item.set_submenu(gtk.Menu()) + self.parent_menu_item.show() + self.parent.menu.append(self.parent_menu_item) + self.menu = self.parent_menu_item.get_submenu() + self.menu_item = gtk.MenuItem(_('Source Editor')) + self.menu_item.connect("activate",self.present) + self.menu_item.show() + self.menu.append(self.menu_item) + + def remove_itself_from_menu(self): + self.menu_item.destroy() + self.menu.destroy() + self.parent_menu_item.destroy() + + def present(self,obj): + self.top.present() + def display_references(self): p_event_list = [] p_attr_list = [] @@ -148,7 +189,12 @@ class EditSource: for key in self.db.get_person_keys(): p = self.db.get_person(key) name = GrampsCfg.nameof(p) - for v in p.get_event_list() + [p.get_birth(), p.get_death()]: + birth_event = self.db.find_event_from_id(p.get_birth_id()) + death_event = self.db.find_event_from_id(p.get_death_id()) + for v_id in p.get_event_list() + [p.get_birth_id(), p.get_death_id()]: + v = self.db.find_event_from_id(v_id) + if not v: + continue for sref in v.get_source_references(): if sref.get_base_id() == self.source.get_id(): p_event_list.append((name,v.get_name())) @@ -170,8 +216,10 @@ class EditSource: if sref.get_base_id() == self.source.get_id(): m_list.append(name) for p in self.db.get_family_id_map().values(): - f = p.get_father_id() - m = p.get_mother_id() + f_id = p.get_father_id() + m_id = p.get_mother_id() + f = self.db.find_person_from_id(f_id) + m = self.db.find_person_from_id(m_id) if f and m: name = _("%(father)s and %(mother)s") % { "father" : GrampsCfg.nameof(f), @@ -180,7 +228,10 @@ class EditSource: name = GrampsCfg.nameof(f) else: name = GrampsCfg.nameof(m) - for v in p.get_event_list(): + for v_id in p.get_event_list(): + v = self.db.find_event_from_id(v_id) + if not v: + continue for sref in v.get_source_references(): if sref.get_base_id() == self.source.get_id(): f_event_list.append((name,v.get_name())) @@ -235,7 +286,7 @@ class EditSource: self.ref_not_loaded = 0 - def on_source_apply_clicked(self): + def on_source_apply_clicked(self,obj): title = unicode(self.title.get_text()) author = unicode(self.author.get_text()) @@ -269,14 +320,14 @@ class EditSource: self.source.set_note_format(format) Utils.modified() - if self.lists_changed: + if self.lists_changed: Utils.modified() - self.gallery_ok = 1 - self.close(None) + self.gallery_ok = 1 if self.callback: self.callback(self.source) + self.close(obj) def on_switch_page(self,obj,a,page): if page == 2 and self.not_loaded: diff --git a/gramps2/src/FamilyView.py b/gramps2/src/FamilyView.py index 383f9fa8a..fefe7caeb 100644 --- a/gramps2/src/FamilyView.py +++ b/gramps2/src/FamilyView.py @@ -467,7 +467,7 @@ class FamilyView: return child = self.parent.db.get_person(self.child_model.get_value(iter,2)) try: - EditPerson.EditPerson(child, self.parent.db, self.spouse_after_edit) + EditPerson.EditPerson(self.parent, child, self.parent.db, self.spouse_after_edit) except: DisplayTrace.DisplayTrace() @@ -536,7 +536,7 @@ class FamilyView: def edit_spouse_callback(self,obj): if self.selected_spouse: try: - EditPerson.EditPerson(self.selected_spouse, self.parent.db, self.spouse_after_edit) + EditPerson.EditPerson(self.parent, self.selected_spouse, self.parent.db, self.spouse_after_edit) except: DisplayTrace.DisplayTrace() @@ -564,7 +564,7 @@ class FamilyView: self.parent.new_after_edit, self.load_family) else: - AddSpouse.AddSpouse(self.parent.db,self.person, + AddSpouse.AddSpouse(self.parent,self.parent.db,self.person, self.load_family, self.parent.people_view.redisplay_person_list, self.family) @@ -575,7 +575,7 @@ class FamilyView: if not self.person: return try: - AddSpouse.AddSpouse(self.parent.db, self.person, + AddSpouse.AddSpouse(self.parent, self.parent.db, self.person, self.load_family, self.parent.people_view.redisplay_person_list) except: @@ -588,7 +588,7 @@ class FamilyView: else: person.set_gender(RelLib.Person.male) try: - EditPerson.EditPerson(person, self.parent.db, self.new_spouse_after_edit) + EditPerson.EditPerson(self.parent, person, self.parent.db, self.new_spouse_after_edit) except: DisplayTrace.DisplayTrace() @@ -648,7 +648,7 @@ class FamilyView: person.get_primary_name().set_surname_prefix(name[0]) try: - EditPerson.EditPerson(person, self.parent.db, self.new_child_after_edit) + EditPerson.EditPerson(self.parent, person, self.parent.db, self.new_child_after_edit) except: DisplayTrace.DisplayTrace() @@ -1175,7 +1175,7 @@ class FamilyView: if not person: return try: - ChooseParents.ChooseParents(self.parent.db,person,None, + ChooseParents.ChooseParents(self.parent, self.parent.db,person,None, self.load_family, self.parent.full_update) except: diff --git a/gramps2/src/ImageSelect.py b/gramps2/src/ImageSelect.py index 267ceeae2..a5b5a8572 100644 --- a/gramps2/src/ImageSelect.py +++ b/gramps2/src/ImageSelect.py @@ -260,10 +260,11 @@ class Gallery(ImageSelect): def close(self,ok=0): self.iconlist.hide() - for a in self.canvas_list.values(): - a[0].destroy() - a[1].destroy() - a[2].destroy() + if self.canvas_list: + for a in self.canvas_list.values(): + a[0].destroy() + a[1].destroy() + a[2].destroy() self.p_map = None self.canvas_list = None # restore old photo list, in case we removed some and then diff --git a/gramps2/src/MergeData.py b/gramps2/src/MergeData.py index 033403f28..89778daa6 100644 --- a/gramps2/src/MergeData.py +++ b/gramps2/src/MergeData.py @@ -51,7 +51,8 @@ from gettext import gettext as _ #------------------------------------------------------------------------- class MergePeople: - def __init__(self,db,person1,person2,update,ep_update=None): + def __init__(self,parent,db,person1,person2,update,ep_update=None): + self.parent = parent self.db = db self.p1 = person1 self.p2 = person2 @@ -213,7 +214,7 @@ class MergePeople: import EditPerson self.on_merge_clicked(obj) # This needs to be fixed to provide an update call - EditPerson.EditPerson(self.p1,self.db,self.ep_update) + EditPerson.EditPerson(self.parent,self.p1,self.db,self.ep_update) def copy_note(self,one,two): if one.get_note() != two.get_note(): diff --git a/gramps2/src/NoteEdit.py b/gramps2/src/NoteEdit.py index 168c04b1f..3d264c74b 100644 --- a/gramps2/src/NoteEdit.py +++ b/gramps2/src/NoteEdit.py @@ -46,7 +46,6 @@ class NoteEditor: self.data = data self.parent_window = parent_window - self.child_windows = [] self.parent = parent self.draw() diff --git a/gramps2/src/RelLib.py b/gramps2/src/RelLib.py index fba3ba9f2..470e34edf 100644 --- a/gramps2/src/RelLib.py +++ b/gramps2/src/RelLib.py @@ -1695,6 +1695,21 @@ class Event(DataObj): return 0 index = index + 1 + witness_list = self.get_witness_list() + other_list = other.get_witness_list() + if (not witness_list) and (not other_list): + return 1 + elif not (witness_list and other_list): + return 0 + other_list = other_list[:] + for a in witness_list: + if a in other_list: + other_list.remove(a) + else: + return 0 + if other_list: + return 0 + return 1 def set_name(self,name): @@ -2237,8 +2252,10 @@ class GenderStats: return Person.unknown - -from bsddb3 import dbshelve, db +try: # First try python2.3 and later: this is the future + from bsddb import dbshelve, db +except ImportError: # try python2.2 + from bsddb3 import dbshelve, db class GrampsDB: """GRAMPS database object. This object is a base class for other diff --git a/gramps2/src/Sources.py b/gramps2/src/Sources.py index 72537f5ae..9b3344ff5 100644 --- a/gramps2/src/Sources.py +++ b/gramps2/src/Sources.py @@ -341,7 +341,7 @@ class SourceEditor: def close_child_windows(self): for child_window in self.child_windows: - child_window.close() + child_window.close(None) self.child_windows = [] def add_itself_to_menu(self): @@ -482,7 +482,7 @@ class SourceEditor: def add_src_clicked(self,obj): import EditSource - EditSource.EditSource(RelLib.Source(),self.db, self.sourceDisplay, self.update_display) + EditSource.EditSource(RelLib.Source(),self.db, self,self.sourceDisplay, self.update_display) def by_title(first,second): diff --git a/gramps2/src/Witness.py b/gramps2/src/Witness.py index 979211352..d8cb5265c 100644 --- a/gramps2/src/Witness.py +++ b/gramps2/src/Witness.py @@ -28,6 +28,7 @@ import gobject import gtk import gtk.glade +import gnome #------------------------------------------------------------------------- # @@ -89,10 +90,10 @@ class WitnessTab: if iter: objs = self.model.get_selected_objects() src = objs[0] - WitnessEditor(src,self.db,self.update_clist,self) + WitnessEditor(src,self.db,self,self.update_clist,self.window) def add_clicked(self,obj): - WitnessEditor(None,self.db,self.update_clist,self,self.window) + WitnessEditor(None,self.db,self,self.update_clist,self.window) def add_ref(self,inst,ref): self.parent.lists_changed = 1 @@ -113,7 +114,7 @@ class WitnessTab: #------------------------------------------------------------------------- class WitnessEditor: - def __init__(self,ref,database,update=None,parent=None,parent_window=None): + def __init__(self,ref,database,parent,update=None,parent_window=None): self.db = database self.parent = parent @@ -122,6 +123,10 @@ class WitnessEditor: self.show_witness = gtk.glade.XML(const.dialogFile, "witness_edit","gramps") self.show_witness.signal_autoconnect({ "on_toggled" : self.on_toggled, + "on_witness_edit_delete_event" : self.on_delete_event, + "on_cancel_witness_clicked" : self.close, + "on_help_witness_clicked" : self.on_help_clicked, + "on_ok_witness_clicked" : self.ok_clicked, }) self.window = self.show_witness.get_widget('witness_edit') @@ -136,7 +141,7 @@ class WitnessEditor: if self.ref.get_type(): self.in_db.set_active(1) self.idval = self.ref.get_value() - person = self.db.get_person(self.idval) + person = self.db.find_person_from_id(self.idval) self.name.set_text(person.get_primary_name().get_regular_name()) else: self.name.set_text(self.ref.get_value()) @@ -150,11 +155,33 @@ class WitnessEditor: if parent_window: self.window.set_transient_for(parent_window) - val = self.window.run() - if val == gtk.RESPONSE_OK: - self.ok_clicked() + self.parent.parent.child_windows.append(self) + self.add_itself_to_menu() + self.window.show() + + def on_delete_event(self,obj,b): + self.remove_itself_from_menu() + + def close(self,obj): + self.remove_itself_from_menu() self.window.destroy() + def add_itself_to_menu(self): + self.parent_menu_item = gtk.MenuItem(_('Witness Editor')) + self.parent_menu_item.connect("activate",self.present) + self.parent_menu_item.show() + self.parent.parent.menu.append(self.parent_menu_item) + + def remove_itself_from_menu(self): + self.parent_menu_item.destroy() + + def present(self,obj): + self.window.present() + + def on_help_clicked(self,obj): + """Display the relevant portion of GRAMPS manual""" + gnome.help_display('gramps-manual','gramps-edit-complete') + def choose(self,obj): import SelectPerson sel_person = SelectPerson.SelectPerson(self.db,_('Select Person'),parent_window=self.window) @@ -163,8 +190,8 @@ class WitnessEditor: self.new_person = new_person self.idval = new_person.get_id() new_name = new_person.get_primary_name().get_regular_name() - if new_name: - self.name.set_text(new_name) + if new_name: + self.name.set_text(new_name) def on_toggled(self,obj): if self.in_db.get_active(): @@ -176,7 +203,7 @@ class WitnessEditor: self.name.set_sensitive(1) self.select.set_sensitive(0) - def ok_clicked(self): + def ok_clicked(self,obj): if not self.ref: if self.in_db.get_active(): self.ref = RelLib.Witness(RelLib.Event.ID) @@ -186,10 +213,13 @@ class WitnessEditor: if self.in_db.get_active(): self.ref.set_value(self.idval) + self.ref.set_type(RelLib.Event.ID) else: self.ref.set_value(unicode(self.name.get_text())) + self.ref.set_type(RelLib.Event.NAME) c = self.comment.get_buffer() self.ref.set_comment(unicode(c.get_text(c.get_start_iter(),c.get_end_iter(),gtk.FALSE))) if self.update: self.update() + self.close(obj) diff --git a/gramps2/src/dialog.glade b/gramps2/src/dialog.glade index 105761c6f..d78fbb75b 100644 --- a/gramps2/src/dialog.glade +++ b/gramps2/src/dialog.glade @@ -4154,6 +4154,7 @@ False gramps.png False + @@ -4175,6 +4176,7 @@ True GTK_RELIEF_NORMAL -6 + @@ -4187,6 +4189,7 @@ True GTK_RELIEF_NORMAL -5 + diff --git a/gramps2/src/gramps.glade b/gramps2/src/gramps.glade index 775a7f1d8..52e31c37a 100644 --- a/gramps2/src/gramps.glade +++ b/gramps2/src/gramps.glade @@ -5548,6 +5548,7 @@ False gramps.png False + @@ -5570,6 +5571,7 @@ True GTK_RELIEF_NORMAL -6 + @@ -5584,6 +5586,7 @@ True GTK_RELIEF_NORMAL -5 + diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index 4aaa69d97..5da6c39d7 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -751,7 +751,7 @@ class Gramps: import MergeData p1 = self.db.get_person(mlist[0]) p2 = self.db.get_person(mlist[1]) - MergeData.MergePeople(self.db,p1,p2,self.merge_update, + MergeData.MergePeople(self,self.db,p1,p2,self.merge_update, self.update_after_edit) elif page == PLACE_VIEW: self.place_view.merge()