本文整理汇总了Python中openlp.core.lib.ServiceItem.themedata方法的典型用法代码示例。如果您正苦于以下问题:Python ServiceItem.themedata方法的具体用法?Python ServiceItem.themedata怎么用?Python ServiceItem.themedata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openlp.core.lib.ServiceItem
的用法示例。
在下文中一共展示了ServiceItem.themedata方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generate_preview
# 需要导入模块: from openlp.core.lib import ServiceItem [as 别名]
# 或者: from openlp.core.lib.ServiceItem import themedata [as 别名]
def generate_preview(self, theme_data, force_page=False):
"""
Generate a preview of a theme.
``theme_data``
The theme to generated a preview for.
``force_page``
Flag to tell message lines per page need to be generated.
"""
log.debug(u'generate preview')
# save value for use in format_slide
self.force_page = force_page
# build a service item to generate preview
serviceItem = ServiceItem()
if self.force_page:
# make big page for theme edit dialog to get line count
serviceItem.add_from_text(VERSE_FOR_LINE_COUNT)
else:
serviceItem.add_from_text(VERSE)
serviceItem.raw_footer = FOOTER
# if No file do not update cache
if theme_data.background_filename:
self.image_manager.add_image(theme_data.background_filename,
ImageSource.Theme,
QtGui.QColor(theme_data.background_border_color))
theme_data, main, footer = self.pre_render(theme_data)
serviceItem.themedata = theme_data
serviceItem.main = main
serviceItem.footer = footer
serviceItem.render(True)
if not self.force_page:
self.display.buildHtml(serviceItem)
raw_html = serviceItem.get_rendered_frame(0)
self.display.text(raw_html, False)
preview = self.display.preview()
return preview
self.force_page = False