Remove redundant line continuations

svn: r16462
This commit is contained in:
Gerald Britton 2011-01-24 20:14:35 +00:00
parent 4313de6f72
commit ef03bdc476
12 changed files with 82 additions and 65 deletions

View File

@ -40,8 +40,8 @@ from gen.ggettext import gettext as _
from gen.display.name import displayer as name_displayer from gen.display.name import displayer as name_displayer
from Errors import ReportError from Errors import ReportError
from gen.lib import ChildRefType from gen.lib import ChildRefType
from gen.plug.menu import BooleanOption, NumberOption, PersonOption, \ from gen.plug.menu import (BooleanOption, NumberOption, PersonOption,
EnumeratedListOption EnumeratedListOption)
from gen.plug.docgen import (IndexMark, FontStyle, ParagraphStyle, from gen.plug.docgen import (IndexMark, FontStyle, ParagraphStyle,
FONT_SANS_SERIF, INDEX_TYPE_TOC, FONT_SANS_SERIF, INDEX_TYPE_TOC,
PARA_ALIGN_CENTER) PARA_ALIGN_CENTER)
@ -61,7 +61,7 @@ def log2(val):
""" """
Calculate the log base 2 of a number Calculate the log base 2 of a number
""" """
return int(math.log10(val)/math.log10(2)) return int(math.log(val, 2))
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #

View File

@ -317,9 +317,9 @@ class CalendarReport(Report):
'nyears' : nyears}) 'nyears' : nyears})
prob_alive_date = Date(self.year, month, day) prob_alive_date = Date(self.year, month, day)
alive1 = probably_alive(person, self.database, \ alive1 = probably_alive(person, self.database,
prob_alive_date) prob_alive_date)
alive2 = probably_alive(spouse, self.database, \ alive2 = probably_alive(spouse, self.database,
prob_alive_date) prob_alive_date)
if (self.alive and alive1 and alive2) or not self.alive: if (self.alive and alive1 and alive2) or not self.alive:
self.add_day_item(text, month, day) self.add_day_item(text, month, day)

View File

@ -106,8 +106,8 @@ class PrintMeurgey():
if len(self.childnum) < level: if len(self.childnum) < level:
self.childnum.append(1) self.childnum.append(1)
to_return = ReportUtils.roman(level) + dash + \ to_return = (ReportUtils.roman(level) + dash +
str(self.childnum[level-1]) + "." str(self.childnum[level-1]) + ".")
if level > 1: if level > 1:
self.childnum[level-1] += 1 self.childnum[level-1] += 1
@ -154,8 +154,9 @@ class Printinfo():
return "" return ""
def dump_string(self, person, family=None): def dump_string(self, person, family=None):
string = self.__date_place(get_birth_or_fallback(self.database, \ string = self.__date_place(
person)) get_birth_or_fallback(self.database, person)
)
tmp = self.__date_place(get_death_or_fallback(self.database, person)) tmp = self.__date_place(get_death_or_fallback(self.database, person))
if string and tmp: if string and tmp:

View File

