本文整理汇总了Python中gramps.gen.simple.SimpleAccess.event_date_obj方法的典型用法代码示例。如果您正苦于以下问题:Python SimpleAccess.event_date_obj方法的具体用法?Python SimpleAccess.event_date_obj怎么用?Python SimpleAccess.event_date_obj使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gramps.gen.simple.SimpleAccess
的用法示例。
在下文中一共展示了SimpleAccess.event_date_obj方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_fam
# 需要导入模块: from gramps.gen.simple import SimpleAccess [as 别名]
# 或者: from gramps.gen.simple.SimpleAccess import event_date_obj [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)
示例2: run
# 需要导入模块: from gramps.gen.simple import SimpleAccess [as 别名]
# 或者: from gramps.gen.simple.SimpleAccess import event_date_obj [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("")
示例3: run
# 需要导入模块: from gramps.gen.simple import SimpleAccess [as 别名]
# 或者: from gramps.gen.simple.SimpleAccess import event_date_obj [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"))