theme

Provide the theme XML and handling functions for OpenLP v2 themes.

class openlp.core.lib.theme.BackgroundGradientType[source]

Bases: object

Type enumeration for background gradients.

Circular = 2
Horizontal = 0
LeftBottom = 4
LeftTop = 3
Vertical = 1
static from_string(type_string)[source]

Return a background gradient type for the given string.

static to_string(gradient_type)[source]

Return a string representation of a background gradient type.

class openlp.core.lib.theme.BackgroundType[source]

Bases: object

Type enumeration for backgrounds.

Gradient = 1
Image = 2
Solid = 0
Transparent = 3
Video = 4
static from_string(type_string)[source]

Return a background type for the given string.

static to_string(background_type)[source]

Return a string representation of a background type.

class openlp.core.lib.theme.HorizontalType[source]

Bases: object

Type enumeration for horizontal alignment.

Center = 2
Justify = 3
Left = 0
Names = ['left', 'right', 'center', 'justify']
Right = 1
class openlp.core.lib.theme.ThemeXML[source]

Bases: object

A class to encapsulate the Theme XML.

add_background_gradient(startcolor, endcolor, direction)[source]

Add a gradient background.

Parameters:
  • startcolor – The gradient’s starting colour.
  • endcolor – The gradient’s ending colour.
  • direction – The direction of the gradient.
add_background_image(filename, border_color)[source]

Add a image background.

Parameters:
  • filename – The file name of the image.
  • border_color
add_background_solid(bkcolor)[source]

Add a Solid background.

Parameters:bkcolor – The color of the background.
add_background_transparent()[source]

Add a transparent background.

add_background_video(filename, border_color)[source]

Add a video background.

Parameters:
  • filename – The file name of the video.
  • border_color
add_display(horizontal, vertical, transition)[source]

Add a Display options.

Parameters:
  • horizontal – The horizontal alignment of the text.
  • vertical – The vertical alignment of the text.
  • transition – Whether the slide transition is active.
add_font(name, color, size, override, fonttype='main', bold='False', italics='False', line_adjustment=0, xpos=0, ypos=0, width=0, height=0, outline='False', outline_color='#ffffff', outline_pixel=2, shadow='False', shadow_color='#ffffff', shadow_pixel=5)[source]

Add a Font.

Parameters:
  • name – The name of the font.
  • color – The colour of the font.
  • size – The size of the font.
  • override – Whether or not to override the default positioning of the theme.
  • fonttype – The type of font, main or footer. Defaults to main.
  • bold
  • italics – The weight of then font Defaults to 50 Normal
  • line_adjustment – Does the font render to italics Defaults to 0 Normal
  • xpos – The X position of the text block.
  • ypos – The Y position of the text block.
  • width – The width of the text block.
  • height – The height of the text block.
  • outline – Whether or not to show an outline.
  • outline_color – The colour of the outline.
  • outline_pixel – How big the Shadow is
  • shadow – Whether or not to show a shadow.
  • shadow_color – The colour of the shadow.
  • shadow_pixel – How big the Shadow is
child_element(element, tag, value)[source]

Generic child element creator.

dump_xml()[source]

Dump the XML to file used for debugging

expand_json(var, prev=None)[source]

Expand the json objects and make into variables.

Parameters:
  • var – The array list to be processed.
  • prev – The preceding string to add to the key to make the variable.
extend_image_filename(path)[source]

Add the path name to the image name so the background can be rendered.

Parameters:path – The path name to be added.
extract_formatted_xml()[source]

Pull out the XML string formatted for human consumption

extract_xml()[source]

Print out the XML string.

parse(xml)[source]

Read in an XML string and parse it.

Parameters:xml – The XML string to parse.
parse_xml(xml)[source]

Parse an XML string.

Parameters:xml – The XML string to parse.

Set the header and footer size into the current primary screen. 10 px on each side is removed to allow for a border.

class openlp.core.lib.theme.VerticalType[source]

Bases: object

Type enumeration for vertical alignment.

Bottom = 2
Middle = 1
Names = ['top', 'middle', 'bottom']
Top = 0