HEAD r1934

This commit is contained in:
Armin Köhler 2012-04-03 21:30:30 +02:00
commit 06b63954a0
62 changed files with 418 additions and 481 deletions

View File

@ -260,7 +260,7 @@ class MediaManagerItem(QtGui.QWidget):
self.menu.addActions(self.listView.actions()) self.menu.addActions(self.listView.actions())
QtCore.QObject.connect(self.listView, QtCore.QObject.connect(self.listView,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
self.onClickPressed) self.onDoubleClicked)
QtCore.QObject.connect(self.listView, QtCore.QObject.connect(self.listView,
QtCore.SIGNAL(u'itemSelectionChanged()'), QtCore.SIGNAL(u'itemSelectionChanged()'),
self.onSelectionChange) self.onSelectionChange)
@ -295,9 +295,9 @@ class MediaManagerItem(QtGui.QWidget):
self.pageLayout.addWidget(self.searchWidget) self.pageLayout.addWidget(self.searchWidget)
# Signals and slots # Signals and slots
QtCore.QObject.connect(self.searchTextEdit, QtCore.QObject.connect(self.searchTextEdit,
QtCore.SIGNAL(u'returnPressed()'), self.onSearchTextButtonClick) QtCore.SIGNAL(u'returnPressed()'), self.onSearchTextButtonClicked)
QtCore.QObject.connect(self.searchTextButton, QtCore.QObject.connect(self.searchTextButton,
QtCore.SIGNAL(u'pressed()'), self.onSearchTextButtonClick) QtCore.SIGNAL(u'clicked()'), self.onSearchTextButtonClicked)
QtCore.QObject.connect(self.searchTextEdit, QtCore.QObject.connect(self.searchTextEdit,
QtCore.SIGNAL(u'textChanged(const QString&)'), QtCore.SIGNAL(u'textChanged(const QString&)'),
self.onSearchTextEditChanged) self.onSearchTextEditChanged)
@ -458,7 +458,7 @@ class MediaManagerItem(QtGui.QWidget):
raise NotImplementedError(u'MediaManagerItem.generateSlideData needs ' raise NotImplementedError(u'MediaManagerItem.generateSlideData needs '
u'to be defined by the plugin') u'to be defined by the plugin')
def onClickPressed(self): def onDoubleClicked(self):
""" """
Allows the list click action to be determined dynamically Allows the list click action to be determined dynamically
""" """

View File

@ -189,7 +189,7 @@ class SearchEdit(QtGui.QLineEdit):
def _onClearButtonClicked(self): def _onClearButtonClicked(self):
""" """
Internally implemented slot to react to the clear button being pressed Internally implemented slot to react to the clear button being clicked
to clear the line edit. Once it has cleared the line edit, it emits the to clear the line edit. Once it has cleared the line edit, it emits the
``cleared()`` signal so that an application can react to the clearing ``cleared()`` signal so that an application can react to the clearing
of the line edit. of the line edit.

View File

@ -112,7 +112,7 @@ class SettingsTab(QtGui.QWidget):
def cancel(self): def cancel(self):
""" """
Reset any settings if cancel pressed Reset any settings if cancel triggered
""" """
self.load() self.load()

View File

@ -306,7 +306,7 @@ class ThemeXML(object):
def add_font(self, name, color, size, override, fonttype=u'main', def add_font(self, name, color, size, override, fonttype=u'main',
bold=u'False', italics=u'False', line_adjustment=0, bold=u'False', italics=u'False', line_adjustment=0,
xpos=0, ypos=0, width=0, height=0 , outline=u'False', xpos=0, ypos=0, width=0, height=0, outline=u'False',
outline_color=u'#ffffff', outline_pixel=2, shadow=u'False', outline_color=u'#ffffff', outline_pixel=2, shadow=u'False',
shadow_color=u'#ffffff', shadow_pixel=5): shadow_color=u'#ffffff', shadow_pixel=5):
""" """
@ -550,7 +550,7 @@ class ThemeXML(object):
element = u'size' element = u'size'
return False, master, element, value return False, master, element, value
def _create_attr(self, master , element, value): def _create_attr(self, master, element, value):
""" """
Create the attributes with the correct data types and name format Create the attributes with the correct data types and name format
""" """

View File

@ -170,31 +170,50 @@ def add_welcome_page(parent, image):
parent.welcomeLayout.addStretch() parent.welcomeLayout.addStretch()
parent.addPage(parent.welcomePage) parent.addPage(parent.welcomePage)
def create_accept_reject_button_box(parent, okay=False): def create_button_box(dialog, name, standard_buttons, custom_buttons=[]):
""" """
Creates a standard dialog button box with two buttons. The buttons default Creates a QDialogButtonBox with the given buttons. The ``accepted()`` and
to save and cancel but the ``okay`` parameter can be used to make the ``rejected()`` signals of the button box are connected with the dialogs
buttons okay and cancel instead. ``accept()`` and ``reject()`` slots.
The button box is connected to the parent's ``accept()`` and ``reject()``
methods to handle the default ``accepted()`` and ``rejected()`` signals.
``parent`` ``dialog``
The parent object. This should be a ``QWidget`` descendant. The parent object. This has to be a ``QDialog`` descendant.
``okay`` ``name``
If true creates an okay/cancel combination instead of save/cancel. 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 a item is a instance of
QtGui.QAbstractButton it is added with QDialogButtonBox.ActionRole.
Otherwhise the item has to be a tuple of a button and a ButtonRole.
""" """
button_box = QtGui.QDialogButtonBox(parent) buttons = QtGui.QDialogButtonBox.NoButton
accept_button = QtGui.QDialogButtonBox.Save if u'ok' in standard_buttons:
if okay: buttons |= QtGui.QDialogButtonBox.Ok
accept_button = QtGui.QDialogButtonBox.Ok if u'save' in standard_buttons:
button_box.setStandardButtons( buttons |= QtGui.QDialogButtonBox.Save
accept_button | QtGui.QDialogButtonBox.Cancel) if u'cancel' in standard_buttons:
button_box.setObjectName(u'%sButtonBox' % parent) buttons |= QtGui.QDialogButtonBox.Cancel
if u'close' in standard_buttons:
buttons |= QtGui.QDialogButtonBox.Close
if u'defaults' in standard_buttons:
buttons |= QtGui.QDialogButtonBox.RestoreDefaults
button_box = QtGui.QDialogButtonBox(dialog)
button_box.setObjectName(name)
button_box.setStandardButtons(buttons)
for button in custom_buttons:
if isinstance(button, QtGui.QAbstractButton):
button_box.addButton(button, QtGui.QDialogButtonBox.ActionRole)
else:
button_box.addButton(*button)
QtCore.QObject.connect(button_box, QtCore.SIGNAL(u'accepted()'), QtCore.QObject.connect(button_box, QtCore.SIGNAL(u'accepted()'),
parent.accept) dialog.accept)
QtCore.QObject.connect(button_box, QtCore.SIGNAL(u'rejected()'), QtCore.QObject.connect(button_box, QtCore.SIGNAL(u'rejected()'),
parent.reject) dialog.reject)
return button_box return button_box
def critical_error_message_box(title=None, message=None, parent=None, def critical_error_message_box(title=None, message=None, parent=None,
@ -223,9 +242,15 @@ def critical_error_message_box(title=None, message=None, parent=None,
data[u'title'] = title if title else UiStrings().Error data[u'title'] = title if title else UiStrings().Error
return Receiver.send_message(u'openlp_error_message', data) return Receiver.send_message(u'openlp_error_message', data)
def media_item_combo_box(parent, name): def create_horizontal_adjusting_combo_box(parent, name):
""" """
Provide a standard combo box for media items. Creates a QComboBox with adapting width for media items.
``parent``
The parent widget.
``name``
A string set as object name for the combo box.
""" """
combo = QtGui.QComboBox(parent) combo = QtGui.QComboBox(parent)
combo.setObjectName(name) combo.setObjectName(name)
@ -233,55 +258,71 @@ def media_item_combo_box(parent, name):
combo.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) combo.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
return combo return combo
def create_delete_push_button(parent, icon=None): def create_button(parent, name, **kwargs):
""" """
Creates a standard push button with a delete label and optional icon. The Return an button with the object name set and the given parameters.
button is connected to the parent's ``onDeleteButtonClicked()`` method to
handle the ``clicked()`` signal.
``parent`` ``parent``
The parent object. This should be a ``QWidget`` descendant. A QtCore.QWidget for the buttons parent (required).
``name``
A string which is set as object name (required).
``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`` ``icon``
An icon to display on the button. This can be either a ``QIcon``, a Either a QIcon, a resource string, or a file location string for the
resource path or a file name. action icon.
"""
delete_button = QtGui.QPushButton(parent)
delete_button.setObjectName(u'deleteButton')
delete_icon = icon if icon else u':/general/general_delete.png'
delete_button.setIcon(build_icon(delete_icon))
delete_button.setText(UiStrings().Delete)
delete_button.setToolTip(
translate('OpenLP.Ui', 'Delete the selected item.'))
QtCore.QObject.connect(delete_button,
QtCore.SIGNAL(u'clicked()'), parent.onDeleteButtonClicked)
return delete_button
def create_up_down_push_button_set(parent): ``tooltip``
""" A string for the action tool tip.
Creates a standard set of two push buttons, one for up and the other for
down, for use with lists. The buttons use arrow icons and no text and are
connected to the parent's ``onUpButtonClicked()`` and
``onDownButtonClicked()`` to handle their respective ``clicked()`` signals.
``parent`` ``enabled``
The parent object. This should be a ``QWidget`` descendant. False in case the button should be disabled.
""" """
up_button = QtGui.QPushButton(parent) if u'role' in kwargs:
up_button.setIcon(build_icon(u':/services/service_up.png')) role = kwargs.pop(u'role')
up_button.setObjectName(u'upButton') if role == u'delete':
up_button.setToolTip( kwargs.setdefault(u'text', UiStrings().Delete)
translate('OpenLP.Ui', 'Move selection up one position.')) kwargs.setdefault(u'tooltip',
down_button = QtGui.QPushButton(parent) translate('OpenLP.Ui', 'Delete the selected item.'))
down_button.setIcon(build_icon(u':/services/service_down.png')) elif role == u'up':
down_button.setObjectName(u'downButton') kwargs.setdefault(u'icon', u':/services/service_up.png')
down_button.setToolTip( kwargs.setdefault(u'tooltip',
translate('OpenLP.Ui', 'Move selection down one position.')) translate('OpenLP.Ui', 'Move selection up one position.'))
QtCore.QObject.connect(up_button, elif role == u'down':
QtCore.SIGNAL(u'clicked()'), parent.onUpButtonClicked) kwargs.setdefault(u'icon', u':/services/service_down.png')
QtCore.QObject.connect(down_button, kwargs.setdefault(u'tooltip',
QtCore.SIGNAL(u'clicked()'), parent.onDownButtonClicked) translate('OpenLP.Ui', 'Move selection down one position.'))
return up_button, down_button else:
log.warn(u'The role "%s" is not defined in create_push_button().',
role)
if kwargs.pop(u'class', u'') == u'toolbutton':
button = QtGui.QToolButton(parent)
else:
button = QtGui.QPushButton(parent)
button.setObjectName(name)
if kwargs.get(u'text'):
button.setText(kwargs.pop(u'text'))
if kwargs.get(u'icon'):
button.setIcon(build_icon(kwargs.pop(u'icon')))
if kwargs.get(u'tooltip'):
button.setToolTip(kwargs.pop(u'tooltip'))
if not kwargs.pop(u'enabled', True):
button.setEnabled(False)
if kwargs.get(u'click'):
QtCore.QObject.connect(button, QtCore.SIGNAL(u'clicked()'),
kwargs.pop(u'click'))
for key in kwargs.keys():
if key not in [u'text', u'icon', u'tooltip', u'click']:
log.warn(u'Parameter %s was not consumed in create_button().', key)
return button
def create_action(parent, name, **kwargs): def create_action(parent, name, **kwargs):
""" """
@ -381,61 +422,38 @@ def create_widget_action(parent, name=u'', **kwargs):
parent.addAction(action) parent.addAction(action)
return action return action
def context_menu(base, icon, text): def set_case_insensitive_completer(cache, widget):
""" """
Utility method to help build context menus. Sets a case insensitive text completer for a widget.
``base``
The parent object to add this menu to
``icon``
An icon for this menu
``text``
The text to display for this menu
"""
action = QtGui.QMenu(text, base)
action.setIcon(build_icon(icon))
return action
def add_widget_completer(cache, widget):
"""
Adds a text autocompleter to a widget.
``cache`` ``cache``
The list of items to use as suggestions. The list of items to use as suggestions.
``widget`` ``widget``
The object to use the completer. A widget to set the completer (QComboBox or QTextEdit instance)
""" """
completer = QtGui.QCompleter(cache) completer = QtGui.QCompleter(cache)
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive) completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
widget.setCompleter(completer) widget.setCompleter(completer)
def create_valign_combo(form, parent, layout): def create_valign_selection_widgets(parent):
""" """
Creates a standard label and combo box for asking users to select a Creates a standard label and combo box for asking users to select a
vertical alignment. vertical alignment.
``form``
The UI screen that the label and combo will appear on.
``parent`` ``parent``
The parent object. This should be a ``QWidget`` descendant. The parent object. This should be a ``QWidget`` descendant.
``layout`` Returns a tuple of QLabel and QComboBox.
A layout object to add the label and combo widgets to.
""" """
verticalLabel = QtGui.QLabel(parent) label = QtGui.QLabel(parent)
verticalLabel.setObjectName(u'VerticalLabel') label.setText(translate('OpenLP.Ui', '&Vertical Align:'))
verticalLabel.setText(translate('OpenLP.Ui', '&Vertical Align:')) combo_box = QtGui.QComboBox(parent)
form.verticalComboBox = QtGui.QComboBox(parent) combo_box.addItem(UiStrings().Top)
form.verticalComboBox.setObjectName(u'VerticalComboBox') combo_box.addItem(UiStrings().Middle)
form.verticalComboBox.addItem(UiStrings().Top) combo_box.addItem(UiStrings().Bottom)
form.verticalComboBox.addItem(UiStrings().Middle) label.setBuddy(combo_box)
form.verticalComboBox.addItem(UiStrings().Bottom) return label, combo_box
verticalLabel.setBuddy(form.verticalComboBox)
layout.addRow(verticalLabel, form.verticalComboBox)
def find_and_set_in_combo_box(combo_box, value_to_find): def find_and_set_in_combo_box(combo_box, value_to_find):
""" """

View File

@ -28,7 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate from openlp.core.lib import build_icon, translate
from openlp.core.lib.ui import UiStrings from openlp.core.lib.ui import UiStrings, create_button, create_button_box
class Ui_AboutDialog(object): class Ui_AboutDialog(object):
def setupUi(self, aboutDialog): def setupUi(self, aboutDialog):
@ -71,21 +71,13 @@ class Ui_AboutDialog(object):
self.licenseTabLayout.addWidget(self.licenseTextEdit) self.licenseTabLayout.addWidget(self.licenseTextEdit)
self.aboutNotebook.addTab(self.licenseTab, u'') self.aboutNotebook.addTab(self.licenseTab, u'')
self.aboutDialogLayout.addWidget(self.aboutNotebook) self.aboutDialogLayout.addWidget(self.aboutNotebook)
self.buttonBox = QtGui.QDialogButtonBox(aboutDialog) self.contributeButton = create_button(None, u'contributeButton',
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Close) icon=u':/system/system_contribute.png')
self.buttonBox.setObjectName(u'buttonBox') self.buttonBox = create_button_box(aboutDialog, u'buttonBox',
self.contributeButton = QtGui.QPushButton() [u'close'], [self.contributeButton])
self.contributeButton.setIcon(
build_icon(u':/system/system_contribute.png'))
self.contributeButton.setObjectName(u'contributeButton')
self.buttonBox.addButton(self.contributeButton,
QtGui.QDialogButtonBox.ActionRole)
self.aboutDialogLayout.addWidget(self.buttonBox) self.aboutDialogLayout.addWidget(self.buttonBox)
self.retranslateUi(aboutDialog) self.retranslateUi(aboutDialog)
self.aboutNotebook.setCurrentIndex(0) self.aboutNotebook.setCurrentIndex(0)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
aboutDialog.close)
QtCore.QMetaObject.connectSlotsByName(aboutDialog)
def retranslateUi(self, aboutDialog): def retranslateUi(self, aboutDialog):
aboutDialog.setWindowTitle(u'%s OpenLP' % UiStrings().About) aboutDialog.setWindowTitle(u'%s OpenLP' % UiStrings().About)

View File

