Provides the generic functions for interfacing plugins with the Media Manager.

class openlp.core.lib.mediamanageritem.MediaManagerItem(parent=None, plugin=None)[source]

Bases: PyQt5.QtWidgets.QWidget, openlp.core.common.registryproperties.RegistryProperties

MediaManagerItem is a helper widget for plugins.

None of the following need to be used, feel free to override them completely in your plugin’s implementation. Alternatively, call them from your plugin before or after you’ve done extra things that you need to.

Constructor Parameters

The parent widget. Usually this will be the Media Manager itself. This needs to be a class descended from QWidget.
The plugin widget. Usually this will be the Plugin itself. This needs to be a class descended from Plugin.

Member Variables

When creating a descendant class from this class for your plugin, the following member variables should be set.


Defaults to ‘Select Image(s)’.
Defaults to ‘Images (.jpg jpeg *.gif *.png *.bmp)’. This assumes that the new action is to load a file. If not, you need to override the OnNew method.
This must be a method which returns a QImage to represent the item (usually a preview). No scaling is required, that is performed automatically by OpenLP when necessary. If this method is not defined, a default will be used (treat the filename as an image).

Implement this method in your descendant media manager item to add any context menu items. This method is called automatically.


Slot at end of toolbar for plugin to add widgets


Creates the main widget for listing items the media item is tracking


Create buttons for the media item toolbar


Creates a search field with button and related signal handling.


Slot at start of toolbar for plugin to add widgets

add_to_service(item=None, replace=None, remote=False, position=-1)[source]

Add this item to the current service.

  • item – Item to be processed
  • replace – Replace the existing item
  • remote – Triggered from remote
  • position – Position to place item

Remote Call wrapper

Parameters:message – The passed data item:Remote.

A method to help developers easily add a toolbar to the media manager item.

build_service_item(item=None, xml_version=False, remote=False, context=1)[source]

Common method for generating a service item :param item: Service Item to be built. :param xml_version: version of XML (False) :param remote: Remote triggered (False) :param context: The context on which this is called


Display a context menu

Parameters:point – The point the cursor was at

Create a media item from an item id.

Parameters:item_id – Id to make live

Handle internal moving of media manager items

Parameters:target – The target of the DnD action
generate_slide_data(service_item, item=None, xml_version=False, remote=False, context=1)[source]

Generate the slide data. Needs to be implemented by the plugin. :param service_item: The service Item to be processed :param item: The database item to be used to build the service item :param xml_version: :param remote: Was this remote triggered (False) :param context: The service context


Return the current list of files

go_live(item_id=None, remote=False)[source]

Make the currently selected item go live.

  • item_id – item to make live
  • remote – From Remote

Remote Call wrapper

Parameters:message – The passed data item_id:Remote.

Implement this method in your descendant media manager item to do any UI or other initialisation. This method is called automatically.


Turn file from Drag and Drop into an array so the Validate code can run it.

Parameters:data – A dictionary containing the list of files to be loaded and the target
load_list(load_list, target_group)[source]

Load a list. Needs to be implemented by the plugin.

  • load_list – List object to load
  • target_group – Group to load

Add a selected item to the current service


Add a selected item to an existing item in the current service.


Delete an item. Needs to be implemented by the plugin.


Allows the list click action to be determined dynamically


Hook for plugins to define behaviour for editing items.


Add a file to the list widget to make it available for showing


Run when a tab in the media manager gains focus. This gives the media item a chance to focus any elements it wants to.


Send an item live by building a service item then adding that service item to the live slide controller.


Hook for plugins to define behaviour for adding new items.


Preview an item by building a service item then adding that service item to the preview slide controller.

Parameters:keep_focus – Do we keep focus (False)

Allows the change of current item in the list to be actioned


This method is called to define the icons for the plugin. It provides a default set and the plugin is able to override the if required.


This method is called automatically to provide OpenLP with the opportunity to translate the MediaManagerItem to another language.


Sorts out, what item to select after loading a list.

search(string, show_error=True)[source]

Performs a plugin specific search for items containing string

  • string – String to be displayed
  • show_error – Should the error be shown (True)

Method to add processing when a service has been loaded and individual service items need to be processed by the plugins.

Parameters:item – The item to be processed and returned.

This method sets up the interface on the button. Plugin developers use this to add and create toolbars, and the rest of the interface of the media manager item.


Override this for additional Plugin setup

validate_and_load(files, target_group=None)[source]

Process a list for files either from the File Dialog or from Drag and Drop

  • files – The files to be loaded.
  • target_group – The QTreeWidgetItem of the group that will be the parent of the added files