diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index d597fcc66..49d4d3e4c 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -260,7 +260,7 @@ class MediaManagerItem(QtGui.QWidget): self.menu.addActions(self.listView.actions()) QtCore.QObject.connect(self.listView, QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), - self.onClickPressed) + self.onDoubleClicked) QtCore.QObject.connect(self.listView, QtCore.SIGNAL(u'itemSelectionChanged()'), self.onSelectionChange) @@ -295,9 +295,9 @@ class MediaManagerItem(QtGui.QWidget): self.pageLayout.addWidget(self.searchWidget) # Signals and slots QtCore.QObject.connect(self.searchTextEdit, - QtCore.SIGNAL(u'returnPressed()'), self.onSearchTextButtonClick) + QtCore.SIGNAL(u'returnPressed()'), self.onSearchTextButtonClicked) QtCore.QObject.connect(self.searchTextButton, - QtCore.SIGNAL(u'pressed()'), self.onSearchTextButtonClick) + QtCore.SIGNAL(u'clicked()'), self.onSearchTextButtonClicked) QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'textChanged(const QString&)'), self.onSearchTextEditChanged) @@ -458,7 +458,7 @@ class MediaManagerItem(QtGui.QWidget): raise NotImplementedError(u'MediaManagerItem.generateSlideData needs ' u'to be defined by the plugin') - def onClickPressed(self): + def onDoubleClicked(self): """ Allows the list click action to be determined dynamically """ diff --git a/openlp/core/lib/searchedit.py b/openlp/core/lib/searchedit.py index 0347cee74..a885e1ecd 100644 --- a/openlp/core/lib/searchedit.py +++ b/openlp/core/lib/searchedit.py @@ -189,7 +189,7 @@ class SearchEdit(QtGui.QLineEdit): 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 ``cleared()`` signal so that an application can react to the clearing of the line edit. diff --git a/openlp/core/lib/settingstab.py b/openlp/core/lib/settingstab.py index aaa1e5af4..61ee87d51 100644 --- a/openlp/core/lib/settingstab.py +++ b/openlp/core/lib/settingstab.py @@ -112,7 +112,7 @@ class SettingsTab(QtGui.QWidget): def cancel(self): """ - Reset any settings if cancel pressed + Reset any settings if cancel triggered """ self.load() diff --git a/openlp/core/lib/theme.py b/openlp/core/lib/theme.py index 486f89b18..a5dcf881f 100644 --- a/openlp/core/lib/theme.py +++ b/openlp/core/lib/theme.py @@ -306,7 +306,7 @@ class ThemeXML(object): def add_font(self, name, color, size, override, fonttype=u'main', 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', shadow_color=u'#ffffff', shadow_pixel=5): """ @@ -550,7 +550,7 @@ class ThemeXML(object): element = u'size' 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 """ diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 038be08b9..7f2ba9a32 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -170,31 +170,50 @@ def add_welcome_page(parent, image): parent.welcomeLayout.addStretch() 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 - to save and cancel but the ``okay`` parameter can be used to make the - buttons okay and cancel instead. - The button box is connected to the parent's ``accept()`` and ``reject()`` - methods to handle the default ``accepted()`` and ``rejected()`` signals. + Creates a QDialogButtonBox with the given buttons. The ``accepted()`` and + ``rejected()`` signals of the button box are connected with the dialogs + ``accept()`` and ``reject()`` slots. - ``parent`` - The parent object. This should be a ``QWidget`` descendant. + ``dialog`` + The parent object. This has to be a ``QDialog`` descendant. - ``okay`` - If true creates an okay/cancel combination instead of save/cancel. + ``name`` + A string which is set as object name. + + ``standard_buttons`` + A list of strings for the used buttons. It might contain: ``ok``, + ``save``, ``cancel``, ``close``, and ``defaults``. + + ``custom_buttons`` + A list of additional buttons. If 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) - accept_button = QtGui.QDialogButtonBox.Save - if okay: - accept_button = QtGui.QDialogButtonBox.Ok - button_box.setStandardButtons( - accept_button | QtGui.QDialogButtonBox.Cancel) - button_box.setObjectName(u'%sButtonBox' % parent) + buttons = QtGui.QDialogButtonBox.NoButton + if u'ok' in standard_buttons: + buttons |= QtGui.QDialogButtonBox.Ok + if u'save' in standard_buttons: + buttons |= QtGui.QDialogButtonBox.Save + if u'cancel' in standard_buttons: + 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()'), - parent.accept) + dialog.accept) QtCore.QObject.connect(button_box, QtCore.SIGNAL(u'rejected()'), - parent.reject) + dialog.reject) return button_box 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 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.setObjectName(name) @@ -233,55 +258,71 @@ def media_item_combo_box(parent, name): combo.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) 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 - button is connected to the parent's ``onDeleteButtonClicked()`` method to - handle the ``clicked()`` signal. - + Return an button with the object name set and the given parameters. + ``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`` - An icon to display on the button. This can be either a ``QIcon``, a - resource path or a file name. - """ - 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 + Either a QIcon, a resource string, or a file location string for the + action icon. -def create_up_down_push_button_set(parent): - """ - 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. + ``tooltip`` + A string for the action tool tip. - ``parent`` - The parent object. This should be a ``QWidget`` descendant. + ``enabled`` + False in case the button should be disabled. """ - up_button = QtGui.QPushButton(parent) - up_button.setIcon(build_icon(u':/services/service_up.png')) - up_button.setObjectName(u'upButton') - up_button.setToolTip( - translate('OpenLP.Ui', 'Move selection up one position.')) - down_button = QtGui.QPushButton(parent) - down_button.setIcon(build_icon(u':/services/service_down.png')) - down_button.setObjectName(u'downButton') - down_button.setToolTip( - translate('OpenLP.Ui', 'Move selection down one position.')) - QtCore.QObject.connect(up_button, - QtCore.SIGNAL(u'clicked()'), parent.onUpButtonClicked) - QtCore.QObject.connect(down_button, - QtCore.SIGNAL(u'clicked()'), parent.onDownButtonClicked) - return up_button, down_button + if u'role' in kwargs: + role = kwargs.pop(u'role') + if role == u'delete': + kwargs.setdefault(u'text', UiStrings().Delete) + kwargs.setdefault(u'tooltip', + translate('OpenLP.Ui', 'Delete the selected item.')) + elif role == u'up': + kwargs.setdefault(u'icon', u':/services/service_up.png') + kwargs.setdefault(u'tooltip', + translate('OpenLP.Ui', 'Move selection up one position.')) + elif role == u'down': + kwargs.setdefault(u'icon', u':/services/service_down.png') + kwargs.setdefault(u'tooltip', + translate('OpenLP.Ui', 'Move selection down one position.')) + 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): """ @@ -381,61 +422,38 @@ def create_widget_action(parent, name=u'', **kwargs): parent.addAction(action) return action -def context_menu(base, icon, text): +def set_case_insensitive_completer(cache, widget): """ - Utility method to help build context menus. - - ``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. + Sets a case insensitive text completer for a widget. ``cache`` The list of items to use as suggestions. ``widget`` - The object to use the completer. + A widget to set the completer (QComboBox or QTextEdit instance) """ completer = QtGui.QCompleter(cache) completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive) 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 vertical alignment. - ``form`` - The UI screen that the label and combo will appear on. - ``parent`` The parent object. This should be a ``QWidget`` descendant. - ``layout`` - A layout object to add the label and combo widgets to. + Returns a tuple of QLabel and QComboBox. """ - verticalLabel = QtGui.QLabel(parent) - verticalLabel.setObjectName(u'VerticalLabel') - verticalLabel.setText(translate('OpenLP.Ui', '&Vertical Align:')) - form.verticalComboBox = QtGui.QComboBox(parent) - form.verticalComboBox.setObjectName(u'VerticalComboBox') - form.verticalComboBox.addItem(UiStrings().Top) - form.verticalComboBox.addItem(UiStrings().Middle) - form.verticalComboBox.addItem(UiStrings().Bottom) - verticalLabel.setBuddy(form.verticalComboBox) - layout.addRow(verticalLabel, form.verticalComboBox) + label = QtGui.QLabel(parent) + label.setText(translate('OpenLP.Ui', '&Vertical Align:')) + combo_box = QtGui.QComboBox(parent) + combo_box.addItem(UiStrings().Top) + combo_box.addItem(UiStrings().Middle) + combo_box.addItem(UiStrings().Bottom) + label.setBuddy(combo_box) + return label, combo_box def find_and_set_in_combo_box(combo_box, value_to_find): """ diff --git a/openlp/core/ui/aboutdialog.py b/openlp/core/ui/aboutdialog.py index 5032f0d40..f0908b729 100644 --- a/openlp/core/ui/aboutdialog.py +++ b/openlp/core/ui/aboutdialog.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui 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): def setupUi(self, aboutDialog): @@ -71,21 +71,13 @@ class Ui_AboutDialog(object): self.licenseTabLayout.addWidget(self.licenseTextEdit) self.aboutNotebook.addTab(self.licenseTab, u'') self.aboutDialogLayout.addWidget(self.aboutNotebook) - self.buttonBox = QtGui.QDialogButtonBox(aboutDialog) - self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Close) - self.buttonBox.setObjectName(u'buttonBox') - self.contributeButton = QtGui.QPushButton() - self.contributeButton.setIcon( - build_icon(u':/system/system_contribute.png')) - self.contributeButton.setObjectName(u'contributeButton') - self.buttonBox.addButton(self.contributeButton, - QtGui.QDialogButtonBox.ActionRole) + self.contributeButton = create_button(None, u'contributeButton', + icon=u':/system/system_contribute.png') + self.buttonBox = create_button_box(aboutDialog, u'buttonBox', + [u'close'], [self.contributeButton]) self.aboutDialogLayout.addWidget(self.buttonBox) self.retranslateUi(aboutDialog) self.aboutNotebook.setCurrentIndex(0) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'), - aboutDialog.close) - QtCore.QMetaObject.connectSlotsByName(aboutDialog) def retranslateUi(self, aboutDialog): aboutDialog.setWindowTitle(u'%s OpenLP' % UiStrings().About) diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index b798759f1..9783c31b0 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -233,22 +233,22 @@ class AdvancedTab(SettingsTab): QtCore.SIGNAL(u'textChanged(QString)'), self.updateServiceNameExample) QtCore.QObject.connect(self.serviceNameRevertButton, - QtCore.SIGNAL(u'pressed()'), - self.onServiceNameRevertButtonPressed) + QtCore.SIGNAL(u'clicked()'), + self.onServiceNameRevertButtonClicked) QtCore.QObject.connect(self.defaultColorButton, - QtCore.SIGNAL(u'pressed()'), self.onDefaultColorButtonPressed) + QtCore.SIGNAL(u'clicked()'), self.onDefaultColorButtonClicked) QtCore.QObject.connect(self.defaultBrowseButton, - QtCore.SIGNAL(u'pressed()'), self.onDefaultBrowseButtonPressed) + QtCore.SIGNAL(u'clicked()'), self.onDefaultBrowseButtonClicked) QtCore.QObject.connect(self.defaultRevertButton, - QtCore.SIGNAL(u'pressed()'), self.onDefaultRevertButtonPressed) + QtCore.SIGNAL(u'clicked()'), self.onDefaultRevertButtonClicked) QtCore.QObject.connect(self.x11BypassCheckBox, QtCore.SIGNAL(u'toggled(bool)'), self.onX11BypassCheckBoxToggled) QtCore.QObject.connect(self.endSlideRadioButton, - QtCore.SIGNAL(u'pressed()'), self.onEndSlideButtonPressed) + QtCore.SIGNAL(u'clicked()'), self.onEndSlideButtonClicked) QtCore.QObject.connect(self.wrapSlideRadioButton, - QtCore.SIGNAL(u'pressed()'), self.onWrapSlideButtonPressed) + QtCore.SIGNAL(u'clicked()'), self.onWrapSlideButtonClicked) QtCore.QObject.connect(self.nextItemRadioButton, - QtCore.SIGNAL(u'pressed()'), self.onnextItemButtonPressed) + QtCore.SIGNAL(u'clicked()'), self.onnextItemButtonClicked) def retranslateUi(self): """ @@ -485,11 +485,11 @@ class AdvancedTab(SettingsTab): self.serviceNameTime.setEnabled(service_day is not 7) self.updateServiceNameExample(None) - def onServiceNameRevertButtonPressed(self): + def onServiceNameRevertButtonClicked(self): self.serviceNameEdit.setText(self.defaultServiceName) self.serviceNameEdit.setFocus() - def onDefaultColorButtonPressed(self): + def onDefaultColorButtonClicked(self): new_color = QtGui.QColorDialog.getColor( QtGui.QColor(self.defaultColor), self) if new_color.isValid(): @@ -497,7 +497,7 @@ class AdvancedTab(SettingsTab): self.defaultColorButton.setStyleSheet( u'background-color: %s' % self.defaultColor) - def onDefaultBrowseButtonPressed(self): + def onDefaultBrowseButtonClicked(self): file_filters = u'%s;;%s (*.*) (*)' % (get_images_filter(), UiStrings().AllFiles) filename = QtGui.QFileDialog.getOpenFileName(self, @@ -507,7 +507,7 @@ class AdvancedTab(SettingsTab): self.defaultFileEdit.setText(filename) self.defaultFileEdit.setFocus() - def onDefaultRevertButtonPressed(self): + def onDefaultRevertButtonClicked(self): self.defaultFileEdit.setText(u':/graphics/openlp-splash-screen.png') self.defaultFileEdit.setFocus() @@ -520,11 +520,11 @@ class AdvancedTab(SettingsTab): """ self.displayChanged = True - def onEndSlideButtonPressed(self): + def onEndSlideButtonClicked(self): self.slide_limits = SlideLimits.End - def onWrapSlideButtonPressed(self): + def onWrapSlideButtonClicked(self): self.slide_limits = SlideLimits.Wrap - def onnextItemButtonPressed(self): + def onnextItemButtonClicked(self): self.slide_limits = SlideLimits.Next diff --git a/openlp/core/ui/exceptiondialog.py b/openlp/core/ui/exceptiondialog.py index 26f90e11f..6d0a56ab9 100644 --- a/openlp/core/ui/exceptiondialog.py +++ b/openlp/core/ui/exceptiondialog.py @@ -28,6 +28,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import translate, build_icon +from openlp.core.lib.ui import create_button, create_button_box class Ui_ExceptionDialog(object): def setupUi(self, exceptionDialog): @@ -62,39 +63,23 @@ class Ui_ExceptionDialog(object): self.exceptionTextEdit.setReadOnly(True) self.exceptionTextEdit.setObjectName(u'exceptionTextEdit') self.exceptionLayout.addWidget(self.exceptionTextEdit) - self.exceptionButtonBox = QtGui.QDialogButtonBox(exceptionDialog) - self.exceptionButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Close) - self.exceptionButtonBox.setObjectName(u'exceptionButtonBox') - self.exceptionLayout.addWidget(self.exceptionButtonBox) - self.sendReportButton = QtGui.QPushButton(exceptionDialog) - self.sendReportButton.setIcon(build_icon( - u':/general/general_email.png')) - self.sendReportButton.setObjectName(u'sendReportButton') - self.exceptionButtonBox.addButton(self.sendReportButton, - QtGui.QDialogButtonBox.ActionRole) - self.saveReportButton = QtGui.QPushButton(exceptionDialog) - self.saveReportButton.setIcon(build_icon(u':/general/general_save.png')) - self.saveReportButton.setObjectName(u'saveReportButton') - 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.sendReportButton = create_button(exceptionDialog, + u'sendReportButton', icon=u':/general/general_email.png', + click=self.onSendReportButtonClicked) + self.saveReportButton = create_button(exceptionDialog, + u'saveReportButton', icon=u':/general/general_save.png', + click=self.onSaveReportButtonClicked) + self.attachFileButton = create_icon(exceptionDialog, + u'attachFileButton', icon=u':/general/general_open.png', + click=self.onAttachFileButtonClicked) + self.buttonBox = create_button_box(exceptionDialog, u'buttonBox', + [u'close'], [self.sendReportButton, self.saveReportButton, + self.attachFileButton]) + self.exceptionLayout.addWidget(self.buttonBox) self.retranslateUi(exceptionDialog) QtCore.QObject.connect(self.descriptionTextEdit, 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): exceptionDialog.setWindowTitle( diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py index 0dde063c4..ed720581c 100644 --- a/openlp/core/ui/exceptionform.py +++ b/openlp/core/ui/exceptionform.py @@ -133,7 +133,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): system = system + u'Desktop: GNOME\n' return (openlp_version, description, traceback, system, libraries) - def onSaveReportButtonPressed(self): + def onSaveReportButtonClicked(self): """ Saving exception log and system informations to a file. """ @@ -169,7 +169,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): finally: report_file.close() - def onSendReportButtonPressed(self): + def onSendReportButtonClicked(self): """ Opening systems default email client and inserting exception log and system informations. @@ -210,7 +210,7 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): unicode(translate('OpenLP.ExceptionDialog', 'Description characters to enter : %s')) % count) - def onAttachFileButtonPressed(self): + def onAttachFileButtonClicked(self): files = QtGui.QFileDialog.getOpenFileName( self,translate('ImagePlugin.ExceptionDialog', 'Select Attachment'), diff --git a/openlp/core/ui/filerenamedialog.py b/openlp/core/ui/filerenamedialog.py index 4822d4751..dfe1b4f25 100644 --- a/openlp/core/ui/filerenamedialog.py +++ b/openlp/core/ui/filerenamedialog.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui 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): def setupUi(self, fileRenameDialog): @@ -44,11 +44,11 @@ class Ui_FileRenameDialog(object): QtCore.QRegExp(r'[^/\\?*|<>\[\]":+%]+'), self)) self.fileNameEdit.setObjectName(u'fileNameEdit') 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.retranslateUi(fileRenameDialog) self.setMaximumHeight(self.sizeHint().height()) - QtCore.QMetaObject.connectSlotsByName(fileRenameDialog) def retranslateUi(self, fileRenameDialog): self.fileNameLabel.setText(translate('OpenLP.FileRenameForm', diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index abee968f9..5926733a8 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -183,7 +183,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): """ 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. if pageId != -1: self.lastId = pageId @@ -239,7 +239,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): def onCancelButtonClicked(self): """ - Process the pressing of the cancel button. + Process the triggering of the cancel button. """ if self.lastId == FirstTimePage.NoInternet or \ (self.lastId <= FirstTimePage.Plugins and \ @@ -251,7 +251,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): 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') self._performWizard() diff --git a/openlp/core/ui/firsttimelanguagedialog.py b/openlp/core/ui/firsttimelanguagedialog.py index b021c9d8e..f07d7bd15 100644 --- a/openlp/core/ui/firsttimelanguagedialog.py +++ b/openlp/core/ui/firsttimelanguagedialog.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui 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): def setupUi(self, languageDialog): @@ -52,12 +52,12 @@ class Ui_FirstTimeLanguageDialog(object): self.languageComboBox.setObjectName("languageComboBox") self.languageLayout.addWidget(self.languageComboBox) 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.retranslateUi(languageDialog) self.setMaximumHeight(self.sizeHint().height()) - QtCore.QMetaObject.connectSlotsByName(languageDialog) def retranslateUi(self, languageDialog): self.setWindowTitle(translate('OpenLP.FirstTimeLanguageForm', diff --git a/openlp/core/ui/firsttimewizard.py b/openlp/core/ui/firsttimewizard.py index e402134c6..d2741838a 100644 --- a/openlp/core/ui/firsttimewizard.py +++ b/openlp/core/ui/firsttimewizard.py @@ -233,14 +233,14 @@ class Ui_FirstTimeWizard(object): self.noInternetText = translate('OpenLP.FirstTimeWizard', 'No Internet connection was found. The First Time Wizard needs an ' '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 ' 'First Time Wizard and import this sample data at a later time, ' 'check your Internet connection and re-run this wizard by ' 'selecting "Tools/Re-run First Time Wizard" from OpenLP.') self.cancelWizardText = translate('OpenLP.FirstTimeWizard', '\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', 'Sample Songs')) self.songsPage.setSubTitle(translate('OpenLP.FirstTimeWizard', diff --git a/openlp/core/ui/formattingtagdialog.py b/openlp/core/ui/formattingtagdialog.py index b73816635..a0ed42800 100644 --- a/openlp/core/ui/formattingtagdialog.py +++ b/openlp/core/ui/formattingtagdialog.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui 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): @@ -112,13 +112,11 @@ class Ui_FormattingTagDialog(object): self.savePushButton.setObjectName(u'savePushButton') self.dataGridLayout.addWidget(self.savePushButton, 4, 2, 1, 1) self.listdataGridLayout.addWidget(self.editGroupBox, 2, 0, 1, 1) - self.buttonBox = QtGui.QDialogButtonBox(formattingTagDialog) - self.buttonBox.setObjectName('formattingTagDialogButtonBox') - self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Close) + self.buttonBox = create_button_box(formattingTagDialog, 'buttonBox', + [u'close']) self.listdataGridLayout.addWidget(self.buttonBox, 3, 0, 1, 1) self.retranslateUi(formattingTagDialog) - QtCore.QMetaObject.connectSlotsByName(formattingTagDialog) def retranslateUi(self, formattingTagDialog): formattingTagDialog.setWindowTitle(translate( diff --git a/openlp/core/ui/formattingtagform.py b/openlp/core/ui/formattingtagform.py index d99758476..28200d132 100644 --- a/openlp/core/ui/formattingtagform.py +++ b/openlp/core/ui/formattingtagform.py @@ -50,11 +50,11 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog): QtCore.QObject.connect(self.tagTableWidget, QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onRowSelected) QtCore.QObject.connect(self.newPushButton, - QtCore.SIGNAL(u'pressed()'), self.onNewPushed) + QtCore.SIGNAL(u'clicked()'), self.onNewClicked) QtCore.QObject.connect(self.savePushButton, - QtCore.SIGNAL(u'pressed()'), self.onSavedPushed) + QtCore.SIGNAL(u'clicked()'), self.onSavedClicked) 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()'), self.close) # Forces reloading of tags from openlp configuration. @@ -95,7 +95,7 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog): self.savePushButton.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. """ @@ -123,7 +123,7 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog): self.onRowSelected() self.tagTableWidget.scrollToBottom() - def onDeletePushed(self): + def onDeleteClicked(self): """ Delete selected custom tag. """ @@ -133,7 +133,7 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog): self._resetTable() FormattingTags.save_html_tags() - def onSavedPushed(self): + def onSavedClicked(self): """ Update Custom Tag details if not duplicate and save the data. """ diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index ec85c6234..7d84c7b84 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -372,7 +372,6 @@ class Ui_MainWindow(object): # Connect up some signals and slots QtCore.QObject.connect(self.fileMenu, QtCore.SIGNAL(u'aboutToShow()'), self.updateRecentFilesMenu) - QtCore.QMetaObject.connectSlotsByName(mainWindow) # Hide the entry, as it does not have any functionality yet. self.toolsAddToolItem.setVisible(False) self.importLanguageItem.setVisible(False) @@ -986,11 +985,11 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): # We have a good file, import it. for section_key in import_keys: value = import_settings.value(section_key) - settings.setValue(u'%s' % (section_key) , + settings.setValue(u'%s' % (section_key), QtCore.QVariant(value)) now = datetime.now() 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', now.strftime("%Y-%m-%d %H:%M")) settings.endGroup() diff --git a/openlp/core/ui/plugindialog.py b/openlp/core/ui/plugindialog.py index a9a38a9eb..b685d819f 100644 --- a/openlp/core/ui/plugindialog.py +++ b/openlp/core/ui/plugindialog.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui 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): def setupUi(self, pluginViewDialog): @@ -65,14 +65,10 @@ class Ui_PluginViewDialog(object): self.pluginInfoLayout.addRow(self.aboutLabel, self.aboutTextBrowser) self.listLayout.addWidget(self.pluginInfoGroupBox) self.pluginLayout.addLayout(self.listLayout) - self.pluginListButtonBox = QtGui.QDialogButtonBox(pluginViewDialog) - self.pluginListButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) - self.pluginListButtonBox.setObjectName(u'pluginListButtonBox') - self.pluginLayout.addWidget(self.pluginListButtonBox) + self.buttonBox = create_button_box(pluginViewDialog, u'buttonBox', + [u'ok']) + self.pluginLayout.addWidget(self.buttonBox) self.retranslateUi(pluginViewDialog) - QtCore.QObject.connect(self.pluginListButtonBox, - QtCore.SIGNAL(u'accepted()'), pluginViewDialog.close) - QtCore.QMetaObject.connectSlotsByName(pluginViewDialog) def retranslateUi(self, pluginViewDialog): pluginViewDialog.setWindowTitle( diff --git a/openlp/core/ui/printservicedialog.py b/openlp/core/ui/printservicedialog.py index 6d39fea55..b31474d76 100644 --- a/openlp/core/ui/printservicedialog.py +++ b/openlp/core/ui/printservicedialog.py @@ -126,7 +126,6 @@ class Ui_PrintServiceDialog(object): self.optionsLayout.addWidget(self.optionsGroupBox) self.retranslateUi(printServiceDialog) - QtCore.QMetaObject.connectSlotsByName(printServiceDialog) QtCore.QObject.connect(self.optionsButton, QtCore.SIGNAL(u'toggled(bool)'), self.toggleOptions) diff --git a/openlp/core/ui/serviceitemeditdialog.py b/openlp/core/ui/serviceitemeditdialog.py index 362687137..8410f4491 100644 --- a/openlp/core/ui/serviceitemeditdialog.py +++ b/openlp/core/ui/serviceitemeditdialog.py @@ -28,8 +28,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import translate -from openlp.core.lib.ui import create_accept_reject_button_box, \ - create_delete_push_button, create_up_down_push_button_set +from openlp.core.lib.ui import create_button_box, create_button class Ui_ServiceItemEditDialog(object): def setupUi(self, serviceItemEditDialog): @@ -44,18 +43,22 @@ class Ui_ServiceItemEditDialog(object): self.dialogLayout.addWidget(self.listWidget, 0, 0) self.buttonLayout = QtGui.QVBoxLayout() 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.addStretch() - self.upButton, self.downButton = create_up_down_push_button_set( - serviceItemEditDialog) + self.upButton = create_button(serviceItemEditDialog, u'upButton', + 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.downButton) self.dialogLayout.addLayout(self.buttonLayout, 0, 1) - self.dialogLayout.addWidget( - create_accept_reject_button_box(serviceItemEditDialog), 1, 0, 1, 2) + self.buttonBox = create_button_box(serviceItemEditDialog, u'buttonBox', + [u'cancel', u'save']) + self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2) self.retranslateUi(serviceItemEditDialog) - QtCore.QMetaObject.connectSlotsByName(serviceItemEditDialog) def retranslateUi(self, serviceItemEditDialog): serviceItemEditDialog.setWindowTitle( diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index bce3e2def..74e4e6ee8 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -181,7 +181,7 @@ class ServiceManager(QtGui.QWidget): self.serviceManagerList.moveUp = self.orderToolbar.addToolbarAction( u'moveUp', text=translate('OpenLP.ServiceManager', 'Move &up'), icon=u':/services/service_up.png', - tooltip=translate( 'OpenLP.ServiceManager', + tooltip=translate('OpenLP.ServiceManager', 'Move item up one position in the service.'), shortcuts=[QtCore.Qt.Key_PageUp], category=UiStrings().Service, triggers=self.onServiceUp) diff --git a/openlp/core/ui/servicenoteform.py b/openlp/core/ui/servicenoteform.py index 392a6f32d..fb173ee43 100644 --- a/openlp/core/ui/servicenoteform.py +++ b/openlp/core/ui/servicenoteform.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui 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): """ @@ -55,8 +55,9 @@ class ServiceNoteForm(QtGui.QDialog): self.textEdit = SpellTextEdit(self, False) self.textEdit.setObjectName(u'textEdit') self.dialogLayout.addWidget(self.textEdit) - self.dialogLayout.addWidget(create_accept_reject_button_box(self)) - QtCore.QMetaObject.connectSlotsByName(self) + self.buttonBox = create_button_box(self, u'buttonBox', + [u'cancel', u'save']) + self.dialogLayout.addWidget(self.buttonBox) def retranslateUi(self): self.setWindowTitle( diff --git a/openlp/core/ui/settingsdialog.py b/openlp/core/ui/settingsdialog.py index 8d692de7b..0b7dcb482 100644 --- a/openlp/core/ui/settingsdialog.py +++ b/openlp/core/ui/settingsdialog.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui 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): def setupUi(self, settingsDialog): @@ -49,10 +49,10 @@ class Ui_SettingsDialog(object): self.stackedLayout = QtGui.QStackedLayout() self.stackedLayout.setObjectName(u'stackedLayout') 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.retranslateUi(settingsDialog) - QtCore.QMetaObject.connectSlotsByName(settingsDialog) QtCore.QObject.connect(self.settingListWidget, QtCore.SIGNAL(u'currentRowChanged(int)'), self.tabChanged) diff --git a/openlp/core/ui/shortcutlistdialog.py b/openlp/core/ui/shortcutlistdialog.py index eaee35afa..39e0c41a7 100644 --- a/openlp/core/ui/shortcutlistdialog.py +++ b/openlp/core/ui/shortcutlistdialog.py @@ -28,6 +28,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import translate, build_icon +from openlp.core.lib.ui import create_button_box class CaptureShortcutButton(QtGui.QPushButton): """ @@ -108,18 +109,11 @@ class Ui_ShortcutListDialog(object): self.alternateLabel.setObjectName(u'alternateLabel') self.detailsLayout.addWidget(self.alternateLabel, 0, 2, 1, 1) self.shortcutListLayout.addLayout(self.detailsLayout) - self.buttonBox = QtGui.QDialogButtonBox(shortcutListDialog) - self.buttonBox.setObjectName(u'buttonBox') + self.buttonBox = create_button_box(shortcutListDialog, u'buttonBox', + [u'cancel', u'ok', u'defaults']) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | - QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.RestoreDefaults) self.shortcutListLayout.addWidget(self.buttonBox) 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): shortcutListDialog.setWindowTitle( diff --git a/openlp/core/ui/splashscreen.py b/openlp/core/ui/splashscreen.py index 7ab2d9798..feae3214f 100644 --- a/openlp/core/ui/splashscreen.py +++ b/openlp/core/ui/splashscreen.py @@ -42,4 +42,3 @@ class SplashScreen(QtGui.QSplashScreen): self.setPixmap(splash_image) self.setMask(splash_image.mask()) self.resize(370, 370) - QtCore.QMetaObject.connectSlotsByName(self) diff --git a/openlp/core/ui/starttimedialog.py b/openlp/core/ui/starttimedialog.py index 236795b01..bebdbf18d 100644 --- a/openlp/core/ui/starttimedialog.py +++ b/openlp/core/ui/starttimedialog.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui 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): def setupUi(self, StartTimeDialog): @@ -99,11 +99,11 @@ class Ui_StartTimeDialog(object): self.secondFinishLabel.setAlignment(QtCore.Qt.AlignRight) self.dialogLayout.addWidget(self.secondFinishLabel, 3, 3, 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.retranslateUi(StartTimeDialog) self.setMaximumHeight(self.sizeHint().height()) - QtCore.QMetaObject.connectSlotsByName(StartTimeDialog) def retranslateUi(self, StartTimeDialog): self.setWindowTitle(translate('OpenLP.StartTimeForm', diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index face5938f..f8c061851 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -608,7 +608,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): 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 self.theme.theme_name = unicode(self.field(u'name').toString()) diff --git a/openlp/core/ui/themelayoutdialog.py b/openlp/core/ui/themelayoutdialog.py index 26346392b..cab9d13fd 100644 --- a/openlp/core/ui/themelayoutdialog.py +++ b/openlp/core/ui/themelayoutdialog.py @@ -28,6 +28,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import translate +from openlp.core.lib.ui import create_button_box class Ui_ThemeLayoutDialog(object): @@ -35,34 +36,30 @@ class Ui_ThemeLayoutDialog(object): themeLayoutDialog.setObjectName(u'themeLayoutDialogDialog') #themeLayoutDialog.resize(300, 200) self.previewLayout = QtGui.QVBoxLayout(themeLayoutDialog) - self.previewLayout.setObjectName(u'PreviewLayout') + self.previewLayout.setObjectName(u'previewLayout') self.previewArea = QtGui.QWidget(themeLayoutDialog) - self.previewArea.setObjectName(u'PreviewArea') + self.previewArea.setObjectName(u'previewArea') self.previewAreaLayout = QtGui.QGridLayout(self.previewArea) self.previewAreaLayout.setMargin(0) self.previewAreaLayout.setColumnStretch(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.setFrameShape(QtGui.QFrame.Box) self.themeDisplayLabel.setScaledContents(True) - self.themeDisplayLabel.setObjectName(u'ThemeDisplayLabel') + self.themeDisplayLabel.setObjectName(u'themeDisplayLabel') self.previewAreaLayout.addWidget(self.themeDisplayLabel) self.previewLayout.addWidget(self.previewArea) self.mainColourLabel = QtGui.QLabel(self.previewArea) - self.mainColourLabel.setObjectName(u'MainColourLabel') + self.mainColourLabel.setObjectName(u'mainColourLabel') self.previewLayout.addWidget(self.mainColourLabel) self.footerColourLabel = QtGui.QLabel(self.previewArea) - self.footerColourLabel.setObjectName(u'FooterColourLabel') + self.footerColourLabel.setObjectName(u'footerColourLabel') self.previewLayout.addWidget(self.footerColourLabel) - self.buttonBox = QtGui.QDialogButtonBox(themeLayoutDialog) - self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) - self.buttonBox.setObjectName(u'ButtonBox') - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'), - themeLayoutDialog.accept) + self.buttonBox = create_button_box(themeLayoutDialog, u'buttonBox', + [u'ok']) self.previewLayout.addWidget(self.buttonBox) self.retranslateUi(themeLayoutDialog) - QtCore.QMetaObject.connectSlotsByName(themeLayoutDialog) def retranslateUi(self, themeLayoutDialog): themeLayoutDialog.setWindowTitle( diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index 2967c0a0d..e6003f75d 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -96,11 +96,11 @@ class ThemesTab(SettingsTab): self.rightLayout.addWidget(self.LevelGroupBox) self.rightLayout.addStretch() QtCore.QObject.connect(self.SongLevelRadioButton, - QtCore.SIGNAL(u'pressed()'), self.onSongLevelButtonPressed) + QtCore.SIGNAL(u'clicked()'), self.onSongLevelButtonClicked) QtCore.QObject.connect(self.ServiceLevelRadioButton, - QtCore.SIGNAL(u'pressed()'), self.onServiceLevelButtonPressed) + QtCore.SIGNAL(u'clicked()'), self.onServiceLevelButtonClicked) QtCore.QObject.connect(self.GlobalLevelRadioButton, - QtCore.SIGNAL(u'pressed()'), self.onGlobalLevelButtonPressed) + QtCore.SIGNAL(u'clicked()'), self.onGlobalLevelButtonClicked) QtCore.QObject.connect(self.DefaultComboBox, QtCore.SIGNAL(u'activated(int)'), self.onDefaultComboBoxChanged) QtCore.QObject.connect(Receiver.get_receiver(), @@ -158,13 +158,13 @@ class ThemesTab(SettingsTab): def postSetUp(self): Receiver.send_message(u'theme_update_global', self.global_theme) - def onSongLevelButtonPressed(self): + def onSongLevelButtonClicked(self): self.theme_level = ThemeLevel.Song - def onServiceLevelButtonPressed(self): + def onServiceLevelButtonClicked(self): self.theme_level = ThemeLevel.Service - def onGlobalLevelButtonPressed(self): + def onGlobalLevelButtonClicked(self): self.theme_level = ThemeLevel.Global def onDefaultComboBoxChanged(self, value): diff --git a/openlp/core/ui/themewizard.py b/openlp/core/ui/themewizard.py index fc471ded6..2e0166285 100644 --- a/openlp/core/ui/themewizard.py +++ b/openlp/core/ui/themewizard.py @@ -30,7 +30,8 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import translate, build_icon from openlp.core.lib.theme import HorizontalType, BackgroundType, \ 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): def setupUi(self, themeWizard): @@ -257,8 +258,11 @@ class Ui_ThemeWizard(object): self.horizontalComboBox.setObjectName(u'HorizontalComboBox') self.alignmentLayout.addRow(self.horizontalLabel, self.horizontalComboBox) - create_valign_combo(themeWizard, self.alignmentPage, - self.alignmentLayout) + self.verticalLabel, self.verticalComboBox = \ + 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.setObjectName(u'TransitionsLabel') self.transitionsCheckBox = QtGui.QCheckBox(self.alignmentPage) @@ -413,7 +417,6 @@ class Ui_ThemeWizard(object): QtCore.QObject.connect(self.footerPositionCheckBox, QtCore.SIGNAL(u'toggled(bool)'), self.footerHeightSpinBox, QtCore.SLOT(u'setDisabled(bool)')) - QtCore.QMetaObject.connectSlotsByName(themeWizard) def retranslateUi(self, themeWizard): themeWizard.setWindowTitle( diff --git a/openlp/core/ui/wizard.py b/openlp/core/ui/wizard.py index 91aa42e43..305e85f24 100644 --- a/openlp/core/ui/wizard.py +++ b/openlp/core/ui/wizard.py @@ -114,7 +114,6 @@ class OpenLPWizard(QtGui.QWizard): self.addCustomPages() self.addProgressPage() self.retranslateUi() - QtCore.QMetaObject.connectSlotsByName(self) def registerFields(self): """ diff --git a/openlp/plugins/alerts/forms/alertdialog.py b/openlp/plugins/alerts/forms/alertdialog.py index 6cd59f9a2..b211a3aa4 100644 --- a/openlp/plugins/alerts/forms/alertdialog.py +++ b/openlp/plugins/alerts/forms/alertdialog.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui 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): def setupUi(self, alertDialog): @@ -67,31 +67,21 @@ class Ui_AlertDialog(object): self.saveButton.setIcon(build_icon(u':/general/general_save.png')) self.saveButton.setObjectName(u'saveButton') self.manageButtonLayout.addWidget(self.saveButton) - self.deleteButton = create_delete_push_button(alertDialog) - self.deleteButton.setEnabled(False) + self.deleteButton = create_button(alertDialog, u'deleteButton', + role=u'delete', enabled=False, + click=alertDialog.onDeleteButtonClicked) self.manageButtonLayout.addWidget(self.deleteButton) self.manageButtonLayout.addStretch() 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') - self.displayButton = QtGui.QPushButton(alertDialog) - self.displayButton.setEnabled(False) - self.displayButton.setIcon(displayIcon) - self.displayButton.setObjectName(u'displayButton') - self.buttonBox.addButton(self.displayButton, - QtGui.QDialogButtonBox.ActionRole) - 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.displayButton = create_button(alertDialog, u'displayButton', + icon=displayIcon, enabled=False) + self.displayCloseButton = create_button(alertDialog, + u'displayCloseButton', icon=displayIcon, enabled=False) + self.buttonBox = create_button_box(alertDialog, u'buttonBox', + [u'close'], [self.displayButton, self.displayCloseButton]) self.alertDialogLayout.addWidget(self.buttonBox, 2, 0, 1, 2) self.retranslateUi(alertDialog) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'), - alertDialog.close) - QtCore.QMetaObject.connectSlotsByName(alertDialog) def retranslateUi(self, alertDialog): alertDialog.setWindowTitle( diff --git a/openlp/plugins/alerts/lib/alertstab.py b/openlp/plugins/alerts/lib/alertstab.py index fc7c74ea5..22346b0aa 100644 --- a/openlp/plugins/alerts/lib/alertstab.py +++ b/openlp/plugins/alerts/lib/alertstab.py @@ -29,7 +29,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import SettingsTab, translate, Receiver 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): """ @@ -76,7 +76,11 @@ class AlertsTab(SettingsTab): self.timeoutSpinBox.setMaximum(180) self.timeoutSpinBox.setObjectName(u'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.addStretch() self.previewGroupBox = QtGui.QGroupBox(self.rightColumn) @@ -90,9 +94,9 @@ class AlertsTab(SettingsTab): self.rightLayout.addStretch() # Signals and slots QtCore.QObject.connect(self.backgroundColorButton, - QtCore.SIGNAL(u'pressed()'), self.onBackgroundColorButtonClicked) + QtCore.SIGNAL(u'clicked()'), self.onBackgroundColorButtonClicked) QtCore.QObject.connect(self.fontColorButton, - QtCore.SIGNAL(u'pressed()'), self.onFontColorButtonClicked) + QtCore.SIGNAL(u'clicked()'), self.onFontColorButtonClicked) QtCore.QObject.connect(self.fontComboBox, QtCore.SIGNAL(u'activated(int)'), self.onFontComboBoxClicked) QtCore.QObject.connect(self.timeoutSpinBox, diff --git a/openlp/plugins/bibles/forms/booknamedialog.py b/openlp/plugins/bibles/forms/booknamedialog.py index 4b67fa826..84d563826 100644 --- a/openlp/plugins/bibles/forms/booknamedialog.py +++ b/openlp/plugins/bibles/forms/booknamedialog.py @@ -27,6 +27,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import translate +from openlp.core.lib.ui import create_button_box class Ui_BookNameDialog(object): def setupUi(self, bookNameDialog): @@ -78,21 +79,11 @@ class Ui_BookNameDialog(object): self.apocryphaCheckBox.setCheckState(QtCore.Qt.Checked) self.optionsLayout.addWidget(self.apocryphaCheckBox) self.bookNameLayout.addWidget(self.optionsGroupBox) - self.buttonBox = QtGui.QDialogButtonBox(bookNameDialog) - self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons( - QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) - self.buttonBox.setObjectName(u'buttonBox') + self.buttonBox = create_button_box(bookNameDialog, u'buttonBox', + [u'cancel', u'ok']) self.bookNameLayout.addWidget(self.buttonBox) 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): bookNameDialog.setWindowTitle(translate('BiblesPlugin.BookNameDialog', diff --git a/openlp/plugins/bibles/forms/languagedialog.py b/openlp/plugins/bibles/forms/languagedialog.py index 390977ee9..b355c09f7 100644 --- a/openlp/plugins/bibles/forms/languagedialog.py +++ b/openlp/plugins/bibles/forms/languagedialog.py @@ -27,6 +27,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import translate +from openlp.core.lib.ui import create_button_box class Ui_LanguageDialog(object): def setupUi(self, languageDialog): @@ -60,18 +61,11 @@ class Ui_LanguageDialog(object): self.languageComboBox.setObjectName(u'languageComboBox') self.languageHBoxLayout.addWidget(self.languageComboBox) self.languageLayout.addLayout(self.languageHBoxLayout) - self.buttonBox = QtGui.QDialogButtonBox(languageDialog) - self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel| - QtGui.QDialogButtonBox.Ok) - self.buttonBox.setObjectName(u'buttonBox') + self.buttonBox = create_button_box(languageDialog, u'buttonBox', + [u'cancel', u'ok']) self.languageLayout.addWidget(self.buttonBox) 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): languageDialog.setWindowTitle( diff --git a/openlp/plugins/bibles/lib/__init__.py b/openlp/plugins/bibles/lib/__init__.py index 456e08cf4..8d51afdee 100644 --- a/openlp/plugins/bibles/lib/__init__.py +++ b/openlp/plugins/bibles/lib/__init__.py @@ -368,37 +368,26 @@ def parse_reference(reference, bible, language_selection, book_ref_id=False): if db_book: book_ref_id = db_book.book_reference_id elif language_selection == LanguageSelection.Application: - book_list = [] - for key, value in booknames.iteritems(): - if regex_book.match(unicode(value)): - book_list.append(key) - books = [] - if book_list: - for value in book_list: - 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 + books = filter(lambda key: + regex_book.match(unicode(booknames[key])), booknames.keys()) + books = filter(None, map(BiblesResourcesDB.get_book, 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: books = BiblesResourcesDB.get_books_like(book) if books: - book_list = [] - for value in books: - if regex_book.match(value[u'name']): - book_list.append(value) + book_list = filter( + lambda value: regex_book.match(value[u'name']), books) if not book_list: book_list = books for value in book_list: if bible.get_book_by_book_ref_id(value[u'id']): book_ref_id = value[u'id'] break - else: - if not bible.get_book_by_book_ref_id(book_ref_id): - book_ref_id = False + elif bible.get_book_by_book_ref_id(book_ref_id): + book_ref_id = False ranges = match.group(u'ranges') range_list = get_reference_match(u'range_separator').split(ranges) ref_list = [] diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index 630772bf3..5880f85f7 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -363,7 +363,7 @@ class CWExtract(object): class HTTPBible(BibleDB): - log.info(u'%s HTTPBible loaded' , __name__) + log.info(u'%s HTTPBible loaded', __name__) def __init__(self, parent, **kwargs): """ diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 072de9bf6..5c38b5f4f 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -33,8 +33,8 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \ translate, create_separated_list from openlp.core.lib.searchedit import SearchEdit -from openlp.core.lib.ui import UiStrings, add_widget_completer, \ - media_item_combo_box, critical_error_message_box, \ +from openlp.core.lib.ui import UiStrings, set_case_insensitive_completer, \ + create_horizontal_adjusting_combo_box, critical_error_message_box, \ find_and_set_in_combo_box, build_icon from openlp.plugins.bibles.forms import BibleImportForm, EditBibleForm from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, \ @@ -143,20 +143,22 @@ class BibleMediaItem(MediaManagerItem): versionLabel = QtGui.QLabel(tab) versionLabel.setObjectName(prefix + u'VersionLabel') layout.addWidget(versionLabel, idx, 0, QtCore.Qt.AlignRight) - versionComboBox = media_item_combo_box(tab, + versionComboBox = create_horizontal_adjusting_combo_box(tab, prefix + u'VersionComboBox') versionLabel.setBuddy(versionComboBox) layout.addWidget(versionComboBox, idx, 1, 1, 2) secondLabel = QtGui.QLabel(tab) secondLabel.setObjectName(prefix + u'SecondLabel') 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) layout.addWidget(secondComboBox, idx + 1, 1, 1, 2) styleLabel = QtGui.QLabel(tab) styleLabel.setObjectName(prefix + u'StyleLabel') 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'']) layout.addWidget(styleComboBox, idx + 2, 1, 1, 2) searchButtonLayout = QtGui.QHBoxLayout() @@ -210,8 +212,8 @@ class BibleMediaItem(MediaManagerItem): self.advancedBookLabel.setObjectName(u'advancedBookLabel') self.advancedLayout.addWidget(self.advancedBookLabel, 0, 0, QtCore.Qt.AlignRight) - self.advancedBookComboBox = media_item_combo_box(self.advancedTab, - u'advancedBookComboBox') + self.advancedBookComboBox = create_horizontal_adjusting_combo_box( + self.advancedTab, u'advancedBookComboBox') self.advancedBookLabel.setBuddy(self.advancedBookComboBox) self.advancedLayout.addWidget(self.advancedBookComboBox, 0, 1, 1, 2) self.advancedChapterLabel = QtGui.QLabel(self.advancedTab) @@ -270,9 +272,9 @@ class BibleMediaItem(MediaManagerItem): self.onAdvancedStyleComboBoxChanged) # Buttons QtCore.QObject.connect(self.advancedSearchButton, - QtCore.SIGNAL(u'pressed()'), self.onAdvancedSearchButton) + QtCore.SIGNAL(u'clicked()'), self.onAdvancedSearchButton) QtCore.QObject.connect(self.quickSearchButton, - QtCore.SIGNAL(u'pressed()'), self.onQuickSearchButton) + QtCore.SIGNAL(u'clicked()'), self.onQuickSearchButton) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.configUpdated) # Other stuff @@ -531,7 +533,7 @@ class BibleMediaItem(MediaManagerItem): book.book_reference_id) books.append(data[u'name'] + u' ') books.sort(cmp=locale.strcoll) - add_widget_completer(books, self.quickSearchEdit) + set_case_insensitive_completer(books, self.quickSearchEdit) def onQuickVersionComboBox(self): self.updateAutoCompleter() @@ -704,7 +706,7 @@ class BibleMediaItem(MediaManagerItem): """ 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) Receiver.send_message(u'openlp_process_events') bible = unicode(self.advancedVersionComboBox.currentText()) @@ -743,7 +745,7 @@ class BibleMediaItem(MediaManagerItem): Does a quick search and saves the search results. Quick search can 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) Receiver.send_message(u'openlp_process_events') bible = unicode(self.quickVersionComboBox.currentText()) diff --git a/openlp/plugins/custom/forms/editcustomdialog.py b/openlp/plugins/custom/forms/editcustomdialog.py index 1d79968f5..bd4fb78fa 100644 --- a/openlp/plugins/custom/forms/editcustomdialog.py +++ b/openlp/plugins/custom/forms/editcustomdialog.py @@ -28,8 +28,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import build_icon, translate -from openlp.core.lib.ui import UiStrings, create_accept_reject_button_box, \ - create_delete_push_button, create_up_down_push_button_set +from openlp.core.lib.ui import UiStrings, create_button_box, create_button class Ui_CustomEditDialog(object): def setupUi(self, customEditDialog): @@ -67,14 +66,16 @@ class Ui_CustomEditDialog(object): self.editAllButton = QtGui.QPushButton(customEditDialog) self.editAllButton.setObjectName(u'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.buttonLayout.addWidget(self.deleteButton) self.buttonLayout.addStretch() - self.upButton, self.downButton = create_up_down_push_button_set( - customEditDialog) - self.upButton.setEnabled(False) - self.downButton.setEnabled(False) + self.upButton = create_button(customEditDialog, u'upButton', role=u'up', + enable=False, click=customEditDialog.onUpButtonClicked) + self.downButton = create_button(customEditDialog, u'downButton', + role=u'down', enable=False, + click=customEditDialog.onDownButtonClicked) self.buttonLayout.addWidget(self.upButton) self.buttonLayout.addWidget(self.downButton) self.centralLayout.addLayout(self.buttonLayout) @@ -95,13 +96,11 @@ class Ui_CustomEditDialog(object): self.creditLabel.setBuddy(self.creditEdit) self.bottomFormLayout.addRow(self.creditLabel, self.creditEdit) self.dialogLayout.addLayout(self.bottomFormLayout) - self.buttonBox = create_accept_reject_button_box(customEditDialog) self.previewButton = QtGui.QPushButton() - self.buttonBox.addButton( - self.previewButton, QtGui.QDialogButtonBox.ActionRole) + self.buttonBox = create_button_box(customEditDialog, u'buttonBox', + [u'cancel', u'save'], [self.previewButton]) self.dialogLayout.addWidget(self.buttonBox) self.retranslateUi(customEditDialog) - QtCore.QMetaObject.connectSlotsByName(customEditDialog) def retranslateUi(self, customEditDialog): customEditDialog.setWindowTitle( diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index 6a72907a9..7c2da3bb0 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -56,20 +56,20 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.editSlideForm = EditCustomSlideForm(self) # Connecting signals and slots QtCore.QObject.connect(self.previewButton, - QtCore.SIGNAL(u'pressed()'), self.onPreviewButtonPressed) + QtCore.SIGNAL(u'clicked()'), self.onPreviewButtonClicked) QtCore.QObject.connect(self.addButton, - QtCore.SIGNAL(u'pressed()'), self.onAddButtonPressed) + QtCore.SIGNAL(u'clicked()'), self.onAddButtonClicked) QtCore.QObject.connect(self.editButton, - QtCore.SIGNAL(u'pressed()'), self.onEditButtonPressed) + QtCore.SIGNAL(u'clicked()'), self.onEditButtonClicked) QtCore.QObject.connect(self.editAllButton, - QtCore.SIGNAL(u'pressed()'), self.onEditAllButtonPressed) + QtCore.SIGNAL(u'clicked()'), self.onEditAllButtonClicked) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_list'), self.loadThemes) QtCore.QObject.connect(self.slideListView, QtCore.SIGNAL(u'currentRowChanged(int)'), self.onCurrentRowChanged) QtCore.QObject.connect(self.slideListView, QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), - self.onEditButtonPressed) + self.onEditButtonClicked) def loadThemes(self, themelist): self.themeComboBox.clear() @@ -154,18 +154,18 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.slideListView.insertItem(selectedRow + 1, qw) self.slideListView.setCurrentRow(selectedRow + 1) - def onAddButtonPressed(self): + def onAddButtonClicked(self): self.editSlideForm.setText(u'') if self.editSlideForm.exec_(): for slide in self.editSlideForm.getText(): self.slideListView.addItem(slide) - def onEditButtonPressed(self): + def onEditButtonClicked(self): self.editSlideForm.setText(self.slideListView.currentItem().text()) if self.editSlideForm.exec_(): self.updateSlideList(self.editSlideForm.getText()) - def onEditAllButtonPressed(self): + def onEditAllButtonClicked(self): """ Edits all slides. """ @@ -179,7 +179,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): if self.editSlideForm.exec_(): self.updateSlideList(self.editSlideForm.getText(), True) - def onPreviewButtonPressed(self): + def onPreviewButtonClicked(self): """ Save the custom item and preview it. """ diff --git a/openlp/plugins/custom/forms/editcustomslidedialog.py b/openlp/plugins/custom/forms/editcustomslidedialog.py index a616075c0..381917e8c 100644 --- a/openlp/plugins/custom/forms/editcustomslidedialog.py +++ b/openlp/plugins/custom/forms/editcustomslidedialog.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui 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): def setupUi(self, customSlideEditDialog): @@ -38,20 +38,14 @@ class Ui_CustomSlideEditDialog(object): self.slideTextEdit = SpellTextEdit(self) self.slideTextEdit.setObjectName(u'slideTextEdit') self.dialogLayout.addWidget(self.slideTextEdit) - self.buttonBox = create_accept_reject_button_box(customSlideEditDialog) - self.splitButton = QtGui.QPushButton(customSlideEditDialog) - self.splitButton.setIcon(build_icon(u':/general/general_add.png')) - self.splitButton.setObjectName(u'splitButton') - self.buttonBox.addButton(self.splitButton, - QtGui.QDialogButtonBox.ActionRole) - 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.splitButton = create_button(customSlideEditDialog, u'splitButton', + icon=u':/general/general_add.png') + self.insertButton = create_button(customSlideEditDialog, + u'insertButton', icon=u':/general/general_add.png') + self.buttonBox = create_button_box(customSlideEditDialog, u'buttonBox', + [u'cancel', u'save'], [self.splitButton, self.insertButton]) self.dialogLayout.addWidget(self.buttonBox) self.retranslateUi(customSlideEditDialog) - QtCore.QMetaObject.connectSlotsByName(customSlideEditDialog) def retranslateUi(self, customSlideEditDialog): self.splitButton.setText(UiStrings().Split) diff --git a/openlp/plugins/custom/forms/editcustomslideform.py b/openlp/plugins/custom/forms/editcustomslideform.py index 6d4c7f9c2..ad9f9391b 100644 --- a/openlp/plugins/custom/forms/editcustomslideform.py +++ b/openlp/plugins/custom/forms/editcustomslideform.py @@ -46,9 +46,9 @@ class EditCustomSlideForm(QtGui.QDialog, Ui_CustomSlideEditDialog): self.setupUi(self) # Connecting signals and slots QtCore.QObject.connect(self.insertButton, - QtCore.SIGNAL(u'clicked()'), self.onInsertButtonPressed) + QtCore.SIGNAL(u'clicked()'), self.onInsertButtonClicked) QtCore.QObject.connect(self.splitButton, - QtCore.SIGNAL(u'clicked()'), self.onSplitButtonPressed) + QtCore.SIGNAL(u'clicked()'), self.onSplitButtonClicked) def setText(self, text): """ @@ -68,14 +68,14 @@ class EditCustomSlideForm(QtGui.QDialog, Ui_CustomSlideEditDialog): """ return self.slideTextEdit.toPlainText().split(u'\n[===]\n') - def onInsertButtonPressed(self): + def onInsertButtonClicked(self): """ Adds a slide split at the cursor. """ self.insertSingleLineTextAtCursor(u'[===]') self.slideTextEdit.setFocus() - def onSplitButtonPressed(self): + def onSplitButtonClicked(self): """ Adds a virtual split at cursor. """ diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index 688e8bf82..5cf872990 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -75,7 +75,7 @@ class CustomMediaItem(MediaManagerItem): QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick) QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'searchTypeChanged(int)'), - self.onSearchTextButtonClick) + self.onSearchTextButtonClicked) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'custom_edit'), self.onRemoteEdit) 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.exec_() self.autoSelectId = -1 - self.onSearchTextButtonClick() + self.onSearchTextButtonClicked() def onEditClick(self): """ @@ -166,7 +166,7 @@ class CustomMediaItem(MediaManagerItem): self.edit_custom_form.loadCustom(item_id, False) self.edit_custom_form.exec_() self.autoSelectId = -1 - self.onSearchTextButtonClick() + self.onSearchTextButtonClicked() def onDeleteClick(self): """ @@ -190,7 +190,7 @@ class CustomMediaItem(MediaManagerItem): for item in self.listView.selectedIndexes()] for id in id_list: self.plugin.manager.delete_object(CustomSlide, id) - self.onSearchTextButtonClick() + self.onSearchTextButtonClicked() def onFocus(self): self.searchTextEdit.setFocus() @@ -226,7 +226,7 @@ class CustomMediaItem(MediaManagerItem): service_item.raw_footer = raw_footer return True - def onSearchTextButtonClick(self): + def onSearchTextButtonClicked(self): # Save the current search type to the configuration. QtCore.QSettings().setValue(u'%s/last search type' % self.settingsSection, @@ -257,7 +257,7 @@ class CustomMediaItem(MediaManagerItem): """ search_length = 2 if len(text) > search_length: - self.onSearchTextButtonClick() + self.onSearchTextButtonClicked() elif len(text) == 0: self.onClearTextButtonClick() @@ -266,7 +266,7 @@ class CustomMediaItem(MediaManagerItem): Clear the search text. """ self.searchTextEdit.clear() - self.onSearchTextButtonClick() + self.onSearchTextButtonClicked() def search(self, string, showError): search_results = self.manager.get_all_objects(CustomSlide, diff --git a/openlp/plugins/images/lib/imagetab.py b/openlp/plugins/images/lib/imagetab.py index 4e708bd17..a8188ace6 100644 --- a/openlp/plugins/images/lib/imagetab.py +++ b/openlp/plugins/images/lib/imagetab.py @@ -62,7 +62,7 @@ class ImageTab(SettingsTab): self.rightLayout.addStretch() # Signals and slots QtCore.QObject.connect(self.backgroundColorButton, - QtCore.SIGNAL(u'pressed()'), self.onbackgroundColorButtonClicked) + QtCore.SIGNAL(u'clicked()'), self.onbackgroundColorButtonClicked) def retranslateUi(self): self.bgColorGroupBox.setTitle( diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 8373586a6..592cd08c6 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -35,7 +35,7 @@ from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, \ SettingsManager, translate, check_item_selected, Receiver, MediaType, \ ServiceItem, build_html 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.media import get_media_players, set_media_players @@ -131,7 +131,7 @@ class MediaMediaItem(MediaManagerItem): self.displayLayout.setObjectName(u'displayLayout') self.displayTypeLabel = QtGui.QLabel(self.mediaWidget) self.displayTypeLabel.setObjectName(u'displayTypeLabel') - self.displayTypeComboBox = media_item_combo_box( + self.displayTypeComboBox = create_horizontal_adjusting_combo_box( self.mediaWidget, u'displayTypeComboBox') self.displayTypeLabel.setBuddy(self.displayTypeComboBox) self.displayLayout.addRow(self.displayTypeLabel, diff --git a/openlp/plugins/media/lib/mediatab.py b/openlp/plugins/media/lib/mediatab.py index a6f2dfb8b..c7ec1a61b 100644 --- a/openlp/plugins/media/lib/mediatab.py +++ b/openlp/plugins/media/lib/mediatab.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui 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 class MediaQCheckBox(QtGui.QCheckBox): """ @@ -87,8 +87,10 @@ class MediaTab(SettingsTab): self.orderingButtonLayout = QtGui.QVBoxLayout() self.orderingButtonLayout.setObjectName(u'orderingButtonLayout') self.orderingButtonLayout.addStretch(1) - self.orderingUpButton, self.orderingDownButton = \ - create_up_down_push_button_set(self) + self.orderingUpButton = create_button(self, u'orderingUpButton', + 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.orderingDownButton) self.orderingButtonLayout.addStretch(1) diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index 3f9c81fc7..45d14f8cc 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -35,7 +35,7 @@ from openlp.core.lib import MediaManagerItem, build_icon, SettingsManager, \ translate, check_item_selected, Receiver, ItemCapabilities, create_thumb, \ validate_thumb 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 log = logging.getLogger(__name__) @@ -110,7 +110,7 @@ class PresentationMediaItem(MediaManagerItem): self.displayLayout.setObjectName(u'displayLayout') self.displayTypeLabel = QtGui.QLabel(self.presentationWidget) self.displayTypeLabel.setObjectName(u'displayTypeLabel') - self.displayTypeComboBox = media_item_combo_box( + self.displayTypeComboBox = create_horizontal_adjusting_combo_box( self.presentationWidget, u'displayTypeComboBox') self.displayTypeLabel.setBuddy(self.displayTypeComboBox) self.displayLayout.addRow(self.displayTypeLabel, diff --git a/openlp/plugins/songs/forms/authorsdialog.py b/openlp/plugins/songs/forms/authorsdialog.py index fb537d04b..f5cc69aa5 100644 --- a/openlp/plugins/songs/forms/authorsdialog.py +++ b/openlp/plugins/songs/forms/authorsdialog.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui 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): def setupUi(self, authorsDialog): @@ -57,11 +57,11 @@ class Ui_AuthorsDialog(object): self.displayLabel.setBuddy(self.displayEdit) self.authorLayout.addRow(self.displayLabel, self.displayEdit) self.dialogLayout.addLayout(self.authorLayout) - self.dialogLayout.addWidget( - create_accept_reject_button_box(authorsDialog)) + self.buttonBox = create_button_box(authorsDialog, u'buttonBox', + [u'cancel', u'save']) + self.dialogLayout.addWidget(self.buttonBox) self.retranslateUi(authorsDialog) authorsDialog.setMaximumHeight(authorsDialog.sizeHint().height()) - QtCore.QMetaObject.connectSlotsByName(authorsDialog) def retranslateUi(self, authorsDialog): authorsDialog.setWindowTitle( diff --git a/openlp/plugins/songs/forms/editsongdialog.py b/openlp/plugins/songs/forms/editsongdialog.py index 1a1517fd3..2dbfdc3b5 100644 --- a/openlp/plugins/songs/forms/editsongdialog.py +++ b/openlp/plugins/songs/forms/editsongdialog.py @@ -28,8 +28,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import build_icon, translate -from openlp.core.lib.ui import UiStrings, create_accept_reject_button_box, \ - create_up_down_push_button_set +from openlp.core.lib.ui import UiStrings, create_button_box, create_button from openlp.plugins.songs.lib.ui import SongStrings class Ui_EditSongDialog(object): @@ -268,8 +267,10 @@ class Ui_EditSongDialog(object): self.audioRemoveAllButton.setObjectName(u'audioRemoveAllButton') self.audioButtonsLayout.addWidget(self.audioRemoveAllButton) self.audioButtonsLayout.addStretch(1) - self.upButton, self.downButton = \ - create_up_down_push_button_set(self) + self.upButton = create_button(self, u'upButton', role=u'up', + 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.downButton) self.audioLayout.addLayout(self.audioButtonsLayout) @@ -282,11 +283,11 @@ class Ui_EditSongDialog(object): self.warningLabel.setObjectName(u'warningLabel') self.warningLabel.setVisible(False) 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.dialogLayout.addLayout(self.bottomLayout) self.retranslateUi(editSongDialog) - QtCore.QMetaObject.connectSlotsByName(editSongDialog) def retranslateUi(self, editSongDialog): editSongDialog.setWindowTitle( diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 330c80110..1412d94cb 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -34,7 +34,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import PluginStatus, Receiver, MediaType, translate, \ 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 from openlp.core.utils import AppLocation 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.QObject.connect(self.authorsListView, QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'), - self.onAuthorsListViewPressed) + self.onAuthorsListViewClicked) QtCore.QObject.connect(self.topicAddButton, QtCore.SIGNAL(u'clicked()'), self.onTopicAddButtonClicked) QtCore.QObject.connect(self.topicRemoveButton, QtCore.SIGNAL(u'clicked()'), self.onTopicRemoveButtonClicked) QtCore.QObject.connect(self.topicsListView, QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'), - self.onTopicListViewPressed) + self.onTopicListViewClicked) QtCore.QObject.connect(self.copyrightInsertButton, QtCore.SIGNAL(u'clicked()'), self.onCopyrightInsertButtonTriggered) QtCore.QObject.connect(self.verseAddButton, @@ -91,7 +91,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): QtCore.SIGNAL(u'clicked()'), self.onVerseDeleteButtonClicked) QtCore.QObject.connect(self.verseListWidget, QtCore.SIGNAL(u'itemClicked(QTableWidgetItem*)'), - self.onVerseListViewPressed) + self.onVerseListViewClicked) QtCore.QObject.connect(self.verseOrderEdit, QtCore.SIGNAL(u'textChanged(QString)'), self.onVerseOrderTextChanged) @@ -148,7 +148,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self.authorsComboBox.setItemData( row, QtCore.QVariant(author.id)) self.authors.append(author.display_name) - add_widget_completer(self.authors, self.authorsComboBox) + set_case_insensitive_completer(self.authors, self.authorsComboBox) def loadTopics(self): self.topics = [] @@ -167,7 +167,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): combo.addItem(object.name) cache.append(object.name) combo.setItemData(row, QtCore.QVariant(object.id)) - add_widget_completer(cache, combo) + set_case_insensitive_completer(cache, combo) def loadThemes(self, theme_list): self.themeComboBox.clear() @@ -176,7 +176,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): for theme in theme_list: self.themeComboBox.addItem(theme) self.themes.append(theme) - add_widget_completer(self.themes, self.themeComboBox) + set_case_insensitive_completer(self.themes, self.themeComboBox) def loadMediaFiles(self): self.audioAddFromMediaButton.setVisible(False) @@ -399,7 +399,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): author_item.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id)) self.authorsListView.addItem(author_item) - def onAuthorsListViewPressed(self): + def onAuthorsListViewClicked(self): if self.authorsListView.count() > 1: 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" ' 'button to add the new topic.')) - def onTopicListViewPressed(self): + def onTopicListViewClicked(self): self.topicRemoveButton.setEnabled(True) def onTopicRemoveButtonClicked(self): @@ -459,7 +459,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): row = self.topicsListView.row(item) self.topicsListView.takeItem(row) - def onVerseListViewPressed(self): + def onVerseListViewClicked(self): self.verseEditButton.setEnabled(True) self.verseDeleteButton.setEnabled(True) @@ -716,7 +716,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): 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. ``button`` diff --git a/openlp/plugins/songs/forms/editversedialog.py b/openlp/plugins/songs/forms/editversedialog.py index 7c78ae355..062d81d7f 100644 --- a/openlp/plugins/songs/forms/editversedialog.py +++ b/openlp/plugins/songs/forms/editversedialog.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui 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 class Ui_EditVerseDialog(object): @@ -65,10 +65,10 @@ class Ui_EditVerseDialog(object): self.verseTypeLayout.addWidget(self.insertButton) self.verseTypeLayout.addStretch() self.dialogLayout.addLayout(self.verseTypeLayout) - self.dialogLayout.addWidget( - create_accept_reject_button_box(editVerseDialog)) + self.buttonBox = create_button_box(editVerseDialog, u'buttonBox', + [u'cancel', u'save']) + self.dialogLayout.addWidget(self.buttonBox) self.retranslateUi(editVerseDialog) - QtCore.QMetaObject.connectSlotsByName(editVerseDialog) def retranslateUi(self, editVerseDialog): editVerseDialog.setWindowTitle( diff --git a/openlp/plugins/songs/forms/mediafilesdialog.py b/openlp/plugins/songs/forms/mediafilesdialog.py index 332cda6b8..3dff7a1a3 100644 --- a/openlp/plugins/songs/forms/mediafilesdialog.py +++ b/openlp/plugins/songs/forms/mediafilesdialog.py @@ -28,6 +28,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import translate, build_icon +from openlp.core.lib.ui import create_button_box class Ui_MediaFilesDialog(object): def setupUi(self, mediaFilesDialog): @@ -51,19 +52,11 @@ class Ui_MediaFilesDialog(object): QtGui.QAbstractItemView.ExtendedSelection) self.fileListWidget.setObjectName(u'fileListWidget') self.filesVerticalLayout.addWidget(self.fileListWidget) - self.buttonBox = QtGui.QDialogButtonBox(mediaFilesDialog) - self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons( - QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok) - self.buttonBox.setObjectName(u'buttonBox') + self.buttonBox = create_button_box(mediaFilesDialog, u'buttonBox', + [u'cancel', u'ok']) self.filesVerticalLayout.addWidget(self.buttonBox) 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): mediaFilesDialog.setWindowTitle( diff --git a/openlp/plugins/songs/forms/songbookdialog.py b/openlp/plugins/songs/forms/songbookdialog.py index b9b0cd137..5c62514ad 100644 --- a/openlp/plugins/songs/forms/songbookdialog.py +++ b/openlp/plugins/songs/forms/songbookdialog.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui 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): def setupUi(self, songBookDialog): @@ -51,11 +51,11 @@ class Ui_SongBookDialog(object): self.publisherLabel.setBuddy(self.publisherEdit) self.bookLayout.addRow(self.publisherLabel, self.publisherEdit) self.dialogLayout.addLayout(self.bookLayout) - self.dialogLayout.addWidget( - create_accept_reject_button_box(songBookDialog)) + self.buttonBox = create_button_box(songBookDialog, u'buttonBox', + [u'cancel', u'save']) + self.dialogLayout.addWidget(self.buttonBox) self.retranslateUi(songBookDialog) songBookDialog.setMaximumHeight(songBookDialog.sizeHint().height()) - QtCore.QMetaObject.connectSlotsByName(songBookDialog) def retranslateUi(self, songBookDialog): songBookDialog.setWindowTitle( diff --git a/openlp/plugins/songs/forms/songexportform.py b/openlp/plugins/songs/forms/songexportform.py index 2014b5d7b..397b52cfc 100644 --- a/openlp/plugins/songs/forms/songexportform.py +++ b/openlp/plugins/songs/forms/songexportform.py @@ -90,7 +90,7 @@ class SongExportForm(OpenLPWizard): """ QtCore.QObject.connect(self.availableListWidget, QtCore.SIGNAL(u'itemActivated(QListWidgetItem*)'), - self.onItemPressed) + self.onItemActivated) QtCore.QObject.connect(self.searchLineEdit, QtCore.SIGNAL(u'textEdited(const QString&)'), self.onSearchLineEditChanged) @@ -312,14 +312,14 @@ class SongExportForm(OpenLPWizard): 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 - item is check if it was not checked, whereas it is unchecked when it was - checked. + Called, when an item in the *availableListWidget* has been triggered. + The item is check if it was not checked, whereas it is unchecked when it + was checked. ``item`` - The *QListWidgetItem* which was pressed. + The *QListWidgetItem* which was triggered. """ item.setCheckState( QtCore.Qt.Unchecked if item.checkState() else QtCore.Qt.Checked) diff --git a/openlp/plugins/songs/forms/songmaintenancedialog.py b/openlp/plugins/songs/forms/songmaintenancedialog.py index 4f347a768..a8f2fc033 100644 --- a/openlp/plugins/songs/forms/songmaintenancedialog.py +++ b/openlp/plugins/songs/forms/songmaintenancedialog.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui 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 class Ui_SongMaintenanceDialog(object): @@ -132,18 +132,14 @@ class Ui_SongMaintenanceDialog(object): self.stackedLayout.addWidget(self.booksPage) # self.dialogLayout.addLayout(self.stackedLayout, 0, 1) - self.buttonBox = QtGui.QDialogButtonBox(songMaintenanceDialog) - self.buttonBox.addButton(QtGui.QDialogButtonBox.Close) - self.buttonBox.setObjectName(u'buttonBox') + self.buttonBox = create_button_box(songMaintenanceDialog, u'buttonBox', + [u'close']) self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2) self.retranslateUi(songMaintenanceDialog) self.stackedLayout.setCurrentIndex(0) - QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'), - songMaintenanceDialog.accept) QtCore.QObject.connect(self.typeListWidget, QtCore.SIGNAL(u'currentRowChanged(int)'), self.stackedLayout.setCurrentIndex) - QtCore.QMetaObject.connectSlotsByName(songMaintenanceDialog) def retranslateUi(self, songMaintenanceDialog): songMaintenanceDialog.setWindowTitle(SongStrings.SongMaintenance) diff --git a/openlp/plugins/songs/forms/songmaintenanceform.py b/openlp/plugins/songs/forms/songmaintenanceform.py index 135351782..697bcb4fe 100644 --- a/openlp/plugins/songs/forms/songmaintenanceform.py +++ b/openlp/plugins/songs/forms/songmaintenanceform.py @@ -60,23 +60,23 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): self.booksEditButton.setEnabled(False) # Signals QtCore.QObject.connect(self.authorsAddButton, - QtCore.SIGNAL(u'pressed()'), self.onAuthorAddButtonClick) + QtCore.SIGNAL(u'clicked()'), self.onAuthorAddButtonClicked) QtCore.QObject.connect(self.topicsAddButton, - QtCore.SIGNAL(u'pressed()'), self.onTopicAddButtonClick) + QtCore.SIGNAL(u'clicked()'), self.onTopicAddButtonClicked) QtCore.QObject.connect(self.booksAddButton, - QtCore.SIGNAL(u'pressed()'), self.onBookAddButtonClick) + QtCore.SIGNAL(u'clicked()'), self.onBookAddButtonClicked) QtCore.QObject.connect(self.authorsEditButton, - QtCore.SIGNAL(u'pressed()'), self.onAuthorEditButtonClick) + QtCore.SIGNAL(u'clicked()'), self.onAuthorEditButtonClicked) QtCore.QObject.connect(self.topicsEditButton, - QtCore.SIGNAL(u'pressed()'), self.onTopicEditButtonClick) + QtCore.SIGNAL(u'clicked()'), self.onTopicEditButtonClicked) QtCore.QObject.connect(self.booksEditButton, - QtCore.SIGNAL(u'pressed()'), self.onBookEditButtonClick) + QtCore.SIGNAL(u'clicked()'), self.onBookEditButtonClicked) QtCore.QObject.connect(self.authorsDeleteButton, - QtCore.SIGNAL(u'pressed()'), self.onAuthorDeleteButtonClick) + QtCore.SIGNAL(u'clicked()'), self.onAuthorDeleteButtonClicked) QtCore.QObject.connect(self.topicsDeleteButton, - QtCore.SIGNAL(u'pressed()'), self.onTopicDeleteButtonClick) + QtCore.SIGNAL(u'clicked()'), self.onTopicDeleteButtonClicked) QtCore.QObject.connect(self.booksDeleteButton, - QtCore.SIGNAL(u'pressed()'), self.onBookDeleteButtonClick) + QtCore.SIGNAL(u'clicked()'), self.onBookDeleteButtonClicked) QtCore.QObject.connect(self.authorsListWidget, QtCore.SIGNAL(u'currentRowChanged(int)'), self.onAuthorsListRowChanged) @@ -204,7 +204,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): else: return True - def onAuthorAddButtonClick(self): + def onAuthorAddButtonClicked(self): self.authorform.setAutoDisplayName(True) if self.authorform.exec_(): author = Author.populate( @@ -223,7 +223,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): message=translate('SongsPlugin.SongMaintenanceForm', 'This author already exists.')) - def onTopicAddButtonClick(self): + def onTopicAddButtonClicked(self): if self.topicform.exec_(): topic = Topic.populate(name=unicode(self.topicform.nameEdit.text())) if self.checkTopic(topic): @@ -238,7 +238,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): message=translate('SongsPlugin.SongMaintenanceForm', 'This topic already exists.')) - def onBookAddButtonClick(self): + def onBookAddButtonClicked(self): if self.bookform.exec_(): book = Book.populate(name=unicode(self.bookform.nameEdit.text()), publisher=unicode(self.bookform.publisherEdit.text())) @@ -254,7 +254,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): message=translate('SongsPlugin.SongMaintenanceForm', 'This book already exists.')) - def onAuthorEditButtonClick(self): + def onAuthorEditButtonClicked(self): author_id = self._getCurrentItemId(self.authorsListWidget) if author_id == -1: return @@ -299,7 +299,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): 'Could not save your modified author, because the ' 'author already exists.')) - def onTopicEditButtonClick(self): + def onTopicEditButtonClicked(self): topic_id = self._getCurrentItemId(self.topicsListWidget) if topic_id == -1: return @@ -331,7 +331,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): 'Could not save your modified topic, because it ' 'already exists.')) - def onBookEditButtonClick(self): + def onBookEditButtonClicked(self): book_id = self._getCurrentItemId(self.booksListWidget) if book_id == -1: return @@ -443,7 +443,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): self.manager.save_object(song) 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. """ @@ -454,7 +454,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): translate('SongsPlugin.SongMaintenanceForm', 'This author cannot ' '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. """ @@ -465,7 +465,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): translate('SongsPlugin.SongMaintenanceForm', 'This topic cannot ' '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. """ diff --git a/openlp/plugins/songs/forms/topicsdialog.py b/openlp/plugins/songs/forms/topicsdialog.py index 851897b89..edd8df9f9 100644 --- a/openlp/plugins/songs/forms/topicsdialog.py +++ b/openlp/plugins/songs/forms/topicsdialog.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui 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): def setupUi(self, topicsDialog): @@ -45,11 +45,11 @@ class Ui_TopicsDialog(object): self.nameLabel.setBuddy(self.nameEdit) self.nameLayout.addRow(self.nameLabel, self.nameEdit) self.dialogLayout.addLayout(self.nameLayout) - self.dialogLayout.addWidget( - create_accept_reject_button_box(topicsDialog)) + self.buttonBox = create_button_box(topicsDialog, u'buttonBox', + [u'cancel', u'save']) + self.dialogLayout.addWidget(self.buttonBox) self.retranslateUi(topicsDialog) topicsDialog.setMaximumHeight(topicsDialog.sizeHint().height()) - QtCore.QMetaObject.connectSlotsByName(topicsDialog) def retranslateUi(self, topicsDialog): topicsDialog.setWindowTitle( diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 70d2e22d6..38f5db956 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -119,7 +119,7 @@ class SongMediaItem(MediaManagerItem): QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick) QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'searchTypeChanged(int)'), - self.onSearchTextButtonClick) + self.onSearchTextButtonClicked) def addCustomContextActions(self): create_widget_action(self.listView, separator=True) @@ -173,7 +173,7 @@ class SongMediaItem(MediaManagerItem): QtCore.QVariant(SongSearch.Entire)).toInt()[0]) self.configUpdated() - def onSearchTextButtonClick(self): + def onSearchTextButtonClicked(self): # Save the current search type to the configuration. QtCore.QSettings().setValue(u'%s/last search type' % self.settingsSection, @@ -251,7 +251,7 @@ class SongMediaItem(MediaManagerItem): item = self.buildServiceItem(self.editItem) self.plugin.serviceManager.replaceServiceItem(item) self.onRemoteEditClear() - self.onSearchTextButtonClick() + self.onSearchTextButtonClicked() log.debug(u'onSongListLoad - finished') def displayResultsSong(self, searchresults): @@ -315,7 +315,7 @@ class SongMediaItem(MediaManagerItem): Clear the search text. """ self.searchTextEdit.clear() - self.onSearchTextButtonClick() + self.onSearchTextButtonClicked() def onSearchTextEditChanged(self, text): """ @@ -330,7 +330,7 @@ class SongMediaItem(MediaManagerItem): elif self.searchTextEdit.currentSearchType() == SongSearch.Lyrics: search_length = 3 if len(text) > search_length: - self.onSearchTextButtonClick() + self.onSearchTextButtonClicked() elif len(text) == 0: self.onClearTextButtonClick() @@ -426,7 +426,7 @@ class SongMediaItem(MediaManagerItem): except OSError: log.exception(u'Could not remove directory: %s', save_path) self.plugin.manager.delete_object(Song, item_id) - self.onSearchTextButtonClick() + self.onSearchTextButtonClicked() def onCloneClick(self): """ @@ -578,7 +578,7 @@ class SongMediaItem(MediaManagerItem): if len(item.background_audio) > 0: self._updateBackgroundAudio(song, item) editId = song.id - self.onSearchTextButtonClick() + self.onSearchTextButtonClicked() elif add_song and not self.addSongFromService: # Make sure we temporary import formatting tags. song = self.openLyrics.xml_to_song(item.xml_version, True) diff --git a/openlp/plugins/songs/lib/songimport.py b/openlp/plugins/songs/lib/songimport.py index d820998c9..6fd9dd403 100644 --- a/openlp/plugins/songs/lib/songimport.py +++ b/openlp/plugins/songs/lib/songimport.py @@ -24,6 +24,7 @@ # with this program; if not, write to the Free Software Foundation, Inc., 59 # # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### + import logging import re import shutil @@ -308,7 +309,7 @@ class SongImport(QtCore.QObject): verses_changed_to_other[verse_def] = new_verse_def other_count += 1 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) verse_def = new_verse_def sxml.add_verse_to_lyrics(verse_tag, verse_def[1:], verse_text, lang) diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index 890db1b4e..47b293310 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -151,7 +151,7 @@ class SongsPlugin(Plugin): clean_song(self.manager, song) progressDialog.setValue(number + 1) self.manager.save_objects(songs) - self.mediaItem.onSearchTextButtonClick() + self.mediaItem.onSearchTextButtonClicked() def onSongImportItemClicked(self): if self.mediaItem: @@ -254,7 +254,7 @@ class SongsPlugin(Plugin): importer = OpenLPSongImport(self.manager, filename=db) importer.doImport() progress.setValue(len(song_dbs)) - self.mediaItem.onSearchTextButtonClick() + self.mediaItem.onSearchTextButtonClicked() def finalise(self): """ diff --git a/openlp/plugins/songusage/forms/songusagedeletedialog.py b/openlp/plugins/songusage/forms/songusagedeletedialog.py index 8f9e19a1e..6571b82fa 100644 --- a/openlp/plugins/songusage/forms/songusagedeletedialog.py +++ b/openlp/plugins/songusage/forms/songusagedeletedialog.py @@ -28,6 +28,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import translate +from openlp.core.lib.ui import create_button_box class Ui_SongUsageDeleteDialog(object): def setupUi(self, songUsageDeleteDialog): @@ -47,10 +48,8 @@ class Ui_SongUsageDeleteDialog(object): QtGui.QCalendarWidget.NoVerticalHeader) self.deleteCalendar.setObjectName(u'deleteCalendar') self.verticalLayout.addWidget(self.deleteCalendar) - self.buttonBox = QtGui.QDialogButtonBox(songUsageDeleteDialog) - self.buttonBox.setStandardButtons( - QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel) - self.buttonBox.setObjectName(u'buttonBox') + self.buttonBox = create_button_box(songUsageDeleteDialog, u'buttonBox', + [u'cancel', u'ok']) self.verticalLayout.addWidget(self.buttonBox) self.retranslateUi(songUsageDeleteDialog) diff --git a/openlp/plugins/songusage/forms/songusagedetaildialog.py b/openlp/plugins/songusage/forms/songusagedetaildialog.py index ec88c9624..994e7d6ef 100644 --- a/openlp/plugins/songusage/forms/songusagedetaildialog.py +++ b/openlp/plugins/songusage/forms/songusagedetaildialog.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui 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): def setupUi(self, songUsageDetailDialog): @@ -74,14 +74,13 @@ class Ui_SongUsageDetailDialog(object): self.saveFilePushButton.setObjectName(u'saveFilePushButton') self.fileHorizontalLayout.addWidget(self.saveFilePushButton) self.verticalLayout.addWidget(self.fileGroupBox) - self.buttonBox = create_accept_reject_button_box( - songUsageDetailDialog, True) + self.buttonBox = create_button_box(songUsageDetailDialog, u'buttonBox', + [u'cancel', u'ok']) self.verticalLayout.addWidget(self.buttonBox) self.retranslateUi(songUsageDetailDialog) QtCore.QObject.connect(self.saveFilePushButton, - QtCore.SIGNAL(u'pressed()'), + QtCore.SIGNAL(u'clicked()'), songUsageDetailDialog.defineOutputLocation) - QtCore.QMetaObject.connectSlotsByName(songUsageDetailDialog) def retranslateUi(self, songUsageDetailDialog): songUsageDetailDialog.setWindowTitle( diff --git a/openlp/plugins/songusage/forms/songusagedetailform.py b/openlp/plugins/songusage/forms/songusagedetailform.py index 1555c653e..363455ea5 100644 --- a/openlp/plugins/songusage/forms/songusagedetailform.py +++ b/openlp/plugins/songusage/forms/songusagedetailform.py @@ -72,7 +72,7 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog): def defineOutputLocation(self): """ - Triggered when the Directory selection button is pressed + Triggered when the Directory selection button is clicked """ path = QtGui.QFileDialog.getExistingDirectory(self, translate('SongUsagePlugin.SongUsageDetailForm', @@ -85,7 +85,7 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog): 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') path = unicode(self.fileLineEdit.text()) @@ -118,7 +118,7 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog): fileHandle = open(outname, u'w') for instance in usage: 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.ccl_number, instance.authors, instance.plugin_name, instance.source)