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


Python BaseDocTemplate._startBuild方法代码示例

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


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

示例1: _startBuild

# 需要导入模块: from reportlab.platypus.doctemplate import BaseDocTemplate [as 别名]
# 或者: from reportlab.platypus.doctemplate.BaseDocTemplate import _startBuild [as 别名]
    def _startBuild(self, filename=None, canvasmaker=canvas.Canvas):
        BaseDocTemplate._startBuild(self, filename=filename, canvasmaker=canvasmaker)

        type2lvl = {"chapter": 0, "article": 1, "heading2": 2, "heading3": 3, "heading4": 4}
        got_chapter = False
        last_lvl = 0
        for (bm_id, (bm_title, bm_type)) in enumerate(self.bookmarks):
            lvl = type2lvl[bm_type]
            if bm_type == "chapter":
                got_chapter = True
            elif not got_chapter:  # outline-lvls can't start above zero
                lvl -= 1
            lvl = min(lvl, last_lvl + 1)
            last_lvl = lvl
            self.canv.addOutlineEntry(bm_title, str(bm_id), lvl, bm_type == "article")
开发者ID:tosher,项目名称:mwlib.rl,代码行数:17,代码来源:pagetemplates.py

示例2: _startBuild

# 需要导入模块: from reportlab.platypus.doctemplate import BaseDocTemplate [as 别名]
# 或者: from reportlab.platypus.doctemplate.BaseDocTemplate import _startBuild [as 别名]
    def _startBuild(self, filename=None, canvasmaker=canvas.Canvas):
        BaseDocTemplate._startBuild(self, filename=filename, canvasmaker=canvasmaker)

        type2lvl = {'chapter': 0,
                    'article': 1,
                    'heading2': 2,
                    'heading3': 3,
                    'heading4': 4,
                    'heading5': 5,#new
                    'heading6': 6,
                    }
        got_chapter = False
        last_lvl =  0
        for (bm_id, (bm_title, bm_type)) in enumerate(self.bookmarks):
            lvl = type2lvl[bm_type]
            if bm_type== 'chapter':
                got_chapter = True
            elif not got_chapter: # outline-lvls can't start above zero
                lvl -= 1
            lvl = min(lvl, last_lvl + 1)
            last_lvl = lvl
            self.canv.addOutlineEntry(bm_title, str(bm_id), lvl, bm_type == 'article')
开发者ID:maximeB,项目名称:mwlib.rl-1,代码行数:24,代码来源:pagetemplates.py


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