ui

The ui module provides standard UI components for OpenLP.

openlp.core.lib.ui.add_welcome_page(parent, image)[source]

Generate an opening welcome page for a wizard using a provided image.

Parameters:
  • parent – A QWizard object to add the welcome page to.
  • image – A splash image for the wizard.
openlp.core.lib.ui.create_action(parent, name, **kwargs)[source]

Return an action with the object name set and the given parameters.

Parameters:
  • parent – A QtCore.QObject for the actions parent (required).
  • name – A string which is set as object name (required).
  • kwargs
text
A string for the action text.
icon
Either a QIcon, a resource string, or a file location string for the action icon.
tooltip
A string for the action tool tip.
statustip
A string for the action status tip.
checked
A bool for the state. If None the Action is not checkable.
enabled
False in case the action should be disabled.
visible
False in case the action should be hidden.
separator
True in case the action will be considered a separator.
data
The action’s data.
can_shortcuts

Capability stating if this action can have shortcuts. If True the action is added to shortcut dialog

otherwise it it not. Define your shortcut in the Settings class. Note: When not True you must not set a shortcuts at all.

context
A context for the shortcut execution.
category
A category the action should be listed in the shortcut dialog.
triggers
A slot which is connected to the actions triggered() slot.
openlp.core.lib.ui.create_button(parent, name, **kwargs)[source]

Return an button with the object name set and the given parameters.

Parameters:
  • parent – A QtCore.QWidget for the buttons parent (required).
  • name – A string which is set as object name (required).
  • kwargs
role
A string which can have one value out of delete, up, and down. This decides about default values for properties like text, icon, or tooltip.
text
A string for the action text.
icon
Either a QIcon, a resource string, or a file location string for the action icon.
tooltip
A string for the action tool tip.
enabled
False in case the button should be disabled.
openlp.core.lib.ui.create_button_box(dialog, name, standard_buttons, custom_buttons=None)[source]

Creates a QDialogButtonBox with the given buttons. The accepted() and rejected() signals of the button box are connected with the dialogs accept() and reject() slots.

Parameters:
  • dialog – The parent object. This has to be a QDialog descendant.
  • name – A string which is set as object name.
  • standard_buttons – A list of strings for the used buttons. It might contain: ok, save, cancel, close, and defaults.
  • custom_buttons – A list of additional buttons. If an item is an instance of QtWidgets.QAbstractButton it is

added with QDialogButtonBox.ActionRole. Otherwise the item has to be a tuple of a Button and a ButtonRole.

openlp.core.lib.ui.create_horizontal_adjusting_combo_box(parent, name)[source]

Creates a QComboBox with adapting width for media items.

Parameters:
  • parent – The parent widget.
  • name – A string set as object name for the combo box.
openlp.core.lib.ui.create_valign_selection_widgets(parent)[source]

Creates a standard label and combo box for asking users to select a vertical alignment.

Parameters:parent – The parent object. This should be a QWidget descendant.
openlp.core.lib.ui.create_widget_action(parent, name='', **kwargs)[source]

Return a new QAction by calling create_action(parent, name, **kwargs). The shortcut context defaults to QtCore.Qt.WidgetShortcut and the action is added to the parents action list.

openlp.core.lib.ui.critical_error_message_box(title=None, message=None, parent=None, question=False)[source]

Provides a standard critical message box for errors that OpenLP displays to users.

Parameters:
  • title – The title for the message box.
  • message – The message to display to the user.
  • parent – The parent UI element to attach the dialog to.
  • question – Should this message box question the user.
openlp.core.lib.ui.find_and_set_in_combo_box(combo_box, value_to_find, set_missing=True)[source]

Find a string in a combo box and set it as the selected item if present

Parameters:
  • combo_box – The combo box to check for selected items
  • value_to_find – The value to find
  • set_missing – if not found leave value as current
openlp.core.lib.ui.set_case_insensitive_completer(cache, widget)[source]

Sets a case insensitive text completer for a widget.

Parameters:
  • cache – The list of items to use as suggestions.
  • widget – A widget to set the completer (QComboBox or QLineEdit instance)