better pylint score for Family Group report (7.99=>9.31)
This commit is contained in:
parent
80ec97baaa
commit
8be0a72ea9
@ -82,11 +82,12 @@ class FamilyGroup(Report):
|
|||||||
|
|
||||||
stdoptions.run_private_data_option(self, menu)
|
stdoptions.run_private_data_option(self, menu)
|
||||||
stdoptions.run_living_people_option(self, menu)
|
stdoptions.run_living_people_option(self, menu)
|
||||||
|
self.db = self.database
|
||||||
|
|
||||||
self.family_handle = None
|
self.family_handle = None
|
||||||
|
|
||||||
family_id = menu.get_option_by_name('family_id').get_value()
|
family_id = menu.get_option_by_name('family_id').get_value()
|
||||||
family = self.database.get_family_from_gramps_id(family_id)
|
family = self.db.get_family_from_gramps_id(family_id)
|
||||||
if family:
|
if family:
|
||||||
self.family_handle = family.get_handle()
|
self.family_handle = family.get_handle()
|
||||||
else:
|
else:
|
||||||
@ -112,13 +113,13 @@ class FamilyGroup(Report):
|
|||||||
|
|
||||||
stdoptions.run_name_format_option(self, menu)
|
stdoptions.run_name_format_option(self, menu)
|
||||||
|
|
||||||
def dump_parent_event(self, name,event):
|
def dump_parent_event(self, name, event):
|
||||||
place = ""
|
place = ""
|
||||||
date = ""
|
date = ""
|
||||||
descr = ""
|
descr = ""
|
||||||
if event:
|
if event:
|
||||||
date = self._get_date(event.get_date_object())
|
date = self._get_date(event.get_date_object())
|
||||||
place = place_displayer.display_event(self.database, event)
|
place = place_displayer.display_event(self.db, event)
|
||||||
if place is None:
|
if place is None:
|
||||||
place = ''
|
place = ''
|
||||||
descr = event.get_description()
|
descr = event.get_description()
|
||||||
@ -142,7 +143,7 @@ class FamilyGroup(Report):
|
|||||||
self.doc.end_cell()
|
self.doc.end_cell()
|
||||||
|
|
||||||
if descr:
|
if descr:
|
||||||
self.doc.start_cell("FGR-TextContentsEnd",2)
|
self.doc.start_cell("FGR-TextContentsEnd", 2)
|
||||||
self.doc.start_paragraph('FGR-Normal')
|
self.doc.start_paragraph('FGR-Normal')
|
||||||
self.doc.write_text(descr)
|
self.doc.write_text(descr)
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
@ -169,15 +170,15 @@ class FamilyGroup(Report):
|
|||||||
self.doc.end_cell()
|
self.doc.end_cell()
|
||||||
self.doc.end_row()
|
self.doc.end_row()
|
||||||
|
|
||||||
def dump_parent_parents(self,person):
|
def dump_parent_parents(self, person):
|
||||||
family_handle = person.get_main_parents_family_handle()
|
family_handle = person.get_main_parents_family_handle()
|
||||||
father_name = ""
|
father_name = ""
|
||||||
mother_name = ""
|
mother_name = ""
|
||||||
if family_handle:
|
if family_handle:
|
||||||
family = self.database.get_family_from_handle(family_handle)
|
family = self.db.get_family_from_handle(family_handle)
|
||||||
father_handle = family.get_father_handle()
|
father_handle = family.get_father_handle()
|
||||||
if father_handle:
|
if father_handle:
|
||||||
father = self.database.get_person_from_handle(father_handle)
|
father = self.db.get_person_from_handle(father_handle)
|
||||||
father_name = self._name_display.display(father)
|
father_name = self._name_display.display(father)
|
||||||
if self.gramps_ids:
|
if self.gramps_ids:
|
||||||
gid = father.get_gramps_id()
|
gid = father.get_gramps_id()
|
||||||
@ -187,18 +188,18 @@ class FamilyGroup(Report):
|
|||||||
birth_ref = father.get_birth_ref()
|
birth_ref = father.get_birth_ref()
|
||||||
birth = " "
|
birth = " "
|
||||||
if birth_ref:
|
if birth_ref:
|
||||||
event = self.database.get_event_from_handle(birth_ref.ref)
|
event = self.db.get_event_from_handle(birth_ref.ref)
|
||||||
birth = self._get_date(event.get_date_object())
|
birth = self._get_date(event.get_date_object())
|
||||||
death_ref = father.get_death_ref()
|
death_ref = father.get_death_ref()
|
||||||
death = " "
|
death = " "
|
||||||
if death_ref:
|
if death_ref:
|
||||||
event = self.database.get_event_from_handle(death_ref.ref)
|
event = self.db.get_event_from_handle(death_ref.ref)
|
||||||
death = self._get_date(event.get_date_object())
|
death = self._get_date(event.get_date_object())
|
||||||
if birth_ref or death_ref:
|
if birth_ref or death_ref:
|
||||||
father_name += " (%s - %s)" % (birth, death)
|
father_name += " (%s - %s)" % (birth, death)
|
||||||
mother_handle = family.get_mother_handle()
|
mother_handle = family.get_mother_handle()
|
||||||
if mother_handle:
|
if mother_handle:
|
||||||
mother = self.database.get_person_from_handle(mother_handle)
|
mother = self.db.get_person_from_handle(mother_handle)
|
||||||
mother_name = self._name_display.display(mother)
|
mother_name = self._name_display.display(mother)
|
||||||
if self.gramps_ids:
|
if self.gramps_ids:
|
||||||
gid = mother.get_gramps_id()
|
gid = mother.get_gramps_id()
|
||||||
@ -208,12 +209,12 @@ class FamilyGroup(Report):
|
|||||||
birth_ref = mother.get_birth_ref()
|
birth_ref = mother.get_birth_ref()
|
||||||
birth = " "
|
birth = " "
|
||||||
if birth_ref:
|
if birth_ref:
|
||||||
event = self.database.get_event_from_handle(birth_ref.ref)
|
event = self.db.get_event_from_handle(birth_ref.ref)
|
||||||
birth = self._get_date(event.get_date_object())
|
birth = self._get_date(event.get_date_object())
|
||||||
death_ref = mother.get_death_ref()
|
death_ref = mother.get_death_ref()
|
||||||
death = " "
|
death = " "
|
||||||
if death_ref:
|
if death_ref:
|
||||||
event = self.database.get_event_from_handle(death_ref.ref)
|
event = self.db.get_event_from_handle(death_ref.ref)
|
||||||
death = self._get_date(event.get_date_object())
|
death = self._get_date(event.get_date_object())
|
||||||
if birth_ref or death_ref:
|
if birth_ref or death_ref:
|
||||||
mother_name += " (%s - %s)" % (birth, death)
|
mother_name += " (%s - %s)" % (birth, death)
|
||||||
@ -225,10 +226,10 @@ class FamilyGroup(Report):
|
|||||||
self.doc.write_text(self._("Father"))
|
self.doc.write_text(self._("Father"))
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
self.doc.end_cell()
|
self.doc.end_cell()
|
||||||
self.doc.start_cell("FGR-TextContentsEnd",2)
|
self.doc.start_cell("FGR-TextContentsEnd", 2)
|
||||||
self.doc.start_paragraph('FGR-Normal')
|
self.doc.start_paragraph('FGR-Normal')
|
||||||
mark = ReportUtils.get_person_mark(self.database,father)
|
mark = ReportUtils.get_person_mark(self.db, father)
|
||||||
self.doc.write_text(father_name,mark)
|
self.doc.write_text(father_name, mark)
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
self.doc.end_cell()
|
self.doc.end_cell()
|
||||||
self.doc.end_row()
|
self.doc.end_row()
|
||||||
@ -242,10 +243,10 @@ class FamilyGroup(Report):
|
|||||||
self.doc.write_text(self._("Mother"))
|
self.doc.write_text(self._("Mother"))
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
self.doc.end_cell()
|
self.doc.end_cell()
|
||||||
self.doc.start_cell("FGR-TextContentsEnd",2)
|
self.doc.start_cell("FGR-TextContentsEnd", 2)
|
||||||
self.doc.start_paragraph('FGR-Normal')
|
self.doc.start_paragraph('FGR-Normal')
|
||||||
mark = ReportUtils.get_person_mark(self.database,mother)
|
mark = ReportUtils.get_person_mark(self.db, mother)
|
||||||
self.doc.write_text(mother_name,mark)
|
self.doc.write_text(mother_name, mark)
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
self.doc.end_cell()
|
self.doc.end_cell()
|
||||||
self.doc.end_row()
|
self.doc.end_row()
|
||||||
@ -259,7 +260,7 @@ class FamilyGroup(Report):
|
|||||||
self.doc.write_text(name)
|
self.doc.write_text(name)
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
self.doc.end_cell()
|
self.doc.end_cell()
|
||||||
self.doc.start_cell("FGR-TextContentsEnd",2)
|
self.doc.start_cell("FGR-TextContentsEnd", 2)
|
||||||
self.doc.start_paragraph('FGR-Normal')
|
self.doc.start_paragraph('FGR-Normal')
|
||||||
self.doc.write_text(text)
|
self.doc.write_text(text)
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
@ -276,27 +277,27 @@ class FamilyGroup(Report):
|
|||||||
self.doc.start_cell("FGR-TextContentsEnd", 2)
|
self.doc.start_cell("FGR-TextContentsEnd", 2)
|
||||||
self.doc.write_styled_note(note.get_styledtext(),
|
self.doc.write_styled_note(note.get_styledtext(),
|
||||||
note.get_format(), 'FGR-Note',
|
note.get_format(), 'FGR-Note',
|
||||||
contains_html= (note.get_type() ==
|
contains_html=
|
||||||
NoteType.HTML_CODE)
|
(note.get_type()==NoteType.HTML_CODE)
|
||||||
)
|
)
|
||||||
self.doc.end_cell()
|
self.doc.end_cell()
|
||||||
self.doc.end_row()
|
self.doc.end_row()
|
||||||
|
|
||||||
def dump_parent(self,title,person_handle):
|
def dump_parent(self, title, person_handle):
|
||||||
|
|
||||||
if not person_handle and not self.missingInfo:
|
if not person_handle and not self.missingInfo:
|
||||||
return
|
return
|
||||||
elif not person_handle:
|
elif not person_handle:
|
||||||
person = Person()
|
person = Person()
|
||||||
else:
|
else:
|
||||||
person = self.database.get_person_from_handle(person_handle)
|
person = self.db.get_person_from_handle(person_handle)
|
||||||
name = self._name_display.display(person)
|
name = self._name_display.display(person)
|
||||||
|
|
||||||
self.doc.start_table(title,'FGR-ParentTable')
|
self.doc.start_table(title, 'FGR-ParentTable')
|
||||||
self.doc.start_row()
|
self.doc.start_row()
|
||||||
self.doc.start_cell('FGR-ParentHead',3)
|
self.doc.start_cell('FGR-ParentHead', 3)
|
||||||
self.doc.start_paragraph('FGR-ParentName')
|
self.doc.start_paragraph('FGR-ParentName')
|
||||||
mark = ReportUtils.get_person_mark(self.database,person)
|
mark = ReportUtils.get_person_mark(self.db, person)
|
||||||
# translators: needed for French, ignore otherwise
|
# translators: needed for French, ignore otherwise
|
||||||
self.doc.write_text(self._("%(str1)s: %(str2)s") % {
|
self.doc.write_text(self._("%(str1)s: %(str2)s") % {
|
||||||
'str1' : title,
|
'str1' : title,
|
||||||
@ -313,26 +314,26 @@ class FamilyGroup(Report):
|
|||||||
birth = None
|
birth = None
|
||||||
evtName = self._("Birth")
|
evtName = self._("Birth")
|
||||||
if birth_ref:
|
if birth_ref:
|
||||||
birth = self.database.get_event_from_handle(birth_ref.ref)
|
birth = self.db.get_event_from_handle(birth_ref.ref)
|
||||||
if birth or self.missingInfo:
|
if birth or self.missingInfo:
|
||||||
self.dump_parent_event(evtName,birth)
|
self.dump_parent_event(evtName, birth)
|
||||||
|
|
||||||
death_ref = person.get_death_ref()
|
death_ref = person.get_death_ref()
|
||||||
death = None
|
death = None
|
||||||
evtName = self._("Death")
|
evtName = self._("Death")
|
||||||
if death_ref:
|
if death_ref:
|
||||||
death = self.database.get_event_from_handle(death_ref.ref)
|
death = self.db.get_event_from_handle(death_ref.ref)
|
||||||
if death or self.missingInfo:
|
if death or self.missingInfo:
|
||||||
self.dump_parent_event(evtName,death)
|
self.dump_parent_event(evtName, death)
|
||||||
|
|
||||||
self.dump_parent_parents(person)
|
self.dump_parent_parents(person)
|
||||||
|
|
||||||
if self.incParEvents:
|
if self.incParEvents:
|
||||||
for event_ref in person.get_primary_event_ref_list():
|
for event_ref in person.get_primary_event_ref_list():
|
||||||
if event_ref != birth_ref and event_ref != death_ref:
|
if event_ref != birth_ref and event_ref != death_ref:
|
||||||
event = self.database.get_event_from_handle(event_ref.ref)
|
event = self.db.get_event_from_handle(event_ref.ref)
|
||||||
event_type = self._get_type(event.get_type())
|
event_type = self._get_type(event.get_type())
|
||||||
self.dump_parent_event(self._(event_type),event)
|
self.dump_parent_event(self._(event_type), event)
|
||||||
|
|
||||||
if self.incParAddr:
|
if self.incParAddr:
|
||||||
addrlist = person.get_address_list()[:]
|
addrlist = person.get_address_list()[:]
|
||||||
@ -360,13 +361,13 @@ class FamilyGroup(Report):
|
|||||||
|
|
||||||
if self.incParNotes:
|
if self.incParNotes:
|
||||||
for notehandle in person.get_note_list():
|
for notehandle in person.get_note_list():
|
||||||
note = self.database.get_note_from_handle(notehandle)
|
note = self.db.get_note_from_handle(notehandle)
|
||||||
self.dump_parent_noteline(self._("Note"), note)
|
self.dump_parent_noteline(self._("Note"), note)
|
||||||
|
|
||||||
if self.includeAttrs:
|
if self.includeAttrs:
|
||||||
for attr in person.get_attribute_list():
|
for attr in person.get_attribute_list():
|
||||||
attr_type = self._get_type(attr.get_type())
|
attr_type = self._get_type(attr.get_type())
|
||||||
self.dump_parent_line(self._(attr_type),attr.get_value())
|
self.dump_parent_line(self._(attr_type), attr.get_value())
|
||||||
|
|
||||||
if self.incParNames:
|
if self.incParNames:
|
||||||
for alt_name in person.get_alternate_names():
|
for alt_name in person.get_alternate_names():
|
||||||
@ -376,26 +377,26 @@ class FamilyGroup(Report):
|
|||||||
|
|
||||||
self.doc.end_table()
|
self.doc.end_table()
|
||||||
|
|
||||||
def dump_marriage(self,family):
|
def dump_marriage(self, family):
|
||||||
|
|
||||||
if not family:
|
if not family:
|
||||||
return
|
return
|
||||||
|
|
||||||
m = None
|
mrg = None
|
||||||
family_list = family.get_event_ref_list()
|
family_list = family.get_event_ref_list()
|
||||||
for event_ref in family_list:
|
for event_ref in family_list:
|
||||||
if event_ref:
|
if event_ref:
|
||||||
event = self.database.get_event_from_handle(event_ref.ref)
|
event = self.db.get_event_from_handle(event_ref.ref)
|
||||||
if event.get_type() == EventType.MARRIAGE and \
|
if event.get_type() == EventType.MARRIAGE and \
|
||||||
(event_ref.get_role() == EventRoleType.FAMILY or
|
(event_ref.get_role() == EventRoleType.FAMILY or
|
||||||
event_ref.get_role() == EventRoleType.PRIMARY):
|
event_ref.get_role() == EventRoleType.PRIMARY):
|
||||||
m = event
|
mrg = event
|
||||||
break
|
break
|
||||||
|
|
||||||
if len(family_list) > 0 or self.missingInfo or self.includeAttrs:
|
if len(family_list) > 0 or self.missingInfo or self.includeAttrs:
|
||||||
self.doc.start_table("MarriageInfo",'FGR-ParentTable')
|
self.doc.start_table("MarriageInfo", 'FGR-ParentTable')
|
||||||
self.doc.start_row()
|
self.doc.start_row()
|
||||||
self.doc.start_cell('FGR-ParentHead',3)
|
self.doc.start_cell('FGR-ParentHead', 3)
|
||||||
self.doc.start_paragraph('FGR-ParentName')
|
self.doc.start_paragraph('FGR-ParentName')
|
||||||
header = self._("Marriage")
|
header = self._("Marriage")
|
||||||
if self.gramps_ids:
|
if self.gramps_ids:
|
||||||
@ -406,30 +407,30 @@ class FamilyGroup(Report):
|
|||||||
self.doc.end_cell()
|
self.doc.end_cell()
|
||||||
self.doc.end_row()
|
self.doc.end_row()
|
||||||
|
|
||||||
self.dump_parent_event(self._("Marriage"),m)
|
self.dump_parent_event(self._("Marriage"), mrg)
|
||||||
|
|
||||||
for event_ref in family_list:
|
for event_ref in family_list:
|
||||||
if event_ref:
|
if event_ref:
|
||||||
event = self.database.get_event_from_handle(event_ref.ref)
|
event = self.db.get_event_from_handle(event_ref.ref)
|
||||||
if event.get_type() != EventType.MARRIAGE:
|
if event.get_type() != EventType.MARRIAGE:
|
||||||
event_type = self._get_type(event.get_type())
|
event_type = self._get_type(event.get_type())
|
||||||
self.dump_parent_event(self._(event_type),event)
|
self.dump_parent_event(self._(event_type), event)
|
||||||
|
|
||||||
if self.includeAttrs:
|
if self.includeAttrs:
|
||||||
for attr in family.get_attribute_list():
|
for attr in family.get_attribute_list():
|
||||||
attr_type = self._get_type(attr.get_type())
|
attr_type = self._get_type(attr.get_type())
|
||||||
self.dump_parent_line(self._(attr_type),attr.get_value())
|
self.dump_parent_line(self._(attr_type), attr.get_value())
|
||||||
|
|
||||||
self.doc.end_table()
|
self.doc.end_table()
|
||||||
|
|
||||||
def dump_child_event(self,text, name,event):
|
def dump_child_event(self, text, name, event):
|
||||||
date = ""
|
date = ""
|
||||||
place = ""
|
place = ""
|
||||||
if event:
|
if event:
|
||||||
date = self._get_date(event.get_date_object())
|
date = self._get_date(event.get_date_object())
|
||||||
place_handle = event.get_place_handle()
|
place_handle = event.get_place_handle()
|
||||||
if place_handle:
|
if place_handle:
|
||||||
place = place_displayer.display_event(self.database, event)
|
place = place_displayer.display_event(self.db, event)
|
||||||
if place is None:
|
if place is None:
|
||||||
place = ''
|
place = ''
|
||||||
|
|
||||||
@ -455,25 +456,25 @@ class FamilyGroup(Report):
|
|||||||
self.doc.end_cell()
|
self.doc.end_cell()
|
||||||
self.doc.end_row()
|
self.doc.end_row()
|
||||||
|
|
||||||
def dump_child(self,index,person_handle):
|
def dump_child(self, index, person_handle):
|
||||||
|
|
||||||
person = self.database.get_person_from_handle(person_handle)
|
person = self.db.get_person_from_handle(person_handle)
|
||||||
families = len(person.get_family_handle_list())
|
families = len(person.get_family_handle_list())
|
||||||
birth_ref = person.get_birth_ref()
|
birth_ref = person.get_birth_ref()
|
||||||
if birth_ref:
|
if birth_ref:
|
||||||
birth = self.database.get_event_from_handle(birth_ref.ref)
|
birth = self.db.get_event_from_handle(birth_ref.ref)
|
||||||
else:
|
else:
|
||||||
birth = None
|
birth = None
|
||||||
death_ref = person.get_death_ref()
|
death_ref = person.get_death_ref()
|
||||||
if death_ref:
|
if death_ref:
|
||||||
death = self.database.get_event_from_handle(death_ref.ref)
|
death = self.db.get_event_from_handle(death_ref.ref)
|
||||||
else:
|
else:
|
||||||
death = None
|
death = None
|
||||||
|
|
||||||
spouse_count = 0;
|
spouse_count = 0;
|
||||||
if self.incChiMar:
|
if self.incChiMar:
|
||||||
for family_handle in person.get_family_handle_list():
|
for family_handle in person.get_family_handle_list():
|
||||||
family = self.database.get_family_from_handle(family_handle)
|
family = self.db.get_family_from_handle(family_handle)
|
||||||
spouse_id = None
|
spouse_id = None
|
||||||
if person_handle == family.get_father_handle():
|
if person_handle == family.get_father_handle():
|
||||||
spouse_id = family.get_mother_handle()
|
spouse_id = family.get_mother_handle()
|
||||||
@ -483,7 +484,9 @@ class FamilyGroup(Report):
|
|||||||
spouse_count += 1
|
spouse_count += 1
|
||||||
|
|
||||||
self.doc.start_row()
|
self.doc.start_row()
|
||||||
if spouse_count != 0 or self.missingInfo or death is not None or birth is not None:
|
if (spouse_count != 0 or self.missingInfo
|
||||||
|
or death is not None
|
||||||
|
or birth is not None):
|
||||||
self.doc.start_cell('FGR-TextChild1')
|
self.doc.start_cell('FGR-TextChild1')
|
||||||
else:
|
else:
|
||||||
self.doc.start_cell('FGR-TextChild2')
|
self.doc.start_cell('FGR-TextChild2')
|
||||||
@ -499,10 +502,10 @@ class FamilyGroup(Report):
|
|||||||
self.doc.end_cell()
|
self.doc.end_cell()
|
||||||
|
|
||||||
name = self._name_display.display(person)
|
name = self._name_display.display(person)
|
||||||
mark = ReportUtils.get_person_mark(self.database,person)
|
mark = ReportUtils.get_person_mark(self.db, person)
|
||||||
self.doc.start_cell('FGR-ChildName',3)
|
self.doc.start_cell('FGR-ChildName', 3)
|
||||||
self.doc.start_paragraph('FGR-ChildText')
|
self.doc.start_paragraph('FGR-ChildText')
|
||||||
self.doc.write_text(name,mark)
|
self.doc.write_text(name, mark)
|
||||||
if self.gramps_ids:
|
if self.gramps_ids:
|
||||||
self.doc.write_text(" (%s)" % person.get_gramps_id())
|
self.doc.write_text(" (%s)" % person.get_gramps_id())
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
@ -511,28 +514,28 @@ class FamilyGroup(Report):
|
|||||||
|
|
||||||
if self.missingInfo or birth is not None:
|
if self.missingInfo or birth is not None:
|
||||||
if spouse_count != 0 or self.missingInfo or death is not None:
|
if spouse_count != 0 or self.missingInfo or death is not None:
|
||||||
self.dump_child_event('FGR-TextChild1',self._('Birth'),birth)
|
self.dump_child_event('FGR-TextChild1', self._('Birth'), birth)
|
||||||
else:
|
else:
|
||||||
self.dump_child_event('FGR-TextChild2',self._('Birth'),birth)
|
self.dump_child_event('FGR-TextChild2', self._('Birth'), birth)
|
||||||
|
|
||||||
if self.missingInfo or death is not None:
|
if self.missingInfo or death is not None:
|
||||||
if spouse_count == 0 or not self.incChiMar:
|
if spouse_count == 0 or not self.incChiMar:
|
||||||
self.dump_child_event('FGR-TextChild2',self._('Death'),death)
|
self.dump_child_event('FGR-TextChild2', self._('Death'), death)
|
||||||
else:
|
else:
|
||||||
self.dump_child_event('FGR-TextChild1',self._('Death'),death)
|
self.dump_child_event('FGR-TextChild1', self._('Death'), death)
|
||||||
|
|
||||||
if self.incChiMar:
|
if self.incChiMar:
|
||||||
index = 0
|
index = 0
|
||||||
for family_handle in person.get_family_handle_list():
|
for family_handle in person.get_family_handle_list():
|
||||||
m = None
|
mrg = None
|
||||||
index += 1
|
index += 1
|
||||||
family = self.database.get_family_from_handle(family_handle)
|
family = self.db.get_family_from_handle(family_handle)
|
||||||
|
|
||||||
for event_ref in family.get_event_ref_list():
|
for event_ref in family.get_event_ref_list():
|
||||||
if event_ref:
|
if event_ref:
|
||||||
event = self.database.get_event_from_handle(event_ref.ref)
|
event = self.db.get_event_from_handle(event_ref.ref)
|
||||||
if event.type == EventType.MARRIAGE:
|
if event.type == EventType.MARRIAGE:
|
||||||
m = event
|
mrg = event
|
||||||
break
|
break
|
||||||
|
|
||||||
spouse_id = None
|
spouse_id = None
|
||||||
@ -544,7 +547,7 @@ class FamilyGroup(Report):
|
|||||||
|
|
||||||
if spouse_id:
|
if spouse_id:
|
||||||
self.doc.start_row()
|
self.doc.start_row()
|
||||||
if m or index != families:
|
if mrg or index != families:
|
||||||
self.doc.start_cell('FGR-TextChild1')
|
self.doc.start_cell('FGR-TextChild1')
|
||||||
else:
|
else:
|
||||||
self.doc.start_cell('FGR-TextChild2')
|
self.doc.start_cell('FGR-TextChild2')
|
||||||
@ -556,10 +559,10 @@ class FamilyGroup(Report):
|
|||||||
self.doc.write_text(self._("Spouse"))
|
self.doc.write_text(self._("Spouse"))
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
self.doc.end_cell()
|
self.doc.end_cell()
|
||||||
self.doc.start_cell('FGR-TextContentsEnd',2)
|
self.doc.start_cell('FGR-TextContentsEnd', 2)
|
||||||
self.doc.start_paragraph('FGR-Normal')
|
self.doc.start_paragraph('FGR-Normal')
|
||||||
|
|
||||||
spouse = self.database.get_person_from_handle(spouse_id)
|
spouse = self.db.get_person_from_handle(spouse_id)
|
||||||
spouse_name = self._name_display.display(spouse)
|
spouse_name = self._name_display.display(spouse)
|
||||||
if self.gramps_ids:
|
if self.gramps_ids:
|
||||||
gid = spouse.get_gramps_id()
|
gid = spouse.get_gramps_id()
|
||||||
@ -569,12 +572,12 @@ class FamilyGroup(Report):
|
|||||||
birth = " "
|
birth = " "
|
||||||
birth_ref = spouse.get_birth_ref()
|
birth_ref = spouse.get_birth_ref()
|
||||||
if birth_ref:
|
if birth_ref:
|
||||||
event = self.database.get_event_from_handle(birth_ref.ref)
|
event = self.db.get_event_from_handle(birth_ref.ref)
|
||||||
birth = self._get_date(event.get_date_object())
|
birth = self._get_date(event.get_date_object())
|
||||||
death = " "
|
death = " "
|
||||||
death_ref = spouse.get_death_ref()
|
death_ref = spouse.get_death_ref()
|
||||||
if death_ref:
|
if death_ref:
|
||||||
event = self.database.get_event_from_handle(death_ref.ref)
|
event = self.db.get_event_from_handle(death_ref.ref)
|
||||||
death = self._get_date(event.get_date_object())
|
death = self._get_date(event.get_date_object())
|
||||||
if birth_ref or death_ref:
|
if birth_ref or death_ref:
|
||||||
spouse_name += " (%s - %s)" % (birth, death)
|
spouse_name += " (%s - %s)" % (birth, death)
|
||||||
@ -582,32 +585,32 @@ class FamilyGroup(Report):
|
|||||||
fid = family.get_gramps_id()
|
fid = family.get_gramps_id()
|
||||||
if fid:
|
if fid:
|
||||||
spouse_name += " (%s)" % fid
|
spouse_name += " (%s)" % fid
|
||||||
mark = ReportUtils.get_person_mark(self.database,spouse)
|
mark = ReportUtils.get_person_mark(self.db, spouse)
|
||||||
self.doc.write_text(spouse_name,mark)
|
self.doc.write_text(spouse_name, mark)
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
self.doc.end_cell()
|
self.doc.end_cell()
|
||||||
self.doc.end_row()
|
self.doc.end_row()
|
||||||
|
|
||||||
if m:
|
if mrg:
|
||||||
evtName = self._("Marriage")
|
evtName = self._("Marriage")
|
||||||
if index == families:
|
if index == families:
|
||||||
self.dump_child_event('FGR-TextChild2',evtName,m)
|
self.dump_child_event('FGR-TextChild2', evtName, mrg)
|
||||||
else:
|
else:
|
||||||
self.dump_child_event('FGR-TextChild1',evtName,m)
|
self.dump_child_event('FGR-TextChild1', evtName, mrg)
|
||||||
|
|
||||||
def dump_family(self,family_handle,generation):
|
def dump_family(self, family_handle, generation):
|
||||||
self.doc.start_paragraph('FGR-Title')
|
self.doc.start_paragraph('FGR-Title')
|
||||||
if self.recursive and self.generations:
|
if self.recursive and self.generations:
|
||||||
title = self._("Family Group Report - Generation %d") % generation
|
title = self._("Family Group Report - Generation %d") % generation
|
||||||
else:
|
else:
|
||||||
title = self._("Family Group Report")
|
title = self._("Family Group Report")
|
||||||
mark = IndexMark(title, INDEX_TYPE_TOC,1)
|
mark = IndexMark(title, INDEX_TYPE_TOC, 1)
|
||||||
self.doc.write_text( title, mark )
|
self.doc.write_text(title, mark)
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
|
|
||||||
family = self.database.get_family_from_handle(family_handle)
|
family = self.db.get_family_from_handle(family_handle)
|
||||||
|
|
||||||
self.dump_parent(self._("Husband"),family.get_father_handle())
|
self.dump_parent(self._("Husband"), family.get_father_handle())
|
||||||
self.doc.start_paragraph("FGR-blank")
|
self.doc.start_paragraph("FGR-blank")
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
|
|
||||||
@ -616,15 +619,15 @@ class FamilyGroup(Report):
|
|||||||
self.doc.start_paragraph("FGR-blank")
|
self.doc.start_paragraph("FGR-blank")
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
|
|
||||||
self.dump_parent(self._("Wife"),family.get_mother_handle())
|
self.dump_parent(self._("Wife"), family.get_mother_handle())
|
||||||
|
|
||||||
length = len(family.get_child_ref_list())
|
length = len(family.get_child_ref_list())
|
||||||
if length > 0:
|
if length > 0:
|
||||||
self.doc.start_paragraph("FGR-blank")
|
self.doc.start_paragraph("FGR-blank")
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
self.doc.start_table('FGR-Children','FGR-ChildTable')
|
self.doc.start_table('FGR-Children', 'FGR-ChildTable')
|
||||||
self.doc.start_row()
|
self.doc.start_row()
|
||||||
self.doc.start_cell('FGR-ParentHead',4)
|
self.doc.start_cell('FGR-ParentHead', 4)
|
||||||
self.doc.start_paragraph('FGR-ParentName')
|
self.doc.start_paragraph('FGR-ParentName')
|
||||||
self.doc.write_text(self._("Children"))
|
self.doc.write_text(self._("Children"))
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
@ -632,21 +635,21 @@ class FamilyGroup(Report):
|
|||||||
self.doc.end_row()
|
self.doc.end_row()
|
||||||
index = 1
|
index = 1
|
||||||
for child_ref in family.get_child_ref_list():
|
for child_ref in family.get_child_ref_list():
|
||||||
self.dump_child(index,child_ref.ref)
|
self.dump_child(index, child_ref.ref)
|
||||||
index += 1
|
index += 1
|
||||||
self.doc.end_table()
|
self.doc.end_table()
|
||||||
|
|
||||||
if self.recursive:
|
if self.recursive:
|
||||||
for child_ref in family.get_child_ref_list():
|
for child_ref in family.get_child_ref_list():
|
||||||
child = self.database.get_person_from_handle(child_ref.ref)
|
child = self.db.get_person_from_handle(child_ref.ref)
|
||||||
for child_family_handle in child.get_family_handle_list():
|
for child_family_handle in child.get_family_handle_list():
|
||||||
if child_family_handle != family_handle:
|
if child_family_handle != family_handle:
|
||||||
self.doc.page_break()
|
self.doc.page_break()
|
||||||
self.dump_family(child_family_handle,(generation+1))
|
self.dump_family(child_family_handle, (generation+1))
|
||||||
|
|
||||||
def write_report(self):
|
def write_report(self):
|
||||||
if self.family_handle:
|
if self.family_handle:
|
||||||
self.dump_family(self.family_handle,1)
|
self.dump_family(self.family_handle, 1)
|
||||||
else:
|
else:
|
||||||
self.doc.start_paragraph('FGR-Title')
|
self.doc.start_paragraph('FGR-Title')
|
||||||
self.doc.write_text(self._("Family Group Report"))
|
self.doc.write_text(self._("Family Group Report"))
|
||||||
@ -683,7 +686,7 @@ class FamilyGroupOptions(MenuReportOptions):
|
|||||||
|
|
||||||
stdoptions.add_living_people_option(menu, category_name)
|
stdoptions.add_living_people_option(menu, category_name)
|
||||||
|
|
||||||
recursive = BooleanOption(_('Recursive'),False)
|
recursive = BooleanOption(_('Recursive'), False)
|
||||||
recursive.set_help(_("Create reports for all descendants "
|
recursive.set_help(_("Create reports for all descendants "
|
||||||
"of this family."))
|
"of this family."))
|
||||||
add_option("recursive", recursive)
|
add_option("recursive", recursive)
|
||||||
@ -699,43 +702,43 @@ class FamilyGroupOptions(MenuReportOptions):
|
|||||||
add_option("gramps_ids", gramps_ids)
|
add_option("gramps_ids", gramps_ids)
|
||||||
|
|
||||||
generations = BooleanOption(_("Generation numbers "
|
generations = BooleanOption(_("Generation numbers "
|
||||||
"(recursive only)"),True)
|
"(recursive only)"), True)
|
||||||
generations.set_help(_("Whether to include the generation on each "
|
generations.set_help(_("Whether to include the generation on each "
|
||||||
"report (recursive only)."))
|
"report (recursive only)."))
|
||||||
add_option("generations", generations)
|
add_option("generations", generations)
|
||||||
|
|
||||||
incParEvents = BooleanOption(_("Parent Events"),False)
|
incParEvents = BooleanOption(_("Parent Events"), False)
|
||||||
incParEvents.set_help(_("Whether to include events for parents."))
|
incParEvents.set_help(_("Whether to include events for parents."))
|
||||||
add_option("incParEvents", incParEvents)
|
add_option("incParEvents", incParEvents)
|
||||||
|
|
||||||
incParAddr = BooleanOption(_("Parent Addresses"),False)
|
incParAddr = BooleanOption(_("Parent Addresses"), False)
|
||||||
incParAddr.set_help(_("Whether to include addresses for parents."))
|
incParAddr.set_help(_("Whether to include addresses for parents."))
|
||||||
add_option("incParAddr", incParAddr)
|
add_option("incParAddr", incParAddr)
|
||||||
|
|
||||||
incParNotes = BooleanOption(_("Parent Notes"),False)
|
incParNotes = BooleanOption(_("Parent Notes"), False)
|
||||||
incParNotes.set_help(_("Whether to include notes for parents."))
|
incParNotes.set_help(_("Whether to include notes for parents."))
|
||||||
add_option("incParNotes", incParNotes)
|
add_option("incParNotes", incParNotes)
|
||||||
|
|
||||||
incattrs = BooleanOption(_("Parent Attributes"),False)
|
incattrs = BooleanOption(_("Parent Attributes"), False)
|
||||||
incattrs.set_help(_("Whether to include attributes."))
|
incattrs.set_help(_("Whether to include attributes."))
|
||||||
add_option("incattrs", incattrs)
|
add_option("incattrs", incattrs)
|
||||||
|
|
||||||
incParNames = BooleanOption(_("Alternate Parent Names"),False)
|
incParNames = BooleanOption(_("Alternate Parent Names"), False)
|
||||||
incParNames.set_help(_("Whether to include alternate "
|
incParNames.set_help(_("Whether to include alternate "
|
||||||
"names for parents."))
|
"names for parents."))
|
||||||
add_option("incParNames", incParNames)
|
add_option("incParNames", incParNames)
|
||||||
|
|
||||||
incParMar = BooleanOption(_("Parent Marriage"),False)
|
incParMar = BooleanOption(_("Parent Marriage"), False)
|
||||||
incParMar.set_help(_("Whether to include marriage information "
|
incParMar.set_help(_("Whether to include marriage information "
|
||||||
"for parents."))
|
"for parents."))
|
||||||
add_option("incParMar", incParMar)
|
add_option("incParMar", incParMar)
|
||||||
|
|
||||||
incRelDates = BooleanOption(_("Dates of Relatives"),False)
|
incRelDates = BooleanOption(_("Dates of Relatives"), False)
|
||||||
incRelDates.set_help(_("Whether to include dates for relatives "
|
incRelDates.set_help(_("Whether to include dates for relatives "
|
||||||
"(father, mother, spouse)."))
|
"(father, mother, spouse)."))
|
||||||
add_option("incRelDates", incRelDates)
|
add_option("incRelDates", incRelDates)
|
||||||
|
|
||||||
incChiMar = BooleanOption(_("Children Marriages"),True)
|
incChiMar = BooleanOption(_("Children Marriages"), True)
|
||||||
incChiMar.set_help(_("Whether to include marriage information "
|
incChiMar.set_help(_("Whether to include marriage information "
|
||||||
"for children."))
|
"for children."))
|
||||||
add_option("incChiMar", incChiMar)
|
add_option("incChiMar", incChiMar)
|
||||||
@ -745,19 +748,19 @@ class FamilyGroupOptions(MenuReportOptions):
|
|||||||
##########################
|
##########################
|
||||||
|
|
||||||
missinginfo = BooleanOption(_("Print fields for missing "
|
missinginfo = BooleanOption(_("Print fields for missing "
|
||||||
"information"),True)
|
"information"), True)
|
||||||
missinginfo.set_help(_("Whether to include fields for missing "
|
missinginfo.set_help(_("Whether to include fields for missing "
|
||||||
"information."))
|
"information."))
|
||||||
add_option("missinginfo", missinginfo)
|
add_option("missinginfo", missinginfo)
|
||||||
|
|
||||||
def make_default_style(self,default_style):
|
def make_default_style(self, default_style):
|
||||||
"""Make default output style for the Family Group Report."""
|
"""Make default output style for the Family Group Report."""
|
||||||
para = ParagraphStyle()
|
para = ParagraphStyle()
|
||||||
#Paragraph Styles
|
#Paragraph Styles
|
||||||
font = FontStyle()
|
font = FontStyle()
|
||||||
font.set_size(4)
|
font.set_size(4)
|
||||||
para.set_font(font)
|
para.set_font(font)
|
||||||
default_style.add_paragraph_style('FGR-blank',para)
|
default_style.add_paragraph_style('FGR-blank', para)
|
||||||
|
|
||||||
font = FontStyle()
|
font = FontStyle()
|
||||||
font.set_type_face(FONT_SANS_SERIF)
|
font.set_type_face(FONT_SANS_SERIF)
|
||||||
@ -768,7 +771,7 @@ class FamilyGroupOptions(MenuReportOptions):
|
|||||||
para.set_alignment(PARA_ALIGN_CENTER)
|
para.set_alignment(PARA_ALIGN_CENTER)
|
||||||
para.set_header_level(1)
|
para.set_header_level(1)
|
||||||
para.set_description(_("The style used for the title of the page."))
|
para.set_description(_("The style used for the title of the page."))
|
||||||
default_style.add_paragraph_style('FGR-Title',para)
|
default_style.add_paragraph_style('FGR-Title', para)
|
||||||
|
|
||||||
font = FontStyle()
|
font = FontStyle()
|
||||||
font.set_type_face(FONT_SERIF)
|
font.set_type_face(FONT_SERIF)
|
||||||
@ -777,7 +780,7 @@ class FamilyGroupOptions(MenuReportOptions):
|
|||||||
para = ParagraphStyle()
|
para = ParagraphStyle()
|
||||||
para.set_font(font)
|
para.set_font(font)
|
||||||
para.set_description(_('The basic style used for the text display.'))
|
para.set_description(_('The basic style used for the text display.'))
|
||||||
default_style.add_paragraph_style('FGR-Normal',para)
|
default_style.add_paragraph_style('FGR-Normal', para)
|
||||||
|
|
||||||
para = ParagraphStyle()
|
para = ParagraphStyle()
|
||||||
font = FontStyle()
|
font = FontStyle()
|
||||||
@ -789,7 +792,7 @@ class FamilyGroupOptions(MenuReportOptions):
|
|||||||
para.set_top_margin(0.0)
|
para.set_top_margin(0.0)
|
||||||
para.set_bottom_margin(0.0)
|
para.set_bottom_margin(0.0)
|
||||||
para.set_description(_('The basic style used for the note display.'))
|
para.set_description(_('The basic style used for the note display.'))
|
||||||
default_style.add_paragraph_style("FGR-Note",para)
|
default_style.add_paragraph_style("FGR-Note", para)
|
||||||
|
|
||||||
font = FontStyle()
|
font = FontStyle()
|
||||||
font.set_type_face(FONT_SANS_SERIF)
|
font.set_type_face(FONT_SANS_SERIF)
|
||||||
@ -797,8 +800,9 @@ class FamilyGroupOptions(MenuReportOptions):
|
|||||||
font.set_bold(1)
|
font.set_bold(1)
|
||||||
para = ParagraphStyle()
|
para = ParagraphStyle()
|
||||||
para.set_font(font)
|
para.set_font(font)
|
||||||
para.set_description(_('The style used for the text related to the children.'))
|
para.set_description(
|
||||||
default_style.add_paragraph_style('FGR-ChildText',para)
|
_('The style used for the text related to the children.'))
|
||||||
|
default_style.add_paragraph_style('FGR-ChildText', para)
|
||||||
|
|
||||||
font = FontStyle()
|
font = FontStyle()
|
||||||
font.set_type_face(FONT_SANS_SERIF)
|
font.set_type_face(FONT_SANS_SERIF)
|
||||||
@ -808,7 +812,7 @@ class FamilyGroupOptions(MenuReportOptions):
|
|||||||
para.set_font(font)
|
para.set_font(font)
|
||||||
para.set_header_level(3)
|
para.set_header_level(3)
|
||||||
para.set_description(_("The style used for the parent's name"))
|
para.set_description(_("The style used for the parent's name"))
|
||||||
default_style.add_paragraph_style('FGR-ParentName',para)
|
default_style.add_paragraph_style('FGR-ParentName', para)
|
||||||
|
|
||||||
#Table Styles
|
#Table Styles
|
||||||
cell = TableCellStyle()
|
cell = TableCellStyle()
|
||||||
@ -817,55 +821,55 @@ class FamilyGroupOptions(MenuReportOptions):
|
|||||||
cell.set_bottom_border(1)
|
cell.set_bottom_border(1)
|
||||||
cell.set_right_border(1)
|
cell.set_right_border(1)
|
||||||
cell.set_left_border(1)
|
cell.set_left_border(1)
|
||||||
default_style.add_cell_style('FGR-ParentHead',cell)
|
default_style.add_cell_style('FGR-ParentHead', cell)
|
||||||
|
|
||||||
cell = TableCellStyle()
|
cell = TableCellStyle()
|
||||||
cell.set_padding(0.1)
|
cell.set_padding(0.1)
|
||||||
cell.set_bottom_border(1)
|
cell.set_bottom_border(1)
|
||||||
cell.set_left_border(1)
|
cell.set_left_border(1)
|
||||||
default_style.add_cell_style('FGR-TextContents',cell)
|
default_style.add_cell_style('FGR-TextContents', cell)
|
||||||
|
|
||||||
cell = TableCellStyle()
|
cell = TableCellStyle()
|
||||||
cell.set_padding(0.1)
|
cell.set_padding(0.1)
|
||||||
cell.set_bottom_border(0)
|
cell.set_bottom_border(0)
|
||||||
cell.set_left_border(1)
|
cell.set_left_border(1)
|
||||||
cell.set_padding(0.1)
|
cell.set_padding(0.1)
|
||||||
default_style.add_cell_style('FGR-TextChild1',cell)
|
default_style.add_cell_style('FGR-TextChild1', cell)
|
||||||
|
|
||||||
cell = TableCellStyle()
|
cell = TableCellStyle()
|
||||||
cell.set_padding(0.1)
|
cell.set_padding(0.1)
|
||||||
cell.set_bottom_border(1)
|
cell.set_bottom_border(1)
|
||||||
cell.set_left_border(1)
|
cell.set_left_border(1)
|
||||||
cell.set_padding(0.1)
|
cell.set_padding(0.1)
|
||||||
default_style.add_cell_style('FGR-TextChild2',cell)
|
default_style.add_cell_style('FGR-TextChild2', cell)
|
||||||
|
|
||||||
cell = TableCellStyle()
|
cell = TableCellStyle()
|
||||||
cell.set_padding(0.1)
|
cell.set_padding(0.1)
|
||||||
cell.set_bottom_border(1)
|
cell.set_bottom_border(1)
|
||||||
cell.set_right_border(1)
|
cell.set_right_border(1)
|
||||||
cell.set_left_border(1)
|
cell.set_left_border(1)
|
||||||
default_style.add_cell_style('FGR-TextContentsEnd',cell)
|
default_style.add_cell_style('FGR-TextContentsEnd', cell)
|
||||||
|
|
||||||
cell = TableCellStyle()
|
cell = TableCellStyle()
|
||||||
cell.set_padding(0.2)
|
cell.set_padding(0.2)
|
||||||
cell.set_bottom_border(1)
|
cell.set_bottom_border(1)
|
||||||
cell.set_right_border(1)
|
cell.set_right_border(1)
|
||||||
cell.set_left_border(1)
|
cell.set_left_border(1)
|
||||||
default_style.add_cell_style('FGR-ChildName',cell)
|
default_style.add_cell_style('FGR-ChildName', cell)
|
||||||
|
|
||||||
table = TableStyle()
|
table = TableStyle()
|
||||||
table.set_width(100)
|
table.set_width(100)
|
||||||
table.set_columns(3)
|
table.set_columns(3)
|
||||||
table.set_column_width(0,20)
|
table.set_column_width(0, 20)
|
||||||
table.set_column_width(1,40)
|
table.set_column_width(1, 40)
|
||||||
table.set_column_width(2,40)
|
table.set_column_width(2, 40)
|
||||||
default_style.add_table_style('FGR-ParentTable',table)
|
default_style.add_table_style('FGR-ParentTable', table)
|
||||||
|
|
||||||
table = TableStyle()
|
table = TableStyle()
|
||||||
table.set_width(100)
|
table.set_width(100)
|
||||||
table.set_columns(4)
|
table.set_columns(4)
|
||||||
table.set_column_width(0,7)
|
table.set_column_width(0, 7)
|
||||||
table.set_column_width(1,18)
|
table.set_column_width(1, 18)
|
||||||
table.set_column_width(2,35)
|
table.set_column_width(2, 35)
|
||||||
table.set_column_width(3,40)
|
table.set_column_width(3, 40)
|
||||||
default_style.add_table_style('FGR-ChildTable',table)
|
default_style.add_table_style('FGR-ChildTable', table)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user