From 36ad79898912f4d3f429549019542e43d0b20038 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Charette?= ,
+ date is now displayed in the user's locale, source references no
+ longer skipped on media pages, allow half-sibling to be shown, allow
+ columns to be configurable, event notes are no longer skipped, progress
+ indicator no longer gets stuck at 100% for long periods of time with
+ large databases
+
2007-10-26 Benny Malengier %s ')
- of.write(' '.join(text.split('\n')))
+ of.write(' ')
- of.write(' '.join(text.split('\n')))
+ of.write(' ".join(text.split("\n"))
+ text = u" %s
not %s
\n' % _('Source References'))
+ of.write('\n
\n')
@@ -662,10 +807,19 @@ class SurnamePage(BasePage):
of.write('\n')
of.write(' \n\n')
person_handle_list = sort_people(db,person_handle_list)
for (surname,handle_list) in person_handle_list:
first = True
- of.write('%s \n' % _('Surname'))
of.write('%s \n' % _('Name'))
- of.write('%s \n' % _('Birth date'))
+ column_count = 2
+ if self.showbirth:
+ of.write('%s \n' % _('Birth'))
+ column_count += 1
+ if self.showdeath:
+ of.write('%s \n' % _('Death'))
+ column_count += 1
+ if self.showspouse:
+ of.write('%s \n' % _('Partner'))
+ column_count += 1
+ if self.showparents:
+ of.write('%s \n' % _('Parents'))
+ column_count += 1
of.write(' \n')
+ of.write(' \n' % column_count)
for person_handle in handle_list:
person = db.get_person_from_handle(person_handle)
if self.exclude_private:
person = ReportUtils.sanitize_person(db,person)
+
+ # surname column
of.write(' \n')
+ # birth column
+ if self.showbirth:
+ of.write('')
if first:
of.write('%s' % (self.lnkfmt(surname),surname))
else:
of.write(' ')
- of.write(' ')
+ of.write(' ')
+
+ # firstname column
+ of.write('')
path = self.build_path(person.handle,"ppl",False)
self.person_link(of, self.build_name(path,person.handle),
_nd.display_given(person), person.gramps_id,False)
- of.write(' ')
+ of.write(' ')
- if person.handle in restrict_list:
- of.write(_('restricted'))
- else:
- birth_ref = person.get_birth_ref()
- if birth_ref:
- birth = db.get_event_from_handle(birth_ref.ref)
- of.write(_dd.display(birth.get_date_object()))
- of.write('')
+ if person.handle in restrict_list:
+ of.write(_('restricted'))
+ else:
+ birth_ref = person.get_birth_ref()
+ if birth_ref:
+ birth = db.get_event_from_handle(birth_ref.ref)
+ of.write(_dd.display(birth.get_date_object()))
+ of.write(' ')
+
+ # death column
+ if self.showdeath:
+ of.write('')
+ if person.handle in restrict_list:
+ of.write(_('restricted'))
+ else:
+ death_ref = person.get_death_ref()
+ if death_ref:
+ death = db.get_event_from_handle(death_ref.ref)
+ of.write(_dd.display(death.get_date_object()))
+ of.write(' ')
+
+ # spouse (partner) column
+ if self.showspouse:
+ of.write('')
+ if person.handle in restrict_list:
+ of.write(_('restricted'))
+ else:
+ family_list = person.get_family_handle_list()
+ first_family = True
+ spouse_name = None
+ if family_list:
+ for family_handle in family_list:
+ family = db.get_family_from_handle(family_handle)
+ spouse_id = ReportUtils.find_spouse(person, family)
+ if spouse_id:
+ spouse = db.get_person_from_handle(spouse_id)
+ if self.exclude_private:
+ spouse = ReportUtils.sanitize_person(db, spouse)
+ spouse_name = spouse.get_primary_name().get_regular_name()
+ if not first_family:
+ of.write(', ')
+ of.write('%s' % spouse_name)
+ first_family = False
+ of.write(' ')
+
+ # parents column
+ if self.showparents:
+ of.write('')
+ parent_handle_list = person.get_parent_family_handle_list()
+ if parent_handle_list:
+ parent_handle = parent_handle_list[0]
+ family = db.get_family_from_handle(parent_handle)
+ father_name = ''
+ mother_name = ''
+ father_id = family.get_father_handle()
+ mother_id = family.get_mother_handle()
+ father = db.get_person_from_handle(father_id)
+ mother = db.get_person_from_handle(mother_id)
+ if father and self.exclude_private:
+ father = ReportUtils.sanitize_person(db, father)
+ father_name = father.get_primary_name().get_regular_name()
+ if mother and self.exclude_private:
+ mother = ReportUtils.sanitize_person(db, mother)
+ mother_name = mother.get_primary_name().get_regular_name()
+ if mother and father:
+ of.write('%s, %s' % (father_name, mother_name))
+ elif mother:
+ of.write('%s' % mother_name)
+ elif father:
+ of.write('%s' % father_name)
+ of.write(' ')
+
+ # finished writing all columns
+ of.write('\n')
first = False
of.write('\n\n
\n')
self.display_footer(of,db)
self.close_file(of)
@@ -922,10 +1145,17 @@ class MediaPage(BasePage):
self.display_note_object(of, photo.get_note_object())
self.display_attr_list(of, ReportUtils.sanitize_list( photo.get_attribute_list(), self.exclude_private))
+ self.display_media_sources(of,db,photo)
self.display_references(of,db,media_list)
self.display_footer(of,db)
self.close_file(of)
+ def display_media_sources(self,of,db,photo):
+ self.db = db
+ self.src_list = {}
+ sreflist = photo.get_source_references()
+ self.display_source_refs(of,db,sreflist)
+
def display_attr_list(self,of,attrlist=None):
if not attrlist:
return
@@ -1105,7 +1335,7 @@ class IntroductionPage(BasePage):
of.write('\n')
of.write(' \n\n')
for person_handle in person_handle_list:
+
+ # firstname column
person = db.get_person_from_handle(person_handle)
if self.exclude_private:
person = ReportUtils.sanitize_person(db,person)
@@ -674,16 +828,85 @@ class SurnamePage(BasePage):
self.person_link(of, self.build_name(path,person.handle),
person.get_primary_name().get_first_name(),
person.gramps_id,False)
- of.write('%s \n' % _('Name'))
- of.write('%s \n' % _('Birth date'))
+ if self.showbirth:
+ of.write('%s \n' % _('Birth'))
+ if self.showdeath:
+ of.write('%s \n' % _('Death'))
+ if self.showspouse:
+ of.write('%s \n' % _('Partner'))
+ if self.showparents:
+ of.write('%s \n' % _('Parents'))
of.write('')
- if person.handle in restrict_list:
- of.write(_('restricted'))
- else:
- 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('')
+
+ # birth column
+ if self.showbirth:
+ of.write('')
+ if person.handle in restrict_list:
+ of.write(_('restricted'))
+ else:
+ birth_ref = person.get_birth_ref()
+ if birth_ref:
+ birth = db.get_event_from_handle(birth_ref.ref)
+ of.write(_dd.display(birth.get_date_object()))
+ of.write(' ')
+
+ # death column
+ if self.showdeath:
+ of.write('')
+ if person.handle in restrict_list:
+ of.write(_('restricted'))
+ else:
+ death_ref = person.get_death_ref()
+ if death_ref:
+ death = db.get_event_from_handle(death_ref.ref)
+ of.write(_dd.display(death.get_date_object()))
+ of.write(' ')
+
+ # spouse (partner) column
+ if self.showspouse:
+ of.write('')
+ if person.handle in restrict_list:
+ of.write(_('restricted'))
+ else:
+ family_list = person.get_family_handle_list()
+ first_family = True
+ spouse_name = None
+ if family_list:
+ for family_handle in family_list:
+ family = db.get_family_from_handle(family_handle)
+ spouse_id = ReportUtils.find_spouse(person, family)
+ if spouse_id:
+ spouse = db.get_person_from_handle(spouse_id)
+ if self.exclude_private:
+ spouse = ReportUtils.sanitize_person(db, spouse)
+ spouse_name = spouse.get_primary_name().get_regular_name()
+ if not first_family:
+ of.write(', ')
+ of.write('%s' % spouse_name)
+ first_family = False
+ of.write(' ')
+
+ # parents column
+ if self.showparents:
+ of.write('')
+ parent_handle_list = person.get_parent_family_handle_list()
+ if parent_handle_list:
+ parent_handle = parent_handle_list[0]
+ family = db.get_family_from_handle(parent_handle)
+ father_name = ''
+ mother_name = ''
+ father_id = family.get_father_handle()
+ mother_id = family.get_mother_handle()
+ father = db.get_person_from_handle(father_id)
+ mother = db.get_person_from_handle(mother_id)
+ if father and self.exclude_private:
+ father = ReportUtils.sanitize_person(db, father)
+ father_name = father.get_primary_name().get_regular_name()
+ if mother and self.exclude_private:
+ mother = ReportUtils.sanitize_person(db, mother)
+ mother_name = mother.get_primary_name().get_regular_name()
+ if mother and father:
+ of.write('%s, %s' % (father_name, mother_name))
+ elif mother:
+ of.write('%s' % mother_name)
+ elif father:
+ of.write('%s' % father_name)
+ of.write(' ')
+
+ # finished writing all columns
+ of.write('\n')
of.write('\n\n%s\n
\n' % text)
else:
of.write('
'.join(text.split('\n')))
of.write('\n%s\n
\n' % text)
else:
of.write('
'.join(text.split('\n')))
of.write('%s
" % text
else:
- text = u"
".join(text.split("\n"))
of.write('%s
\n' % _('Source References'))
- of.write('\n')
self.display_parent(of,mother_handle,_('Mother'),mrel)
of.write(' \n')
+
first = False
if len(child_ref_list) > 1:
of.write('\n')
@@ -1874,9 +2071,53 @@ class IndividualPage(BasePage):
of.write(' \n')
+
+ # Also try to identify half-siblings
+ other_siblings = set()
+
+ # if we have a known father...
+ if father_handle and self.showhalfsiblings:
+ # 1) get all of the families in which this father is involved
+ # 2) get all of the children from those families
+ # 3) if the children are not already listed as siblings...
+ # 4) then remember those children since we're going to list them
+ father = self.db.get_person_from_handle(father_handle)
+ for family_handle in father.get_family_handle_list():
+ family = self.db.get_family_from_handle(family_handle)
+ step_child_ref_list = ReportUtils.sanitize_list(family.get_child_ref_list(), self.exclude_private)
+ for step_child_ref in step_child_ref_list:
+ step_child_handle = step_child_ref.ref
+ if step_child_handle not in sibling:
+ if step_child_handle != self.person.handle:
+ # we have a new step/half sibling
+ other_siblings.add(step_child_ref.ref)
+
+ # do the same thing with the mother (see "father" just above):
+ if mother_handle and self.showhalfsiblings:
+ mother = self.db.get_person_from_handle(mother_handle)
+ for family_handle in mother.get_family_handle_list():
+ family = self.db.get_family_from_handle(family_handle)
+ step_child_ref_list = ReportUtils.sanitize_list(family.get_child_ref_list(), self.exclude_private)
+ for step_child_ref in step_child_ref_list:
+ step_child_handle = step_child_ref.ref
+ if step_child_handle not in sibling:
+ if step_child_handle != self.person.handle:
+ # we have a new step/half sibling
+ other_siblings.add(step_child_ref.ref)
+
+ # now that we have all of the step-siblings/half-siblings, print them out
+ if len(other_siblings) > 0:
+ of.write('\n')
for child_ref in child_ref_list:
child_handle = child_ref.ref
+ sibling.add(child_handle) # remember that we've already "seen" this child
if child_handle != self.person.handle:
self.display_child_link(of,child_handle)
of.write(' \n\n')
+ of.write(' \n')
+
of.write('%s \n' % _("Other Siblings"))
+ of.write('\n')
+ for child_handle in other_siblings:
+ self.display_child_link(of, child_handle)
+ of.write(' \n \n')
of.write('\n')
of.write('\n')
@@ -1979,7 +2220,7 @@ class IndividualPage(BasePage):
if format:
of.write( u" %s
" % text )
else:
- of.write( u"
".join(text.split("\n")))
+ of.write( u"
".join(text.split("\n")))
of.write('\n\n')
def pedigree_person(self,of,person,is_spouse=False):
@@ -2054,6 +2295,21 @@ class IndividualPage(BasePage):
else:
text = '\n'
text += self.get_citation_links( event.get_source_references() )
+
+ # if the event has a note attached to it, get the text and format it correctly
+ note_obj = event.get_note_object()
+ if note_obj:
+ note_text = note_obj.get()
+ if note_text != '':
+ if note_obj.get_format():
+ text += '
\n' + text += note_text + text += '\n' + else: + text += '
'
+ text += u"
".join(note_text.split("\n"))
+ text += '