lib

class openlp.core.ui.lib.ColorButton(parent=None)[source]

Bases: PyQt5.QtWidgets.QPushButton

Subclasses QPushbutton to create a “Color Chooser” button

change_color(color)[source]

Sets the _color variable and the background color.

Parameters:color – String representation of a hexidecimal color
color

Property method to return the color variable

Returns:String representation of a hexidecimal color
colorChanged
on_clicked()[source]

Handle the PushButton clicked signal, showing the ColorDialog and validating the input

class openlp.core.ui.lib.ListPreviewWidget(parent, screen_ratio)[source]

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

A special type of QTableWidget which lists the slides in the slide controller

Parameters:
  • parent
  • screen_ratio
change_slide(slide)[source]

Switches to the given row.

current_slide_number()[source]

Returns the position of the currently active item. Will return -1 if the widget is empty.

replace_service_item(service_item, width, slide_number)[source]

Replace the current preview items with the ones in service_item and display the given slide

Parameters:
  • service_item – The service item to insert
  • width – The width of the column
  • slide_number – The slide number to pre-select
resizeEvent(event)[source]

Overloaded method from QTableWidget. Will recalculate the layout.

row_resized(row, old_height, new_height)[source]

Will scale non-image slides.

screen_size_changed(screen_ratio)[source]

This method is called whenever the live screen size changes, which then makes a layout recalculation necessary

Parameters:screen_ratio – The new screen ratio
slide_count()[source]

Returns the number of slides this widget holds.

class openlp.core.ui.lib.ListWidgetWithDnD(parent=None, name='')[source]

Bases: PyQt5.QtWidgets.QListWidget

Provide a list widget to store objects and handle drag and drop events

activateDnD()[source]

Activate DnD of widget

clear(search_while_typing=False, override_lock=False)[source]

Re-implement clear, so that we can customise feedback when using ‘Search as you type’

Parameters:search_while_typing – True if we want to display the customised message
Returns:None
dragEnterEvent(event)[source]

When something is dragged into this object, check if you should be able to drop it in here.

dragMoveEvent(event)[source]

Make an object droppable, and set it to copy the contents of the object, not move it.

dropEvent(event)[source]

Receive drop event check if it is a file and process it if it is.

Parameters:event – Handle of the event pint passed
mouseMoveEvent(event)[source]

Drag and drop event does not care what data is selected as the recipient will use events to request the data move just tell it what plugin to call

paintEvent(event)[source]

Re-implement paintEvent so that we can add ‘No Results’ text when the listWidget is empty.

Parameters:event – A QPaintEvent
Returns:None
class openlp.core.ui.lib.MediaDockManager(media_dock)[source]

Bases: object

Provide a repository for MediaManagerItems

add_item_to_dock(media_item)[source]

Add a MediaManagerItem to the dock If the item has been added before, it’s silently skipped

Parameters:media_item – The item to add to the dock
remove_dock(media_item)[source]

Removes a MediaManagerItem from the dock

Parameters:media_item – The item to add to the dock
class openlp.core.ui.lib.OpenLPDockWidget(parent=None, name=None, icon=None)[source]

Bases: PyQt5.QtWidgets.QDockWidget

Custom DockWidget class to handle events

class openlp.core.ui.lib.OpenLPToolbar(parent)[source]

Bases: PyQt5.QtWidgets.QToolBar

Lots of toolbars around the place, so it makes sense to have a common way to manage them. This is the base toolbar class.

add_toolbar_action(name, **kwargs)[source]

A method to help developers easily add a button to the toolbar. A new QAction is created by calling create_action(). The action is added to the toolbar and the toolbar is set as parent. For more details please look at openlp.core.lib.ui.create_action()

add_toolbar_widget(widget)[source]

Add a widget and store it’s handle under the widgets object name.

set_widget_enabled(widgets, enabled=True)[source]

Set the enabled state for a widget or a list of widgets.

Parameters:
  • widgets – A list of string with widget object names.
  • enabled – The new state as bool.
set_widget_visible(widgets, visible=True)[source]

Set the visibility for a widget or a list of widgets.

Parameters:
  • widgets – A list of string with widget object names.
  • visible – The new state as bool.
class openlp.core.ui.lib.OpenLPWizard(parent, plugin, name, image, add_progress_page=True)[source]

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

Generic OpenLP wizard to provide generic functionality and a unified look and feel.

parent
The QWidget-derived parent of the wizard.
plugin
Plugin this wizard is part of. The plugin will be saved in the “plugin” variable. The plugin will also be used as basis for the file dialog methods this class provides.
name
The object name this wizard should have.
image
The image to display on the “welcome” page of the wizard. Should be 163x350.
add_progress_page
Whether to add a progress page with a progressbar at the end of the wizard.
add_custom_pages()[source]

Hook method for wizards to add extra pages

add_progress_page()[source]

Add the progress page for the wizard. This page informs the user how the wizard is progressing with its task.

custom_init()[source]

Hook method for custom initialisation

custom_page_changed(page_id)[source]

Called when changing to a page other than the progress page :param page_id: current page number

custom_signals()[source]

Hook method for adding custom signals

exec()[source]

Run the wizard.

get_file_name(title, editbox, setting_name, filters='')[source]

Opens a QFileDialog and saves the filename to the given editbox.

