本文整理汇总了Python中gramps.gen.lib.Person.unserialize方法的典型用法代码示例。如果您正苦于以下问题:Python Person.unserialize方法的具体用法?Python Person.unserialize怎么用?Python Person.unserialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gramps.gen.lib.Person
的用法示例。
在下文中一共展示了Person.unserialize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: log
# 需要导入模块: from gramps.gen.lib import Person [as 别名]
# 或者: from gramps.gen.lib.Person import unserialize [as 别名]
def log(self, ltype, action, handles):
for handle in set(handles):
if self.last_log == (ltype, action, handle):
continue
self.last_log = (ltype, action, handle)
self.timestamp()
# translators: needed for French, ignore otherwise
self.append_text(_("%s: ") % _(action))
if action == 'Deleted':
transaction = self.dbstate.db.transaction
if ltype == 'Person':
name = 'a person'
if transaction is not None:
for i in transaction.get_recnos(reverse=True):
(obj_type, trans_type, hndl, old_data, dummy) = \
transaction.get_record(i)
if isinstance(hndl, bytes):
hndl = str(hndl, "utf-8")
if (obj_type == PERSON_KEY and trans_type == TXNDEL
and hndl == handle):
person = Person()
person.unserialize(old_data)
name = name_displayer.display(person)
break
elif ltype == 'Family':
name = 'a family'
if transaction is not None:
for i in transaction.get_recnos(reverse=True):
(obj_type, trans_type, hndl, old_data, dummy) = \
transaction.get_record(i)
if isinstance(hndl, bytes):
hndl = str(hndl, "utf-8")
if (obj_type == FAMILY_KEY and trans_type == TXNDEL
and hndl == handle):
family = Family()
family.unserialize(old_data)
name = family_name(family, self.dbstate.db, name)
break
self.append_text(name)
else:
if ltype == 'Person':
person = self.dbstate.db.get_person_from_handle(handle)
name = name_displayer.display(person)
elif ltype == 'Family':
family = self.dbstate.db.get_family_from_handle(handle)
name = family_name(family, self.dbstate.db, 'a family')
self.link(name, ltype, handle)
self.append_text("\n")