当前位置: 首页>>代码示例>>Python>>正文


Python Person.unserialize方法代码示例

本文整理汇总了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")
开发者ID:SNoiraud,项目名称:gramps,代码行数:50,代码来源:sessionloggramplet.py


注:本文中的gramps.gen.lib.Person.unserialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。