class openlp.core.lib.renderer.Renderer[source]

Bases: openlp.core.common.openlpmixin.OpenLPMixin, openlp.core.common.registrymixin.RegistryMixin, openlp.core.common.registryproperties.RegistryProperties

Class to pull all Renderer interactions into one place. The plugins will call helper methods to do the rendering but this class will provide display defense code.


Initialise functions

format_slide(text, item)[source]

Calculate how much text can fit on a slide.

  • text – The words to go on the slides.
  • item – The ServiceItem item object.
generate_preview(theme_data, force_page=False)[source]

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.

Calculates the placement and size of the footer rectangle.

Parameters:theme_data – The theme data.

Calculates the placement and size of the main rectangle.

Parameters:theme_data – The theme information

Set up the theme to be used before rendering an item.

Parameters:override_theme_data – The theme data should be passed, when we want to use our own theme data, regardless of the theme level. This should for example be used in the theme manager. Note, this is not to be mixed up with the set_item_theme method.

Set the global-level theme name.


Set the item-level theme. Note, this has to be done for each item we are rendering.

Parameters:item_theme_name – The item theme’s name.

Set the service-level theme.

Parameters:service_theme_name – The service level theme’s name.

Sets the theme level.

Parameters:theme_level – The theme level to be used.

Updates the renderer’s information about the current screen.

update_theme(theme_name, old_theme_name=None, only_delete=False)[source]

This method updates the theme in _theme_dimensions when a theme has been edited or renamed.

  • theme_name – The current theme name.
  • old_theme_name – The old theme name. Has only to be passed, when the theme has been renamed. Defaults to None.
  • only_delete – Only remove the given theme_name from the _theme_dimensions list. This can be used when a theme is permanently deleted.

Tests the given text for not closed formatting tags and returns a tuple consisting of three unicode strings:

('{st}{r}Text text text{/r}{/st}', '{st}{r}', '<strong><span style="-webkit-text-fill-color:red">')

The first unicode string is the text, with correct closing tags. The second unicode string are OpenLP’s opening formatting tags and the third unicode string the html opening formatting tags.

Parameters:raw_text – The text to test. The text must not contain html tags, only OpenLP formatting tags
are allowed::
{st}{r}Text text text

Split the slide up by word so can wrap better

Parameters:line – Line to be split