@ -304,16 +304,17 @@ class DetAncestorReport(Report):
note = self.database.get_note_from_handle(notehandle) note = self.database.get_note_from_handle(notehandle)
self.doc.write_styled_note(note.get_styledtext(), self.doc.write_styled_note(note.get_styledtext(),
note.get_format(), "DAR-Entry", note.get_format(), "DAR-Entry",
contains_html= note.get_type() \ contains_html = note.get_type()
== NoteType.HTML_CODE) == NoteType.HTML_CODE
)
first = True first = True
if self.inc_names: if self.inc_names:
for alt_name in person.get_alternate_names(): for alt_name in person.get_alternate_names():
if first: if first:
self.doc.start_paragraph('DAR-MoreHeader') self.doc.start_paragraph('DAR-MoreHeader')
self.doc.write_text(self._('More about %(person_name)s:') % { self.doc.write_text(self._('More about %(person_name)s:')
'person_name' : name }) % {'person_name': name})
self.doc.end_paragraph() self.doc.end_paragraph()
first = False first = False
self.doc.start_paragraph('DAR-MoreDetails') self.doc.start_paragraph('DAR-MoreDetails')
@ -323,7 +324,8 @@ class DetAncestorReport(Report):
'name_kind' : self._(atype), 'name_kind' : self._(atype),
'name' : alt_name.get_regular_name(), 'name' : alt_name.get_regular_name(),
'endnotes' : self.endnotes(alt_name), 'endnotes' : self.endnotes(alt_name),
}) }
)
self.doc.end_paragraph() self.doc.end_paragraph()
if self.inc_events: if self.inc_events:
@ -454,8 +456,9 @@ class DetAncestorReport(Report):
note = self.database.get_note_from_handle(notehandle) note = self.database.get_note_from_handle(notehandle)
self.doc.write_styled_note(note.get_styledtext(), self.doc.write_styled_note(note.get_styledtext(),
note.get_format(),"DAR-MoreDetails", note.get_format(),"DAR-MoreDetails",
contains_html= note.get_type() \ contains_html = (note.get_type()
== NoteType.HTML_CODE) == NoteType.HTML_CODE)
)
def write_parents(self, person): def write_parents(self, person):
family_handle = person.get_main_parents_family_handle() family_handle = person.get_main_parents_family_handle()
@ -605,10 +608,10 @@ class DetAncestorReport(Report):
event = self.database.get_event_from_handle(event_ref.ref) event = self.database.get_event_from_handle(event_ref.ref)
if event: if event:
etype = event.get_type() etype = event.get_type()
if etype == EventType.BAPTISM or \ if (etype == EventType.BAPTISM or
etype == EventType.BURIAL or \ etype == EventType.BURIAL or
etype == EventType.BIRTH or \ etype == EventType.BIRTH or
etype == EventType.DEATH : etype == EventType.DEATH):
has_info = True has_info = True
break break
if not has_info: if not has_info:

View File

