renderer

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.

bootstrap_initialise()[source]

Initialise functions

format_slide(text, item)[source]

Calculate how much text can fit on a slide.

Parameters:
  • 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.

Parameters:
  • 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.
get_main_rectangle(theme_data)[source]

Calculates the placement and size of the main rectangle.

Parameters:theme_data – The theme information
pre_render(override_theme_data=None)[source]

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_global_theme()[source]

Set the global-level theme name.

set_item_theme(item_theme_name)[source]

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_service_theme(service_theme_name)[source]

Set the service-level theme.

Parameters:service_theme_name – The service level theme’s name.
set_theme_level(theme_level)[source]

Sets the theme level.

Parameters:theme_level – The theme level to be used.
update_display()[source]

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.

Parameters:
  • 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.
openlp.core.lib.renderer.get_start_tags(raw_text)[source]

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
openlp.core.lib.renderer.words_split(line)[source]

Split the slide up by word so can wrap better

Parameters:line – Line to be split