本文整理汇总了Python中position.Position.update_position方法的典型用法代码示例。如果您正苦于以下问题:Python Position.update_position方法的具体用法?Python Position.update_position怎么用?Python Position.update_position使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类position.Position
的用法示例。
在下文中一共展示了Position.update_position方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Presentation
# 需要导入模块: from position import Position [as 别名]
# 或者: from position.Position import update_position [as 别名]
#.........这里部分代码省略.........
tokens = self.parser.tokenize(source=complete_source)
self.__check_bad_sectioning(tokens=tokens)
chapters_number = 0
sections_number = 0
subsections_number = 0
slides_number = 0
titlepage_inserted = False
for chap in tokens['chapters']:
chapters_number += 1
slide_local_numbers = [0, 0, 0]
if chap['match'].group('expr'):
chapter = Chapter(number=chapters_number, title=chap['match'].group('expr'))
else:
chapter = Chapter(number=chapters_number, title='')
for sec in tokens['sections']:
if sec['start'] >= chap['start'] and sec['start'] <= chap['end_next']:
sections_number += 1
slide_local_numbers[1] = 0
slide_local_numbers[2] = 0
section = Section(number=sections_number, title=sec['match'].group('expr'))
for subsec in tokens['subsections']:
if subsec['start'] >= sec['start'] and subsec['start'] <= sec['end_next']:
subsections_number += 1
slide_local_numbers[2] = 0
subsection = Subsection(number=subsections_number, title=subsec['match'].group('expr'))
for sld in tokens['slides']:
if '$titlepage' in sld['match'].group().lower() and not titlepage_inserted:
slide = Slide(number=0,
title='titlepage',
contents=complete_source[sld['end']:sld['end_next']])
slide.get_overtheme(parser=self.parser)
if slide.overtheme.copy_from_theme is not None and slide.overtheme.copy_from_theme:
slide.overtheme.copy_from(other=self.theme)
self.position.update_position(presentation_theme=self.theme, overtheme=slide.overtheme)
slide.set_position(position=self.position.position)
subsection.add_slide(slide=slide)
titlepage_inserted = True
else:
if sld['start'] >= subsec['start'] and sld['start'] <= subsec['end_next']:
slide_local_numbers[0] += 1
slide_local_numbers[1] += 1
slide_local_numbers[2] += 1
if slide_local_numbers[0] == 1 and config.toc_at_chap_beginning is not None:
slides_number += 1
self.position.update_position(presentation_theme=self.theme)
subsection.add_slide(slide=Slide(number=slides_number,
position=self.position.position,
title='Table of Contents',
contents='$toc[depth:' + str(config.toc_at_chap_beginning) + ']'))
if slide_local_numbers[1] == 1 and config.toc_at_sec_beginning is not None:
slides_number += 1
self.position.update_position(presentation_theme=self.theme)
subsection.add_slide(slide=Slide(number=slides_number,
position=self.position.position,
title='Table of Contents',
contents='$toc[depth:' + str(config.toc_at_sec_beginning) + ']'))
if slide_local_numbers[2] == 1 and config.toc_at_subsec_beginning is not None:
slides_number += 1
self.position.update_position(presentation_theme=self.theme)
subsection.add_slide(slide=Slide(number=slides_number,
position=self.position.position,
title='Table of Contents',
contents='$toc[depth:' + str(config.toc_at_subsec_beginning) + ']'))
slides_number += 1
slide = Slide(number=slides_number,
title=sld['match'].group('expr'),