Narrative Web Page should work now

svn: r6254
This commit is contained in:
Brian Matherly 2006-04-01 17:38:34 +00:00
parent 206c8d5e1e
commit 9653c3e6de
3 changed files with 49 additions and 37 deletions

View File

@ -1,3 +1,7 @@
2006-04-01 Brian Matherly <pez4brian@users.sourceforge.net>
* src/PluginUtils/_ReportUtils.py: remove use of deprecated functions
* src/plugins/NavWebPage.py: various fixes - should work now
2006-04-01 Martin Hawlisch <Martin.Hawlisch@gmx.de> 2006-04-01 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/DataViews/_PedigreeView.py: Work around the bug of * src/DataViews/_PedigreeView.py: Work around the bug of
dbstate.active not being updated when the active person was edited. dbstate.active not being updated when the active person was edited.

View File

@ -1130,7 +1130,7 @@ def sanitize_person(db,person):
new_person.add_alternate_name(name) new_person.add_alternate_name(name)
# set complete flag # set complete flag
new_person.set_complete_flag(person.get_complete_flag()) new_person.set_marker(person.get_marker())
# copy birth event # copy birth event
event_ref = person.get_birth_ref() event_ref = person.get_birth_ref()
@ -1151,7 +1151,7 @@ def sanitize_person(db,person):
if event_ref: if event_ref:
event = db.get_event_from_handle(event_ref.ref) event = db.get_event_from_handle(event_ref.ref)
if not event.get_privacy(): if not event.get_privacy():
new_person.add_event_handle(event_ref) new_person.add_event_ref(event_ref)
# copy address list # copy address list
for address in person.get_address_list(): for address in person.get_address_list():

View File

