mediaitem

class openlp.plugins.bibles.lib.mediaitem.BibleMediaItem(*args, **kwargs)[source]

Bases: openlp.core.lib.mediamanageritem.MediaManagerItem

This is the custom media manager item for Bibles.

add_end_header_bar()[source]
adjust_combo_box(range_from, range_to, combo, restore=False)[source]

Adjusts the given como box to the given values.

Parameters:
  • range_from – The first number of the range (int).
  • range_to – The last number of the range (int).
  • combo – The combo box itself (QComboBox).
  • restore – If True, then the combo’s currentText will be restored after adjusting (if possible).
bibles_add_to_service
bibles_go_live
build_display_results(bible, second_bible, search_results)[source]

Displays the search results in the media manager. All data needed for further action is saved for/in each row.

config_update()[source]

Change the visible widgets when the config changes

Returns:None
create_item_from_id(item_id)[source]

Create a media item from an item id.

display_results()[source]

Add the search results to the media manager list.

Returns:None
format_verse(old_chapter, chapter, verse)[source]

Formats and returns the text, each verse starts with, for the given chapter and verse. The text is either surrounded by round, square, curly brackets or no brackets at all. For example:

'{su}1:1{/su}'
Parameters:
  • old_chapter – The previous verse’s chapter number (int).
  • chapter – The chapter number (int).
  • verse – The verse number (int).
Returns:

An empty or formatted string

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
get_common_books(first_bible, second_bible=None)[source]

Return a list of common books between two bibles.

Parameters:
  • first_bible – The first bible (BibleDB)
  • second_bible – The second bible. (Optional, BibleDB
Returns:

A list of common books between the two bibles. Or if only one bible is supplied a list of that bibles books (list of Book objects)

initialise()[source]

Called to complete initialisation that could not be completed in the constructor.

Returns:None
initialise_advanced_bible(last_book=None)[source]

This initialises the given bible, which means that its book names and their chapter numbers is added to the combo boxes on the ‘Select’ Tab. This is not of any importance of the ‘Search’ Tab.

Parameters:last_book_id – The “book reference id” of the book which is chosen at the moment. (int)
Returns:None
on_advanced_book_combo_box()[source]

Update the verse selection boxes

Returns:None
on_book_order_button_toggled(checked)[source]

Change the sort order of the book names

Parameters:checked – Indicates if the button is checked or not (Bool)
Returns:None
on_clear_button_clicked()[source]

Clear the list_view and the search_edit

Returns:None
on_delete_click()[source]

Confirm that the user wants to delete the main bible

Returns:None
on_edit_click()[source]

Load the EditBibleForm and reload the bibles if the user accepts it

Returns:None
on_focus()[source]

Set focus on the appropriate widget when BibleMediaItem receives focus

Reimplements MediaManagerItem.on_focus()

Returns:None
on_from_chapter_activated()[source]

Update the verse selection boxes

Returns:None
on_from_verse()[source]

Update the verse selection boxes

Returns:None
on_import_click()[source]

Create, if not already, the BibleImportForm and execute it

Returns:None
on_lock_button_toggled(checked)[source]

Toggle the lock button, if Search tab is used, set focus to search field.

Parameters:checked – The state of the toggle button. (bool)
Returns:None
on_search_button_clicked()[source]

Call the correct search function depending on which tab the user is using

Returns:None
on_search_edit_text_changed()[source]

If ‘search_as_you_type’ is enabled, start a timer when the search_edit emits a textChanged signal. This is to prevent overloading the system by submitting too many search requests in a short space of time.

Returns:None
on_search_tab_bar_current_changed(index)[source]

Show the selected tab and set focus to it

Parameters:index – The tab selected (int)
Returns:None
on_search_timer_timeout()[source]

Perform a search when the search timer timeouts. The search timer is used for ‘search_as_you_type’ so that we don’t overload the system buy submitting too many search requests in a short space of time.

Returns:None
on_second_combo_box_index_changed(selection)[source]

Update the second bible. If changing from single to dual bible modes as if the user wants to clear the search results, if not revert to the previously selected bible

Returns:None
on_style_combo_box_index_changed(index)[source]

Change the layout style and save the setting

Parameters:index – The index of the current item in the combobox (int)
Returns:None

We are doing a ‘Text Search’. This search is called on def text_search by ‘Search’ Text and Combined Searches.

on_to_chapter()[source]

Update the verse selection boxes

Returns:None
on_version_combo_box_index_changed()[source]

Update the main bible and save it to settings

Returns:None
populate_bible_combo_boxes()[source]

Populate the bible combo boxes with the list of bibles that have been loaded

Returns:None
reload_bibles()[source]

Reload the bibles and update the combo boxes

Returns:None
required_icons()[source]

Set which icons the media manager tab should show

Returns:None
retranslateUi()[source]
search(string, showError)[source]

Search for some Bible verses (by reference).

Preform a search using the passage selected on the Select tab

Returns:None
setupUi()[source]
setup_item()[source]

Do some additional setup.

Returns:None

We are doing a ‘Reference Search’. This search is called on def text_search by Reference and Combined Searches.

Returns:None

This triggers the proper ‘Search’ search based on which search type is used. “Eg. “Reference Search”, “Text Search” or “Combined search”.

update_auto_completer()[source]

This updates the bible book completion list for the search field. The completion depends on the bible. It is only updated when we are doing reference or combined search, in text search the completion list is removed.

Returns:None
class openlp.plugins.bibles.lib.mediaitem.BibleSearch[source]

Bases: object

Enumeration class for the different search methods for the “Search” tab.

Combined = 3
Reference = 1
Text = 2
openlp.plugins.bibles.lib.mediaitem.get_reference_separators()[source]