@ -361,8 +361,12 @@ class DetDescendantReport(Report):
if dkey >= key: if dkey >= key:
break break
if self.map[key] == self.map[dkey]: if self.map[key] == self.map[dkey]:
self.doc.write_text(self._("%(name)s is the same person as [%(id_str)s].") % self.doc.write_text(self._(
{ 'name' : '', 'id_str' : str(dkey) }) "%(name)s is the same person as [%(id_str)s].") % {
'name' :'',
'id_str': str(dkey),
}
)
self.doc.end_paragraph() self.doc.end_paragraph()
return return
@ -370,8 +374,8 @@ class DetDescendantReport(Report):
self.write_person_info(person) self.write_person_info(person)
if self.inc_mates or self.listchildren or self.inc_notes \ if (self.inc_mates or self.listchildren or self.inc_notes or
or self.inc_events or self.inc_attrs: self.inc_events or self.inc_attrs):
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.database.get_family_from_handle(family_handle)
if self.inc_mates: if self.inc_mates:
@ -846,8 +850,9 @@ class DetDescendantOptions(MenuReportOptions):
menu.add_option(category_name, "numbering", numbering) menu.add_option(category_name, "numbering", numbering)
generations = NumberOption(_("Generations"), 10, 1, 100) generations = NumberOption(_("Generations"), 10, 1, 100)
generations.set_help(_("The number of generations to include in the " \ generations.set_help(
"report")) _("The number of generations to include in the report")
)
menu.add_option(category_name, "gen", generations) menu.add_option(category_name, "gen", generations)
pagebbg = BooleanOption(_("Page break between generations"), False) pagebbg = BooleanOption(_("Page break between generations"), False)
@ -941,7 +946,7 @@ class DetDescendantOptions(MenuReportOptions):
incmates.set_help(_("Whether to include detailed spouse information.")) incmates.set_help(_("Whether to include detailed spouse information."))
menu.add_option(category_name, "incmates", incmates) menu.add_option(category_name, "incmates", incmates)
incssign = BooleanOption(_("Include sign of succession ('+')" \ incssign = BooleanOption(_("Include sign of succession ('+')"
" in child-list"), True) " in child-list"), True)
incssign.set_help(_("Whether to include a sign ('+') before the" incssign.set_help(_("Whether to include a sign ('+') before the"
" descendant number in the child-list to indicate" " descendant number in the child-list to indicate"
@ -949,7 +954,7 @@ class DetDescendantOptions(MenuReportOptions):
menu.add_option(category_name, "incssign", incssign) menu.add_option(category_name, "incssign", incssign)
incpaths = BooleanOption(_("Include path to start-person"), False) incpaths = BooleanOption(_("Include path to start-person"), False)
incpaths.set_help(_("Whether to include the path of descendancy " \ incpaths.set_help(_("Whether to include the path of descendancy "
"from the start-person to each descendant.")) "from the start-person to each descendant."))
menu.add_option(category_name, "incpaths", incpaths) menu.add_option(category_name, "incpaths", incpaths)

View File

@ -104,7 +104,8 @@ class FamilyGroup(Report):
descr += "; " descr += "; "
descr += _("%(type)s: %(value)s") % { descr += _("%(type)s: %(value)s") % {
'type' : attr.get_type(), 'type' : attr.get_type(),
'value' : attr.get_value() } 'value' : attr.get_value()
}
self.doc.start_row() self.doc.start_row()
self.doc.start_cell("FGR-TextContents") self.doc.start_cell("FGR-TextContents")
@ -240,8 +241,9 @@ 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= (note.get_type() ==
gen.lib.NoteType.HTML_CODE) gen.lib.NoteType.HTML_CODE)
)
self.doc.end_cell() self.doc.end_cell()
self.doc.end_row() self.doc.end_row()

View File

@ -43,8 +43,8 @@ from gen.plug.docgen import (IndexMark, FontStyle, ParagraphStyle, TableStyle,
TableCellStyle, FONT_SANS_SERIF, INDEX_TYPE_TOC, TableCellStyle, FONT_SANS_SERIF, INDEX_TYPE_TOC,
PARA_ALIGN_CENTER) PARA_ALIGN_CENTER)
import DateHandler import DateHandler
from gen.plug.menu import BooleanOption, FilterOption, PersonOption, \ from gen.plug.menu import (BooleanOption, FilterOption, PersonOption,
BooleanListOption BooleanListOption)
from gen.plug.report import Report from gen.plug.report import Report
from gen.plug.report import utils as ReportUtils from gen.plug.report import utils as ReportUtils
from gui.plug.report import MenuReportOptions from gui.plug.report import MenuReportOptions
@ -285,8 +285,8 @@ class IndivCompleteReport(Report):
family_handle_list = self.person.get_parent_family_handle_list() family_handle_list = self.person.get_parent_family_handle_list()
for family_handle in family_handle_list: for family_handle in family_handle_list:
if family_handle == \ if (family_handle ==
self.person.get_main_parents_family_handle(): self.person.get_main_parents_family_handle()):
continue continue
family = self.database.get_family_from_handle(family_handle) family = self.database.get_family_from_handle(family_handle)

View File

@ -136,9 +136,9 @@ class KinshipReport(Report):
title = get_rel_str(Ga, Gb, in_law_b=False) title = get_rel_str(Ga, Gb, in_law_b=False)
self.write_people(title, self.kinship_map[Ga][Gb]) self.write_people(title, self.kinship_map[Ga][Gb])
if self.inc_spouses and \ if (self.inc_spouses and
Ga in self.spouse_map and \ Ga in self.spouse_map and
Gb in self.spouse_map[Ga]: Gb in self.spouse_map[Ga]):
title = get_rel_str(Ga, Gb, in_law_b=True) title = get_rel_str(Ga, Gb, in_law_b=True)
self.write_people(title, self.spouse_map[Ga][Gb]) self.write_people(title, self.spouse_map[Ga][Gb])

View File

@ -127,17 +127,19 @@ class NumberOfAncestorsReport(Report):
father_handle = family.get_father_handle() father_handle = family.get_father_handle()
mother_handle = family.get_mother_handle() mother_handle = family.get_mother_handle()
if father_handle: if father_handle:
thisgen[father_handle] = \ thisgen[father_handle] = (
thisgen.get(father_handle, 0) + person_data thisgen.get(father_handle, 0) + person_data
all_people[father_handle] = \ )
all_people.get(father_handle, 0) + \ all_people[father_handle] = (
person_data all_people.get(father_handle, 0) + person_data
)
if mother_handle: if mother_handle:
thisgen[mother_handle] = \ thisgen[mother_handle] = (
thisgen.get(mother_handle, 0) + person_data thisgen.get(mother_handle, 0) + person_data
all_people[mother_handle] = \ )
all_people.get(mother_handle, 0) + \ all_people[mother_handle] = (
person_data all_people.get(mother_handle, 0) + person_data
)
if( total_theoretical != 1 ): if( total_theoretical != 1 ):
percent = '(%3.2f%%)' % (( sum(all_people.itervalues()) percent = '(%3.2f%%)' % (( sum(all_people.itervalues())
@ -152,7 +154,8 @@ class NumberOfAncestorsReport(Report):
'second_generation': 2, 'second_generation': 2,
'last_generation' : gen, 'last_generation' : gen,
'count' : len(all_people), 'count' : len(all_people),
'percent' : percent} 'percent' : percent
}
self.doc.start_paragraph('NOA-Normal') self.doc.start_paragraph('NOA-Normal')
self.doc.write_text(text) self.doc.write_text(text)

View File

@ -141,7 +141,7 @@ class PlaceReport(Report):
""" """
This procedure writes out each of the events related to the place This procedure writes out each of the events related to the place
""" """
event_handles = [event_handle for (object_type, event_handle) in \ event_handles = [event_handle for (object_type, event_handle) in
self.database.find_backlink_handles(handle)] self.database.find_backlink_handles(handle)]
event_handles.sort(self.sort.by_date) event_handles.sort(self.sort.by_date)
@ -184,13 +184,15 @@ class PlaceReport(Report):
""" """
This procedure writes out each of the people related to the place This procedure writes out each of the people related to the place
""" """
event_handles = [event_handle for (object_type, event_handle) in \ event_handles = [event_handle for (object_type, event_handle) in
self.database.find_backlink_handles(handle)] self.database.find_backlink_handles(handle)]
person_list = [] person_list = []
for evt_handle in event_handles: for evt_handle in event_handles:
ref_handles = [x \ ref_handles = [x for x in
for x in self.database.find_backlink_handles(evt_handle)] self.database.find_backlink_handles(evt_handle)]
print type(self.database.find_backlink_handles(evt_handle))
ref_handles == list(self.database.find_backlink_handles(evt_handle))
for (ref_type, ref_handle) in ref_handles: for (ref_type, ref_handle) in ref_handles:
if ref_type == 'Person': if ref_type == 'Person':
person_list.append(ref_handle) person_list.append(ref_handle)

View File

@ -117,8 +117,8 @@ class SummaryReport(Report):
incomp_names += 1 incomp_names += 1
# Count people without families. # Count people without families.
if (not person.get_main_parents_family_handle()) and \ if (not person.get_main_parents_family_handle() and
(not len(person.get_family_handle_list())): not len(person.get_family_handle_list())):
disconnected += 1 disconnected += 1
# Count missing birthdays. # Count missing birthdays.

View File

@ -416,8 +416,9 @@ class TagReport(Report):
self.doc.start_cell('TR-TableCell', 2) self.doc.start_cell('TR-TableCell', 2)
self.doc.write_styled_note(note.get_styledtext(), self.doc.write_styled_note(note.get_styledtext(),
note.get_format(), 'TR-Note', note.get_format(), 'TR-Note',
contains_html= note.get_type() \ contains_html = (note.get_type()
== NoteType.HTML_CODE) == NoteType.HTML_CODE)
)
self.doc.end_cell() self.doc.end_cell()
self.doc.end_row() self.doc.end_row()