@ -443,7 +443,8 @@ class BasePage:
of.write('<table class="infolist">\n') of.write('<table class="infolist">\n')
for attr in attrlist: for attr in attrlist:
of.write('<tr><td class="field">%s</td>' % _(attr.get_type())) atType = Utils.format_personal_attribute( attr.get_type() )
of.write('<tr><td class="field">%s</td>' % atType)
of.write('<td class="data">%s</td></tr>\n' % attr.get_value()) of.write('<td class="data">%s</td></tr>\n' % attr.get_value())
of.write('</table>\n') of.write('</table>\n')
of.write('</div>\n') of.write('</div>\n')
@ -645,10 +646,11 @@ class SurnamePage(BasePage):
if person.handle in restrict_list: if person.handle in restrict_list:
of.write(_('restricted')) of.write(_('restricted'))
else: else:
birth_handle = person.get_birth_handle() birth_ref = person.get_birth_ref()
if birth_handle: if birth_ref:
birth = db.get_event_from_handle(birth_handle) birth = db.get_event_from_handle(birth_ref.ref)
of.write(birth.get_date()) birth_date = _dd.display(birth.get_date_object())
of.write(birth_date)
of.write('</td></tr>\n') of.write('</td></tr>\n')
of.write('<tbody>\n</table>\n') of.write('<tbody>\n</table>\n')
self.display_footer(of,db) self.display_footer(of,db)
@ -1376,10 +1378,12 @@ class IndividualPage(BasePage):
family = self.db.get_family_from_handle(handle) family = self.db.get_family_from_handle(handle)
media_list += ReportUtils.sanitize_list(family.get_media_list(), media_list += ReportUtils.sanitize_list(family.get_media_list(),
self.exclude_private) self.exclude_private)
for handle in self.person.get_event_list(): for evt_ref in self.person.get_event_ref_list():
event = self.db.get_event_from_handle(handle) event = self.db.get_event_from_handle(evt_ref.ref)
media_list += ReportUtils.sanitize_list(event.get_media_list(), if event:
self.exclude_private) media_list += ReportUtils.sanitize_list(
event.get_media_list(),
self.exclude_private )
self.display_additional_images_as_gallery(of, db, media_list) 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) self.source_link(of,source.handle,title,source.gramps_id,True)
tmp = [] tmp = []
for (label,data) in [(_('Page'),sref.page), for (label,data) in [(_('Page'),sref.page),
(_('Confidence'),const.confidence[sref.confidence]), (_('Confidence'),Utils.confidence[sref.confidence]),
(_('Text'),sref.text)]: (_('Text'),sref.text)]:
if data: if data:
tmp.append("%s: %s" % (label,data)) tmp.append("%s: %s" % (label,data))
@ -1705,7 +1709,6 @@ class IndividualPage(BasePage):
of.write('<table class="infolist">\n') of.write('<table class="infolist">\n')
# Birth # Birth
if birth_ref: if birth_ref:
event = self.db.get_event_from_handle(birth_ref.ref) event = self.db.get_event_from_handle(birth_ref.ref)
of.write('<tr><td class="field">%s</td>\n' % _('Birth')) of.write('<tr><td class="field">%s</td>\n' % _('Birth'))
@ -1720,8 +1723,10 @@ class IndividualPage(BasePage):
of.write('</tr>\n') of.write('</tr>\n')
for event_ref in evt_ref_list: for event_ref in evt_ref_list:
event = self.db.get_event_from_handle(evt_ref.ref) event = self.db.get_event_from_handle(event_ref.ref)
of.write('<tr><td class="field">%s</td>\n' % _(event.get_name())) if event:
evt_name = Utils.format_event(event.get_type())
of.write('<tr><td class="field">%s</td>\n' % evt_name)
of.write('<td class="data">\n') of.write('<td class="data">\n')
of.write(self.format_event(event)) of.write(self.format_event(event))
of.write('</td>\n') of.write('</td>\n')
@ -1759,8 +1764,8 @@ class IndividualPage(BasePage):
val) val)
else: else:
of.write(nameof(person,self.exclude_private)) of.write(nameof(person,self.exclude_private))
if rel != RelLib.Person.CHILD_REL_BIRTH: if rel != RelLib.Person.CHILD_BIRTH:
of.write('&nbsp;&nbsp;&nbsp;(%s)' % const.child_rel_list[rel]) of.write('&nbsp;&nbsp;&nbsp;(%s)' % Utils.format_child_relation(rel))
of.write('</td>\n') of.write('</td>\n')
def display_ind_parents(self,of): def display_ind_parents(self,of):
@ -1836,7 +1841,7 @@ class IndividualPage(BasePage):
gender = self.person.get_gender() gender = self.person.get_gender()
reltype = family.get_relationship() reltype = family.get_relationship()
if reltype == RelLib.Family.MARRIED: if reltype[0] == RelLib.Family.MARRIED:
if gender == RelLib.Person.FEMALE: if gender == RelLib.Person.FEMALE:
relstr = _("Husband") relstr = _("Husband")
elif gender == RelLib.Person.MALE: elif gender == RelLib.Person.MALE:
@ -1856,7 +1861,7 @@ class IndividualPage(BasePage):
name = _("unknown") name = _("unknown")
if not first: if not first:
of.write('<tr><td colspan="3">&nbsp;</td></tr>\n') of.write('<tr><td colspan="3">&nbsp;</td></tr>\n')
rtype = const.family_relations[family.get_relationship()][0] rtype = Utils.format_family_relation(family.get_relationship())
of.write('<tr><td class="category">%s</td>\n' % rtype) of.write('<tr><td class="category">%s</td>\n' % rtype)
of.write('<td class="field">%s</td>\n' % relstr) of.write('<td class="field">%s</td>\n' % relstr)
of.write('<td class="data">') of.write('<td class="data">')
@ -1875,29 +1880,32 @@ class IndividualPage(BasePage):
if self.restrict: if self.restrict:
return return
for event_id in family.get_event_list(): for event_ref in family.get_event_ref_list():
event = self.db.get_event_from_handle(event_id) event = self.db.get_event_from_handle(event_ref.ref)
if self.exclude_private and event.private: if self.exclude_private and event.private:
continue continue
evtType = Utils.format_event(event.get_type())
of.write('<tr><td>&nbsp;</td>\n') of.write('<tr><td>&nbsp;</td>\n')
of.write('<td class="field">%s</td>\n' % _(event.get_name())) of.write('<td class="field">%s</td>\n' % evtType)
of.write('<td class="data">\n') of.write('<td class="data">\n')
of.write(self.format_event(event)) of.write(self.format_event(event))
of.write('</td>\n</tr>\n') of.write('</td>\n</tr>\n')
for attr in family.get_attribute_list(): for attr in family.get_attribute_list():
if self.exclude_private and attr.private: if self.exclude_private and attr.private:
continue continue
attrType = Utils.format_family_attribute(attr.get_type())
of.write('<tr><td>&nbsp;</td>\n') of.write('<tr><td>&nbsp;</td>\n')
of.write('<td class="field">%s</td>' % _(attr.get_type())) of.write('<td class="field">%s</td>' % attrType)
of.write('<td class="data">%s</td>\n</tr>\n' % attr.get_value()) of.write('<td class="data">%s</td>\n</tr>\n' % attr.get_value())
nobj = family.get_note_object() nobj = family.get_note_object()
if nobj: if nobj:
text = nobj.get()
format = nobj.get_format()
if text:
of.write('<tr><td>&nbsp;</td>\n') of.write('<tr><td>&nbsp;</td>\n')
of.write('<td class="field">%s</td>\n' % _('Narrative')) of.write('<td class="field">%s</td>\n' % _('Narrative'))
of.write('<td class="data">\n') of.write('<td class="data">\n')
format = nobj.get_format()
text = nobj.get()
if format: if format:
of.write( u"<pre>%s</pre>" % text ) of.write( u"<pre>%s</pre>" % text )
else: else:
@ -2855,7 +2863,7 @@ def nameof(person,private):
if person.private and private: if person.private and private:
return _("Private") return _("Private")
else: else:
return _nd.display_with_nick(person) return _nd.display(person)
def name_nameof(name,private): def name_nameof(name,private):
if name.private and private: if name.private and private: