本文整理匯總了Python中gramps.gen.lib.Family.unserialize方法的典型用法代碼示例。如果您正苦於以下問題:Python Family.unserialize方法的具體用法?Python Family.unserialize怎麽用?Python Family.unserialize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gramps.gen.lib.Family
的用法示例。
在下文中一共展示了Family.unserialize方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: log
# 需要導入模塊: from gramps.gen.lib import Family [as 別名]
# 或者: from gramps.gen.lib.Family 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")