@ -233,22 +233,22 @@ class AdvancedTab(SettingsTab):
QtCore.SIGNAL(u'textChanged(QString)'), QtCore.SIGNAL(u'textChanged(QString)'),
self.updateServiceNameExample) self.updateServiceNameExample)
QtCore.QObject.connect(self.serviceNameRevertButton, QtCore.QObject.connect(self.serviceNameRevertButton,
QtCore.SIGNAL(u'pressed()'), QtCore.SIGNAL(u'clicked()'),
self.onServiceNameRevertButtonPressed) self.onServiceNameRevertButtonClicked)
QtCore.QObject.connect(self.defaultColorButton, QtCore.QObject.connect(self.defaultColorButton,
QtCore.SIGNAL(u'pressed()'), self.onDefaultColorButtonPressed) QtCore.SIGNAL(u'clicked()'), self.onDefaultColorButtonClicked)
QtCore.QObject.connect(self.defaultBrowseButton, QtCore.QObject.connect(self.defaultBrowseButton,
QtCore.SIGNAL(u'pressed()'), self.onDefaultBrowseButtonPressed) QtCore.SIGNAL(u'clicked()'), self.onDefaultBrowseButtonClicked)
QtCore.QObject.connect(self.defaultRevertButton, QtCore.QObject.connect(self.defaultRevertButton,
QtCore.SIGNAL(u'pressed()'), self.onDefaultRevertButtonPressed) QtCore.SIGNAL(u'clicked()'), self.onDefaultRevertButtonClicked)
QtCore.QObject.connect(self.x11BypassCheckBox, QtCore.QObject.connect(self.x11BypassCheckBox,
QtCore.SIGNAL(u'toggled(bool)'), self.onX11BypassCheckBoxToggled) QtCore.SIGNAL(u'toggled(bool)'), self.onX11BypassCheckBoxToggled)
QtCore.QObject.connect(self.endSlideRadioButton, QtCore.QObject.connect(self.endSlideRadioButton,
QtCore.SIGNAL(u'pressed()'), self.onEndSlideButtonPressed) QtCore.SIGNAL(u'clicked()'), self.onEndSlideButtonClicked)
QtCore.QObject.connect(self.wrapSlideRadioButton, QtCore.QObject.connect(self.wrapSlideRadioButton,
QtCore.SIGNAL(u'pressed()'), self.onWrapSlideButtonPressed) QtCore.SIGNAL(u'clicked()'), self.onWrapSlideButtonClicked)
QtCore.QObject.connect(self.nextItemRadioButton, QtCore.QObject.connect(self.nextItemRadioButton,
QtCore.SIGNAL(u'pressed()'), self.onnextItemButtonPressed) QtCore.SIGNAL(u'clicked()'), self.onnextItemButtonClicked)
def retranslateUi(self): def retranslateUi(self):
""" """
@ -485,11 +485,11 @@ class AdvancedTab(SettingsTab):
self.serviceNameTime.setEnabled(service_day is not 7) self.serviceNameTime.setEnabled(service_day is not 7)
self.updateServiceNameExample(None) self.updateServiceNameExample(None)
def onServiceNameRevertButtonPressed(self): def onServiceNameRevertButtonClicked(self):
self.serviceNameEdit.setText(self.defaultServiceName) self.serviceNameEdit.setText(self.defaultServiceName)
self.serviceNameEdit.setFocus() self.serviceNameEdit.setFocus()
def onDefaultColorButtonPressed(self): def onDefaultColorButtonClicked(self):
new_color = QtGui.QColorDialog.getColor( new_color = QtGui.QColorDialog.getColor(
QtGui.QColor(self.defaultColor), self) QtGui.QColor(self.defaultColor), self)
if new_color.isValid(): if new_color.isValid():
@ -497,7 +497,7 @@ class AdvancedTab(SettingsTab):
self.defaultColorButton.setStyleSheet( self.defaultColorButton.setStyleSheet(
u'background-color: %s' % self.defaultColor) u'background-color: %s' % self.defaultColor)
def onDefaultBrowseButtonPressed(self): def onDefaultBrowseButtonClicked(self):
file_filters = u'%s;;%s (*.*) (*)' % (get_images_filter(), file_filters = u'%s;;%s (*.*) (*)' % (get_images_filter(),
UiStrings().AllFiles) UiStrings().AllFiles)
filename = QtGui.QFileDialog.getOpenFileName(self, filename = QtGui.QFileDialog.getOpenFileName(self,
@ -507,7 +507,7 @@ class AdvancedTab(SettingsTab):
self.defaultFileEdit.setText(filename) self.defaultFileEdit.setText(filename)
self.defaultFileEdit.setFocus() self.defaultFileEdit.setFocus()
def onDefaultRevertButtonPressed(self): def onDefaultRevertButtonClicked(self):
self.defaultFileEdit.setText(u':/graphics/openlp-splash-screen.png') self.defaultFileEdit.setText(u':/graphics/openlp-splash-screen.png')
self.defaultFileEdit.setFocus() self.defaultFileEdit.setFocus()
@ -520,11 +520,11 @@ class AdvancedTab(SettingsTab):
""" """
self.displayChanged = True self.displayChanged = True
def onEndSlideButtonPressed(self): def onEndSlideButtonClicked(self):
self.slide_limits = SlideLimits.End self.slide_limits = SlideLimits.End
def onWrapSlideButtonPressed(self): def onWrapSlideButtonClicked(self):
self.slide_limits = SlideLimits.Wrap self.slide_limits = SlideLimits.Wrap
def onnextItemButtonPressed(self): def onnextItemButtonClicked(self):
self.slide_limits = SlideLimits.Next self.slide_limits = SlideLimits.Next

View File

@ -28,6 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate, build_icon from openlp.core.lib import translate, build_icon
from openlp.core.lib.ui import create_button, create_button_box
class Ui_ExceptionDialog(object): class Ui_ExceptionDialog(object):
def setupUi(self, exceptionDialog): def setupUi(self, exceptionDialog):
@ -62,39 +63,23 @@ class Ui_ExceptionDialog(object):
self.exceptionTextEdit.setReadOnly(True) self.exceptionTextEdit.setReadOnly(True)
self.exceptionTextEdit.setObjectName(u'exceptionTextEdit') self.exceptionTextEdit.setObjectName(u'exceptionTextEdit')
self.exceptionLayout.addWidget(self.exceptionTextEdit) self.exceptionLayout.addWidget(self.exceptionTextEdit)
self.exceptionButtonBox = QtGui.QDialogButtonBox(exceptionDialog) self.sendReportButton = create_button(exceptionDialog,
self.exceptionButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Close) u'sendReportButton', icon=u':/general/general_email.png',
self.exceptionButtonBox.setObjectName(u'exceptionButtonBox') click=self.onSendReportButtonClicked)
self.exceptionLayout.addWidget(self.exceptionButtonBox) self.saveReportButton = create_button(exceptionDialog,
self.sendReportButton = QtGui.QPushButton(exceptionDialog) u'saveReportButton', icon=u':/general/general_save.png',
self.sendReportButton.setIcon(build_icon( click=self.onSaveReportButtonClicked)
u':/general/general_email.png')) self.attachFileButton = create_icon(exceptionDialog,
self.sendReportButton.setObjectName(u'sendReportButton') u'attachFileButton', icon=u':/general/general_open.png',
self.exceptionButtonBox.addButton(self.sendReportButton, click=self.onAttachFileButtonClicked)
QtGui.QDialogButtonBox.ActionRole) self.buttonBox = create_button_box(exceptionDialog, u'buttonBox',
self.saveReportButton = QtGui.QPushButton(exceptionDialog) [u'close'], [self.sendReportButton, self.saveReportButton,
self.saveReportButton.setIcon(build_icon(u':/general/general_save.png')) self.attachFileButton])
self.saveReportButton.setObjectName(u'saveReportButton') self.exceptionLayout.addWidget(self.buttonBox)
self.exceptionButtonBox.addButton(self.saveReportButton,
QtGui.QDialogButtonBox.ActionRole)
self.attachFileButton = QtGui.QPushButton(exceptionDialog)
self.attachFileButton.setIcon(build_icon(u':/general/general_open.png'))
self.attachFileButton.setObjectName(u'attachFileButton')
self.exceptionButtonBox.addButton(self.attachFileButton,
QtGui.QDialogButtonBox.ActionRole)
self.retranslateUi(exceptionDialog) self.retranslateUi(exceptionDialog)
QtCore.QObject.connect(self.descriptionTextEdit, QtCore.QObject.connect(self.descriptionTextEdit,
QtCore.SIGNAL(u'textChanged()'), self.onDescriptionUpdated) QtCore.SIGNAL(u'textChanged()'), self.onDescriptionUpdated)
QtCore.QObject.connect(self.exceptionButtonBox,
QtCore.SIGNAL(u'rejected()'), exceptionDialog.reject)
QtCore.QObject.connect(self.sendReportButton,
QtCore.SIGNAL(u'pressed()'), self.onSendReportButtonPressed)
QtCore.QObject.connect(self.saveReportButton,
QtCore.SIGNAL(u'pressed()'), self.onSaveReportButtonPressed)
QtCore.QObject.connect(self.attachFileButton,
QtCore.SIGNAL(u'pressed()'), self.onAttachFileButtonPressed)
QtCore.QMetaObject.connectSlotsByName(exceptionDialog)
def retranslateUi(self, exceptionDialog): def retranslateUi(self, exceptionDialog):
exceptionDialog.setWindowTitle( exceptionDialog.setWindowTitle(

View File

@ -133,7 +133,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
system = system + u'Desktop: GNOME\n' system = system + u'Desktop: GNOME\n'
return (openlp_version, description, traceback, system, libraries) return (openlp_version, description, traceback, system, libraries)
def onSaveReportButtonPressed(self): def onSaveReportButtonClicked(self):
""" """
Saving exception log and system informations to a file. Saving exception log and system informations to a file.
""" """
@ -169,7 +169,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
finally: finally:
report_file.close() report_file.close()
def onSendReportButtonPressed(self): def onSendReportButtonClicked(self):
""" """
Opening systems default email client and inserting exception log and Opening systems default email client and inserting exception log and
system informations. system informations.
@ -210,7 +210,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
unicode(translate('OpenLP.ExceptionDialog', unicode(translate('OpenLP.ExceptionDialog',
'Description characters to enter : %s')) % count) 'Description characters to enter : %s')) % count)
def onAttachFileButtonPressed(self): def onAttachFileButtonClicked(self):
files = QtGui.QFileDialog.getOpenFileName( files = QtGui.QFileDialog.getOpenFileName(
self,translate('ImagePlugin.ExceptionDialog', self,translate('ImagePlugin.ExceptionDialog',
'Select Attachment'), 'Select Attachment'),

View File

@ -28,7 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import create_accept_reject_button_box from openlp.core.lib.ui import create_button_box
class Ui_FileRenameDialog(object): class Ui_FileRenameDialog(object):
def setupUi(self, fileRenameDialog): def setupUi(self, fileRenameDialog):
@ -44,11 +44,11 @@ class Ui_FileRenameDialog(object):
QtCore.QRegExp(r'[^/\\?*|<>\[\]":+%]+'), self)) QtCore.QRegExp(r'[^/\\?*|<>\[\]":+%]+'), self))
self.fileNameEdit.setObjectName(u'fileNameEdit') self.fileNameEdit.setObjectName(u'fileNameEdit')
self.dialogLayout.addWidget(self.fileNameEdit, 0, 1) self.dialogLayout.addWidget(self.fileNameEdit, 0, 1)
self.buttonBox = create_accept_reject_button_box(fileRenameDialog, True) self.buttonBox = create_button_box(fileRenameDialog, u'buttonBox',
[u'cancel', u'ok'])
self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2) self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2)
self.retranslateUi(fileRenameDialog) self.retranslateUi(fileRenameDialog)
self.setMaximumHeight(self.sizeHint().height()) self.setMaximumHeight(self.sizeHint().height())
QtCore.QMetaObject.connectSlotsByName(fileRenameDialog)
def retranslateUi(self, fileRenameDialog): def retranslateUi(self, fileRenameDialog):
self.fileNameLabel.setText(translate('OpenLP.FileRenameForm', self.fileNameLabel.setText(translate('OpenLP.FileRenameForm',

View File

@ -183,7 +183,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
""" """
Detects Page changes and updates as approprate. Detects Page changes and updates as approprate.
""" """
# Keep track of the page we are at. Pressing "Cancel" causes pageId # Keep track of the page we are at. Triggering "Cancel" causes pageId
# to be a -1. # to be a -1.
if pageId != -1: if pageId != -1:
self.lastId = pageId self.lastId = pageId
@ -239,7 +239,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
def onCancelButtonClicked(self): def onCancelButtonClicked(self):
""" """
Process the pressing of the cancel button. Process the triggering of the cancel button.
""" """
if self.lastId == FirstTimePage.NoInternet or \ if self.lastId == FirstTimePage.NoInternet or \
(self.lastId <= FirstTimePage.Plugins and \ (self.lastId <= FirstTimePage.Plugins and \
@ -251,7 +251,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
def onNoInternetFinishButtonClicked(self): def onNoInternetFinishButtonClicked(self):
""" """
Process the pressing of the "Finish" button on the No Internet page. Process the triggering of the "Finish" button on the No Internet page.
""" """
Receiver.send_message(u'cursor_busy') Receiver.send_message(u'cursor_busy')
self._performWizard() self._performWizard()

View File

@ -28,7 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import create_accept_reject_button_box from openlp.core.lib.ui import create_button_box
class Ui_FirstTimeLanguageDialog(object): class Ui_FirstTimeLanguageDialog(object):
def setupUi(self, languageDialog): def setupUi(self, languageDialog):
@ -52,12 +52,12 @@ class Ui_FirstTimeLanguageDialog(object):
self.languageComboBox.setObjectName("languageComboBox") self.languageComboBox.setObjectName("languageComboBox")
self.languageLayout.addWidget(self.languageComboBox) self.languageLayout.addWidget(self.languageComboBox)
self.dialogLayout.addLayout(self.languageLayout) self.dialogLayout.addLayout(self.languageLayout)
self.buttonBox = create_accept_reject_button_box(languageDialog, True) self.buttonBox = create_button_box(languageDialog, u'buttonBox',
[u'cancel', u'ok'])
self.dialogLayout.addWidget(self.buttonBox) self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(languageDialog) self.retranslateUi(languageDialog)
self.setMaximumHeight(self.sizeHint().height()) self.setMaximumHeight(self.sizeHint().height())
QtCore.QMetaObject.connectSlotsByName(languageDialog)
def retranslateUi(self, languageDialog): def retranslateUi(self, languageDialog):
self.setWindowTitle(translate('OpenLP.FirstTimeLanguageForm', self.setWindowTitle(translate('OpenLP.FirstTimeLanguageForm',

View File

@ -233,14 +233,14 @@ class Ui_FirstTimeWizard(object):
self.noInternetText = translate('OpenLP.FirstTimeWizard', self.noInternetText = translate('OpenLP.FirstTimeWizard',
'No Internet connection was found. The First Time Wizard needs an ' 'No Internet connection was found. The First Time Wizard needs an '
'Internet connection in order to be able to download sample ' 'Internet connection in order to be able to download sample '
'songs, Bibles and themes. Press the Finish button now to start ' 'songs, Bibles and themes. Click the Finish button now to start '
'OpenLP with initial settings and no sample data.\n\nTo re-run the ' 'OpenLP with initial settings and no sample data.\n\nTo re-run the '
'First Time Wizard and import this sample data at a later time, ' 'First Time Wizard and import this sample data at a later time, '
'check your Internet connection and re-run this wizard by ' 'check your Internet connection and re-run this wizard by '
'selecting "Tools/Re-run First Time Wizard" from OpenLP.') 'selecting "Tools/Re-run First Time Wizard" from OpenLP.')
self.cancelWizardText = translate('OpenLP.FirstTimeWizard', self.cancelWizardText = translate('OpenLP.FirstTimeWizard',
'\n\nTo cancel the First Time Wizard completely (and not start ' '\n\nTo cancel the First Time Wizard completely (and not start '
'OpenLP), press the Cancel button now.') 'OpenLP), click the Cancel button now.')
self.songsPage.setTitle(translate('OpenLP.FirstTimeWizard', self.songsPage.setTitle(translate('OpenLP.FirstTimeWizard',
'Sample Songs')) 'Sample Songs'))
self.songsPage.setSubTitle(translate('OpenLP.FirstTimeWizard', self.songsPage.setSubTitle(translate('OpenLP.FirstTimeWizard',

View File

@ -28,7 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import UiStrings from openlp.core.lib.ui import UiStrings, create_button_box
class Ui_FormattingTagDialog(object): class Ui_FormattingTagDialog(object):
@ -112,13 +112,11 @@ class Ui_FormattingTagDialog(object):
self.savePushButton.setObjectName(u'savePushButton') self.savePushButton.setObjectName(u'savePushButton')
self.dataGridLayout.addWidget(self.savePushButton, 4, 2, 1, 1) self.dataGridLayout.addWidget(self.savePushButton, 4, 2, 1, 1)
self.listdataGridLayout.addWidget(self.editGroupBox, 2, 0, 1, 1) self.listdataGridLayout.addWidget(self.editGroupBox, 2, 0, 1, 1)
self.buttonBox = QtGui.QDialogButtonBox(formattingTagDialog) self.buttonBox = create_button_box(formattingTagDialog, 'buttonBox',
self.buttonBox.setObjectName('formattingTagDialogButtonBox') [u'close'])
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Close)
self.listdataGridLayout.addWidget(self.buttonBox, 3, 0, 1, 1) self.listdataGridLayout.addWidget(self.buttonBox, 3, 0, 1, 1)
self.retranslateUi(formattingTagDialog) self.retranslateUi(formattingTagDialog)
QtCore.QMetaObject.connectSlotsByName(formattingTagDialog)
def retranslateUi(self, formattingTagDialog): def retranslateUi(self, formattingTagDialog):
formattingTagDialog.setWindowTitle(translate( formattingTagDialog.setWindowTitle(translate(

View File

@ -50,11 +50,11 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog):
QtCore.QObject.connect(self.tagTableWidget, QtCore.QObject.connect(self.tagTableWidget,
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onRowSelected) QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onRowSelected)
QtCore.QObject.connect(self.newPushButton, QtCore.QObject.connect(self.newPushButton,
QtCore.SIGNAL(u'pressed()'), self.onNewPushed) QtCore.SIGNAL(u'clicked()'), self.onNewClicked)
QtCore.QObject.connect(self.savePushButton, QtCore.QObject.connect(self.savePushButton,
QtCore.SIGNAL(u'pressed()'), self.onSavedPushed) QtCore.SIGNAL(u'clicked()'), self.onSavedClicked)
QtCore.QObject.connect(self.deletePushButton, QtCore.QObject.connect(self.deletePushButton,
QtCore.SIGNAL(u'pressed()'), self.onDeletePushed) QtCore.SIGNAL(u'clicked()'), self.onDeleteClicked)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'), QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
self.close) self.close)
# Forces reloading of tags from openlp configuration. # Forces reloading of tags from openlp configuration.
@ -95,7 +95,7 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog):
self.savePushButton.setEnabled(True) self.savePushButton.setEnabled(True)
self.deletePushButton.setEnabled(True) self.deletePushButton.setEnabled(True)
def onNewPushed(self): def onNewClicked(self):
""" """
Add a new tag to list only if it is not a duplicate. Add a new tag to list only if it is not a duplicate.
""" """
@ -123,7 +123,7 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog):
self.onRowSelected() self.onRowSelected()
self.tagTableWidget.scrollToBottom() self.tagTableWidget.scrollToBottom()
def onDeletePushed(self): def onDeleteClicked(self):
""" """
Delete selected custom tag. Delete selected custom tag.
""" """
@ -133,7 +133,7 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog):
self._resetTable() self._resetTable()
FormattingTags.save_html_tags() FormattingTags.save_html_tags()
def onSavedPushed(self): def onSavedClicked(self):
""" """
Update Custom Tag details if not duplicate and save the data. Update Custom Tag details if not duplicate and save the data.
""" """

View File

@ -372,7 +372,6 @@ class Ui_MainWindow(object):
# Connect up some signals and slots # Connect up some signals and slots
QtCore.QObject.connect(self.fileMenu, QtCore.QObject.connect(self.fileMenu,
QtCore.SIGNAL(u'aboutToShow()'), self.updateRecentFilesMenu) QtCore.SIGNAL(u'aboutToShow()'), self.updateRecentFilesMenu)
QtCore.QMetaObject.connectSlotsByName(mainWindow)
# Hide the entry, as it does not have any functionality yet. # Hide the entry, as it does not have any functionality yet.
self.toolsAddToolItem.setVisible(False) self.toolsAddToolItem.setVisible(False)
self.importLanguageItem.setVisible(False) self.importLanguageItem.setVisible(False)
@ -986,11 +985,11 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
# We have a good file, import it. # We have a good file, import it.
for section_key in import_keys: for section_key in import_keys:
value = import_settings.value(section_key) value = import_settings.value(section_key)
settings.setValue(u'%s' % (section_key) , settings.setValue(u'%s' % (section_key),
QtCore.QVariant(value)) QtCore.QVariant(value))
now = datetime.now() now = datetime.now()
settings.beginGroup(self.headerSection) settings.beginGroup(self.headerSection)
settings.setValue( u'file_imported' , QtCore.QVariant(import_file_name)) settings.setValue(u'file_imported', QtCore.QVariant(import_file_name))
settings.setValue(u'file_date_imported', settings.setValue(u'file_date_imported',
now.strftime("%Y-%m-%d %H:%M")) now.strftime("%Y-%m-%d %H:%M"))
settings.endGroup() settings.endGroup()

View File

@ -28,7 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import UiStrings from openlp.core.lib.ui import UiStrings, create_button_box
class Ui_PluginViewDialog(object): class Ui_PluginViewDialog(object):
def setupUi(self, pluginViewDialog): def setupUi(self, pluginViewDialog):
@ -65,14 +65,10 @@ class Ui_PluginViewDialog(object):
self.pluginInfoLayout.addRow(self.aboutLabel, self.aboutTextBrowser) self.pluginInfoLayout.addRow(self.aboutLabel, self.aboutTextBrowser)
self.listLayout.addWidget(self.pluginInfoGroupBox) self.listLayout.addWidget(self.pluginInfoGroupBox)
self.pluginLayout.addLayout(self.listLayout) self.pluginLayout.addLayout(self.listLayout)
self.pluginListButtonBox = QtGui.QDialogButtonBox(pluginViewDialog) self.buttonBox = create_button_box(pluginViewDialog, u'buttonBox',
self.pluginListButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) [u'ok'])
self.pluginListButtonBox.setObjectName(u'pluginListButtonBox') self.pluginLayout.addWidget(self.buttonBox)
self.pluginLayout.addWidget(self.pluginListButtonBox)
self.retranslateUi(pluginViewDialog) self.retranslateUi(pluginViewDialog)
QtCore.QObject.connect(self.pluginListButtonBox,
QtCore.SIGNAL(u'accepted()'), pluginViewDialog.close)
QtCore.QMetaObject.connectSlotsByName(pluginViewDialog)
def retranslateUi(self, pluginViewDialog): def retranslateUi(self, pluginViewDialog):
pluginViewDialog.setWindowTitle( pluginViewDialog.setWindowTitle(

View File

@ -126,7 +126,6 @@ class Ui_PrintServiceDialog(object):
self.optionsLayout.addWidget(self.optionsGroupBox) self.optionsLayout.addWidget(self.optionsGroupBox)
self.retranslateUi(printServiceDialog) self.retranslateUi(printServiceDialog)
QtCore.QMetaObject.connectSlotsByName(printServiceDialog)
QtCore.QObject.connect(self.optionsButton, QtCore.QObject.connect(self.optionsButton,
QtCore.SIGNAL(u'toggled(bool)'), self.toggleOptions) QtCore.SIGNAL(u'toggled(bool)'), self.toggleOptions)

View File

@ -28,8 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import create_accept_reject_button_box, \ from openlp.core.lib.ui import create_button_box, create_button
create_delete_push_button, create_up_down_push_button_set
class Ui_ServiceItemEditDialog(object): class Ui_ServiceItemEditDialog(object):
def setupUi(self, serviceItemEditDialog): def setupUi(self, serviceItemEditDialog):
@ -44,18 +43,22 @@ class Ui_ServiceItemEditDialog(object):
self.dialogLayout.addWidget(self.listWidget, 0, 0) self.dialogLayout.addWidget(self.listWidget, 0, 0)
self.buttonLayout = QtGui.QVBoxLayout() self.buttonLayout = QtGui.QVBoxLayout()
self.buttonLayout.setObjectName(u'buttonLayout') self.buttonLayout.setObjectName(u'buttonLayout')
self.deleteButton = create_delete_push_button(serviceItemEditDialog) self.deleteButton = create_button(serviceItemEditDialog,
u'deleteButton', role=u'delete',
click=serviceItemEditDialog.onDeleteButtonClicked)
self.buttonLayout.addWidget(self.deleteButton) self.buttonLayout.addWidget(self.deleteButton)
self.buttonLayout.addStretch() self.buttonLayout.addStretch()
self.upButton, self.downButton = create_up_down_push_button_set( self.upButton = create_button(serviceItemEditDialog, u'upButton',
serviceItemEditDialog) role=u'up', click=serviceItemEditDialog.onUpButtonClicked)
self.downButton = create_button(serviceItemEditDialog, u'downButton',
role=u'down', click=serviceItemEditDialog.onDownButtonClicked)
self.buttonLayout.addWidget(self.upButton) self.buttonLayout.addWidget(self.upButton)
self.buttonLayout.addWidget(self.downButton) self.buttonLayout.addWidget(self.downButton)
self.dialogLayout.addLayout(self.buttonLayout, 0, 1) self.dialogLayout.addLayout(self.buttonLayout, 0, 1)
self.dialogLayout.addWidget( self.buttonBox = create_button_box(serviceItemEditDialog, u'buttonBox',
create_accept_reject_button_box(serviceItemEditDialog), 1, 0, 1, 2) [u'cancel', u'save'])
self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2)
self.retranslateUi(serviceItemEditDialog) self.retranslateUi(serviceItemEditDialog)
QtCore.QMetaObject.connectSlotsByName(serviceItemEditDialog)
def retranslateUi(self, serviceItemEditDialog): def retranslateUi(self, serviceItemEditDialog):
serviceItemEditDialog.setWindowTitle( serviceItemEditDialog.setWindowTitle(

View File

@ -181,7 +181,7 @@ class ServiceManager(QtGui.QWidget):
self.serviceManagerList.moveUp = self.orderToolbar.addToolbarAction( self.serviceManagerList.moveUp = self.orderToolbar.addToolbarAction(
u'moveUp', text=translate('OpenLP.ServiceManager', 'Move &up'), u'moveUp', text=translate('OpenLP.ServiceManager', 'Move &up'),
icon=u':/services/service_up.png', icon=u':/services/service_up.png',
tooltip=translate( 'OpenLP.ServiceManager', tooltip=translate('OpenLP.ServiceManager',
'Move item up one position in the service.'), 'Move item up one position in the service.'),
shortcuts=[QtCore.Qt.Key_PageUp], category=UiStrings().Service, shortcuts=[QtCore.Qt.Key_PageUp], category=UiStrings().Service,
triggers=self.onServiceUp) triggers=self.onServiceUp)

View File

@ -28,7 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate, SpellTextEdit from openlp.core.lib import translate, SpellTextEdit
from openlp.core.lib.ui import create_accept_reject_button_box from openlp.core.lib.ui import create_button_box
class ServiceNoteForm(QtGui.QDialog): class ServiceNoteForm(QtGui.QDialog):
""" """
@ -55,8 +55,9 @@ class ServiceNoteForm(QtGui.QDialog):
self.textEdit = SpellTextEdit(self, False) self.textEdit = SpellTextEdit(self, False)
self.textEdit.setObjectName(u'textEdit') self.textEdit.setObjectName(u'textEdit')
self.dialogLayout.addWidget(self.textEdit) self.dialogLayout.addWidget(self.textEdit)
self.dialogLayout.addWidget(create_accept_reject_button_box(self)) self.buttonBox = create_button_box(self, u'buttonBox',
QtCore.QMetaObject.connectSlotsByName(self) [u'cancel', u'save'])
self.dialogLayout.addWidget(self.buttonBox)
def retranslateUi(self): def retranslateUi(self):
self.setWindowTitle( self.setWindowTitle(

View File

@ -28,7 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate, build_icon from openlp.core.lib import translate, build_icon
from openlp.core.lib.ui import create_accept_reject_button_box from openlp.core.lib.ui import create_button_box
class Ui_SettingsDialog(object): class Ui_SettingsDialog(object):
def setupUi(self, settingsDialog): def setupUi(self, settingsDialog):
@ -49,10 +49,10 @@ class Ui_SettingsDialog(object):
self.stackedLayout = QtGui.QStackedLayout() self.stackedLayout = QtGui.QStackedLayout()
self.stackedLayout.setObjectName(u'stackedLayout') self.stackedLayout.setObjectName(u'stackedLayout')
self.dialogLayout.addLayout(self.stackedLayout, 0, 1, 1, 1) self.dialogLayout.addLayout(self.stackedLayout, 0, 1, 1, 1)
self.buttonBox = create_accept_reject_button_box(settingsDialog, True) self.buttonBox = create_button_box(settingsDialog, u'buttonBox',
[u'cancel', u'ok'])
self.dialogLayout.addWidget(self.buttonBox, 1, 1, 1, 1) self.dialogLayout.addWidget(self.buttonBox, 1, 1, 1, 1)
self.retranslateUi(settingsDialog) self.retranslateUi(settingsDialog)
QtCore.QMetaObject.connectSlotsByName(settingsDialog)
QtCore.QObject.connect(self.settingListWidget, QtCore.QObject.connect(self.settingListWidget,
QtCore.SIGNAL(u'currentRowChanged(int)'), QtCore.SIGNAL(u'currentRowChanged(int)'),
self.tabChanged) self.tabChanged)

View File

@ -28,6 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate, build_icon from openlp.core.lib import translate, build_icon
from openlp.core.lib.ui import create_button_box
class CaptureShortcutButton(QtGui.QPushButton): class CaptureShortcutButton(QtGui.QPushButton):
""" """
@ -108,18 +109,11 @@ class Ui_ShortcutListDialog(object):
self.alternateLabel.setObjectName(u'alternateLabel') self.alternateLabel.setObjectName(u'alternateLabel')
self.detailsLayout.addWidget(self.alternateLabel, 0, 2, 1, 1) self.detailsLayout.addWidget(self.alternateLabel, 0, 2, 1, 1)
self.shortcutListLayout.addLayout(self.detailsLayout) self.shortcutListLayout.addLayout(self.detailsLayout)
self.buttonBox = QtGui.QDialogButtonBox(shortcutListDialog) self.buttonBox = create_button_box(shortcutListDialog, u'buttonBox',
self.buttonBox.setObjectName(u'buttonBox') [u'cancel', u'ok', u'defaults'])
self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.RestoreDefaults)
self.shortcutListLayout.addWidget(self.buttonBox) self.shortcutListLayout.addWidget(self.buttonBox)
self.retranslateUi(shortcutListDialog) self.retranslateUi(shortcutListDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'),
shortcutListDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
shortcutListDialog.reject)
QtCore.QMetaObject.connectSlotsByName(shortcutListDialog)
def retranslateUi(self, shortcutListDialog): def retranslateUi(self, shortcutListDialog):
shortcutListDialog.setWindowTitle( shortcutListDialog.setWindowTitle(

View File

@ -42,4 +42,3 @@ class SplashScreen(QtGui.QSplashScreen):
self.setPixmap(splash_image) self.setPixmap(splash_image)
self.setMask(splash_image.mask()) self.setMask(splash_image.mask())
self.resize(370, 370) self.resize(370, 370)
QtCore.QMetaObject.connectSlotsByName(self)

View File

@ -28,7 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import UiStrings, create_accept_reject_button_box from openlp.core.lib.ui import UiStrings, create_button_box
class Ui_StartTimeDialog(object): class Ui_StartTimeDialog(object):
def setupUi(self, StartTimeDialog): def setupUi(self, StartTimeDialog):
@ -99,11 +99,11 @@ class Ui_StartTimeDialog(object):
self.secondFinishLabel.setAlignment(QtCore.Qt.AlignRight) self.secondFinishLabel.setAlignment(QtCore.Qt.AlignRight)
self.dialogLayout.addWidget(self.secondFinishLabel, 3, 3, 1, 1) self.dialogLayout.addWidget(self.secondFinishLabel, 3, 3, 1, 1)
self.dialogLayout.addWidget(self.secondSpinBox, 3, 1, 1, 1) self.dialogLayout.addWidget(self.secondSpinBox, 3, 1, 1, 1)
self.buttonBox = create_accept_reject_button_box(StartTimeDialog, True) self.buttonBox = create_button_box(StartTimeDialog, u'buttonBox',
[u'cancel', u'ok'])
self.dialogLayout.addWidget(self.buttonBox, 5, 2, 1, 2) self.dialogLayout.addWidget(self.buttonBox, 5, 2, 1, 2)
self.retranslateUi(StartTimeDialog) self.retranslateUi(StartTimeDialog)
self.setMaximumHeight(self.sizeHint().height()) self.setMaximumHeight(self.sizeHint().height())
QtCore.QMetaObject.connectSlotsByName(StartTimeDialog)
def retranslateUi(self, StartTimeDialog): def retranslateUi(self, StartTimeDialog):
self.setWindowTitle(translate('OpenLP.StartTimeForm', self.setWindowTitle(translate('OpenLP.StartTimeForm',

View File

@ -608,7 +608,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
def accept(self): def accept(self):
""" """
Lets save the theme as Finish has been pressed Lets save the theme as Finish has been triggered
""" """
# Save the theme name # Save the theme name
self.theme.theme_name = unicode(self.field(u'name').toString()) self.theme.theme_name = unicode(self.field(u'name').toString())

View File

@ -28,6 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import create_button_box
class Ui_ThemeLayoutDialog(object): class Ui_ThemeLayoutDialog(object):
@ -35,34 +36,30 @@ class Ui_ThemeLayoutDialog(object):
themeLayoutDialog.setObjectName(u'themeLayoutDialogDialog') themeLayoutDialog.setObjectName(u'themeLayoutDialogDialog')
#themeLayoutDialog.resize(300, 200) #themeLayoutDialog.resize(300, 200)
self.previewLayout = QtGui.QVBoxLayout(themeLayoutDialog) self.previewLayout = QtGui.QVBoxLayout(themeLayoutDialog)
self.previewLayout.setObjectName(u'PreviewLayout') self.previewLayout.setObjectName(u'previewLayout')
self.previewArea = QtGui.QWidget(themeLayoutDialog) self.previewArea = QtGui.QWidget(themeLayoutDialog)
self.previewArea.setObjectName(u'PreviewArea') self.previewArea.setObjectName(u'previewArea')
self.previewAreaLayout = QtGui.QGridLayout(self.previewArea) self.previewAreaLayout = QtGui.QGridLayout(self.previewArea)
self.previewAreaLayout.setMargin(0) self.previewAreaLayout.setMargin(0)
self.previewAreaLayout.setColumnStretch(0, 1) self.previewAreaLayout.setColumnStretch(0, 1)
self.previewAreaLayout.setRowStretch(0, 1) self.previewAreaLayout.setRowStretch(0, 1)
self.previewAreaLayout.setObjectName(u'PreviewAreaLayout') self.previewAreaLayout.setObjectName(u'previewAreaLayout')
self.themeDisplayLabel = QtGui.QLabel(self.previewArea) self.themeDisplayLabel = QtGui.QLabel(self.previewArea)
self.themeDisplayLabel.setFrameShape(QtGui.QFrame.Box) self.themeDisplayLabel.setFrameShape(QtGui.QFrame.Box)
self.themeDisplayLabel.setScaledContents(True) self.themeDisplayLabel.setScaledContents(True)
self.themeDisplayLabel.setObjectName(u'ThemeDisplayLabel') self.themeDisplayLabel.setObjectName(u'themeDisplayLabel')
self.previewAreaLayout.addWidget(self.themeDisplayLabel) self.previewAreaLayout.addWidget(self.themeDisplayLabel)
self.previewLayout.addWidget(self.previewArea) self.previewLayout.addWidget(self.previewArea)
self.mainColourLabel = QtGui.QLabel(self.previewArea) self.mainColourLabel = QtGui.QLabel(self.previewArea)
self.mainColourLabel.setObjectName(u'MainColourLabel') self.mainColourLabel.setObjectName(u'mainColourLabel')
self.previewLayout.addWidget(self.mainColourLabel) self.previewLayout.addWidget(self.mainColourLabel)
self.footerColourLabel = QtGui.QLabel(self.previewArea) self.footerColourLabel = QtGui.QLabel(self.previewArea)
self.footerColourLabel.setObjectName(u'FooterColourLabel') self.footerColourLabel.setObjectName(u'footerColourLabel')
self.previewLayout.addWidget(self.footerColourLabel) self.previewLayout.addWidget(self.footerColourLabel)
self.buttonBox = QtGui.QDialogButtonBox(themeLayoutDialog) self.buttonBox = create_button_box(themeLayoutDialog, u'buttonBox',
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) [u'ok'])
self.buttonBox.setObjectName(u'ButtonBox')
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'),
themeLayoutDialog.accept)
self.previewLayout.addWidget(self.buttonBox) self.previewLayout.addWidget(self.buttonBox)
self.retranslateUi(themeLayoutDialog) self.retranslateUi(themeLayoutDialog)
QtCore.QMetaObject.connectSlotsByName(themeLayoutDialog)
def retranslateUi(self, themeLayoutDialog): def retranslateUi(self, themeLayoutDialog):
themeLayoutDialog.setWindowTitle( themeLayoutDialog.setWindowTitle(

View File

@ -96,11 +96,11 @@ class ThemesTab(SettingsTab):
self.rightLayout.addWidget(self.LevelGroupBox) self.rightLayout.addWidget(self.LevelGroupBox)
self.rightLayout.addStretch() self.rightLayout.addStretch()
QtCore.QObject.connect(self.SongLevelRadioButton, QtCore.QObject.connect(self.SongLevelRadioButton,
QtCore.SIGNAL(u'pressed()'), self.onSongLevelButtonPressed) QtCore.SIGNAL(u'clicked()'), self.onSongLevelButtonClicked)
QtCore.QObject.connect(self.ServiceLevelRadioButton, QtCore.QObject.connect(self.ServiceLevelRadioButton,
QtCore.SIGNAL(u'pressed()'), self.onServiceLevelButtonPressed) QtCore.SIGNAL(u'clicked()'), self.onServiceLevelButtonClicked)
QtCore.QObject.connect(self.GlobalLevelRadioButton, QtCore.QObject.connect(self.GlobalLevelRadioButton,
QtCore.SIGNAL(u'pressed()'), self.onGlobalLevelButtonPressed) QtCore.SIGNAL(u'clicked()'), self.onGlobalLevelButtonClicked)
QtCore.QObject.connect(self.DefaultComboBox, QtCore.QObject.connect(self.DefaultComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onDefaultComboBoxChanged) QtCore.SIGNAL(u'activated(int)'), self.onDefaultComboBoxChanged)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
@ -158,13 +158,13 @@ class ThemesTab(SettingsTab):
def postSetUp(self): def postSetUp(self):
Receiver.send_message(u'theme_update_global', self.global_theme) Receiver.send_message(u'theme_update_global', self.global_theme)
def onSongLevelButtonPressed(self): def onSongLevelButtonClicked(self):
self.theme_level = ThemeLevel.Song self.theme_level = ThemeLevel.Song
def onServiceLevelButtonPressed(self): def onServiceLevelButtonClicked(self):
self.theme_level = ThemeLevel.Service self.theme_level = ThemeLevel.Service
def onGlobalLevelButtonPressed(self): def onGlobalLevelButtonClicked(self):
self.theme_level = ThemeLevel.Global self.theme_level = ThemeLevel.Global
def onDefaultComboBoxChanged(self, value): def onDefaultComboBoxChanged(self, value):

View File

@ -30,7 +30,8 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate, build_icon from openlp.core.lib import translate, build_icon
from openlp.core.lib.theme import HorizontalType, BackgroundType, \ from openlp.core.lib.theme import HorizontalType, BackgroundType, \
BackgroundGradientType BackgroundGradientType
from openlp.core.lib.ui import UiStrings, add_welcome_page, create_valign_combo from openlp.core.lib.ui import UiStrings, add_welcome_page, \
create_valign_selection_widgets
class Ui_ThemeWizard(object): class Ui_ThemeWizard(object):
def setupUi(self, themeWizard): def setupUi(self, themeWizard):
@ -257,8 +258,11 @@ class Ui_ThemeWizard(object):
self.horizontalComboBox.setObjectName(u'HorizontalComboBox') self.horizontalComboBox.setObjectName(u'HorizontalComboBox')
self.alignmentLayout.addRow(self.horizontalLabel, self.alignmentLayout.addRow(self.horizontalLabel,
self.horizontalComboBox) self.horizontalComboBox)
create_valign_combo(themeWizard, self.alignmentPage, self.verticalLabel, self.verticalComboBox = \
self.alignmentLayout) create_valign_selection_widgets(self.alignmentPage)
self.verticalLabel.setObjectName(u'verticalLabel')
self.verticalComboBox.setObjectName(u'verticalComboBox')
self.alignmentLayout.addRow(self.verticalLabel, self.verticalComboBox)
self.transitionsLabel = QtGui.QLabel(self.alignmentPage) self.transitionsLabel = QtGui.QLabel(self.alignmentPage)
self.transitionsLabel.setObjectName(u'TransitionsLabel') self.transitionsLabel.setObjectName(u'TransitionsLabel')
self.transitionsCheckBox = QtGui.QCheckBox(self.alignmentPage) self.transitionsCheckBox = QtGui.QCheckBox(self.alignmentPage)
@ -413,7 +417,6 @@ class Ui_ThemeWizard(object):
QtCore.QObject.connect(self.footerPositionCheckBox, QtCore.QObject.connect(self.footerPositionCheckBox,
QtCore.SIGNAL(u'toggled(bool)'), self.footerHeightSpinBox, QtCore.SIGNAL(u'toggled(bool)'), self.footerHeightSpinBox,
QtCore.SLOT(u'setDisabled(bool)')) QtCore.SLOT(u'setDisabled(bool)'))
QtCore.QMetaObject.connectSlotsByName(themeWizard)
def retranslateUi(self, themeWizard): def retranslateUi(self, themeWizard):
themeWizard.setWindowTitle( themeWizard.setWindowTitle(

View File

@ -114,7 +114,6 @@ class OpenLPWizard(QtGui.QWizard):
self.addCustomPages() self.addCustomPages()
self.addProgressPage() self.addProgressPage()
self.retranslateUi() self.retranslateUi()
QtCore.QMetaObject.connectSlotsByName(self)
def registerFields(self): def registerFields(self):
""" """

View File

@ -28,7 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate from openlp.core.lib import build_icon, translate
from openlp.core.lib.ui import create_delete_push_button from openlp.core.lib.ui import create_button, create_button_box
class Ui_AlertDialog(object): class Ui_AlertDialog(object):
def setupUi(self, alertDialog): def setupUi(self, alertDialog):
@ -67,31 +67,21 @@ class Ui_AlertDialog(object):
self.saveButton.setIcon(build_icon(u':/general/general_save.png')) self.saveButton.setIcon(build_icon(u':/general/general_save.png'))
self.saveButton.setObjectName(u'saveButton') self.saveButton.setObjectName(u'saveButton')
self.manageButtonLayout.addWidget(self.saveButton) self.manageButtonLayout.addWidget(self.saveButton)
self.deleteButton = create_delete_push_button(alertDialog) self.deleteButton = create_button(alertDialog, u'deleteButton',
self.deleteButton.setEnabled(False) role=u'delete', enabled=False,
click=alertDialog.onDeleteButtonClicked)
self.manageButtonLayout.addWidget(self.deleteButton) self.manageButtonLayout.addWidget(self.deleteButton)
self.manageButtonLayout.addStretch() self.manageButtonLayout.addStretch()
self.alertDialogLayout.addLayout(self.manageButtonLayout, 1, 1) self.alertDialogLayout.addLayout(self.manageButtonLayout, 1, 1)
self.buttonBox = QtGui.QDialogButtonBox(alertDialog)
self.buttonBox.addButton(QtGui.QDialogButtonBox.Close)
displayIcon = build_icon(u':/general/general_live.png') displayIcon = build_icon(u':/general/general_live.png')
self.displayButton = QtGui.QPushButton(alertDialog) self.displayButton = create_button(alertDialog, u'displayButton',
self.displayButton.setEnabled(False) icon=displayIcon, enabled=False)
self.displayButton.setIcon(displayIcon) self.displayCloseButton = create_button(alertDialog,
self.displayButton.setObjectName(u'displayButton') u'displayCloseButton', icon=displayIcon, enabled=False)
self.buttonBox.addButton(self.displayButton, self.buttonBox = create_button_box(alertDialog, u'buttonBox',
QtGui.QDialogButtonBox.ActionRole) [u'close'], [self.displayButton, self.displayCloseButton])
self.displayCloseButton = QtGui.QPushButton(alertDialog)
self.displayCloseButton.setEnabled(False)
self.displayCloseButton.setIcon(displayIcon)
self.displayCloseButton.setObjectName(u'displayCloseButton')
self.buttonBox.addButton(self.displayCloseButton,
QtGui.QDialogButtonBox.ActionRole)
self.alertDialogLayout.addWidget(self.buttonBox, 2, 0, 1, 2) self.alertDialogLayout.addWidget(self.buttonBox, 2, 0, 1, 2)
self.retranslateUi(alertDialog) self.retranslateUi(alertDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
alertDialog.close)
QtCore.QMetaObject.connectSlotsByName(alertDialog)
def retranslateUi(self, alertDialog): def retranslateUi(self, alertDialog):
alertDialog.setWindowTitle( alertDialog.setWindowTitle(

View File

@ -29,7 +29,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import SettingsTab, translate, Receiver from openlp.core.lib import SettingsTab, translate, Receiver
from openlp.core.ui import AlertLocation from openlp.core.ui import AlertLocation
from openlp.core.lib.ui import UiStrings, create_valign_combo from openlp.core.lib.ui import UiStrings, create_valign_selection_widgets
class AlertsTab(SettingsTab): class AlertsTab(SettingsTab):
""" """
@ -76,7 +76,11 @@ class AlertsTab(SettingsTab):
self.timeoutSpinBox.setMaximum(180) self.timeoutSpinBox.setMaximum(180)
self.timeoutSpinBox.setObjectName(u'timeoutSpinBox') self.timeoutSpinBox.setObjectName(u'timeoutSpinBox')
self.fontLayout.addRow(self.timeoutLabel, self.timeoutSpinBox) self.fontLayout.addRow(self.timeoutLabel, self.timeoutSpinBox)
create_valign_combo(self, self.fontGroupBox, self.fontLayout) self.verticalLabel, self.verticalComboBox = \
create_valign_selection_widgets(self.fontGroupBox)
self.verticalLabel.setObjectName(u'verticalLabel')
self.verticalComboBox.setObjectName(u'verticalComboBox')
self.fontLayout.addRow(self.verticalLabel, self.verticalComboBox)
self.leftLayout.addWidget(self.fontGroupBox) self.leftLayout.addWidget(self.fontGroupBox)
self.leftLayout.addStretch() self.leftLayout.addStretch()
self.previewGroupBox = QtGui.QGroupBox(self.rightColumn) self.previewGroupBox = QtGui.QGroupBox(self.rightColumn)
@ -90,9 +94,9 @@ class AlertsTab(SettingsTab):
self.rightLayout.addStretch() self.rightLayout.addStretch()
# Signals and slots # Signals and slots
QtCore.QObject.connect(self.backgroundColorButton, QtCore.QObject.connect(self.backgroundColorButton,
QtCore.SIGNAL(u'pressed()'), self.onBackgroundColorButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onBackgroundColorButtonClicked)
QtCore.QObject.connect(self.fontColorButton, QtCore.QObject.connect(self.fontColorButton,
QtCore.SIGNAL(u'pressed()'), self.onFontColorButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onFontColorButtonClicked)
QtCore.QObject.connect(self.fontComboBox, QtCore.QObject.connect(self.fontComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onFontComboBoxClicked) QtCore.SIGNAL(u'activated(int)'), self.onFontComboBoxClicked)
QtCore.QObject.connect(self.timeoutSpinBox, QtCore.QObject.connect(self.timeoutSpinBox,

View File

@ -27,6 +27,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import create_button_box
class Ui_BookNameDialog(object): class Ui_BookNameDialog(object):
def setupUi(self, bookNameDialog): def setupUi(self, bookNameDialog):
@ -78,21 +79,11 @@ class Ui_BookNameDialog(object):
self.apocryphaCheckBox.setCheckState(QtCore.Qt.Checked) self.apocryphaCheckBox.setCheckState(QtCore.Qt.Checked)
self.optionsLayout.addWidget(self.apocryphaCheckBox) self.optionsLayout.addWidget(self.apocryphaCheckBox)
self.bookNameLayout.addWidget(self.optionsGroupBox) self.bookNameLayout.addWidget(self.optionsGroupBox)
self.buttonBox = QtGui.QDialogButtonBox(bookNameDialog) self.buttonBox = create_button_box(bookNameDialog, u'buttonBox',
self.buttonBox.setOrientation(QtCore.Qt.Horizontal) [u'cancel', u'ok'])
self.buttonBox.setStandardButtons(
QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(u'buttonBox')
self.bookNameLayout.addWidget(self.buttonBox) self.bookNameLayout.addWidget(self.buttonBox)
self.retranslateUi(bookNameDialog) self.retranslateUi(bookNameDialog)
QtCore.QObject.connect(
self.buttonBox, QtCore.SIGNAL(u'accepted()'),
bookNameDialog.accept)
QtCore.QObject.connect(
self.buttonBox, QtCore.SIGNAL(u'rejected()'),
bookNameDialog.reject)
QtCore.QMetaObject.connectSlotsByName(bookNameDialog)
def retranslateUi(self, bookNameDialog): def retranslateUi(self, bookNameDialog):
bookNameDialog.setWindowTitle(translate('BiblesPlugin.BookNameDialog', bookNameDialog.setWindowTitle(translate('BiblesPlugin.BookNameDialog',

View File

@ -27,6 +27,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import create_button_box
class Ui_LanguageDialog(object): class Ui_LanguageDialog(object):
def setupUi(self, languageDialog): def setupUi(self, languageDialog):
@ -60,18 +61,11 @@ class Ui_LanguageDialog(object):
self.languageComboBox.setObjectName(u'languageComboBox') self.languageComboBox.setObjectName(u'languageComboBox')
self.languageHBoxLayout.addWidget(self.languageComboBox) self.languageHBoxLayout.addWidget(self.languageComboBox)
self.languageLayout.addLayout(self.languageHBoxLayout) self.languageLayout.addLayout(self.languageHBoxLayout)
self.buttonBox = QtGui.QDialogButtonBox(languageDialog) self.buttonBox = create_button_box(languageDialog, u'buttonBox',
self.buttonBox.setOrientation(QtCore.Qt.Horizontal) [u'cancel', u'ok'])
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|
QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(u'buttonBox')
self.languageLayout.addWidget(self.buttonBox) self.languageLayout.addWidget(self.buttonBox)
self.retranslateUi(languageDialog) self.retranslateUi(languageDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'),
languageDialog.accept)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
languageDialog.reject)
def retranslateUi(self, languageDialog): def retranslateUi(self, languageDialog):
languageDialog.setWindowTitle( languageDialog.setWindowTitle(

View File

@ -368,37 +368,26 @@ def parse_reference(reference, bible, language_selection, book_ref_id=False):
if db_book: if db_book:
book_ref_id = db_book.book_reference_id book_ref_id = db_book.book_reference_id
elif language_selection == LanguageSelection.Application: elif language_selection == LanguageSelection.Application:
book_list = [] books = filter(lambda key:
for key, value in booknames.iteritems(): regex_book.match(unicode(booknames[key])), booknames.keys())
if regex_book.match(unicode(value)): books = filter(None, map(BiblesResourcesDB.get_book, books))
book_list.append(key) for value in books:
books = [] if bible.get_book_by_book_ref_id(value[u'id']):
if book_list: book_ref_id = value[u'id']
for value in book_list: break
item = BiblesResourcesDB.get_book(value)
if item:
books.append(item)
if books:
for value in books:
if bible.get_book_by_book_ref_id(value[u'id']):
book_ref_id = value[u'id']
break
elif language_selection == LanguageSelection.English: elif language_selection == LanguageSelection.English:
books = BiblesResourcesDB.get_books_like(book) books = BiblesResourcesDB.get_books_like(book)
if books: if books:
book_list = [] book_list = filter(
for value in books: lambda value: regex_book.match(value[u'name']), books)
if regex_book.match(value[u'name']):
book_list.append(value)
if not book_list: if not book_list:
book_list = books book_list = books
for value in book_list: for value in book_list:
if bible.get_book_by_book_ref_id(value[u'id']): if bible.get_book_by_book_ref_id(value[u'id']):
book_ref_id = value[u'id'] book_ref_id = value[u'id']
break break
else: elif bible.get_book_by_book_ref_id(book_ref_id):
if not bible.get_book_by_book_ref_id(book_ref_id): book_ref_id = False
book_ref_id = False
ranges = match.group(u'ranges') ranges = match.group(u'ranges')
range_list = get_reference_match(u'range_separator').split(ranges) range_list = get_reference_match(u'range_separator').split(ranges)
ref_list = [] ref_list = []

View File

@ -363,7 +363,7 @@ class CWExtract(object):
class HTTPBible(BibleDB): class HTTPBible(BibleDB):
log.info(u'%s HTTPBible loaded' , __name__) log.info(u'%s HTTPBible loaded', __name__)
def __init__(self, parent, **kwargs): def __init__(self, parent, **kwargs):
""" """

View File

@ -33,8 +33,8 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \ from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
translate, create_separated_list translate, create_separated_list
from openlp.core.lib.searchedit import SearchEdit from openlp.core.lib.searchedit import SearchEdit
from openlp.core.lib.ui import UiStrings, add_widget_completer, \ from openlp.core.lib.ui import UiStrings, set_case_insensitive_completer, \
media_item_combo_box, critical_error_message_box, \ create_horizontal_adjusting_combo_box, critical_error_message_box, \
find_and_set_in_combo_box, build_icon find_and_set_in_combo_box, build_icon
from openlp.plugins.bibles.forms import BibleImportForm, EditBibleForm from openlp.plugins.bibles.forms import BibleImportForm, EditBibleForm
from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, \ from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, \
@ -143,20 +143,22 @@ class BibleMediaItem(MediaManagerItem):
versionLabel = QtGui.QLabel(tab) versionLabel = QtGui.QLabel(tab)
versionLabel.setObjectName(prefix + u'VersionLabel') versionLabel.setObjectName(prefix + u'VersionLabel')
layout.addWidget(versionLabel, idx, 0, QtCore.Qt.AlignRight) layout.addWidget(versionLabel, idx, 0, QtCore.Qt.AlignRight)
versionComboBox = media_item_combo_box(tab, versionComboBox = create_horizontal_adjusting_combo_box(tab,
prefix + u'VersionComboBox') prefix + u'VersionComboBox')
versionLabel.setBuddy(versionComboBox) versionLabel.setBuddy(versionComboBox)
layout.addWidget(versionComboBox, idx, 1, 1, 2) layout.addWidget(versionComboBox, idx, 1, 1, 2)
secondLabel = QtGui.QLabel(tab) secondLabel = QtGui.QLabel(tab)
secondLabel.setObjectName(prefix + u'SecondLabel') secondLabel.setObjectName(prefix + u'SecondLabel')
layout.addWidget(secondLabel, idx + 1, 0, QtCore.Qt.AlignRight) layout.addWidget(secondLabel, idx + 1, 0, QtCore.Qt.AlignRight)
secondComboBox = media_item_combo_box(tab, prefix + u'SecondComboBox') secondComboBox = create_horizontal_adjusting_combo_box(
tab, prefix + u'SecondComboBox')
versionLabel.setBuddy(secondComboBox) versionLabel.setBuddy(secondComboBox)
layout.addWidget(secondComboBox, idx + 1, 1, 1, 2) layout.addWidget(secondComboBox, idx + 1, 1, 1, 2)
styleLabel = QtGui.QLabel(tab) styleLabel = QtGui.QLabel(tab)
styleLabel.setObjectName(prefix + u'StyleLabel') styleLabel.setObjectName(prefix + u'StyleLabel')
layout.addWidget(styleLabel, idx + 2, 0, QtCore.Qt.AlignRight) layout.addWidget(styleLabel, idx + 2, 0, QtCore.Qt.AlignRight)
styleComboBox = media_item_combo_box(tab, prefix + u'StyleComboBox') styleComboBox = create_horizontal_adjusting_combo_box(
tab, prefix + u'StyleComboBox')
styleComboBox.addItems([u'', u'', u'']) styleComboBox.addItems([u'', u'', u''])
layout.addWidget(styleComboBox, idx + 2, 1, 1, 2) layout.addWidget(styleComboBox, idx + 2, 1, 1, 2)
searchButtonLayout = QtGui.QHBoxLayout() searchButtonLayout = QtGui.QHBoxLayout()
@ -210,8 +212,8 @@ class BibleMediaItem(MediaManagerItem):
self.advancedBookLabel.setObjectName(u'advancedBookLabel') self.advancedBookLabel.setObjectName(u'advancedBookLabel')
self.advancedLayout.addWidget(self.advancedBookLabel, 0, 0, self.advancedLayout.addWidget(self.advancedBookLabel, 0, 0,
QtCore.Qt.AlignRight) QtCore.Qt.AlignRight)
self.advancedBookComboBox = media_item_combo_box(self.advancedTab, self.advancedBookComboBox = create_horizontal_adjusting_combo_box(
u'advancedBookComboBox') self.advancedTab, u'advancedBookComboBox')
self.advancedBookLabel.setBuddy(self.advancedBookComboBox) self.advancedBookLabel.setBuddy(self.advancedBookComboBox)
self.advancedLayout.addWidget(self.advancedBookComboBox, 0, 1, 1, 2) self.advancedLayout.addWidget(self.advancedBookComboBox, 0, 1, 1, 2)
self.advancedChapterLabel = QtGui.QLabel(self.advancedTab) self.advancedChapterLabel = QtGui.QLabel(self.advancedTab)
@ -270,9 +272,9 @@ class BibleMediaItem(MediaManagerItem):
self.onAdvancedStyleComboBoxChanged) self.onAdvancedStyleComboBoxChanged)
# Buttons # Buttons
QtCore.QObject.connect(self.advancedSearchButton, QtCore.QObject.connect(self.advancedSearchButton,
QtCore.SIGNAL(u'pressed()'), self.onAdvancedSearchButton) QtCore.SIGNAL(u'clicked()'), self.onAdvancedSearchButton)
QtCore.QObject.connect(self.quickSearchButton, QtCore.QObject.connect(self.quickSearchButton,
QtCore.SIGNAL(u'pressed()'), self.onQuickSearchButton) QtCore.SIGNAL(u'clicked()'), self.onQuickSearchButton)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'config_updated'), self.configUpdated) QtCore.SIGNAL(u'config_updated'), self.configUpdated)
# Other stuff # Other stuff
@ -531,7 +533,7 @@ class BibleMediaItem(MediaManagerItem):
book.book_reference_id) book.book_reference_id)
books.append(data[u'name'] + u' ') books.append(data[u'name'] + u' ')
books.sort(cmp=locale.strcoll) books.sort(cmp=locale.strcoll)
add_widget_completer(books, self.quickSearchEdit) set_case_insensitive_completer(books, self.quickSearchEdit)
def onQuickVersionComboBox(self): def onQuickVersionComboBox(self):
self.updateAutoCompleter() self.updateAutoCompleter()
@ -704,7 +706,7 @@ class BibleMediaItem(MediaManagerItem):
""" """
Does an advanced search and saves the search results. Does an advanced search and saves the search results.
""" """
log.debug(u'Advanced Search Button pressed') log.debug(u'Advanced Search Button clicked')
self.advancedSearchButton.setEnabled(False) self.advancedSearchButton.setEnabled(False)
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
bible = unicode(self.advancedVersionComboBox.currentText()) bible = unicode(self.advancedVersionComboBox.currentText())
@ -743,7 +745,7 @@ class BibleMediaItem(MediaManagerItem):
Does a quick search and saves the search results. Quick search can Does a quick search and saves the search results. Quick search can
either be "Reference Search" or "Text Search". either be "Reference Search" or "Text Search".
""" """
log.debug(u'Quick Search Button pressed') log.debug(u'Quick Search Button clicked')
self.quickSearchButton.setEnabled(False) self.quickSearchButton.setEnabled(False)
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
bible = unicode(self.quickVersionComboBox.currentText()) bible = unicode(self.quickVersionComboBox.currentText())

View File

@ -28,8 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate from openlp.core.lib import build_icon, translate
from openlp.core.lib.ui import UiStrings, create_accept_reject_button_box, \ from openlp.core.lib.ui import UiStrings, create_button_box, create_button
create_delete_push_button, create_up_down_push_button_set
class Ui_CustomEditDialog(object): class Ui_CustomEditDialog(object):
def setupUi(self, customEditDialog): def setupUi(self, customEditDialog):
@ -67,14 +66,16 @@ class Ui_CustomEditDialog(object):
self.editAllButton = QtGui.QPushButton(customEditDialog) self.editAllButton = QtGui.QPushButton(customEditDialog)
self.editAllButton.setObjectName(u'editAllButton') self.editAllButton.setObjectName(u'editAllButton')
self.buttonLayout.addWidget(self.editAllButton) self.buttonLayout.addWidget(self.editAllButton)
self.deleteButton = create_delete_push_button(customEditDialog) self.deleteButton = create_button(customEditDialog, u'deleteButton',
role=u'delete', click=customEditDialog.onDeleteButtonClicked)
self.deleteButton.setEnabled(False) self.deleteButton.setEnabled(False)
self.buttonLayout.addWidget(self.deleteButton) self.buttonLayout.addWidget(self.deleteButton)
self.buttonLayout.addStretch() self.buttonLayout.addStretch()
self.upButton, self.downButton = create_up_down_push_button_set( self.upButton = create_button(customEditDialog, u'upButton', role=u'up',
customEditDialog) enable=False, click=customEditDialog.onUpButtonClicked)
self.upButton.setEnabled(False) self.downButton = create_button(customEditDialog, u'downButton',
self.downButton.setEnabled(False) role=u'down', enable=False,
click=customEditDialog.onDownButtonClicked)
self.buttonLayout.addWidget(self.upButton) self.buttonLayout.addWidget(self.upButton)
self.buttonLayout.addWidget(self.downButton) self.buttonLayout.addWidget(self.downButton)
self.centralLayout.addLayout(self.buttonLayout) self.centralLayout.addLayout(self.buttonLayout)
@ -95,13 +96,11 @@ class Ui_CustomEditDialog(object):
self.creditLabel.setBuddy(self.creditEdit) self.creditLabel.setBuddy(self.creditEdit)
self.bottomFormLayout.addRow(self.creditLabel, self.creditEdit) self.bottomFormLayout.addRow(self.creditLabel, self.creditEdit)
self.dialogLayout.addLayout(self.bottomFormLayout) self.dialogLayout.addLayout(self.bottomFormLayout)
self.buttonBox = create_accept_reject_button_box(customEditDialog)
self.previewButton = QtGui.QPushButton() self.previewButton = QtGui.QPushButton()
self.buttonBox.addButton( self.buttonBox = create_button_box(customEditDialog, u'buttonBox',
self.previewButton, QtGui.QDialogButtonBox.ActionRole) [u'cancel', u'save'], [self.previewButton])
self.dialogLayout.addWidget(self.buttonBox) self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(customEditDialog) self.retranslateUi(customEditDialog)
QtCore.QMetaObject.connectSlotsByName(customEditDialog)
def retranslateUi(self, customEditDialog): def retranslateUi(self, customEditDialog):
customEditDialog.setWindowTitle( customEditDialog.setWindowTitle(

View File

@ -56,20 +56,20 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
self.editSlideForm = EditCustomSlideForm(self) self.editSlideForm = EditCustomSlideForm(self)
# Connecting signals and slots # Connecting signals and slots
QtCore.QObject.connect(self.previewButton, QtCore.QObject.connect(self.previewButton,
QtCore.SIGNAL(u'pressed()'), self.onPreviewButtonPressed) QtCore.SIGNAL(u'clicked()'), self.onPreviewButtonClicked)
QtCore.QObject.connect(self.addButton, QtCore.QObject.connect(self.addButton,
QtCore.SIGNAL(u'pressed()'), self.onAddButtonPressed) QtCore.SIGNAL(u'clicked()'), self.onAddButtonClicked)
QtCore.QObject.connect(self.editButton, QtCore.QObject.connect(self.editButton,
QtCore.SIGNAL(u'pressed()'), self.onEditButtonPressed) QtCore.SIGNAL(u'clicked()'), self.onEditButtonClicked)
QtCore.QObject.connect(self.editAllButton, QtCore.QObject.connect(self.editAllButton,
QtCore.SIGNAL(u'pressed()'), self.onEditAllButtonPressed) QtCore.SIGNAL(u'clicked()'), self.onEditAllButtonClicked)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'theme_update_list'), self.loadThemes) QtCore.SIGNAL(u'theme_update_list'), self.loadThemes)
QtCore.QObject.connect(self.slideListView, QtCore.QObject.connect(self.slideListView,
QtCore.SIGNAL(u'currentRowChanged(int)'), self.onCurrentRowChanged) QtCore.SIGNAL(u'currentRowChanged(int)'), self.onCurrentRowChanged)
QtCore.QObject.connect(self.slideListView, QtCore.QObject.connect(self.slideListView,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
self.onEditButtonPressed) self.onEditButtonClicked)
def loadThemes(self, themelist): def loadThemes(self, themelist):
self.themeComboBox.clear() self.themeComboBox.clear()
@ -154,18 +154,18 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
self.slideListView.insertItem(selectedRow + 1, qw) self.slideListView.insertItem(selectedRow + 1, qw)
self.slideListView.setCurrentRow(selectedRow + 1) self.slideListView.setCurrentRow(selectedRow + 1)
def onAddButtonPressed(self): def onAddButtonClicked(self):
self.editSlideForm.setText(u'') self.editSlideForm.setText(u'')
if self.editSlideForm.exec_(): if self.editSlideForm.exec_():
for slide in self.editSlideForm.getText(): for slide in self.editSlideForm.getText():
self.slideListView.addItem(slide) self.slideListView.addItem(slide)
def onEditButtonPressed(self): def onEditButtonClicked(self):
self.editSlideForm.setText(self.slideListView.currentItem().text()) self.editSlideForm.setText(self.slideListView.currentItem().text())
if self.editSlideForm.exec_(): if self.editSlideForm.exec_():
self.updateSlideList(self.editSlideForm.getText()) self.updateSlideList(self.editSlideForm.getText())
def onEditAllButtonPressed(self): def onEditAllButtonClicked(self):
""" """
Edits all slides. Edits all slides.
""" """
@ -179,7 +179,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
if self.editSlideForm.exec_(): if self.editSlideForm.exec_():
self.updateSlideList(self.editSlideForm.getText(), True) self.updateSlideList(self.editSlideForm.getText(), True)
def onPreviewButtonPressed(self): def onPreviewButtonClicked(self):
""" """
Save the custom item and preview it. Save the custom item and preview it.
""" """

View File

@ -28,7 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate, SpellTextEdit, build_icon from openlp.core.lib import translate, SpellTextEdit, build_icon
from openlp.core.lib.ui import create_accept_reject_button_box, UiStrings from openlp.core.lib.ui import UiStrings, create_button, create_button_box
class Ui_CustomSlideEditDialog(object): class Ui_CustomSlideEditDialog(object):
def setupUi(self, customSlideEditDialog): def setupUi(self, customSlideEditDialog):
@ -38,20 +38,14 @@ class Ui_CustomSlideEditDialog(object):
self.slideTextEdit = SpellTextEdit(self) self.slideTextEdit = SpellTextEdit(self)
self.slideTextEdit.setObjectName(u'slideTextEdit') self.slideTextEdit.setObjectName(u'slideTextEdit')
self.dialogLayout.addWidget(self.slideTextEdit) self.dialogLayout.addWidget(self.slideTextEdit)
self.buttonBox = create_accept_reject_button_box(customSlideEditDialog) self.splitButton = create_button(customSlideEditDialog, u'splitButton',
self.splitButton = QtGui.QPushButton(customSlideEditDialog) icon=u':/general/general_add.png')
self.splitButton.setIcon(build_icon(u':/general/general_add.png')) self.insertButton = create_button(customSlideEditDialog,
self.splitButton.setObjectName(u'splitButton') u'insertButton', icon=u':/general/general_add.png')
self.buttonBox.addButton(self.splitButton, self.buttonBox = create_button_box(customSlideEditDialog, u'buttonBox',
QtGui.QDialogButtonBox.ActionRole) [u'cancel', u'save'], [self.splitButton, self.insertButton])
self.insertButton = QtGui.QPushButton(customSlideEditDialog)
self.insertButton.setIcon(build_icon(u':/general/general_add.png'))
self.insertButton.setObjectName(u'insertButton')
self.buttonBox.addButton(self.insertButton,
QtGui.QDialogButtonBox.ActionRole)
self.dialogLayout.addWidget(self.buttonBox) self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(customSlideEditDialog) self.retranslateUi(customSlideEditDialog)
QtCore.QMetaObject.connectSlotsByName(customSlideEditDialog)
def retranslateUi(self, customSlideEditDialog): def retranslateUi(self, customSlideEditDialog):
self.splitButton.setText(UiStrings().Split) self.splitButton.setText(UiStrings().Split)

View File

@ -46,9 +46,9 @@ class EditCustomSlideForm(QtGui.QDialog, Ui_CustomSlideEditDialog):
self.setupUi(self) self.setupUi(self)
# Connecting signals and slots # Connecting signals and slots
QtCore.QObject.connect(self.insertButton, QtCore.QObject.connect(self.insertButton,
QtCore.SIGNAL(u'clicked()'), self.onInsertButtonPressed) QtCore.SIGNAL(u'clicked()'), self.onInsertButtonClicked)
QtCore.QObject.connect(self.splitButton, QtCore.QObject.connect(self.splitButton,
QtCore.SIGNAL(u'clicked()'), self.onSplitButtonPressed) QtCore.SIGNAL(u'clicked()'), self.onSplitButtonClicked)
def setText(self, text): def setText(self, text):
""" """
@ -68,14 +68,14 @@ class EditCustomSlideForm(QtGui.QDialog, Ui_CustomSlideEditDialog):
""" """
return self.slideTextEdit.toPlainText().split(u'\n[===]\n') return self.slideTextEdit.toPlainText().split(u'\n[===]\n')
def onInsertButtonPressed(self): def onInsertButtonClicked(self):
""" """
Adds a slide split at the cursor. Adds a slide split at the cursor.
""" """
self.insertSingleLineTextAtCursor(u'[===]') self.insertSingleLineTextAtCursor(u'[===]')
self.slideTextEdit.setFocus() self.slideTextEdit.setFocus()
def onSplitButtonPressed(self): def onSplitButtonClicked(self):
""" """
Adds a virtual split at cursor. Adds a virtual split at cursor.
""" """

View File

@ -75,7 +75,7 @@ class CustomMediaItem(MediaManagerItem):
QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick) QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick)
QtCore.QObject.connect(self.searchTextEdit, QtCore.QObject.connect(self.searchTextEdit,
QtCore.SIGNAL(u'searchTypeChanged(int)'), QtCore.SIGNAL(u'searchTypeChanged(int)'),
self.onSearchTextButtonClick) self.onSearchTextButtonClicked)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'custom_edit'), self.onRemoteEdit) QtCore.SIGNAL(u'custom_edit'), self.onRemoteEdit)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
@ -154,7 +154,7 @@ class CustomMediaItem(MediaManagerItem):
self.edit_custom_form.loadCustom(custom_id, (remote_type == u'P')) self.edit_custom_form.loadCustom(custom_id, (remote_type == u'P'))
self.edit_custom_form.exec_() self.edit_custom_form.exec_()
self.autoSelectId = -1 self.autoSelectId = -1
self.onSearchTextButtonClick() self.onSearchTextButtonClicked()
def onEditClick(self): def onEditClick(self):
""" """
@ -166,7 +166,7 @@ class CustomMediaItem(MediaManagerItem):
self.edit_custom_form.loadCustom(item_id, False) self.edit_custom_form.loadCustom(item_id, False)
self.edit_custom_form.exec_() self.edit_custom_form.exec_()
self.autoSelectId = -1 self.autoSelectId = -1
self.onSearchTextButtonClick() self.onSearchTextButtonClicked()
def onDeleteClick(self): def onDeleteClick(self):
""" """
@ -190,7 +190,7 @@ class CustomMediaItem(MediaManagerItem):
for item in self.listView.selectedIndexes()] for item in self.listView.selectedIndexes()]
for id in id_list: for id in id_list:
self.plugin.manager.delete_object(CustomSlide, id) self.plugin.manager.delete_object(CustomSlide, id)
self.onSearchTextButtonClick() self.onSearchTextButtonClicked()
def onFocus(self): def onFocus(self):
self.searchTextEdit.setFocus() self.searchTextEdit.setFocus()
@ -226,7 +226,7 @@ class CustomMediaItem(MediaManagerItem):
service_item.raw_footer = raw_footer service_item.raw_footer = raw_footer
return True return True
def onSearchTextButtonClick(self): def onSearchTextButtonClicked(self):
# Save the current search type to the configuration. # Save the current search type to the configuration.
QtCore.QSettings().setValue(u'%s/last search type' % QtCore.QSettings().setValue(u'%s/last search type' %
self.settingsSection, self.settingsSection,
@ -257,7 +257,7 @@ class CustomMediaItem(MediaManagerItem):
""" """
search_length = 2 search_length = 2
if len(text) > search_length: if len(text) > search_length:
self.onSearchTextButtonClick() self.onSearchTextButtonClicked()
elif len(text) == 0: elif len(text) == 0:
self.onClearTextButtonClick() self.onClearTextButtonClick()
@ -266,7 +266,7 @@ class CustomMediaItem(MediaManagerItem):
Clear the search text. Clear the search text.
""" """
self.searchTextEdit.clear() self.searchTextEdit.clear()
self.onSearchTextButtonClick() self.onSearchTextButtonClicked()
def search(self, string, showError): def search(self, string, showError):
search_results = self.manager.get_all_objects(CustomSlide, search_results = self.manager.get_all_objects(CustomSlide,

View File

@ -62,7 +62,7 @@ class ImageTab(SettingsTab):
self.rightLayout.addStretch() self.rightLayout.addStretch()
# Signals and slots # Signals and slots
QtCore.QObject.connect(self.backgroundColorButton, QtCore.QObject.connect(self.backgroundColorButton,
QtCore.SIGNAL(u'pressed()'), self.onbackgroundColorButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onbackgroundColorButtonClicked)
def retranslateUi(self): def retranslateUi(self):
self.bgColorGroupBox.setTitle( self.bgColorGroupBox.setTitle(

View File

@ -35,7 +35,7 @@ from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \
SettingsManager, translate, check_item_selected, Receiver, MediaType, \ SettingsManager, translate, check_item_selected, Receiver, MediaType, \
ServiceItem, build_html ServiceItem, build_html
from openlp.core.lib.ui import UiStrings, critical_error_message_box, \ from openlp.core.lib.ui import UiStrings, critical_error_message_box, \
media_item_combo_box create_horizontal_adjusting_combo_box
from openlp.core.ui import Controller, Display from openlp.core.ui import Controller, Display
from openlp.core.ui.media import get_media_players, set_media_players from openlp.core.ui.media import get_media_players, set_media_players
@ -131,7 +131,7 @@ class MediaMediaItem(MediaManagerItem):
self.displayLayout.setObjectName(u'displayLayout') self.displayLayout.setObjectName(u'displayLayout')
self.displayTypeLabel = QtGui.QLabel(self.mediaWidget) self.displayTypeLabel = QtGui.QLabel(self.mediaWidget)
self.displayTypeLabel.setObjectName(u'displayTypeLabel') self.displayTypeLabel.setObjectName(u'displayTypeLabel')
self.displayTypeComboBox = media_item_combo_box( self.displayTypeComboBox = create_horizontal_adjusting_combo_box(
self.mediaWidget, u'displayTypeComboBox') self.mediaWidget, u'displayTypeComboBox')
self.displayTypeLabel.setBuddy(self.displayTypeComboBox) self.displayTypeLabel.setBuddy(self.displayTypeComboBox)
self.displayLayout.addRow(self.displayTypeLabel, self.displayLayout.addRow(self.displayTypeLabel,

View File

@ -28,7 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import SettingsTab, translate, Receiver from openlp.core.lib import SettingsTab, translate, Receiver
from openlp.core.lib.ui import UiStrings, create_up_down_push_button_set from openlp.core.lib.ui import UiStrings, create_button
from openlp.core.ui.media import get_media_players, set_media_players from openlp.core.ui.media import get_media_players, set_media_players
class MediaQCheckBox(QtGui.QCheckBox): class MediaQCheckBox(QtGui.QCheckBox):
""" """
@ -87,8 +87,10 @@ class MediaTab(SettingsTab):
self.orderingButtonLayout = QtGui.QVBoxLayout() self.orderingButtonLayout = QtGui.QVBoxLayout()
self.orderingButtonLayout.setObjectName(u'orderingButtonLayout') self.orderingButtonLayout.setObjectName(u'orderingButtonLayout')
self.orderingButtonLayout.addStretch(1) self.orderingButtonLayout.addStretch(1)
self.orderingUpButton, self.orderingDownButton = \ self.orderingUpButton = create_button(self, u'orderingUpButton',
create_up_down_push_button_set(self) role=u'up', click=self.onUpButtonClicked)
self.orderingDownButton = create_button(self, u'orderingDownButton',
role=u'down', click=self.onDownButtonClicked)
self.orderingButtonLayout.addWidget(self.orderingUpButton) self.orderingButtonLayout.addWidget(self.orderingUpButton)
self.orderingButtonLayout.addWidget(self.orderingDownButton) self.orderingButtonLayout.addWidget(self.orderingDownButton)
self.orderingButtonLayout.addStretch(1) self.orderingButtonLayout.addStretch(1)

View File

@ -35,7 +35,7 @@ from openlp.core.lib import MediaManagerItem, build_icon, SettingsManager, \
translate, check_item_selected, Receiver, ItemCapabilities, create_thumb, \ translate, check_item_selected, Receiver, ItemCapabilities, create_thumb, \
validate_thumb validate_thumb
from openlp.core.lib.ui import UiStrings, critical_error_message_box, \ from openlp.core.lib.ui import UiStrings, critical_error_message_box, \
media_item_combo_box create_horizontal_adjusting_combo_box
from openlp.plugins.presentations.lib import MessageListener from openlp.plugins.presentations.lib import MessageListener
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -110,7 +110,7 @@ class PresentationMediaItem(MediaManagerItem):
self.displayLayout.setObjectName(u'displayLayout') self.displayLayout.setObjectName(u'displayLayout')
self.displayTypeLabel = QtGui.QLabel(self.presentationWidget) self.displayTypeLabel = QtGui.QLabel(self.presentationWidget)
self.displayTypeLabel.setObjectName(u'displayTypeLabel') self.displayTypeLabel.setObjectName(u'displayTypeLabel')
self.displayTypeComboBox = media_item_combo_box( self.displayTypeComboBox = create_horizontal_adjusting_combo_box(
self.presentationWidget, u'displayTypeComboBox') self.presentationWidget, u'displayTypeComboBox')
self.displayTypeLabel.setBuddy(self.displayTypeComboBox) self.displayTypeLabel.setBuddy(self.displayTypeComboBox)
self.displayLayout.addRow(self.displayTypeLabel, self.displayLayout.addRow(self.displayTypeLabel,

View File

@ -28,7 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import create_accept_reject_button_box from openlp.core.lib.ui import create_button_box
class Ui_AuthorsDialog(object): class Ui_AuthorsDialog(object):
def setupUi(self, authorsDialog): def setupUi(self, authorsDialog):
@ -57,11 +57,11 @@ class Ui_AuthorsDialog(object):
self.displayLabel.setBuddy(self.displayEdit) self.displayLabel.setBuddy(self.displayEdit)
self.authorLayout.addRow(self.displayLabel, self.displayEdit) self.authorLayout.addRow(self.displayLabel, self.displayEdit)
self.dialogLayout.addLayout(self.authorLayout) self.dialogLayout.addLayout(self.authorLayout)
self.dialogLayout.addWidget( self.buttonBox = create_button_box(authorsDialog, u'buttonBox',
create_accept_reject_button_box(authorsDialog)) [u'cancel', u'save'])
self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(authorsDialog) self.retranslateUi(authorsDialog)
authorsDialog.setMaximumHeight(authorsDialog.sizeHint().height()) authorsDialog.setMaximumHeight(authorsDialog.sizeHint().height())
QtCore.QMetaObject.connectSlotsByName(authorsDialog)
def retranslateUi(self, authorsDialog): def retranslateUi(self, authorsDialog):
authorsDialog.setWindowTitle( authorsDialog.setWindowTitle(

View File

@ -28,8 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate from openlp.core.lib import build_icon, translate
from openlp.core.lib.ui import UiStrings, create_accept_reject_button_box, \ from openlp.core.lib.ui import UiStrings, create_button_box, create_button
create_up_down_push_button_set
from openlp.plugins.songs.lib.ui import SongStrings from openlp.plugins.songs.lib.ui import SongStrings
class Ui_EditSongDialog(object): class Ui_EditSongDialog(object):
@ -268,8 +267,10 @@ class Ui_EditSongDialog(object):
self.audioRemoveAllButton.setObjectName(u'audioRemoveAllButton') self.audioRemoveAllButton.setObjectName(u'audioRemoveAllButton')
self.audioButtonsLayout.addWidget(self.audioRemoveAllButton) self.audioButtonsLayout.addWidget(self.audioRemoveAllButton)
self.audioButtonsLayout.addStretch(1) self.audioButtonsLayout.addStretch(1)
self.upButton, self.downButton = \ self.upButton = create_button(self, u'upButton', role=u'up',
create_up_down_push_button_set(self) click=self.onUpButtonClicked)
self.downButton = create_button(self, u'downButton', role=u'down',
click=self.onDownButtonClicked)
self.audioButtonsLayout.addWidget(self.upButton) self.audioButtonsLayout.addWidget(self.upButton)
self.audioButtonsLayout.addWidget(self.downButton) self.audioButtonsLayout.addWidget(self.downButton)
self.audioLayout.addLayout(self.audioButtonsLayout) self.audioLayout.addLayout(self.audioButtonsLayout)
@ -282,11 +283,11 @@ class Ui_EditSongDialog(object):
self.warningLabel.setObjectName(u'warningLabel') self.warningLabel.setObjectName(u'warningLabel')
self.warningLabel.setVisible(False) self.warningLabel.setVisible(False)
self.bottomLayout.addWidget(self.warningLabel) self.bottomLayout.addWidget(self.warningLabel)
self.buttonBox = create_accept_reject_button_box(editSongDialog) self.buttonBox = create_button_box(editSongDialog, u'buttonBox',
[u'cancel', u'save'])
self.bottomLayout.addWidget(self.buttonBox) self.bottomLayout.addWidget(self.buttonBox)
self.dialogLayout.addLayout(self.bottomLayout) self.dialogLayout.addLayout(self.bottomLayout)
self.retranslateUi(editSongDialog) self.retranslateUi(editSongDialog)
QtCore.QMetaObject.connectSlotsByName(editSongDialog)
def retranslateUi(self, editSongDialog): def retranslateUi(self, editSongDialog):
editSongDialog.setWindowTitle( editSongDialog.setWindowTitle(

View File

@ -34,7 +34,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import PluginStatus, Receiver, MediaType, translate, \ from openlp.core.lib import PluginStatus, Receiver, MediaType, translate, \
create_separated_list create_separated_list
from openlp.core.lib.ui import UiStrings, add_widget_completer, \ from openlp.core.lib.ui import UiStrings, set_case_insensitive_completer, \
critical_error_message_box, find_and_set_in_combo_box critical_error_message_box, find_and_set_in_combo_box
from openlp.core.utils import AppLocation from openlp.core.utils import AppLocation
from openlp.plugins.songs.forms import EditVerseForm, MediaFilesForm from openlp.plugins.songs.forms import EditVerseForm, MediaFilesForm
@ -68,14 +68,14 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
QtCore.SIGNAL(u'clicked()'), self.onAuthorRemoveButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onAuthorRemoveButtonClicked)
QtCore.QObject.connect(self.authorsListView, QtCore.QObject.connect(self.authorsListView,
QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'), QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'),
self.onAuthorsListViewPressed) self.onAuthorsListViewClicked)
QtCore.QObject.connect(self.topicAddButton, QtCore.QObject.connect(self.topicAddButton,
QtCore.SIGNAL(u'clicked()'), self.onTopicAddButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onTopicAddButtonClicked)
QtCore.QObject.connect(self.topicRemoveButton, QtCore.QObject.connect(self.topicRemoveButton,
QtCore.SIGNAL(u'clicked()'), self.onTopicRemoveButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onTopicRemoveButtonClicked)
QtCore.QObject.connect(self.topicsListView, QtCore.QObject.connect(self.topicsListView,
QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'), QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'),
self.onTopicListViewPressed) self.onTopicListViewClicked)
QtCore.QObject.connect(self.copyrightInsertButton, QtCore.QObject.connect(self.copyrightInsertButton,
QtCore.SIGNAL(u'clicked()'), self.onCopyrightInsertButtonTriggered) QtCore.SIGNAL(u'clicked()'), self.onCopyrightInsertButtonTriggered)
QtCore.QObject.connect(self.verseAddButton, QtCore.QObject.connect(self.verseAddButton,
@ -91,7 +91,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
QtCore.SIGNAL(u'clicked()'), self.onVerseDeleteButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onVerseDeleteButtonClicked)
QtCore.QObject.connect(self.verseListWidget, QtCore.QObject.connect(self.verseListWidget,
QtCore.SIGNAL(u'itemClicked(QTableWidgetItem*)'), QtCore.SIGNAL(u'itemClicked(QTableWidgetItem*)'),
self.onVerseListViewPressed) self.onVerseListViewClicked)
QtCore.QObject.connect(self.verseOrderEdit, QtCore.QObject.connect(self.verseOrderEdit,
QtCore.SIGNAL(u'textChanged(QString)'), QtCore.SIGNAL(u'textChanged(QString)'),
self.onVerseOrderTextChanged) self.onVerseOrderTextChanged)
@ -148,7 +148,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.authorsComboBox.setItemData( self.authorsComboBox.setItemData(
row, QtCore.QVariant(author.id)) row, QtCore.QVariant(author.id))
self.authors.append(author.display_name) self.authors.append(author.display_name)
add_widget_completer(self.authors, self.authorsComboBox) set_case_insensitive_completer(self.authors, self.authorsComboBox)
def loadTopics(self): def loadTopics(self):
self.topics = [] self.topics = []
@ -167,7 +167,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
combo.addItem(object.name) combo.addItem(object.name)
cache.append(object.name) cache.append(object.name)
combo.setItemData(row, QtCore.QVariant(object.id)) combo.setItemData(row, QtCore.QVariant(object.id))
add_widget_completer(cache, combo) set_case_insensitive_completer(cache, combo)
def loadThemes(self, theme_list): def loadThemes(self, theme_list):
self.themeComboBox.clear() self.themeComboBox.clear()
@ -176,7 +176,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
for theme in theme_list: for theme in theme_list:
self.themeComboBox.addItem(theme) self.themeComboBox.addItem(theme)
self.themes.append(theme) self.themes.append(theme)
add_widget_completer(self.themes, self.themeComboBox) set_case_insensitive_completer(self.themes, self.themeComboBox)
def loadMediaFiles(self): def loadMediaFiles(self):
self.audioAddFromMediaButton.setVisible(False) self.audioAddFromMediaButton.setVisible(False)
@ -399,7 +399,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
author_item.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id)) author_item.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id))
self.authorsListView.addItem(author_item) self.authorsListView.addItem(author_item)
def onAuthorsListViewPressed(self): def onAuthorsListViewClicked(self):
if self.authorsListView.count() > 1: if self.authorsListView.count() > 1:
self.authorRemoveButton.setEnabled(True) self.authorRemoveButton.setEnabled(True)
@ -450,7 +450,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
'type in a new topic and click the "Add Topic to Song" ' 'type in a new topic and click the "Add Topic to Song" '
'button to add the new topic.')) 'button to add the new topic.'))
def onTopicListViewPressed(self): def onTopicListViewClicked(self):
self.topicRemoveButton.setEnabled(True) self.topicRemoveButton.setEnabled(True)
def onTopicRemoveButtonClicked(self): def onTopicRemoveButtonClicked(self):
@ -459,7 +459,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
row = self.topicsListView.row(item) row = self.topicsListView.row(item)
self.topicsListView.takeItem(row) self.topicsListView.takeItem(row)
def onVerseListViewPressed(self): def onVerseListViewClicked(self):
self.verseEditButton.setEnabled(True) self.verseEditButton.setEnabled(True)
self.verseDeleteButton.setEnabled(True) self.verseDeleteButton.setEnabled(True)
@ -716,7 +716,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def onPreview(self, button): def onPreview(self, button):
""" """
Save and Preview button pressed. Save and Preview button clicked.
The Song is valid so as the plugin to add it to preview to see. The Song is valid so as the plugin to add it to preview to see.
``button`` ``button``

View File

@ -28,7 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate, SpellTextEdit from openlp.core.lib import build_icon, translate, SpellTextEdit
from openlp.core.lib.ui import create_accept_reject_button_box, UiStrings from openlp.core.lib.ui import create_button_box, UiStrings
from openlp.plugins.songs.lib import VerseType from openlp.plugins.songs.lib import VerseType
class Ui_EditVerseDialog(object): class Ui_EditVerseDialog(object):
@ -65,10 +65,10 @@ class Ui_EditVerseDialog(object):
self.verseTypeLayout.addWidget(self.insertButton) self.verseTypeLayout.addWidget(self.insertButton)
self.verseTypeLayout.addStretch() self.verseTypeLayout.addStretch()
self.dialogLayout.addLayout(self.verseTypeLayout) self.dialogLayout.addLayout(self.verseTypeLayout)
self.dialogLayout.addWidget( self.buttonBox = create_button_box(editVerseDialog, u'buttonBox',
create_accept_reject_button_box(editVerseDialog)) [u'cancel', u'save'])
self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(editVerseDialog) self.retranslateUi(editVerseDialog)
QtCore.QMetaObject.connectSlotsByName(editVerseDialog)
def retranslateUi(self, editVerseDialog): def retranslateUi(self, editVerseDialog):
editVerseDialog.setWindowTitle( editVerseDialog.setWindowTitle(

View File

@ -28,6 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate, build_icon from openlp.core.lib import translate, build_icon
from openlp.core.lib.ui import create_button_box
class Ui_MediaFilesDialog(object): class Ui_MediaFilesDialog(object):
def setupUi(self, mediaFilesDialog): def setupUi(self, mediaFilesDialog):
@ -51,19 +52,11 @@ class Ui_MediaFilesDialog(object):
QtGui.QAbstractItemView.ExtendedSelection) QtGui.QAbstractItemView.ExtendedSelection)
self.fileListWidget.setObjectName(u'fileListWidget') self.fileListWidget.setObjectName(u'fileListWidget')
self.filesVerticalLayout.addWidget(self.fileListWidget) self.filesVerticalLayout.addWidget(self.fileListWidget)
self.buttonBox = QtGui.QDialogButtonBox(mediaFilesDialog) self.buttonBox = create_button_box(mediaFilesDialog, u'buttonBox',
self.buttonBox.setOrientation(QtCore.Qt.Horizontal) [u'cancel', u'ok'])
self.buttonBox.setStandardButtons(
QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok)
self.buttonBox.setObjectName(u'buttonBox')
self.filesVerticalLayout.addWidget(self.buttonBox) self.filesVerticalLayout.addWidget(self.buttonBox)
self.retranslateUi(mediaFilesDialog) self.retranslateUi(mediaFilesDialog)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'accepted()'), mediaFilesDialog.accept)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'rejected()'), mediaFilesDialog.reject)
QtCore.QMetaObject.connectSlotsByName(mediaFilesDialog)
def retranslateUi(self, mediaFilesDialog): def retranslateUi(self, mediaFilesDialog):
mediaFilesDialog.setWindowTitle( mediaFilesDialog.setWindowTitle(

View File

@ -28,7 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import create_accept_reject_button_box from openlp.core.lib.ui import create_button_box
class Ui_SongBookDialog(object): class Ui_SongBookDialog(object):
def setupUi(self, songBookDialog): def setupUi(self, songBookDialog):
@ -51,11 +51,11 @@ class Ui_SongBookDialog(object):
self.publisherLabel.setBuddy(self.publisherEdit) self.publisherLabel.setBuddy(self.publisherEdit)
self.bookLayout.addRow(self.publisherLabel, self.publisherEdit) self.bookLayout.addRow(self.publisherLabel, self.publisherEdit)
self.dialogLayout.addLayout(self.bookLayout) self.dialogLayout.addLayout(self.bookLayout)
self.dialogLayout.addWidget( self.buttonBox = create_button_box(songBookDialog, u'buttonBox',
create_accept_reject_button_box(songBookDialog)) [u'cancel', u'save'])
self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(songBookDialog) self.retranslateUi(songBookDialog)
songBookDialog.setMaximumHeight(songBookDialog.sizeHint().height()) songBookDialog.setMaximumHeight(songBookDialog.sizeHint().height())
QtCore.QMetaObject.connectSlotsByName(songBookDialog)
def retranslateUi(self, songBookDialog): def retranslateUi(self, songBookDialog):
songBookDialog.setWindowTitle( songBookDialog.setWindowTitle(

View File

@ -90,7 +90,7 @@ class SongExportForm(OpenLPWizard):
""" """
QtCore.QObject.connect(self.availableListWidget, QtCore.QObject.connect(self.availableListWidget,
QtCore.SIGNAL(u'itemActivated(QListWidgetItem*)'), QtCore.SIGNAL(u'itemActivated(QListWidgetItem*)'),
self.onItemPressed) self.onItemActivated)
QtCore.QObject.connect(self.searchLineEdit, QtCore.QObject.connect(self.searchLineEdit,
QtCore.SIGNAL(u'textEdited(const QString&)'), QtCore.SIGNAL(u'textEdited(const QString&)'),
self.onSearchLineEditChanged) self.onSearchLineEditChanged)
@ -312,14 +312,14 @@ class SongExportForm(OpenLPWizard):
QtCore.QString(unicode(text)), QtCore.Qt.MatchContains) QtCore.QString(unicode(text)), QtCore.Qt.MatchContains)
] ]
def onItemPressed(self, item): def onItemActivated(self, item):
""" """
Called, when an item in the *availableListWidget* has been pressed. Thes Called, when an item in the *availableListWidget* has been triggered.
item is check if it was not checked, whereas it is unchecked when it was The item is check if it was not checked, whereas it is unchecked when it
checked. was checked.
``item`` ``item``
The *QListWidgetItem* which was pressed. The *QListWidgetItem* which was triggered.
""" """
item.setCheckState( item.setCheckState(
QtCore.Qt.Unchecked if item.checkState() else QtCore.Qt.Checked) QtCore.Qt.Unchecked if item.checkState() else QtCore.Qt.Checked)

View File

@ -28,7 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon from openlp.core.lib import build_icon
from openlp.core.lib.ui import UiStrings from openlp.core.lib.ui import UiStrings, create_button_box
from openlp.plugins.songs.lib.ui import SongStrings from openlp.plugins.songs.lib.ui import SongStrings
class Ui_SongMaintenanceDialog(object): class Ui_SongMaintenanceDialog(object):
@ -132,18 +132,14 @@ class Ui_SongMaintenanceDialog(object):
self.stackedLayout.addWidget(self.booksPage) self.stackedLayout.addWidget(self.booksPage)
# #
self.dialogLayout.addLayout(self.stackedLayout, 0, 1) self.dialogLayout.addLayout(self.stackedLayout, 0, 1)
self.buttonBox = QtGui.QDialogButtonBox(songMaintenanceDialog) self.buttonBox = create_button_box(songMaintenanceDialog, u'buttonBox',
self.buttonBox.addButton(QtGui.QDialogButtonBox.Close) [u'close'])
self.buttonBox.setObjectName(u'buttonBox')
self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2) self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2)
self.retranslateUi(songMaintenanceDialog) self.retranslateUi(songMaintenanceDialog)
self.stackedLayout.setCurrentIndex(0) self.stackedLayout.setCurrentIndex(0)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
songMaintenanceDialog.accept)
QtCore.QObject.connect(self.typeListWidget, QtCore.QObject.connect(self.typeListWidget,
QtCore.SIGNAL(u'currentRowChanged(int)'), QtCore.SIGNAL(u'currentRowChanged(int)'),
self.stackedLayout.setCurrentIndex) self.stackedLayout.setCurrentIndex)
QtCore.QMetaObject.connectSlotsByName(songMaintenanceDialog)
def retranslateUi(self, songMaintenanceDialog): def retranslateUi(self, songMaintenanceDialog):
songMaintenanceDialog.setWindowTitle(SongStrings.SongMaintenance) songMaintenanceDialog.setWindowTitle(SongStrings.SongMaintenance)

View File

@ -60,23 +60,23 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.booksEditButton.setEnabled(False) self.booksEditButton.setEnabled(False)
# Signals # Signals
QtCore.QObject.connect(self.authorsAddButton, QtCore.QObject.connect(self.authorsAddButton,
QtCore.SIGNAL(u'pressed()'), self.onAuthorAddButtonClick) QtCore.SIGNAL(u'clicked()'), self.onAuthorAddButtonClicked)
QtCore.QObject.connect(self.topicsAddButton, QtCore.QObject.connect(self.topicsAddButton,
QtCore.SIGNAL(u'pressed()'), self.onTopicAddButtonClick) QtCore.SIGNAL(u'clicked()'), self.onTopicAddButtonClicked)
QtCore.QObject.connect(self.booksAddButton, QtCore.QObject.connect(self.booksAddButton,
QtCore.SIGNAL(u'pressed()'), self.onBookAddButtonClick) QtCore.SIGNAL(u'clicked()'), self.onBookAddButtonClicked)
QtCore.QObject.connect(self.authorsEditButton, QtCore.QObject.connect(self.authorsEditButton,
QtCore.SIGNAL(u'pressed()'), self.onAuthorEditButtonClick) QtCore.SIGNAL(u'clicked()'), self.onAuthorEditButtonClicked)
QtCore.QObject.connect(self.topicsEditButton, QtCore.QObject.connect(self.topicsEditButton,
QtCore.SIGNAL(u'pressed()'), self.onTopicEditButtonClick) QtCore.SIGNAL(u'clicked()'), self.onTopicEditButtonClicked)
QtCore.QObject.connect(self.booksEditButton, QtCore.QObject.connect(self.booksEditButton,
QtCore.SIGNAL(u'pressed()'), self.onBookEditButtonClick) QtCore.SIGNAL(u'clicked()'), self.onBookEditButtonClicked)
QtCore.QObject.connect(self.authorsDeleteButton, QtCore.QObject.connect(self.authorsDeleteButton,
QtCore.SIGNAL(u'pressed()'), self.onAuthorDeleteButtonClick) QtCore.SIGNAL(u'clicked()'), self.onAuthorDeleteButtonClicked)
QtCore.QObject.connect(self.topicsDeleteButton, QtCore.QObject.connect(self.topicsDeleteButton,
QtCore.SIGNAL(u'pressed()'), self.onTopicDeleteButtonClick) QtCore.SIGNAL(u'clicked()'), self.onTopicDeleteButtonClicked)
QtCore.QObject.connect(self.booksDeleteButton, QtCore.QObject.connect(self.booksDeleteButton,
QtCore.SIGNAL(u'pressed()'), self.onBookDeleteButtonClick) QtCore.SIGNAL(u'clicked()'), self.onBookDeleteButtonClicked)
QtCore.QObject.connect(self.authorsListWidget, QtCore.QObject.connect(self.authorsListWidget,
QtCore.SIGNAL(u'currentRowChanged(int)'), QtCore.SIGNAL(u'currentRowChanged(int)'),
self.onAuthorsListRowChanged) self.onAuthorsListRowChanged)
@ -204,7 +204,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
else: else:
return True return True
def onAuthorAddButtonClick(self): def onAuthorAddButtonClicked(self):
self.authorform.setAutoDisplayName(True) self.authorform.setAutoDisplayName(True)
if self.authorform.exec_(): if self.authorform.exec_():
author = Author.populate( author = Author.populate(
@ -223,7 +223,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
message=translate('SongsPlugin.SongMaintenanceForm', message=translate('SongsPlugin.SongMaintenanceForm',
'This author already exists.')) 'This author already exists.'))
def onTopicAddButtonClick(self): def onTopicAddButtonClicked(self):
if self.topicform.exec_(): if self.topicform.exec_():
topic = Topic.populate(name=unicode(self.topicform.nameEdit.text())) topic = Topic.populate(name=unicode(self.topicform.nameEdit.text()))
if self.checkTopic(topic): if self.checkTopic(topic):
@ -238,7 +238,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
message=translate('SongsPlugin.SongMaintenanceForm', message=translate('SongsPlugin.SongMaintenanceForm',
'This topic already exists.')) 'This topic already exists.'))
def onBookAddButtonClick(self): def onBookAddButtonClicked(self):
if self.bookform.exec_(): if self.bookform.exec_():
book = Book.populate(name=unicode(self.bookform.nameEdit.text()), book = Book.populate(name=unicode(self.bookform.nameEdit.text()),
publisher=unicode(self.bookform.publisherEdit.text())) publisher=unicode(self.bookform.publisherEdit.text()))
@ -254,7 +254,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
message=translate('SongsPlugin.SongMaintenanceForm', message=translate('SongsPlugin.SongMaintenanceForm',
'This book already exists.')) 'This book already exists.'))
def onAuthorEditButtonClick(self): def onAuthorEditButtonClicked(self):
author_id = self._getCurrentItemId(self.authorsListWidget) author_id = self._getCurrentItemId(self.authorsListWidget)
if author_id == -1: if author_id == -1:
return return
@ -299,7 +299,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
'Could not save your modified author, because the ' 'Could not save your modified author, because the '
'author already exists.')) 'author already exists.'))
def onTopicEditButtonClick(self): def onTopicEditButtonClicked(self):
topic_id = self._getCurrentItemId(self.topicsListWidget) topic_id = self._getCurrentItemId(self.topicsListWidget)
if topic_id == -1: if topic_id == -1:
return return
@ -331,7 +331,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
'Could not save your modified topic, because it ' 'Could not save your modified topic, because it '
'already exists.')) 'already exists.'))
def onBookEditButtonClick(self): def onBookEditButtonClicked(self):
book_id = self._getCurrentItemId(self.booksListWidget) book_id = self._getCurrentItemId(self.booksListWidget)
if book_id == -1: if book_id == -1:
return return
@ -443,7 +443,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.manager.save_object(song) self.manager.save_object(song)
self.manager.delete_object(Book, old_book.id) self.manager.delete_object(Book, old_book.id)
def onAuthorDeleteButtonClick(self): def onAuthorDeleteButtonClicked(self):
""" """
Delete the author if the author is not attached to any songs. Delete the author if the author is not attached to any songs.
""" """
@ -454,7 +454,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
translate('SongsPlugin.SongMaintenanceForm', 'This author cannot ' translate('SongsPlugin.SongMaintenanceForm', 'This author cannot '
'be deleted, they are currently assigned to at least one song.')) 'be deleted, they are currently assigned to at least one song.'))
def onTopicDeleteButtonClick(self): def onTopicDeleteButtonClicked(self):
""" """
Delete the Book if the Book is not attached to any songs. Delete the Book if the Book is not attached to any songs.
""" """
@ -465,7 +465,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
translate('SongsPlugin.SongMaintenanceForm', 'This topic cannot ' translate('SongsPlugin.SongMaintenanceForm', 'This topic cannot '
'be deleted, it is currently assigned to at least one song.')) 'be deleted, it is currently assigned to at least one song.'))
def onBookDeleteButtonClick(self): def onBookDeleteButtonClicked(self):
""" """
Delete the Book if the Book is not attached to any songs. Delete the Book if the Book is not attached to any songs.
""" """

View File

@ -28,7 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import create_accept_reject_button_box from openlp.core.lib.ui import create_button_box
class Ui_TopicsDialog(object): class Ui_TopicsDialog(object):
def setupUi(self, topicsDialog): def setupUi(self, topicsDialog):
@ -45,11 +45,11 @@ class Ui_TopicsDialog(object):
self.nameLabel.setBuddy(self.nameEdit) self.nameLabel.setBuddy(self.nameEdit)
self.nameLayout.addRow(self.nameLabel, self.nameEdit) self.nameLayout.addRow(self.nameLabel, self.nameEdit)
self.dialogLayout.addLayout(self.nameLayout) self.dialogLayout.addLayout(self.nameLayout)
self.dialogLayout.addWidget( self.buttonBox = create_button_box(topicsDialog, u'buttonBox',
create_accept_reject_button_box(topicsDialog)) [u'cancel', u'save'])
self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(topicsDialog) self.retranslateUi(topicsDialog)
topicsDialog.setMaximumHeight(topicsDialog.sizeHint().height()) topicsDialog.setMaximumHeight(topicsDialog.sizeHint().height())
QtCore.QMetaObject.connectSlotsByName(topicsDialog)
def retranslateUi(self, topicsDialog): def retranslateUi(self, topicsDialog):
topicsDialog.setWindowTitle( topicsDialog.setWindowTitle(

View File

@ -119,7 +119,7 @@ class SongMediaItem(MediaManagerItem):
QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick) QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick)
QtCore.QObject.connect(self.searchTextEdit, QtCore.QObject.connect(self.searchTextEdit,
QtCore.SIGNAL(u'searchTypeChanged(int)'), QtCore.SIGNAL(u'searchTypeChanged(int)'),
self.onSearchTextButtonClick) self.onSearchTextButtonClicked)
def addCustomContextActions(self): def addCustomContextActions(self):
create_widget_action(self.listView, separator=True) create_widget_action(self.listView, separator=True)
@ -173,7 +173,7 @@ class SongMediaItem(MediaManagerItem):
QtCore.QVariant(SongSearch.Entire)).toInt()[0]) QtCore.QVariant(SongSearch.Entire)).toInt()[0])
self.configUpdated() self.configUpdated()
def onSearchTextButtonClick(self): def onSearchTextButtonClicked(self):
# Save the current search type to the configuration. # Save the current search type to the configuration.
QtCore.QSettings().setValue(u'%s/last search type' % QtCore.QSettings().setValue(u'%s/last search type' %
self.settingsSection, self.settingsSection,
@ -251,7 +251,7 @@ class SongMediaItem(MediaManagerItem):
item = self.buildServiceItem(self.editItem) item = self.buildServiceItem(self.editItem)
self.plugin.serviceManager.replaceServiceItem(item) self.plugin.serviceManager.replaceServiceItem(item)
self.onRemoteEditClear() self.onRemoteEditClear()
self.onSearchTextButtonClick() self.onSearchTextButtonClicked()
log.debug(u'onSongListLoad - finished') log.debug(u'onSongListLoad - finished')
def displayResultsSong(self, searchresults): def displayResultsSong(self, searchresults):
@ -315,7 +315,7 @@ class SongMediaItem(MediaManagerItem):
Clear the search text. Clear the search text.
""" """
self.searchTextEdit.clear() self.searchTextEdit.clear()
self.onSearchTextButtonClick() self.onSearchTextButtonClicked()
def onSearchTextEditChanged(self, text): def onSearchTextEditChanged(self, text):
""" """
@ -330,7 +330,7 @@ class SongMediaItem(MediaManagerItem):
elif self.searchTextEdit.currentSearchType() == SongSearch.Lyrics: elif self.searchTextEdit.currentSearchType() == SongSearch.Lyrics:
search_length = 3 search_length = 3
if len(text) > search_length: if len(text) > search_length:
self.onSearchTextButtonClick() self.onSearchTextButtonClicked()
elif len(text) == 0: elif len(text) == 0:
self.onClearTextButtonClick() self.onClearTextButtonClick()
@ -426,7 +426,7 @@ class SongMediaItem(MediaManagerItem):
except OSError: except OSError:
log.exception(u'Could not remove directory: %s', save_path) log.exception(u'Could not remove directory: %s', save_path)
self.plugin.manager.delete_object(Song, item_id) self.plugin.manager.delete_object(Song, item_id)
self.onSearchTextButtonClick() self.onSearchTextButtonClicked()
def onCloneClick(self): def onCloneClick(self):
""" """
@ -578,7 +578,7 @@ class SongMediaItem(MediaManagerItem):
if len(item.background_audio) > 0: if len(item.background_audio) > 0:
self._updateBackgroundAudio(song, item) self._updateBackgroundAudio(song, item)
editId = song.id editId = song.id
self.onSearchTextButtonClick() self.onSearchTextButtonClicked()
elif add_song and not self.addSongFromService: elif add_song and not self.addSongFromService:
# Make sure we temporary import formatting tags. # Make sure we temporary import formatting tags.
song = self.openLyrics.xml_to_song(item.xml_version, True) song = self.openLyrics.xml_to_song(item.xml_version, True)

View File

@ -24,6 +24,7 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 # # with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
import logging import logging
import re import re
import shutil import shutil
@ -308,7 +309,7 @@ class SongImport(QtCore.QObject):
verses_changed_to_other[verse_def] = new_verse_def verses_changed_to_other[verse_def] = new_verse_def
other_count += 1 other_count += 1
verse_tag = VerseType.Tags[VerseType.Other] verse_tag = VerseType.Tags[VerseType.Other]
log.info(u'Versetype %s changing to %s' , verse_def, log.info(u'Versetype %s changing to %s', verse_def,
new_verse_def) new_verse_def)
verse_def = new_verse_def verse_def = new_verse_def
sxml.add_verse_to_lyrics(verse_tag, verse_def[1:], verse_text, lang) sxml.add_verse_to_lyrics(verse_tag, verse_def[1:], verse_text, lang)

View File

@ -151,7 +151,7 @@ class SongsPlugin(Plugin):
clean_song(self.manager, song) clean_song(self.manager, song)
progressDialog.setValue(number + 1) progressDialog.setValue(number + 1)
self.manager.save_objects(songs) self.manager.save_objects(songs)
self.mediaItem.onSearchTextButtonClick() self.mediaItem.onSearchTextButtonClicked()
def onSongImportItemClicked(self): def onSongImportItemClicked(self):
if self.mediaItem: if self.mediaItem:
@ -254,7 +254,7 @@ class SongsPlugin(Plugin):
importer = OpenLPSongImport(self.manager, filename=db) importer = OpenLPSongImport(self.manager, filename=db)
importer.doImport() importer.doImport()
progress.setValue(len(song_dbs)) progress.setValue(len(song_dbs))
self.mediaItem.onSearchTextButtonClick() self.mediaItem.onSearchTextButtonClicked()
def finalise(self): def finalise(self):
""" """

View File

@ -28,6 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.core.lib.ui import create_button_box
class Ui_SongUsageDeleteDialog(object): class Ui_SongUsageDeleteDialog(object):
def setupUi(self, songUsageDeleteDialog): def setupUi(self, songUsageDeleteDialog):
@ -47,10 +48,8 @@ class Ui_SongUsageDeleteDialog(object):
QtGui.QCalendarWidget.NoVerticalHeader) QtGui.QCalendarWidget.NoVerticalHeader)
self.deleteCalendar.setObjectName(u'deleteCalendar') self.deleteCalendar.setObjectName(u'deleteCalendar')
self.verticalLayout.addWidget(self.deleteCalendar) self.verticalLayout.addWidget(self.deleteCalendar)
self.buttonBox = QtGui.QDialogButtonBox(songUsageDeleteDialog) self.buttonBox = create_button_box(songUsageDeleteDialog, u'buttonBox',
self.buttonBox.setStandardButtons( [u'cancel', u'ok'])
QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel)
self.buttonBox.setObjectName(u'buttonBox')
self.verticalLayout.addWidget(self.buttonBox) self.verticalLayout.addWidget(self.buttonBox)
self.retranslateUi(songUsageDeleteDialog) self.retranslateUi(songUsageDeleteDialog)

