From 9653c3e6deb98ab46880b2d2e0ac0263fa73d980 Mon Sep 17 00:00:00 2001 From: Brian Matherly Date: Sat, 1 Apr 2006 17:38:34 +0000 Subject: [PATCH] Narrative Web Page should work now svn: r6254 --- ChangeLog | 4 ++ src/PluginUtils/_ReportUtils.py | 4 +- src/plugins/NavWebPage.py | 78 ++++++++++++++++++--------------- 3 files changed, 49 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8b259fb62..5ad44ea80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2006-04-01 Brian Matherly + * src/PluginUtils/_ReportUtils.py: remove use of deprecated functions + * src/plugins/NavWebPage.py: various fixes - should work now + 2006-04-01 Martin Hawlisch * src/DataViews/_PedigreeView.py: Work around the bug of dbstate.active not being updated when the active person was edited. diff --git a/src/PluginUtils/_ReportUtils.py b/src/PluginUtils/_ReportUtils.py index 5b4f31320..1f43b3902 100644 --- a/src/PluginUtils/_ReportUtils.py +++ b/src/PluginUtils/_ReportUtils.py @@ -1130,7 +1130,7 @@ def sanitize_person(db,person): new_person.add_alternate_name(name) # set complete flag - new_person.set_complete_flag(person.get_complete_flag()) + new_person.set_marker(person.get_marker()) # copy birth event event_ref = person.get_birth_ref() @@ -1151,7 +1151,7 @@ def sanitize_person(db,person): if event_ref: event = db.get_event_from_handle(event_ref.ref) if not event.get_privacy(): - new_person.add_event_handle(event_ref) + new_person.add_event_ref(event_ref) # copy address list for address in person.get_address_list(): diff --git a/src/plugins/NavWebPage.py b/src/plugins/NavWebPage.py index 00609eaba..327a7f587 100644 --- a/src/plugins/NavWebPage.py +++ b/src/plugins/NavWebPage.py @@ -443,7 +443,8 @@ class BasePage: of.write('\n') for attr in attrlist: - of.write('' % _(attr.get_type())) + atType = Utils.format_personal_attribute( attr.get_type() ) + of.write('' % atType) of.write('\n' % attr.get_value()) of.write('
%s
%s%s
\n') of.write('\n') @@ -645,10 +646,11 @@ class SurnamePage(BasePage): if person.handle in restrict_list: of.write(_('restricted')) else: - birth_handle = person.get_birth_handle() - if birth_handle: - birth = db.get_event_from_handle(birth_handle) - of.write(birth.get_date()) + birth_ref = person.get_birth_ref() + if birth_ref: + birth = db.get_event_from_handle(birth_ref.ref) + birth_date = _dd.display(birth.get_date_object()) + of.write(birth_date) of.write('\n') of.write('\n\n') self.display_footer(of,db) @@ -1376,10 +1378,12 @@ class IndividualPage(BasePage): family = self.db.get_family_from_handle(handle) media_list += ReportUtils.sanitize_list(family.get_media_list(), self.exclude_private) - for handle in self.person.get_event_list(): - event = self.db.get_event_from_handle(handle) - media_list += ReportUtils.sanitize_list(event.get_media_list(), - self.exclude_private) + for evt_ref in self.person.get_event_ref_list(): + event = self.db.get_event_from_handle(evt_ref.ref) + if event: + media_list += ReportUtils.sanitize_list( + event.get_media_list(), + self.exclude_private ) self.display_additional_images_as_gallery(of, db, media_list) @@ -1574,7 +1578,7 @@ class IndividualPage(BasePage): self.source_link(of,source.handle,title,source.gramps_id,True) tmp = [] for (label,data) in [(_('Page'),sref.page), - (_('Confidence'),const.confidence[sref.confidence]), + (_('Confidence'),Utils.confidence[sref.confidence]), (_('Text'),sref.text)]: if data: tmp.append("%s: %s" % (label,data)) @@ -1705,7 +1709,6 @@ class IndividualPage(BasePage): of.write('\n') # Birth - if birth_ref: event = self.db.get_event_from_handle(birth_ref.ref) of.write('\n' % _('Birth')) @@ -1720,12 +1723,14 @@ class IndividualPage(BasePage): of.write('\n') for event_ref in evt_ref_list: - event = self.db.get_event_from_handle(evt_ref.ref) - of.write('\n' % _(event.get_name())) - of.write('\n') - of.write('\n') + event = self.db.get_event_from_handle(event_ref.ref) + if event: + evt_name = Utils.format_event(event.get_type()) + of.write('\n' % evt_name) + of.write('\n') + of.write('\n') of.write('
%s
%s\n') - of.write(self.format_event(event)) - of.write('
%s\n') + of.write(self.format_event(event)) + of.write('
\n') of.write('\n') @@ -1759,8 +1764,8 @@ class IndividualPage(BasePage): val) else: of.write(nameof(person,self.exclude_private)) - if rel != RelLib.Person.CHILD_REL_BIRTH: - of.write('   (%s)' % const.child_rel_list[rel]) + if rel != RelLib.Person.CHILD_BIRTH: + of.write('   (%s)' % Utils.format_child_relation(rel)) of.write('\n') def display_ind_parents(self,of): @@ -1836,7 +1841,7 @@ class IndividualPage(BasePage): gender = self.person.get_gender() reltype = family.get_relationship() - if reltype == RelLib.Family.MARRIED: + if reltype[0] == RelLib.Family.MARRIED: if gender == RelLib.Person.FEMALE: relstr = _("Husband") elif gender == RelLib.Person.MALE: @@ -1856,7 +1861,7 @@ class IndividualPage(BasePage): name = _("unknown") if not first: of.write(' \n') - rtype = const.family_relations[family.get_relationship()][0] + rtype = Utils.format_family_relation(family.get_relationship()) of.write('%s\n' % rtype) of.write('%s\n' % relstr) of.write('') @@ -1875,34 +1880,37 @@ class IndividualPage(BasePage): if self.restrict: return - for event_id in family.get_event_list(): - event = self.db.get_event_from_handle(event_id) + for event_ref in family.get_event_ref_list(): + event = self.db.get_event_from_handle(event_ref.ref) if self.exclude_private and event.private: continue + evtType = Utils.format_event(event.get_type()) of.write(' \n') - of.write('%s\n' % _(event.get_name())) + of.write('%s\n' % evtType) of.write('\n') of.write(self.format_event(event)) of.write('\n\n') for attr in family.get_attribute_list(): if self.exclude_private and attr.private: continue + attrType = Utils.format_family_attribute(attr.get_type()) of.write(' \n') - of.write('%s' % _(attr.get_type())) + of.write('%s' % attrType) of.write('%s\n\n' % attr.get_value()) nobj = family.get_note_object() if nobj: - of.write(' \n') - of.write('%s\n' % _('Narrative')) - of.write('\n') - format = nobj.get_format() text = nobj.get() - if format: - of.write( u"
%s
" % text ) - else: - of.write( u"

".join(text.split("\n"))) - of.write('\n\n') + format = nobj.get_format() + if text: + of.write(' \n') + of.write('%s\n' % _('Narrative')) + of.write('\n') + if format: + of.write( u"

%s
" % text ) + else: + of.write( u"

".join(text.split("\n"))) + of.write('\n\n') def pedigree_person(self,of,person,is_spouse=False): person_link = person.handle in self.ind_list @@ -2855,7 +2863,7 @@ def nameof(person,private): if person.private and private: return _("Private") else: - return _nd.display_with_nick(person) + return _nd.display(person) def name_nameof(name,private): if name.private and private: