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


Python EventRef.get_role方法代码示例

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


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

示例1: column_death_place

# 需要导入模块: from gramps.gen.lib import EventRef [as 别名]
# 或者: from gramps.gen.lib.EventRef import get_role [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 ""
开发者ID:gogglesguy,项目名称:gramps,代码行数:30,代码来源:peoplemodel.py

示例2: column_birth_place

# 需要导入模块: from gramps.gen.lib import EventRef [as 别名]
# 或者: from gramps.gen.lib.EventRef import get_role [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 ""
开发者ID:gogglesguy,项目名称:gramps,代码行数:29,代码来源:peoplemodel.py

示例3: column_death_place

# 需要导入模块: from gramps.gen.lib import EventRef [as 别名]
# 或者: from gramps.gen.lib.EventRef import get_role [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
开发者ID:tester0077,项目名称:gramps,代码行数:44,代码来源:peoplemodel.py

示例4: _get_birth_data

# 需要导入模块: from gramps.gen.lib import EventRef [as 别名]
# 或者: from gramps.gen.lib.EventRef import get_role [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 ""
开发者ID:tester0077,项目名称:gramps,代码行数:44,代码来源:peoplemodel.py

示例5: _get_death_data

# 需要导入模块: from gramps.gen.lib import EventRef [as 别名]
# 或者: from gramps.gen.lib.EventRef import get_role [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 ""
开发者ID:gogglesguy,项目名称:gramps,代码行数:43,代码来源:peoplemodel.py

示例6: column_birth_place

# 需要导入模块: from gramps.gen.lib import EventRef [as 别名]
# 或者: from gramps.gen.lib.EventRef import get_role [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
开发者ID:tester0077,项目名称:gramps,代码行数:40,代码来源:peoplemodel.py


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