Fixed editing the active person

svn: r510
This commit is contained in:
Don Allingham 2001-10-26 12:56:39 +00:00
parent c523dea85d
commit b40034531d
4 changed files with 45 additions and 25 deletions

View File

@ -232,40 +232,45 @@ class MergePeople:
def on_merge_clicked(self,obj):
utils.modified()
anames = self.p1.getAlternateNames()[:]
for xname in self.p2.getAlternateNames():
for name in anames:
if name.getFirstName() == xname.getFirstName() and \
name.getSurname() == xname.getSurname() and \
name.getTitle() == xname.getTitle() and \
name.getSuffix() == xname.getSuffix():
self.copy_note(xname,name)
self.copy_sources(xname,name)
list = self.p1.getAlternateNames()[:]
for xdata in self.p2.getAlternateNames():
for data in list:
if data.are_equal(xdata):
self.copy_note(xdata,data)
self.copy_sources(xdata,data)
break
else:
self.p1.addAlternateName(xname)
anames = self.p1.getAttributeList()[:]
for xname in self.p2.getAttributeList():
for name in anames:
if name.getType() == xname.getType() and \
name.getValue() == xname.getValue():
self.copy_note(xname,name)
self.copy_sources(xname,name)
list = self.p1.getAttributeList()[:]
for xdata in self.p2.getAttributeList():
for data in list:
if data.getType() == xdata.getType() and \
data.getValue() == xdata.getValue():
self.copy_note(xdata,data)
self.copy_sources(xdata,data)
break
else:
self.p1.addAttribute(xname)
elist = self.p1.getEventList()[:]
for xevent in self.p2.getEventList():
for event in elist:
if event.are_equal(xevent):
self.copy_note(xevent,event)
self.copy_sources(xevent,event)
list = self.p1.getEventList()[:]
for xdata in self.p2.getEventList():
for data in list:
if data.are_equal(xdata):
self.copy_note(xdata,data)
self.copy_sources(xdata,data)
break
else:
self.p1.addEvent(xevent)
list = self.p1.getUrlList()[:]
for xdata in self.p2.getUrlList():
for data in list:
if data.are_equal(xdata):
break
else:
self.p1.addUrl(xdata)
if self.bname1.get_active():
if self.altname.get_active():
self.p1.addAlternateName(self.p2.getPrimaryName())

View File

@ -721,6 +721,17 @@ class Url:
"""returns the description of the URL"""
return self.desc
def are_equal(self,other):
"""returns 1 if the specified URL is the same as the instance"""
if other == None:
return 0
if self.path != other.path:
return 0
if self.desc != other.desc:
return 0
return 1
class Person:
"""Represents an individual person in the gramps database"""

View File

@ -1110,8 +1110,8 @@
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_edit_active_person</handler>
<last_modification_time>Fri, 01 Dec 2000 04:16:55 GMT</last_modification_time>
<handler>on_edit_selected_people</handler>
<last_modification_time>Fri, 26 Oct 2001 12:53:20 GMT</last_modification_time>
</signal>
<label>Edit/View Person</label>
<relief>GTK_RELIEF_NORMAL</relief>

View File

@ -785,7 +785,7 @@ def save_file(filename,comment):
# Edit Person window for specified people
#
#-------------------------------------------------------------------------
def load_active_person(obj):
def load_selected_people(obj):
"""Display the selected people in the EditPerson display"""
if len(person_list.selection) > 5:
msg = _("You requested too many people to edit at the same time")
@ -795,6 +795,9 @@ def load_active_person(obj):
person = person_list.get_row_data(p)
load_person(person[0])
def load_active_person(obj):
load_person(active_person)
def on_edit_spouse_clicked(obj):
"""Display the active spouse in the EditPerson display"""
load_person(active_spouse)
@ -2656,6 +2659,7 @@ def main(arg):
"on_delete_media_clicked" : on_delete_media_clicked,
"on_delete_sp_clicked" : on_delete_sp_clicked,
"on_edit_active_person" : load_active_person,
"on_edit_selected_people" : load_selected_people,
"on_edit_bookmarks_activate" : on_edit_bookmarks_activate,
"on_edit_father_clicked" : on_edit_father_clicked,
"on_edit_media_clicked" : on_edit_media_clicked,