Fixed a handle variable in display_spouse() which was preventing the spouse's name to be hyperlinked.

svn: r18445
This commit is contained in:
Rob G. Healey 2011-11-15 04:11:13 +00:00
parent 4ad5681ee3
commit a73075f881

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
#!/usr/bin/python
#!/usr/bin/env python
#
# Gramps - a GTK+/GNOME based genealogy program
#
@ -364,14 +364,13 @@ class BasePage(object):
if classname == "Person":
_obj = db.get_person_from_handle(handle)
if _obj:
person_name = self.get_name(_obj)
if check_person_database(handle, ppl_handle_list):
use_link = check_person_database(handle, ppl_handle_list)
if use_link:
url = self.report.build_url_fname_html(handle, "ppl", up)
tcell += Html("span", self.person_link(url, _obj,
_NAME_STYLE_DEFAULT, gid=_obj.get_gramps_id()),
class_="person", inline=True)
_NAME_STYLE_DEFAULT, gid=_obj.get_gramps_id()), class_ ="person", inline =True)
else:
tcell += Html("span", person_name, class_="person",
tcell += Html("span", self.get_name(_obj), class_="person",
inline=True)
# family event
@ -388,32 +387,28 @@ class BasePage(object):
if spouse_handle:
spouse = db.get_person_from_handle(spouse_handle)
if husband:
husband_name = self.get_name(husband)
if check_person_database(husband_handle, ppl_handle_list):
use_link = check_person_database(husband_handle, ppl_handle_list)
if use_link:
url = self.report.build_url_fname_html(husband_handle, "ppl", up)
hlink = self.person_link(url, husband, _NAME_STYLE_DEFAULT,
gid = husband.gramps_id)
hlink = self.person_link(url, husband, _NAME_STYLE_DEFAULT, gid = husband.get_gramps_id())
else:
hlink = husband_name
hlink = self.get_name(husband)
if spouse:
spouse_name = self.get_name(spouse)
if check_person_database(spouse_handle, ppl_handle_list):
use_link = check_person_database(spouse_handle, ppl_handle_list)
if use_link:
url = self.report.build_url_fname_html(spouse_handle, "ppl", up)
slink = self.person_link(url, spouse, _NAME_STYLE_DEFAULT,
gid = spouse.gramps_id)
slink = self.person_link(url, spouse, _NAME_STYLE_DEFAULT, gid = spouse.get_gramps_id())
else:
slink = spouse_name
slink = self.get_name(spouse)
if spouse and husband:
tcell += Html("span", hlink, class_ = "father", inline=True)
tcell += Html("span", slink, class_ = "mother", inline=True)
tcell += Html("span", hlink, class_ = "father", inline =True)
tcell += Html("span", slink, class_ = "mother", inline =True)
elif spouse:
tcell += Html("span", slink, class_ = "mother", inline=True)
tcell += Html("span", slink, class_ = "mother", inline =True)
elif husband:
tcell += Html("span", hlink, class_ = "father", inline=True)
# return tcell, and first_person back to its callers
tcell += Html("span", hlink, class_ = "father", inline =True)
return tcell
def dump_attribute(self, attr):
@ -686,7 +681,8 @@ class BasePage(object):
db = self.report.database
# check to see if this person is in the report database?
if check_person_database(person.get_handle(), ppl_handle_list):
use_link = check_person_database(person.get_handle(), ppl_handle_list)
if use_link:
evt_ref_list = person.get_event_ref_list()
if evt_ref_list:
for evt_ref in evt_ref_list:
@ -2000,11 +1996,10 @@ class BasePage(object):
tcell = Html("td", class_ ="ColumnValue")
trow += tcell
use_link = check_person_database(spouse, ppl_handle_list)
gid = spouse.get_gramps_id()
use_link = check_person_database(spouse_handle, ppl_handle_list)
if use_link:
url = self.report.build_url_fname_html(spouse_handle, "ppl", True)
tcell += self.person_link(url, spouse, _NAME_STYLE_DEFAULT, gid =gid)
tcell += self.person_link(url, spouse, _NAME_STYLE_DEFAULT, gid =spouse.get_gramps_id())
else:
tcell += self.get_name(spouse)
@ -2026,13 +2021,12 @@ class BasePage(object):
child = db.get_person_from_handle(chandle)
list = Html("li")
if check_person_database(chandle, ppl_handle_list):
use_link = check_person_database(chandle, ppl_handle_list)
if use_link:
url = self.report.build_url_fname_html(chandle, "ppl", True)
list += self.person_link(url, child, _NAME_STYLE_DEFAULT, gid =child.get_gramps_id())
else:
list += self.get_name(child)
# return list to its caller
return list
def person_link(self, url, person, name_style, first = True, gid = None, thumbnailUrl = None):
@ -2444,15 +2438,15 @@ class IndividualListPage(BasePage):
partner_handle = ReportUtils.find_spouse(person, family)
if partner_handle:
partner = db.get_person_from_handle(partner_handle)
partner_name = self.get_name(partner)
if not first_family:
tcell += ", "
if check_person_database(partner_handle, ppl_handle_list):
use_link = check_person_database(partner_handle, ppl_handle_list)
if use_link:
url = self.report.build_url_fname_html(partner_handle, "ppl")
tcell += self.person_link(url, partner, _NAME_STYLE_DEFAULT,
gid = partner.gramps_id)
else:
tcell += partner_name
tcell += self.get_name(partner)
first_family = False
else:
tcell += " "
@ -2607,15 +2601,15 @@ class SurnamePage(BasePage):
partner_handle = ReportUtils.find_spouse(person, family)
if partner_handle:
partner = db.get_person_from_handle(partner_handle)
partner_name = self.get_name(partner)
if not first_family:
tcell += ','
if check_person_database(partner_handle, ppl_handle_list):
use_link = check_person_database(partner_handle, ppl_handle_list)
if use_link:
url = self.report.build_url_fname_html(partner_handle, "ppl", True)
tcell += self.person_link(url, partner, _NAME_STYLE_DEFAULT,
gid = partner.gramps_id)
gid = partner.get_gramps_id())
else:
tcell += partner_name
tcell += self.get_name(partner)
first_family = False
else:
tcell += " "
@ -2768,7 +2762,8 @@ class FamilyListPage(BasePage):
partner = db.get_person_from_handle(partner_handle)
if partner:
displayed.add(partner_handle)
if check_person_database(partner_handle, ind_list):
use_link = check_person_database(partner_handle, ind_list)
if use_link:
url = self.report.build_url_fname_html(fhandle, "fam")
tcell += self.family_link(url, self.get_name(partner),
partner.get_gramps_id())
@ -2863,10 +2858,10 @@ class FamilyPage(BasePage):
person_link = self.person_link(url, person, _NAME_STYLE_DEFAULT, gid = person.get_gramps_id())
if partner:
if check_person_database(partner_handle, ppl_handle_list):
use_link = check_person_database(partner_handle, ppl_handle_list)
if use_link:
url = self.report.build_url_fname_html(partner_handle, 'ppl', up =self.up)
partner_link = self.person_link(url, partner, _NAME_STYLE_DEFAULT,
gid = partner.get_gramps_id())
partner_link = self.person_link(url, partner, _NAME_STYLE_DEFAULT, gid = partner.get_gramps_id())
else:
partner_link = self.get_name(partner)
@ -2922,12 +2917,13 @@ class FamilyPage(BasePage):
# display partner's name
if partner_handle:
if check_person_database(partner_handle, ppl_handle_list):
use_link = check_person_database(partner_handle, ppl_handle_list)
if use_link:
url = self.report.build_url_fname_html(partner_handle, "ppl", True)
tcell += self.person_link(url, partner, _NAME_STYLE_DEFAULT,
gid = partner.gramps_id)
gid = partner.get_gramps_id())
else:
tcell += partner_name
tcell += self.get_name(partner)
else:
tcell += ' '
@ -5131,7 +5127,8 @@ class IndividualPage(BasePage):
)
person_name = self.get_name(person)
if check_person_database(person.get_handle(), self.ind_list):
use_link = check_person_database(person.get_handle(), self.ind_list)
if use_link:
thumbnailUrl = None
if self.create_media and col < 5:
photolist = person.get_media_list()
@ -5568,7 +5565,8 @@ class IndividualPage(BasePage):
tcell1 = Html("td", title, class_ = "ColumnAttribute", inline = True)
tcell2 = Html("td", class_ = "ColumnValue")
if check_person_database(handle, self.ind_list):
use_link = check_person_database(handle, self.ind_list)
if use_link:
url = self.report.build_url_fname_html(handle, "ppl", True)
tcell2 += self.person_link(url, person, _NAME_STYLE_DEFAULT, gid =person.get_gramps_id())
else:
@ -5844,12 +5842,12 @@ class IndividualPage(BasePage):
will produce a hyperlink for a pedigree person ...
"""
person_name = self.get_name(person)
if check_person_database(person.get_handle(), self.ind_list):
use_link = check_person_database(person.get_handle(), self.ind_list)
if use_link:
url = self.report.build_url_fname_html(person.handle, "ppl", True)
hyper = self.person_link(url, person, _NAME_STYLE_DEFAULT)
else:
hyper = person_name
hyper = self.get_name(person)
# return hyperlink to its callers
# can be an actual hyperlink or just a person's name
@ -7899,8 +7897,6 @@ def build_event_data(db, ppl_handle_list):
if event:
event_types.append(str(event.type))
event_handle_list.append(evt_ref.ref)
# return event_handle_list and event types to its caller
return event_handle_list, event_types
def check_person_database(phandle, ppl_handle_list):