Changed some of the gen.lib objects back to gen.lib. EventType, Person, ChildRelType...

svn: r14973
This commit is contained in:
Rob G. Healey 2010-03-30 07:52:35 +00:00
parent 110c45c7f0
commit 902b343897

View File

@ -36,7 +36,6 @@ Narrative Web Page generator.
# python modules # python modules
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
from __future__ import with_statement
import gc import gc
import os import os
import sys import sys
@ -69,7 +68,7 @@ log = logging.getLogger(".WebPage")
#------------------------------------------------------------------------ #------------------------------------------------------------------------
from gen.ggettext import sgettext as _ from gen.ggettext import sgettext as _
import gen.lib import gen.lib
from gen.lib import UrlType, EventType, Person, date, Date, ChildRefType, \ from gen.lib import UrlType, date, Date, \
FamilyRelType, NameType, Name FamilyRelType, NameType, Name
import const import const
import Sort import Sort
@ -1904,7 +1903,7 @@ class IndividualListPage(BasePage):
birth = db.get_event_from_handle(birth_ref.ref) birth = db.get_event_from_handle(birth_ref.ref)
if birth: if birth:
birth_date = _dd.display(birth.get_date_object()) birth_date = _dd.display(birth.get_date_object())
if birth.get_type() == EventType.BIRTH: if birth.get_type() == gen.lib.EventType.BIRTH:
tcell += birth_date tcell += birth_date
else: else:
tcell += Html('em', birth_date) tcell += Html('em', birth_date)
@ -2065,7 +2064,7 @@ class SurnamePage(BasePage):
birth = db.get_event_from_handle(birth_ref.ref) birth = db.get_event_from_handle(birth_ref.ref)
if birth: if birth:
birth_date = _dd.display(birth.get_date_object()) birth_date = _dd.display(birth.get_date_object())
if birth.get_type() == EventType.BIRTH: if birth.get_type() == gen.lib.EventType.BIRTH:
tcell += birth_date tcell += birth_date
else: else:
tcell += Html('em', birth_date) tcell += Html('em', birth_date)
@ -3526,9 +3525,9 @@ class IndividualPage(BasePage):
This class is used to write HTML for an individual. This class is used to write HTML for an individual.
""" """
gender_map = { gender_map = {
Person.MALE : _('male'), gen.lib.Person.MALE : _('male'),
Person.FEMALE : _('female'), gen.lib.Person.FEMALE : _('female'),
Person.UNKNOWN : _('unknown'), gen.lib.Person.UNKNOWN : _('unknown'),
} }
def __init__(self, report, title, person, ind_list, place_list, src_list, attribute_list): def __init__(self, report, title, person, ind_list, place_list, src_list, attribute_list):
@ -3655,9 +3654,9 @@ class IndividualPage(BasePage):
top = center - _HEIGHT/2 top = center - _HEIGHT/2
xoff = _XOFFSET+col*(_WIDTH+_HGAP) xoff = _XOFFSET+col*(_WIDTH+_HGAP)
sex = person.gender sex = person.gender
if sex == Person.MALE: if sex == gen.lib.Person.MALE:
divclass = "male" divclass = "male"
elif sex == Person.FEMALE: elif sex == gen.lib.Person.FEMALE:
divclass = "female" divclass = "female"
else: else:
divclass = "unknown" divclass = "unknown"
@ -4117,7 +4116,7 @@ class IndividualPage(BasePage):
else: else:
person_name = self.get_name(person) person_name = self.get_name(person)
tcell2 += person_name tcell2 += person_name
if rel and rel != ChildRefType(ChildRefType.BIRTH): if rel and rel != gen.lib.ChildRefType(gen.lib.ChildRefType.BIRTH):
tcell2 += '   (%s)' % str(rel) tcell2 += '   (%s)' % str(rel)
# return table columns to its caller # return table columns to its caller
@ -4448,9 +4447,9 @@ class IndividualPage(BasePage):
db = self.report.database db = self.report.database
if reltype == FamilyRelType.MARRIED: if reltype == FamilyRelType.MARRIED:
if gender == Person.FEMALE: if gender == gen.lib.Person.FEMALE:
relstr = _("Husband") relstr = _("Husband")
elif gender == Person.MALE: elif gender == gen.lib.Person.MALE:
relstr = _("Wife") relstr = _("Wife")
else: else:
relstr = _PARTNER relstr = _PARTNER
@ -4751,8 +4750,10 @@ class AddressBookListPage(BasePage):
# Internet Address Book Page message # Internet Address Book Page message
msg = _("This page contains an index of all the individuals in the " msg = _("This page contains an index of all the individuals in the "
"database, sorted by their surname. Selecting the person’s " "database, sorted by their surname, with one of the "
"name will take you to their Address Book’s individual page.") "following: Address, Residence, or Web Links. Selecting the "
"person’s name will take you to their Address "
"Book’s individual page.")
addressbooklist += Html("p", msg, id = "description") addressbooklist += Html("p", msg, id = "description")
# begin Address Book table # begin Address Book table
@ -4765,16 +4766,15 @@ class AddressBookListPage(BasePage):
trow = Html("tr") trow = Html("tr")
thead += trow thead += trow
header_row = [
[" ", "RowLabel"],
[_("Name"), "Name"],
[_("Address"), "Address"],
[_("Residence"), "Residence"],
[_("Web Links"), "WebLinks"] ]
trow.extend( trow.extend(
Html("th", label, class_="Column" + colclass, inline=True) Html("th", label, class_="Column" + colclass, inline=True)
for (label, colclass) in header_row) for (label, colclass) in [
[" ", "RowLabel"],
[_("Name"), "Name"],
[_("Address"), "Address"],
[_("Residence"), "Residence"],
[_("Web Links"), "WebLinks"] ]
)
tbody = Html("tbody") tbody = Html("tbody")
table += tbody table += tbody
@ -6076,7 +6076,7 @@ def _get_short_name(gender, name):
prefix = name.get_surname_prefix() prefix = name.get_surname_prefix()
if prefix: if prefix:
short_name = prefix + " " + short_name short_name = prefix + " " + short_name
if gender == Person.FEMALE: if gender == gen.lib.Person.FEMALE:
return short_name return short_name
else: else:
suffix = name.get_suffix() suffix = name.get_suffix()