thememanager

The Theme Manager manages adding, deleteing and modifying of themes.

class openlp.core.ui.thememanager.ThemeManager(parent=None)[source]

Bases: openlp.core.common.openlpmixin.OpenLPMixin, openlp.core.common.registrymixin.RegistryMixin, PyQt5.QtWidgets.QWidget, openlp.core.ui.thememanager.Ui_ThemeManager, openlp.core.common.registryproperties.RegistryProperties

Manages the orders of Theme.

bootstrap_initialise()[source]

process the bootstrap initialise setup request

bootstrap_post_set_up()[source]

process the bootstrap post setup request

build_theme_path()[source]

Set up the theme path variables

change_global_from_screen(index=-1)[source]

Change the global theme when a theme is double clicked upon in the Theme Manager list.

Parameters:index
change_global_from_tab()[source]

Change the global theme when it is changed through the Themes settings tab

check_if_theme_exists(theme_name)[source]

Check if theme already exists and displays error message

Parameters:theme_name – Name of the Theme to test
Returns:True or False if theme exists
check_list_state(item, field=None)[source]

If Default theme selected remove delete button. Note for some reason a dummy field is required. Nothing is passed!

Parameters:
  • field
  • item – Service Item to process
clone_theme_data(theme_data, new_theme_name)[source]

Takes a theme and makes a new copy of it as well as saving it.

Parameters:
  • theme_data – The theme to be used
  • new_theme_name – The new theme name to save the data to
context_menu(point)[source]

Build the Right Click Context menu and set state depending on the type of theme.

Parameters:point – The position of the mouse so the correct item can be found.
delete_theme(theme)[source]

Delete a theme.

Parameters:theme – The theme to delete.
generate_and_save_image(name, theme)[source]

Generate and save a preview image

Parameters:
  • name – The name of the theme.
  • theme – The theme data object.
generate_image(theme_data, force_page=False)[source]

Call the renderer to build a Sample Image

Parameters:
  • theme_data – The theme to generated a preview for.
  • force_page – Flag to tell message lines per page need to be generated.
get_preview_image(theme)[source]

Return an image representing the look of the theme

Parameters:theme – The theme to return the image for.
get_theme_data(theme_name)[source]

Returns a theme object from an XML file

Parameters:theme_name – Name of the theme to load from file
Returns:The theme object.
get_themes()[source]

Return the list of loaded themes

load_first_time_themes()[source]

Imports any themes on start up and makes sure there is at least one theme

load_themes()[source]

Loads the theme lists and triggers updates across the whole system using direct calls or core functions and events for the plugins. The plugins will call back in to get the real list if they want it.

on_add_theme(field=None)[source]

Loads a new theme with the default settings and then launches the theme editing form for the user to make their customisations. :param field:

on_copy_theme(field=None)[source]

Copies an existing theme to a new name :param field:

on_delete_theme(field=None)[source]

Delete a theme triggered by the UI. :param field:

on_edit_theme(field=None)[source]

Loads the settings for the theme that is to be edited and launches the theme editing form so the user can make their changes. :param field:

on_export_theme(field=None)[source]

Export the theme in a zip file :param field:

on_import_theme(field=None)[source]

Opens a file dialog to select the theme file(s) to import before attempting to extract OpenLP themes from those files. This process will only load version 2 themes. :param field:

on_rename_theme(field=None)[source]

Renames an existing theme to a new name :param field:

over_write_message_box(theme_name)[source]

Display a warning box to the user that a theme already exists

Parameters:theme_name – Name of the theme.
Returns:Confirm if the theme is to be overwritten.
save_theme(theme, image_from, image_to)[source]

Called by theme maintenance Dialog to save the theme and to trigger the reload of the theme list

Parameters:
  • theme – The theme data object.
  • image_from – Where the theme image is currently located.
  • image_to – Where the Theme Image is to be saved to
unzip_theme(file_name, directory)[source]

Unzip the theme, remove the preview file if stored. Generate a new preview file. Check the XML theme version and upgrade if necessary. :param file_name: :param directory:

update_preview_images()[source]

Called to update the themes’ preview images.

class openlp.core.ui.thememanager.Ui_ThemeManager[source]

Bases: object

UI part of the Theme Manager

setup_ui(widget)[source]

Define the UI :param widget: The screen object the the dialog is to be attached to.