本文整理汇总了Python中gramps.gen.simple.SimpleDoc.paragraph方法的典型用法代码示例。如果您正苦于以下问题:Python SimpleDoc.paragraph方法的具体用法?Python SimpleDoc.paragraph怎么用?Python SimpleDoc.paragraph使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gramps.gen.simple.SimpleDoc
的用法示例。
在下文中一共展示了SimpleDoc.paragraph方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from gramps.gen.simple import SimpleDoc [as 别名]
# 或者: from gramps.gen.simple.SimpleDoc import paragraph [as 别名]
def run(database, document, person):
"""
Loops through the families that the person is a child in, and display
the information about the other children.
"""
global cache
cache = {}
# setup the simple access functions
sdb = SimpleAccess(database)
sdoc = SimpleDoc(document)
stab = QuickTable(sdb)
# display the title
sdoc.title(_("Descendant Count"))
sdoc.paragraph("")
stab.columns(_("Person"), _("Number of Descendants"))
people = database.get_person_handles(sort_handles=True)
for person_handle in people:
result = countem(database, handle2internal(person_handle))
cache[person_handle] = len(result)
matches = 0
for person_handle in cache:
person = database.get_person_from_handle(person_handle)
stab.row(person, cache[person_handle])
matches += 1
sdoc.paragraph(_("There are %d people.\n") % matches)
stab.write(sdoc)
示例2: run_mother
# 需要导入模块: from gramps.gen.simple import SimpleDoc [as 别名]
# 或者: from gramps.gen.simple.SimpleDoc import paragraph [as 别名]
def run_mother(database, document, person):
""" Function writing the mother lineage quick report
"""
sa = SimpleAccess(database)
sd = SimpleDoc(document)
# display the results
# feature request 2356: avoid genitive form
sd.title(_("Mother lineage for %s") % sa.name(person))
sd.paragraph("")
sd.paragraph(_(""
"This report shows the mother lineage, also called matronymic lineage "
"mtDNA lineage."
" People in this lineage all share the same Mitochondrial DNA (mtDNA)."
))
sd.paragraph("")
stab = QuickTable(sa)
stab.columns(_("Name Mother"), _("Birth"), _("Death Date"), _("Remark"))
make_details(Person.FEMALE, person, sa, sd, database, stab)
stab.write(sd)
sd.paragraph("")
if person.gender == Person.MALE :
return
sd.header2((_("Direct line female descendants")))
sd.paragraph("")
make_details_child(Person.FEMALE, person, sa, sd, database)
示例3: run_fam
# 需要导入模块: from gramps.gen.simple import SimpleDoc [as 别名]
# 或者: from gramps.gen.simple.SimpleDoc import paragraph [as 别名]
def run_fam(database, document, family):
"""
Loops through the family events and the events of all parents, displaying
the basic details of the event
"""
sdb = SimpleAccess(database)
sdoc = SimpleDoc(document)
stab = QuickTable(sdb)
# get the family events
event_list = [(_('Family'), x) for x in sdb.events(family)]
# get the events of father and mother
#fathername = sdb.first_name(sdb.father(family))
event_list += [(sdb.father(family), x) for x in sdb.events(sdb.father(family))]
#mothername = sdb.first_name(sdb.mother(family))
event_list += [(sdb.mother(family), x) for x in sdb.events(sdb.mother(family))]
# children events
event_list_children = []
for child in sdb.children(family) :
#name = sdb.first_name(child)
event_list_children += [(child, x) for x in sdb.events(child)]
# Sort the events by their date
event_list.sort(key=lambda x: x[1].get_date_object())
event_list_children.sort(key=lambda x: x[1].get_date_object())
# display the results
sdoc.title(_("Sorted events of family\n %(father)s - %(mother)s") % {
'father' : sdb.name(sdb.father(family)), 'mother' : sdb.name(sdb.mother(family)) })
sdoc.paragraph("")
document.has_data = False
stab.columns(_("Family Member"), _("Event Type"),
_("Event Date"), _("Event Place"))
for (person, event) in event_list:
stab.row(person, sdb.event_type(event),
sdb.event_date_obj(event),
sdb.event_place(event))
document.has_data = True
stab.write(sdoc)
stab = QuickTable(sdb)
sdoc.header1(_("Personal events of the children"))
stab.columns(_("Family Member"), _("Event Type"),
_("Event Date"), _("Event Place"))
for (person, event) in event_list_children:
stab.row(person, sdb.event_type(event),
sdb.event_date_obj(event),
sdb.event_place(event))
document.has_data = True
stab.write(sdoc)
示例4: run
# 需要导入模块: from gramps.gen.simple import SimpleDoc [as 别名]
# 或者: from gramps.gen.simple.SimpleDoc import paragraph [as 别名]
def run(database, document, object, item, trans):
"""
Display back-references for this object.
"""
# setup the simple access functions
sdb = SimpleAccess(database)
sdoc = SimpleDoc(document)
stab = QuickTable(sdb)
# display the title
sdoc.title(_("References for this %s") % trans)
sdoc.paragraph("\n")
stab.columns(_("Type"), _("Reference"))
for (objclass, handle) in database.find_backlink_handles(object.handle):
ref = get_ref(database, objclass, handle)
stab.row(_(objclass), ref) # translation are explicit (above)
if stab.get_row_count() > 0:
document.has_data = True
stab.write(sdoc)
else:
document.has_data = False
sdoc.paragraph(_("No references for this %s") % trans)
sdoc.paragraph("")
sdoc.paragraph("")
示例5: run
# 需要导入模块: from gramps.gen.simple import SimpleDoc [as 别名]
# 或者: from gramps.gen.simple.SimpleDoc import paragraph [as 别名]
def run(database, document, person):
"""
Loops through the families that the person is a child in, and displays
the information about the other children.
"""
# setup the simple access functions
sdb = SimpleAccess(database)
sdoc = SimpleDoc(document)
stab = QuickTable(sdb)
if isinstance(person, Person):
surname = sdb.surname(person)
rsurname = person.get_primary_name().get_group_name()
else:
surname = person
rsurname = person
# display the title
sdoc.title(_("People sharing the surname '%s'") % surname)
sdoc.paragraph("")
stab.columns(_("Person"), _("Birth Date"), _("Name type"))
filter = GenericFilterFactory('Person')()
if rsurname != '':
rule = SameSurname([rsurname])
else:
rule = IncompleteSurname([])
filter.add_rule(rule)
people = filter.apply(database,
database.iter_person_handles())
matches = 0
for person_handle in people:
person = database.get_person_from_handle(person_handle)
stab.row(person, sdb.birth_or_fallback(person),
str(person.get_primary_name().get_type()))
matches += 1
document.has_data = matches > 0
sdoc.paragraph(
# translators: leave all/any {...} untranslated
ngettext("There is {number_of} person "
"with a matching name, or alternate name.\n",
"There are {number_of} people "
"with a matching name, or alternate name.\n", matches
).format(number_of=matches) )
stab.write(sdoc)
示例6: run
# 需要导入模块: from gramps.gen.simple import SimpleDoc [as 别名]
# 或者: from gramps.gen.simple.SimpleDoc import paragraph [as 别名]
def run(database, document, attribute, value=None):
sdb = SimpleAccess(database)
sdoc = SimpleDoc(document)
stab = QuickTable(sdb)
sdoc.title(_("People who have the '%s' Attribute") % attribute)
sdoc.paragraph("")
stab.columns(_("Person"), str(attribute))
matches = 0
for person_handle in database.iter_person_handles():
person = database.get_person_from_handle(person_handle)
matched = False
for attr in person.attribute_list:
if str(attr.type) == attribute:
stab.row(person, str(attr.get_value()))
matched = True
if matched:
matches += 1
document.has_data = matches > 0
sdoc.paragraph(_("There are %d people with a matching attribute name.\n") % matches)
stab.write(sdoc)
示例7: run
# 需要导入模块: from gramps.gen.simple import SimpleDoc [as 别名]
# 或者: from gramps.gen.simple.SimpleDoc import paragraph [as 别名]
def run(database, document, person):
"""
Display a person's timeline.
"""
sa = SimpleAccess(database)
sd = SimpleDoc(document)
sd.title(_("Timeline for %s") % sa.name(person))
sd.paragraph("")
stab = QuickTable(sa)
stab.columns(_("Date"),
_("Event"),
_("Age"),
_("Place"),
_("People involved"))
stab.set_link_col(4)
handled = {}
birth_ref = gramps.gen.lib.Person.get_birth_ref(person)
birth_date = get_event_date_from_ref(database, birth_ref)
event_list = []
process(database, sa, event_list, handled, person, False, person)
for (event, obj, desc) in sorted(event_list, key=by_date):
edate = sa.event_date_obj(event)
span_str, span_int = format_date(birth_date, edate, obj == person)
if desc == None:
desc = event
stab.row(edate,
desc,
span_str,
sa.event_place(event),
obj)
stab.row_sort_val(2, span_int)
today = Today()
span_str, span_int = format_date(birth_date, today, False)
stab.row(today, _("Today"), span_str, "", person)
stab.row_sort_val(2, span_int)
stab.write(sd)
sd.paragraph("")
示例8: run
# 需要导入模块: from gramps.gen.simple import SimpleDoc [as 别名]
# 或者: from gramps.gen.simple.SimpleDoc import paragraph [as 别名]
def run(database, document, person):
"""
Loops through the families that the person is a child in, and display
the information about the other children.
"""
# setup the simple access functions
sdb = SimpleAccess(database)
sdoc = SimpleDoc(document)
stab = QuickTable(sdb)
rel_class = get_relationship_calculator(glocale)
# display the title
# feature request 2356: avoid genitive form
sdoc.title(_("Siblings of %s") % sdb.name(person))
sdoc.paragraph("")
stab.columns(_("Sibling"), _("Gender"), _("Birth Date"), _("Type"))
# grab our current id (self):
gid = sdb.gid(person)
# loop through each family in which the person is a child
document.has_data = False
for family in sdb.child_in(person):
# loop through each child in the family
for child in sdb.children(family):
# only display if this child is not the active person
if sdb.gid(child) != gid:
rel_str = rel_class.get_sibling_relationship_string(
rel_class.get_sibling_type(database, person, child),
person.get_gender(), child.get_gender())
else:
rel_str = _('self')
# pass row the child object to make link:
stab.row(child,
sdb.gender(child),
sdb.birth_or_fallback(child),
rel_str)
document.has_data = True
if document.has_data:
stab.write(sdoc)
else:
sdoc.header1(_("Not found") + "\n")
示例9: run
# 需要导入模块: from gramps.gen.simple import SimpleDoc [as 别名]
# 或者: from gramps.gen.simple.SimpleDoc import paragraph [as 别名]
def run(database, document, *args, **kwargs):
"""
Loops through the families that the person is a child in, and display
the information about the other children.
"""
# setup the simple access functions
sdb = SimpleAccess(database)
sdoc = SimpleDoc(document)
stab = QuickTable(sdb)
# display the title
sdoc.title(_("All Names of All People"))
sdoc.paragraph("")
matches = 0
stab.columns(_("Name"), _("Primary Name"), _("Name Type"))
names = [] # name, person
for person in database.iter_people():
primary_name = person.get_primary_name()
if primary_name:
names += [(nd.display_name(primary_name),
person,
str(primary_name.get_type()))]
names += [(nd.display_name(name),
person,
str(name.get_type())) for name in
person.get_alternate_names()]
matches = 0
for (name, person, name_type) in sorted(names, key=lambda x: x[0]):
stab.row(name, person, name_type)
matches += 1
sdoc.paragraph(_("Total names %d") % matches)
sdoc.paragraph("")
stab.write(sdoc)
示例10: run
# 需要导入模块: from gramps.gen.simple import SimpleDoc [as 别名]
# 或者: from gramps.gen.simple.SimpleDoc import paragraph [as 别名]
def run(database, document, person):
"""
Loops through the person events and the family events of any family
in which the person is a parent (to catch Marriage events), displaying
the basic details of the event
"""
sdb = SimpleAccess(database)
sdoc = SimpleDoc(document)
stab = QuickTable(sdb)
# get the personal events
event_list = sdb.events(person)
# get the events of each family in which the person is
# a parent
for family in sdb.parent_in(person):
event_list += sdb.events(family)
# Sort the events by their date
event_list.sort(key=lambda x: x.get_date_object())
# display the results
# feature request 2356: avoid genitive form
sdoc.title(_("Sorted events of %s") % sdb.name(person))
sdoc.paragraph("")
stab.columns(_("Event Type"), _("Event Date"), _("Event Place"))
document.has_data = False
for event in event_list:
stab.row(event,
sdb.event_date_obj(event),
sdb.event_place(event))
document.has_data = True
if document.has_data:
stab.write(sdoc)
else:
sdoc.header1(_("Not found"))
示例11: run
# 需要导入模块: from gramps.gen.simple import SimpleDoc [as 别名]
# 或者: from gramps.gen.simple.SimpleDoc import paragraph [as 别名]
def run(database, document, date):
"""
Display people probably alive and their ages on a particular date.
"""
# setup the simple access functions
sdb = SimpleAccess(database)
sdoc = SimpleDoc(document)
stab = QuickTable(sdb)
if not date.get_valid():
sdoc.paragraph("Date is not a valid date.")
return
# display the title
if date.get_day_valid():
sdoc.title(_("People and their ages the %s") %
displayer.display(date))
else:
sdoc.title(_("People and their ages on %s") %
displayer.display(date))
stab.columns(_("Person"), _("Age"), _("Status")) # Actual Date makes column unicode
alive_matches = 0
dead_matches = 0
for person in sdb.all_people():
alive, birth, death, explain, relative = \
probably_alive(person, database, date, return_range=True)
# Doesn't show people probably alive but no way of figuring an age:
if alive:
if birth:
diff_span = (date - birth)
stab.row(person, str(diff_span), _("Alive: %s") % explain)
stab.row_sort_val(1, int(diff_span))
else:
stab.row(person, "", _("Alive: %s") % explain)
stab.row_sort_val(1, 0)
alive_matches += 1
else: # not alive
if birth:
diff_span = (date - birth)
stab.row(person, str(diff_span), _("Deceased: %s") % explain)
stab.row_sort_val(1, int(diff_span))
else:
stab.row(person, "", _("Deceased: %s") % explain)
stab.row_sort_val(1, 1)
dead_matches += 1
document.has_data = (alive_matches + dead_matches) > 0
sdoc.paragraph(_("\nLiving matches: %(alive)d, "
"Deceased matches: %(dead)d\n") %
{'alive' : alive_matches, 'dead' : dead_matches})
if document.has_data:
stab.write(sdoc)
sdoc.paragraph("")
示例12: run
# 需要导入模块: from gramps.gen.simple import SimpleDoc [as 别名]
# 或者: from gramps.gen.simple.SimpleDoc import paragraph [as 别名]
def run(database, document, obj):
"""
Display link references for this note.
"""
# setup the simple access functions
sdb = SimpleAccess(database)
sdoc = SimpleDoc(document)
stab = QuickTable(sdb)
# display the title
sdoc.title(_("Link References for this note"))
sdoc.paragraph("\n")
stab.columns(_("Type"), _("Reference"), _("Link check"))
for (ldomain, ltype, lprop, lvalue) in obj.get_links():
if ldomain == "gramps":
tagtype = _(ltype)
ref_obj = sdb.get_link(ltype, lprop, lvalue)
if ref_obj:
tagvalue = ref_obj
tagcheck = _("Ok")
else:
tagvalue = lvalue
tagcheck = _("Failed: missing object")
else:
tagtype = _("Internet")
tagvalue = lvalue
tagcheck = ""
stab.row(tagtype, tagvalue, tagcheck)
if stab.get_row_count() > 0:
stab.write(sdoc)
document.has_data = True
else:
sdoc.paragraph(_("No link references for this note"))
sdoc.paragraph("")
document.has_data = False
sdoc.paragraph("")
示例13: __init__
# 需要导入模块: from gramps.gen.simple import SimpleDoc [as 别名]
# 或者: from gramps.gen.simple.SimpleDoc import paragraph [as 别名]
class AllRelReport:
"""
Obtains all relationships, displays the relations, and in details, the
relation path
"""
def __init__(self, database, document, person):
self.database = database
self.person = person
self.sdb = SimpleAccess(database)
self.sdoc = SimpleDoc(document)
self.rel_class = get_relationship_calculator(glocale)
self.msg_list = []
def run(self):
# get home_person
self.home_person = self.database.get_default_person()
if not self.home_person:
self.sdoc.paragraph(_("Home person not set."))
return
self.print_title()
p2 = self.sdb.name(self.home_person)
p1 = self.sdb.name(self.person)
if self.person.handle == self.home_person.handle:
self.sdoc.paragraph(
_FMT_VOID
% (_("%(person)s and %(active_person)s are the same person."))
% {"person": p1, "active_person": p2}
)
return
# check if not a family too:
is_spouse = self.rel_class.is_spouse(self.database, self.home_person, self.person)
if is_spouse:
rel_string = is_spouse
rstr = _("%(person)s is the %(relationship)s of %(active_person)s.") % {
"person": p1,
"relationship": rel_string,
"active_person": p2,
}
self.sdoc.paragraph(_FMT_VOID % (rstr))
self.sdoc.paragraph("")
# obtain all relationships, assume home person has largest tree
common, self.msg_list = self.rel_class.get_relationship_distance_new(
self.database, self.person, self.home_person, all_families=True, all_dist=True, only_birth=False
)
# all relations
if (not common or common[0][0] == -1) and not is_spouse:
rstr = _("%(person)s and %(active_person)s are not " "directly related.") % {
"person": p2,
"active_person": p1,
}
self.sdoc.paragraph(_FMT_VOID % (rstr))
self.sdoc.paragraph("")
# collapse common so parents of same fam in common are one line
commonnew = self.rel_class.collapse_relations(common)
self.print_details_header(commonnew, self.home_person, self.person, skip_list_text=None)
self.print_details_path(commonnew, self.home_person, self.person)
self.print_details_path(commonnew, self.home_person, self.person, first=False)
if not common or common[0][0] == -1:
self.remarks(self.msg_list)
self.msg_list = []
# check inlaw relation next
else:
# stop
return
# we check the inlaw relationships if not partners.
if is_spouse:
return
handles_done = [(self.person.handle, self.home_person.handle)]
inlaws_pers = [self.person] + self.get_inlaws(self.person)
inlaws_home = [self.home_person] + self.get_inlaws(self.home_person)
# remove overlap:
inlaws_home = [x for x in inlaws_home if x not in inlaws_pers]
inlawwritten = False
skiplist = []
commonnew = []
for inlawpers in inlaws_pers:
for inlawhome in inlaws_home:
if (inlawpers, inlawhome) in handles_done:
continue
else:
handles_done.append((inlawpers, inlawhome))
common, msg = self.rel_class.get_relationship_distance_new(
self.database, inlawpers, inlawhome, all_families=True, all_dist=True, only_birth=False
)
if msg:
self.msg_list += msg
if common and not common[0][0] == -1:
if not inlawwritten:
rstr = _("%(person)s and %(active_person)s have " "following in-law relations:") % {
"person": p2,
"active_person": p1,
#.........这里部分代码省略.........
示例14: run
# 需要导入模块: from gramps.gen.simple import SimpleDoc [as 别名]
# 或者: from gramps.gen.simple.SimpleDoc import paragraph [as 别名]
def run(database, document, filter_name, *args, **kwargs):
"""
Loops through the families that the person is a child in, and display
the information about the other children.
"""
# setup the simple access functions
sdb = SimpleAccess(database)
sdoc = SimpleDoc(document)
stab = QuickTable(sdb)
if (filter_name == 'all'):
sdoc.title(_("Summary counts of current selection"))
sdoc.paragraph("")
sdoc.paragraph(_("Right-click row (or press ENTER) to see selected items."))
sdoc.paragraph("")
stab.columns(_("Object"), _("Count/Total"))
if hasattr(database, "db"):
stab.row([_("People"), "Filter", "Person"],
"%d/%d" % (len(database.get_person_handles()),
len(database.db.get_person_handles())))
stab.row([_("Families"), "Filter", "Family"],
"%d/%d" % (len(database.get_family_handles()),
len(database.db.get_family_handles())))
stab.row([_("Events"), "Filter", "Event"],
"%d/%d" % (len(database.get_event_handles()),
len(database.db.get_event_handles())))
stab.row([_("Places"), "Filter", "Place"],
"%d/%d" % (len(database.get_place_handles()),
len(database.db.get_place_handles())))
stab.row([_("Sources"), "Filter", "Source"],
"%d/%d" % (len(database.get_source_handles()),
len(database.db.get_source_handles())))
stab.row([_("Repositories"), "Filter", "Repository"],
"%d/%d" % (len(database.get_repository_handles()),
len(database.db.get_repository_handles())))
stab.row([_("Media"), "Filter", "MediaObject"],
"%d/%d" % (len(database.get_media_object_handles()),
len(database.db.get_media_object_handles())))
stab.row([_("Notes"), "Filter", "Note"],
"%d/%d" % (len(database.get_note_handles()),
len(database.db.get_note_handles())))
else:
stab.row([_("People"), "Filter", "Person"],
"%d/%d" % (len(database.get_person_handles()),
len(database.basedb.get_person_handles())))
stab.row([_("Families"), "Filter", "Family"],
"%d/%d" % (len(database.get_family_handles()),
len(database.basedb.get_family_handles())))
stab.row([_("Events"), "Filter", "Event"],
"%d/%d" % (len(database.get_event_handles()),
len(database.basedb.get_event_handles())))
stab.row([_("Places"), "Filter", "Place"],
"%d/%d" % (len(database.get_place_handles()),
len(database.basedb.get_place_handles())))
stab.row([_("Sources"), "Filter", "Source"],
"%d/%d" % (len(database.get_source_handles()),
len(database.basedb.get_source_handles())))
stab.row([_("Repositories"), "Filter", "Repository"],
"%d/%d" % (len(database.get_repository_handles()),
len(database.basedb.get_repository_handles())))
stab.row([_("Media"), "Filter", "MediaObject"],
"%d/%d" % (len(database.get_media_object_handles()),
len(database.basedb.get_media_object_handles())))
stab.row([_("Notes"), "Filter", "Note"],
"%d/%d" % (len(database.get_note_handles()),
len(database.basedb.get_note_handles())))
sdoc.paragraph("")
stab.write(sdoc)
return
# display the title
if filter_name in fname_map:
sdoc.title(_("Filtering on %s") % fname_map[filter_name]) # listed above
else:
sdoc.title(_("Filtering on %s") % _(filter_name))
sdoc.paragraph("")
matches = 0
if (filter_name == 'Inverse Person'):
sdb.dbase = database.db
stab.columns(_("Person"), _("Gramps ID"), _("Birth Date"))
proxy_handles = set(database.iter_person_handles())
for person in database.db.iter_people():
if person.handle not in proxy_handles:
stab.row(person, person.gramps_id,
sdb.birth_or_fallback(person))
matches += 1
elif (filter_name == 'Inverse Family'):
sdb.dbase = database.db
stab.columns(_("Family"), _("Gramps ID"))
proxy_handles = set(database.iter_family_handles())
for family in database.db.iter_families():
if family.handle not in proxy_handles:
stab.row(family, family.gramps_id)
matches += 1
elif (filter_name == 'Inverse Event'):
sdb.dbase = database.db
#.........这里部分代码省略.........
示例15: run
# 需要导入模块: from gramps.gen.simple import SimpleDoc [as 别名]
# 或者: from gramps.gen.simple.SimpleDoc import paragraph [as 别名]
def run(database, document, main_event):
"""
Displays events on a specific date of an event (or date)
Takes an Event or Date object
"""
if isinstance(main_event, Date):
main_date = main_event
else:
main_date = main_event.get_date_object()
cal = main_date.get_calendar();
# setup the simple access functions
sdb = SimpleAccess(database)
sdoc = SimpleDoc(document)
stab = QuickTable(sdb)
stab.set_link_col(3)
yeartab = QuickTable(sdb)
yeartab.set_link_col(3)
histab = QuickTable(sdb)
histab.set_link_col(3)
# display the title
sdoc.title(_("Events of %(date)s") %
{"date": sdb.date_string(main_date)})
sdoc.paragraph("")
stab.columns(_("Date"), _("Type"), _("Place"), _("Reference"))
yeartab.columns(_("Date"), _("Type"), _("Place"), _("Reference"))
histab.columns(_("Date"), _("Type"), _("Place"), _("Reference"))
for event in database.iter_events():
date = event.get_date_object()
date.convert_calendar(cal)
if date.get_year() == 0:
continue
if (date.get_year() == main_date.get_year() and
date.get_month() == main_date.get_month() and
date.get_day() == main_date.get_day()):
for (objclass, handle) in database.find_backlink_handles(event.handle):
ref = get_ref(database, objclass, handle)
stab.row(date,
sdb.event_type(event),
sdb.event_place(event), ref)
elif (date.get_month() == main_date.get_month() and
date.get_day() == main_date.get_day() and
date.get_month() != 0):
for (objclass, handle) in database.find_backlink_handles(event.handle):
ref = get_ref(database, objclass, handle)
histab.row(date,
sdb.event_type(event),
sdb.event_place(event), ref)
elif (date.get_year() == main_date.get_year()):
for (objclass, handle) in database.find_backlink_handles(event.handle):
ref = get_ref(database, objclass, handle)
yeartab.row(date,
sdb.event_type(event),
sdb.event_place(event), ref)
document.has_data = False
if stab.get_row_count() > 0:
document.has_data = True
sdoc.paragraph(_("Events on this exact date"))
stab.write(sdoc)
else:
sdoc.paragraph(_("No events on this exact date"))
sdoc.paragraph("")
sdoc.paragraph("")
if histab.get_row_count() > 0:
document.has_data = True
sdoc.paragraph(_("Other events on this month/day in history"))
histab.write(sdoc)
else:
sdoc.paragraph(_("No other events on this month/day in history"))
sdoc.paragraph("")
sdoc.paragraph("")
if yeartab.get_row_count() > 0:
document.has_data = True
sdoc.paragraph(_("Other events in %(year)d") %
{"year":main_date.get_year()})
yeartab.write(sdoc)
else:
sdoc.paragraph(_("No other events in %(year)d") %
{"year":main_date.get_year()})
sdoc.paragraph("")
sdoc.paragraph("")