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


Python Name.get_surname_list方法代码示例

本文整理汇总了Python中gramps.gen.lib.Name.get_surname_list方法的典型用法代码示例。如果您正苦于以下问题:Python Name.get_surname_list方法的具体用法?Python Name.get_surname_list怎么用?Python Name.get_surname_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gramps.gen.lib.Name的用法示例。


在下文中一共展示了Name.get_surname_list方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: latin_american

# 需要导入模块: from gramps.gen.lib import Name [as 别名]
# 或者: from gramps.gen.lib.Name import get_surname_list [as 别名]
 def latin_american(self):
     """
     Child inherits name from father and mother
     """
     name = Name()
     #the editor requires a surname
     name.add_surname(Surname())
     name.set_primary_surname(0)
     if self.family:
         father_handle = self.family.get_father_handle()
         mother_handle = self.family.get_mother_handle()
         father = self.dbstate.db.get_person_from_handle(father_handle)
         mother = self.dbstate.db.get_person_from_handle(mother_handle)
         if not father and not mother:
             return name
         if not father:
             preset_name(mother, name)
             return name
         if not mother:
             preset_name(father, name)
             return name
         #we take first surname, and keep that
         mothername = Name()
         preset_name(mother, mothername)
         preset_name(father, name)
         mothersurname = mothername.get_surname_list()[0]
         mothersurname.set_primary(False)
         name.set_surname_list([name.get_surname_list()[0], mothersurname])
         return name
     else:
         return name
开发者ID:tecknicaltom,项目名称:gramps,代码行数:33,代码来源:editfamily.py

示例2: latin_american_child

# 需要导入模块: from gramps.gen.lib import Name [as 别名]
# 或者: from gramps.gen.lib.Name import get_surname_list [as 别名]
    def latin_american_child(self, parent):
        """
        If SURNAME_GUESSING is latin american, then find a child
        and return their name for the father or mother.

        parent = "mother" | "father"
        """
        name = Name()
        #the editor requires a surname
        name.add_surname(Surname())
        name.set_primary_surname(0)
        # for each child, find one with a last name
        for ref in self.obj.get_child_ref_list():
            child = self.db.get_person_from_handle(ref.ref)
            if child:
                pname = child.get_primary_name()
                preset_name(child, name)
                if len(name.get_surname_list()) < 2:
                    return name
                else:
                    #return first for the father, and last for the mother
                    if parent == 'father':
                        name.set_surname_list(name.get_surname_list()[0])
                        return name
                    else:
                        name.set_surname_list(name.get_surname_list()[-1])
                        return name
        return name
开发者ID:tecknicaltom,项目名称:gramps,代码行数:30,代码来源:editfamily.py


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