Parameters:
  • title – The title of the dialog (unicode).
  • editbox – An editbox (QLineEdit).
  • setting_name – The place where to save the last opened directory.
  • filters

    The file extension filters. It should contain the file description as well as the file extension. For example:

    'OpenLP 2 Databases (*.sqlite)'
    
get_folder(title, editbox, setting_name)[source]

Opens a QFileDialog and saves the selected folder to the given editbox.

Parameters:
  • title – The title of the dialog (unicode).
  • editbox – An editbox (QLineEdit).
  • setting_name – The place where to save the last opened directory.
increment_progress_bar(status_text, increment=1)[source]

Update the wizard progress page.

Parameters:
  • status_text – Current status information to display.
  • increment – The value to increment the progress bar by.
on_current_id_changed(page_id)[source]

Perform necessary functions depending on which wizard page is active. :param page_id: current page number

on_error_copy_to_button_clicked()[source]

Called when the error_copy_to_button has been clicked.

on_error_save_to_button_clicked()[source]

Called when the error_save_to_button has been clicked.

post_wizard()[source]

Clean up the UI after the import has finished.

pre_wizard()[source]

Prepare the UI for the import.

register_fields()[source]

Hook method for wizards to register any fields they need.

reject()[source]

Stop the wizard on cancel button, close button or ESC key.

setupUi(image)[source]

Set up the wizard UI. :param image: path to start up image

class openlp.core.ui.lib.PathEdit(parent=None, path_type=<PathType.Files: 1>, default_path=None, dialog_caption=None, show_revert=True)[source]

Bases: PyQt5.QtWidgets.QWidget

The PathEdit class subclasses QWidget to create a custom widget for use when a file or directory needs to be selected.

on_browse_button_clicked()[source]

A handler to handle a click on the browse button.

Show the QFileDialog and process the input from the user :return: None

on_line_edit_editing_finished()[source]

A handler to handle when the line edit has finished being edited. :return: None

on_new_path(path)[source]

A method called to validate and set a new path.

Emits the pathChanged Signal

Parameters:path (str) – The new path
Returns:None
on_revert_button_clicked()[source]

A handler to handle a click on the revert button.

Set the new path to the value of the default_path instance variable. :return: None

path

A property getter method to return the selected path.

Returns:The selected path
Return type:str
pathChanged
path_type

A property getter method to return the path_type. Path type allows you to sepecify if the user is restricted to selecting a file or directory.

Returns:The type selected
Return type:Enum of PathEdit
update_button_tool_tips()[source]

Called to update the tooltips on the buttons. This is changing path types, and when the widget is initalised :return: None

class openlp.core.ui.lib.PathType[source]

Bases: enum.Enum

An enumeration.

Directories = 2
Files = 1
class openlp.core.ui.lib.SpellTextEdit(parent=None, formatting_tags_allowed=True)[source]

Bases: PyQt5.QtWidgets.QPlainTextEdit

Spell checking widget based on QPlanTextEdit.

contextMenuEvent(event)[source]

Provide the context menu for the text edit region.

correct_word(word)[source]

Replaces the selected text with word.

html_tag(tag)[source]

Replaces the selected text with word.

mousePressEvent(event)[source]

Handle mouse clicks within the text edit region.

set_language(action)[source]

Changes the language for this spelltextedit.

Parameters:action – The action.
class openlp.core.ui.lib.TreeWidgetWithDnD(parent=None, name='')[source]

Bases: PyQt5.QtWidgets.QTreeWidget

Provide a tree widget to store objects and handle drag and drop events

activateDnD()[source]

Activate DnD of widget

addItem(item)[source]
count()[source]
dragEnterEvent(event)[source]

Receive drag enter event, check if it is a file or internal object and allow it if it is.

Parameters:event – The event that occurred
dragMoveEvent(event)[source]

Receive drag move event, check if it is a file or internal object and allow it if it is.

Parameters:event – The event that occurred
dropEvent(event)[source]

Receive drop event, check if it is a file or internal object and process it if it is.

Parameters:event – Handle of the event pint passed
item(index)[source]
mouseMoveEvent(event)[source]

Drag and drop event does not care what data is selected as the recipient will use events to request the data move just tell it what plugin to call

Parameters:event – The event that occurred
class openlp.core.ui.lib.WizardStrings[source]

Bases: object

Provide standard strings for wizards to use.

CSV = 'CSV'
FinishedImport = 'Finished import.'
FormatLabel = 'Format:'
HeaderStyle = '<span style="font-size:14pt; font-weight:600;">%s</span>'
ImportSelect = 'Select Import Source'
ImportSelectLong = 'Select the import format and the location to import from.'
Importing = 'Importing'
ImportingType = 'Importing "%s"...'
OS = 'OpenSong'
OSIS = 'OSIS'
OpenTypeFile = 'Open %s File'
OpenTypeFolder = 'Open %s Folder'
PercentSymbolFormat = '%p%'
Ready = 'Ready.'
SWORD = 'Sword'
StartingImport = 'Starting import...'
WordProject = 'WordProject'
YouSpecifyFile = 'You need to specify one %s file to import from.'
YouSpecifyFiles = 'You need to specify at least one %s file to import from.'
YouSpecifyFolder = 'You need to specify one %s folder to import from.'
ZEF = 'Zefania'