View File

@ -28,7 +28,7 @@
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate from openlp.core.lib import build_icon, translate
from openlp.core.lib.ui import create_accept_reject_button_box from openlp.core.lib.ui import create_button_box
class Ui_SongUsageDetailDialog(object): class Ui_SongUsageDetailDialog(object):
def setupUi(self, songUsageDetailDialog): def setupUi(self, songUsageDetailDialog):
@ -74,14 +74,13 @@ class Ui_SongUsageDetailDialog(object):
self.saveFilePushButton.setObjectName(u'saveFilePushButton') self.saveFilePushButton.setObjectName(u'saveFilePushButton')
self.fileHorizontalLayout.addWidget(self.saveFilePushButton) self.fileHorizontalLayout.addWidget(self.saveFilePushButton)
self.verticalLayout.addWidget(self.fileGroupBox) self.verticalLayout.addWidget(self.fileGroupBox)
self.buttonBox = create_accept_reject_button_box( self.buttonBox = create_button_box(songUsageDetailDialog, u'buttonBox',
songUsageDetailDialog, True) [u'cancel', u'ok'])
self.verticalLayout.addWidget(self.buttonBox) self.verticalLayout.addWidget(self.buttonBox)
self.retranslateUi(songUsageDetailDialog) self.retranslateUi(songUsageDetailDialog)
QtCore.QObject.connect(self.saveFilePushButton, QtCore.QObject.connect(self.saveFilePushButton,
QtCore.SIGNAL(u'pressed()'), QtCore.SIGNAL(u'clicked()'),
songUsageDetailDialog.defineOutputLocation) songUsageDetailDialog.defineOutputLocation)
QtCore.QMetaObject.connectSlotsByName(songUsageDetailDialog)
def retranslateUi(self, songUsageDetailDialog): def retranslateUi(self, songUsageDetailDialog):
songUsageDetailDialog.setWindowTitle( songUsageDetailDialog.setWindowTitle(

View File

@ -72,7 +72,7 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
def defineOutputLocation(self): def defineOutputLocation(self):
""" """
Triggered when the Directory selection button is pressed Triggered when the Directory selection button is clicked
""" """
path = QtGui.QFileDialog.getExistingDirectory(self, path = QtGui.QFileDialog.getExistingDirectory(self,
translate('SongUsagePlugin.SongUsageDetailForm', translate('SongUsagePlugin.SongUsageDetailForm',
@ -85,7 +85,7 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
def accept(self): def accept(self):
""" """
Ok was pressed so lets save the data and run the report Ok was triggered so lets save the data and run the report
""" """
log.debug(u'accept') log.debug(u'accept')
path = unicode(self.fileLineEdit.text()) path = unicode(self.fileLineEdit.text())
@ -118,7 +118,7 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
fileHandle = open(outname, u'w') fileHandle = open(outname, u'w')
for instance in usage: for instance in usage:
record = u'\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",' \ record = u'\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",' \
u'\"%s\",\"%s\"\n' % ( instance.usagedate, u'\"%s\",\"%s\"\n' % (instance.usagedate,
instance.usagetime, instance.title, instance.copyright, instance.usagetime, instance.title, instance.copyright,
instance.ccl_number, instance.authors, instance.ccl_number, instance.authors,
instance.plugin_name, instance.source) instance.plugin_name, instance.source)