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


Python SimpleAccess.describe方法代码示例

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


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

示例1: main

# 需要导入模块: from gramps.gen.simple import SimpleAccess [as 别名]
# 或者: from gramps.gen.simple.SimpleAccess import describe [as 别名]
 def main(self):
     database = self.dbstate.db
     simple_a = SimpleAccess(database)
     # stime = time.perf_counter()
     counts_list = {}
     count = 0
     self.model.clear()
     for person in database.iter_people():
         if count == 200:
             count = 0
             yield True
         count += 1
         result = len(countem(database, person, counts_list))
         self.model.append((simple_a.describe(person), result,
                            person.handle))
     self.set_has_data(len(self.model) > 0)
开发者ID:daleathan,项目名称:addons-source,代码行数:18,代码来源:DescendantCount.py

示例2: write_report

# 需要导入模块: from gramps.gen.simple import SimpleAccess [as 别名]
# 或者: from gramps.gen.simple.SimpleAccess import describe [as 别名]
    def write_report(self):
        """
        The routine that actually creates the report.
        At this point, the document is opened and ready for writing.
        """
        sdb = SimpleAccess(self.database)

        self.doc.start_paragraph("NoteLink-Title")
        title = _("Note Link Check Report")
        mark = IndexMark(title, INDEX_TYPE_TOC, 1)
        self.doc.write_text(title, mark)
        self.doc.end_paragraph()
        self.doc.start_table('NoteLinkTable','NoteLink-Table')

        self.doc.start_row()

        self.doc.start_cell('NoteLink-TableCell')
        self.doc.start_paragraph('NoteLink-Normal-Bold')
        self.doc.write_text(_("Note ID"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('NoteLink-TableCell')
        self.doc.start_paragraph('NoteLink-Normal-Bold')
        self.doc.write_text(_("Link Type"))
        self.doc.end_paragraph()
        self.doc.end_cell()
        
        self.doc.start_cell('NoteLink-TableCell')
        self.doc.start_paragraph('NoteLink-Normal-Bold')
        self.doc.write_text(_("Links To"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.start_cell('NoteLink-TableCell')
        self.doc.start_paragraph('NoteLink-Normal-Bold')
        self.doc.write_text(_("Status"))
        self.doc.end_paragraph()
        self.doc.end_cell()

        self.doc.end_row()

        for note in self.database.iter_notes():
            for (ldomain, ltype, lprop, lvalue) in note.get_links():
                    if ldomain == "gramps":
                        tagtype = _(ltype)
                        ref_obj = sdb.get_link(ltype, lprop, lvalue)
                        if ref_obj:
                            tagvalue = sdb.describe(ref_obj)
                            tagcheck = _("Ok")
                        else:
                            tagvalue = "%s://%s/%s/%s" % (ldomain, ltype, lprop, lvalue)
                            tagcheck = _("Failed")
                    else:
                        tagtype = _("Internet")
                        tagvalue = lvalue
                        tagcheck = ""
        
                    self.doc.start_row()

                    self.doc.start_cell('NoteLink-TableCell')
                    self.doc.start_paragraph('NoteLink-Normal')
                    self.doc.write_text(note.gramps_id)
                    self.doc.end_paragraph()
                    self.doc.end_cell()

                    self.doc.start_cell('NoteLink-TableCell')
                    self.doc.start_paragraph('NoteLink-Normal')
                    self.doc.write_text(tagtype)
                    self.doc.end_paragraph()
                    self.doc.end_cell()

                    self.doc.start_cell('NoteLink-TableCell')
                    self.doc.start_paragraph('NoteLink-Normal')
                    self.doc.write_text(tagvalue)
                    self.doc.end_paragraph()
                    self.doc.end_cell()

                    self.doc.start_cell('NoteLink-TableCell')
                    self.doc.start_paragraph('NoteLink-Normal')
                    self.doc.write_text(tagcheck)
                    self.doc.end_paragraph()
                    self.doc.end_cell()

                    self.doc.end_row()

        self.doc.end_table()
开发者ID:nblock,项目名称:gramps,代码行数:89,代码来源:notelinkreport.py


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