本文整理汇总了Python中gramps.gen.lib.EventRef.unserialize方法的典型用法代码示例。如果您正苦于以下问题:Python EventRef.unserialize方法的具体用法?Python EventRef.unserialize怎么用?Python EventRef.unserialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gramps.gen.lib.EventRef
的用法示例。
在下文中一共展示了EventRef.unserialize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: column_death_place
# 需要导入模块: from gramps.gen.lib import EventRef [as 别名]
# 或者: from gramps.gen.lib.EventRef import unserialize [as 别名]
def column_death_place(self, data):
index = data[COLUMN_DEATH]
if index != -1:
try:
local = data[COLUMN_EVENT][index]
dr = EventRef()
dr.unserialize(local)
event = self.db.get_event_from_handle(dr.ref)
if event:
place_title = place_displayer.display_event(self.db, event)
if place_title:
return escape(place_title)
except:
return ''
for event_ref in data[COLUMN_EVENT]:
er = EventRef()
er.unserialize(event_ref)
event = self.db.get_event_from_handle(er.ref)
etype = event.get_type()
if (etype in [EventType.BURIAL, EventType.CREMATION,
EventType.CAUSE_DEATH]
and er.get_role() == EventRoleType.PRIMARY):
place_title = place_displayer.display_event(self.db, event)
if place_title:
return "<i>%s</i>" % escape(place_title)
return ""
示例2: column_birth_place
# 需要导入模块: from gramps.gen.lib import EventRef [as 别名]
# 或者: from gramps.gen.lib.EventRef import unserialize [as 别名]
def column_birth_place(self, data):
index = data[COLUMN_BIRTH]
if index != -1:
try:
local = data[COLUMN_EVENT][index]
br = EventRef()
br.unserialize(local)
event = self.db.get_event_from_handle(br.ref)
if event:
place_title = place_displayer.display_event(self.db, event)
if place_title:
return escape(place_title)
except:
return ''
for event_ref in data[COLUMN_EVENT]:
er = EventRef()
er.unserialize(event_ref)
event = self.db.get_event_from_handle(er.ref)
etype = event.get_type()
if (etype in [EventType.BAPTISM, EventType.CHRISTEN] and
er.get_role() == EventRoleType.PRIMARY):
place_title = place_displayer.display_event(self.db, event)
if place_title:
return "<i>%s</i>" % escape(place_title)
return ""
示例3: column_death_place
# 需要导入模块: from gramps.gen.lib import EventRef [as 别名]
# 或者: from gramps.gen.lib.EventRef import unserialize [as 别名]
def column_death_place(self, data):
handle = data[0]
cached, value = self.get_cached_value(handle, "DEATH_PLACE")
if cached:
return value
else:
index = data[COLUMN_DEATH]
if index != -1:
try:
local = data[COLUMN_EVENT][index]
dr = EventRef()
dr.unserialize(local)
event = self.db.get_event_from_handle(dr.ref)
if event:
place_title = place_displayer.display_event(self.db, event)
if place_title:
value = escape(place_title)
self.set_cached_value(handle, "DEATH_PLACE", value)
return value
except:
value = ""
self.set_cached_value(handle, "DEATH_PLACE", value)
return value
for event_ref in data[COLUMN_EVENT]:
er = EventRef()
er.unserialize(event_ref)
event = self.db.get_event_from_handle(er.ref)
etype = event.get_type()
if (
etype in [EventType.BURIAL, EventType.CREMATION, EventType.CAUSE_DEATH]
and er.get_role() == EventRoleType.PRIMARY
):
place_title = place_displayer.display_event(self.db, event)
if place_title:
value = "<i>%s</i>" % escape(place_title)
self.set_cached_value(handle, "DEATH_PLACE", value)
return value
value = ""
self.set_cached_value(handle, "DEATH_PLACE", value)
return value
示例4: _get_birth_data
# 需要导入模块: from gramps.gen.lib import EventRef [as 别名]
# 或者: from gramps.gen.lib.EventRef import unserialize [as 别名]
def _get_birth_data(self, data, sort_mode):
index = data[COLUMN_BIRTH]
if index != -1:
try:
local = data[COLUMN_EVENT][index]
b = EventRef()
b.unserialize(local)
birth = self.db.get_event_from_handle(b.ref)
if sort_mode:
retval = "%09d" % birth.get_date_object().get_sort_value()
else:
date_str = get_date(birth)
if date_str != "":
retval = escape(date_str)
if not get_date_valid(birth):
return invalid_date_format % retval
else:
return retval
except:
return ""
for event_ref in data[COLUMN_EVENT]:
er = EventRef()
er.unserialize(event_ref)
event = self.db.get_event_from_handle(er.ref)
etype = event.get_type()
date_str = get_date(event)
if (
etype in [EventType.BAPTISM, EventType.CHRISTEN]
and er.get_role() == EventRoleType.PRIMARY
and date_str != ""
):
if sort_mode:
retval = "%09d" % event.get_date_object().get_sort_value()
else:
retval = "<i>%s</i>" % escape(date_str)
if not get_date_valid(event):
return invalid_date_format % retval
else:
return retval
return ""
示例5: _get_death_data
# 需要导入模块: from gramps.gen.lib import EventRef [as 别名]
# 或者: from gramps.gen.lib.EventRef import unserialize [as 别名]
def _get_death_data(self, data, sort_mode):
index = data[COLUMN_DEATH]
if index != -1:
try:
local = data[COLUMN_EVENT][index]
ref = EventRef()
ref.unserialize(local)
event = self.db.get_event_from_handle(ref.ref)
if sort_mode:
retval = "%09d" % event.get_date_object().get_sort_value()
else:
date_str = get_date(event)
if date_str != "":
retval = escape(date_str)
if not get_date_valid(event):
return invalid_date_format % retval
else:
return retval
except:
return ''
for event_ref in data[COLUMN_EVENT]:
er = EventRef()
er.unserialize(event_ref)
event = self.db.get_event_from_handle(er.ref)
etype = event.get_type()
date_str = get_date(event)
if (etype in [EventType.BURIAL,
EventType.CREMATION,
EventType.CAUSE_DEATH]
and er.get_role() == EventRoleType.PRIMARY
and date_str):
if sort_mode:
retval = "%09d" % event.get_date_object().get_sort_value()
else:
retval = "<i>%s</i>" % escape(date_str)
if not get_date_valid(event):
return invalid_date_format % retval
else:
return retval
return ""
示例6: column_birth_place
# 需要导入模块: from gramps.gen.lib import EventRef [as 别名]
# 或者: from gramps.gen.lib.EventRef import unserialize [as 别名]
def column_birth_place(self, data):
handle = data[0]
cached, value = self.get_cached_value(handle, "BIRTH_PLACE")
if cached:
return value
else:
index = data[COLUMN_BIRTH]
if index != -1:
try:
local = data[COLUMN_EVENT][index]
br = EventRef()
br.unserialize(local)
event = self.db.get_event_from_handle(br.ref)
if event:
place_title = place_displayer.display_event(self.db, event)
if place_title:
value = escape(place_title)
self.set_cached_value(handle, "BIRTH_PLACE", value)
return value
except:
value = ""
self.set_cached_value(handle, "BIRTH_PLACE", value)
return value
for event_ref in data[COLUMN_EVENT]:
er = EventRef()
er.unserialize(event_ref)
event = self.db.get_event_from_handle(er.ref)
etype = event.get_type()
if etype in [EventType.BAPTISM, EventType.CHRISTEN] and er.get_role() == EventRoleType.PRIMARY:
place_title = place_displayer.display_event(self.db, event)
if place_title:
value = "<i>%s</i>" % escape(place_title)
self.set_cached_value(handle, "BIRTH_PLACE", value)
return value
value = ""
self.set_cached_value(handle, "BIRTH_PLACE", value)
return value