mediaitem

class openlp.plugins.images.lib.mediaitem.ImageMediaItem(parent, plugin)[source]

Bases: openlp.core.lib.mediamanageritem.MediaManagerItem

This is the custom media manager item for images.

add_custom_context_actions()[source]

Add custom actions to the context menu.

add_end_header_bar()[source]

Add custom buttons to the end of the toolbar

add_list_view_to_toolbar()[source]

Creates the main widget for listing items the media item is tracking. This method overloads MediaManagerItem.add_list_view_to_toolbar.

add_start_header_bar()[source]

Add custom buttons to the start of the toolbar.

add_sub_groups(group_list, parent_group_id)[source]

Recursively add subgroups to the given parent group in a QTreeWidget.

Parameters:
  • group_list – The List object that contains all QTreeWidgetItems.
  • parent_group_id – The ID of the group that will be added recursively.
check_group_exists(new_group)[source]

Returns True if the given Group already exists in the database, otherwise False.

Parameters:new_group – The ImageGroups object that contains the name of the group that will be checked
create_item_from_id(item_id)[source]

Create a media item from an item id. Overridden from the parent method to change the item type.

Parameters:item_id – Id to make live
dnd_move_internal(target)[source]

Handle drag-and-drop moving of images within the media manager

Parameters:target – This contains the QTreeWidget that is the target of the DnD action
expand_group(group_id, root_item=None)[source]

Expand groups in the widget recursively.

Parameters:
  • group_id – The ID of the group that will be expanded.
  • root_item – This option is only used for recursion purposes.
fill_groups_combobox(combobox, parent_group_id=0, prefix='')[source]

Recursively add groups to the combobox in the ‘Add group’ dialog.

Parameters:
  • combobox – The QComboBox to add the options to.
  • parent_group_id – The ID of the group that will be added.
  • prefix – A string containing the prefix that will be added in front of the groupname for each level of the tree.
generate_slide_data(service_item, item=None, xml_version=False, remote=False, context=2)[source]

Generate the slide data. Needs to be implemented by the plugin.

Parameters:
  • service_item – The service item to be built on
  • item – The Song item to be used
  • xml_version – The xml version (not used)
  • remote – Triggered from remote
  • context – Why is it being generated
generate_thumbnail_path(image)[source]

Generate a path to the thumbnail

Parameters:image – An instance of ImageFileNames
Returns:A path to the thumbnail of type str
images_add_to_service
images_go_live
initialise()[source]
live_theme_changed()[source]

Triggered by the change of theme in the slide controller.

load_full_list(images, initial_load=False, open_group=None)[source]

Replace the list of images and groups in the interface.

Parameters:
  • images – A List of Image Filenames objects that will be used to reload the mediamanager list.
  • initial_load – When set to False, the busy cursor and progressbar will be shown while loading images.
  • open_group – ImageGroups object of the group that must be expanded after reloading the list in the interface.
load_list(images, target_group=None, initial_load=False)[source]

Add new images to the database. This method is called when adding images using the Add button or DnD.

Parameters:
  • images – A List of strings containing the filenames of the files to be loaded
  • target_group – The QTreeWidgetItem of the group that will be the parent of the added files
  • initial_load – When set to False, the busy cursor and progressbar will be shown while loading images
on_add_group_click()[source]

Called to add a new group

on_delete_click()[source]

Remove an image item from the list.

on_replace_click()[source]

Called to replace Live background with the image selected.

on_reset_click()[source]

Called to reset the Live background with the image selected.

recursively_delete_group(image_group)[source]

Recursively deletes a group and all groups and images in it.

Parameters:image_group – The ImageGroups instance of the group that will be deleted.
required_icons()[source]

Set which icons the media manager tab should show.

retranslateUi()[source]
save_new_images_list(images_list, group_id=0, reload_list=True)[source]

Convert a list of image filenames to ImageFilenames objects and save them in the database.

Parameters:
  • images_list – A List of strings containing image filenames
  • group_id – The ID of the group to save the images in
  • reload_list – This boolean is set to True when the list in the interface should be reloaded after saving the new images
search(string, show_error=True)[source]

Perform a search on the image file names.

Parameters:
  • string – The glob to search for
  • show_error – Unused.
setup_item()[source]

Do some additional setup.

validate_and_load(files, target_group=None)[source]

Process a list for files either from the File Dialog or from Drag and Drop. This method is overloaded from MediaManagerItem.

Parameters:
  • files – A List of strings containing the filenames of the files to be loaded
  • target_group – The QTreeWidgetItem of the group that will be the parent of the added files