mediamanageritem¶
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
parent
- The parent widget. Usually this will be the Media Manager itself. This needs to be a class descended from
QWidget
. plugin
- 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.
self.on_new_prompt
Defaults to ‘Select Image(s)’.self.on_new_file_masks
- 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. self.PreviewFunction
- 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).
-
add_custom_context_actions
()[source]¶ Implement this method in your descendant media manager item to add any context menu items. This method is called automatically.
-
add_list_view_to_toolbar
()[source]¶ Creates the main widget for listing items the media item is tracking
-
add_to_service
(item=None, replace=None, remote=False, position=-1)[source]¶ Add this item to the current service.
Parameters: - item – Item to be processed
- replace – Replace the existing item
- remote – Triggered from remote
- position – Position to place item
-
add_to_service_remote
(message)[source]¶ Remote Call wrapper
Parameters: message – The passed data item:Remote.
-
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_item_from_id
(item_id)[source]¶ Create a media item from an item id.
Parameters: item_id – Id to make live
-
dnd_move_internal
(target)[source]¶ 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
-
go_live
(item_id=None, remote=False)[source]¶ Make the currently selected item go live.
Parameters: - item_id – item to make live
- remote – From Remote
-
go_live_remote
(message)[source]¶ Remote Call wrapper
Parameters: message – The passed data item_id:Remote.
-
initialise
()[source]¶ Implement this method in your descendant media manager item to do any UI or other initialisation. This method is called automatically.
-
load_file
(data)[source]¶ 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.
Parameters: - load_list – List object to load
- target_group – Group to load
-
on_focus
()[source]¶ Run when a tab in the media manager gains focus. This gives the media item a chance to focus any elements it wants to.
-
on_live_click
()[source]¶ Send an item live by building a service item then adding that service item to the live slide controller.
-
on_preview_click
(keep_focus=False)[source]¶ 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)
-
required_icons
()[source]¶ 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.
-
retranslateUi
()[source]¶ This method is called automatically to provide OpenLP with the opportunity to translate the
MediaManagerItem
to another language.
-
search
(string, show_error=True)[source]¶ Performs a plugin specific search for items containing
string
Parameters: - string – String to be displayed
- show_error – Should the error be shown (True)
-
service_load
(item)[source]¶ 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.