openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #06025
[Merge] lp:~meths/openlp/trivialfixes into lp:openlp
Jon Tibble has proposed merging lp:~meths/openlp/trivialfixes into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/48684
Docstrings and function renaming to deobfuscate the UI library.
Catch failure to start presenter processes (Bug #712140)
--
https://code.launchpad.net/~meths/openlp/trivialfixes/+merge/48684
Your team OpenLP Core is requested to review the proposed merge of lp:~meths/openlp/trivialfixes into lp:openlp.
=== modified file 'openlp/core/lib/ui.py'
--- openlp/core/lib/ui.py 2011-02-04 18:17:28 +0000
+++ openlp/core/lib/ui.py 2011-02-05 01:34:54 +0000
@@ -38,6 +38,9 @@
"""
Generate an opening welcome page for a wizard using a provided image.
+ ``parent``
+ A ``QWizard`` object to add the welcome page to.
+
``image``
A splash image for the wizard.
"""
@@ -58,9 +61,14 @@
parent.welcomeLayout.addStretch()
parent.addPage(parent.welcomePage)
-def save_cancel_button_box(parent):
+def create_save_cancel_button_box(parent):
"""
- Return a standard dialog button box with save and cancel buttons.
+ Creates a standard dialog button box with save and cancel buttons. The
+ button box is connected to the parent's ``accept()`` and ``reject()``
+ methods to handle the default ``accepted()`` and ``rejected()`` signals.
+
+ ``parent``
+ The parent object. This should be a ``QWidget`` descendant.
"""
button_box = QtGui.QDialogButtonBox(parent)
button_box.setStandardButtons(
@@ -109,9 +117,18 @@
combo.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
return combo
-def delete_push_button(parent, icon=None):
+def create_delete_push_button(parent, icon=None):
"""
- Return a standard push button with delete label.
+ 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.
+
+ ``parent``
+ The parent object. This should be a ``QWidget`` descendant.
+
+ ``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')
@@ -124,9 +141,15 @@
QtCore.SIGNAL(u'clicked()'), parent.onDeleteButtonClicked)
return delete_button
-def up_down_push_button_set(parent):
+def create_up_down_push_button_set(parent):
"""
- Return a standard set of two push buttons for up and down use with lists.
+ Creates a standard set of two push buttons, one for up and the other for
+ down, for use with lists. The buttons use arrow icons and no text and are
+ connected to the parent's ``onUpButtonClicked()`` and
+ ``onDownButtonClicked()`` to handle their respective ``clicked()`` signals.
+
+ ``parent``
+ The parent object. This should be a ``QWidget`` descendant.
"""
up_button = QtGui.QPushButton(parent)
up_button.setIcon(build_icon(u':/services/service_up.png'))
@@ -185,7 +208,13 @@
def add_widget_completer(cache, widget):
"""
- Add a text autocompleter to a widget.
+ Adds a text autocompleter to a widget.
+
+ ``cache``
+ The list of items to use as suggestions.
+
+ ``widget``
+ The object to use the completer.
"""
completer = QtGui.QCompleter(cache)
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
=== modified file 'openlp/core/ui/serviceitemeditdialog.py'
--- openlp/core/ui/serviceitemeditdialog.py 2011-02-03 22:39:18 +0000
+++ openlp/core/ui/serviceitemeditdialog.py 2011-02-05 01:34:54 +0000
@@ -27,8 +27,8 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
-from openlp.core.lib.ui import save_cancel_button_box, delete_push_button, \
- up_down_push_button_set
+from openlp.core.lib.ui import create_save_cancel_button_box, \
+ create_delete_push_button, create_up_down_push_button_set
class Ui_ServiceItemEditDialog(object):
def setupUi(self, serviceItemEditDialog):
@@ -41,16 +41,16 @@
self.dialogLayout.addWidget(self.listWidget, 0, 0)
self.buttonLayout = QtGui.QVBoxLayout()
self.buttonLayout.setObjectName(u'buttonLayout')
- self.deleteButton = delete_push_button(serviceItemEditDialog)
+ self.deleteButton = create_delete_push_button(serviceItemEditDialog)
self.buttonLayout.addWidget(self.deleteButton)
self.buttonLayout.addStretch()
- self.upButton, self.downButton = up_down_push_button_set(
+ self.upButton, self.downButton = create_up_down_push_button_set(
serviceItemEditDialog)
self.buttonLayout.addWidget(self.upButton)
self.buttonLayout.addWidget(self.downButton)
self.dialogLayout.addLayout(self.buttonLayout, 0, 1)
self.dialogLayout.addWidget(
- save_cancel_button_box(serviceItemEditDialog), 1, 0, 1, 2)
+ create_save_cancel_button_box(serviceItemEditDialog), 1, 0, 1, 2)
self.retranslateUi(serviceItemEditDialog)
QtCore.QMetaObject.connectSlotsByName(serviceItemEditDialog)
=== modified file 'openlp/core/ui/servicenoteform.py'
--- openlp/core/ui/servicenoteform.py 2011-02-02 19:30:06 +0000
+++ openlp/core/ui/servicenoteform.py 2011-02-05 01:34:54 +0000
@@ -27,7 +27,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
-from openlp.core.lib.ui import save_cancel_button_box
+from openlp.core.lib.ui import create_save_cancel_button_box
class ServiceNoteForm(QtGui.QDialog):
"""
@@ -48,7 +48,7 @@
self.textEdit = QtGui.QTextEdit(self)
self.textEdit.setObjectName(u'textEdit')
self.dialogLayout.addWidget(self.textEdit)
- self.dialogLayout.addWidget(save_cancel_button_box(self))
+ self.dialogLayout.addWidget(create_save_cancel_button_box(self))
QtCore.QMetaObject.connectSlotsByName(self)
def retranslateUi(self):
=== modified file 'openlp/plugins/alerts/forms/alertdialog.py'
--- openlp/plugins/alerts/forms/alertdialog.py 2011-02-03 21:49:37 +0000
+++ openlp/plugins/alerts/forms/alertdialog.py 2011-02-05 01:34:54 +0000
@@ -27,7 +27,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate
-from openlp.core.lib.ui import delete_push_button
+from openlp.core.lib.ui import create_delete_push_button
class Ui_AlertDialog(object):
def setupUi(self, alertDialog):
@@ -66,7 +66,7 @@
self.saveButton.setIcon(build_icon(u':/general/general_save.png'))
self.saveButton.setObjectName(u'saveButton')
self.manageButtonLayout.addWidget(self.saveButton)
- self.deleteButton = delete_push_button(alertDialog)
+ self.deleteButton = create_delete_push_button(alertDialog)
self.deleteButton.setEnabled(False)
self.manageButtonLayout.addWidget(self.deleteButton)
self.manageButtonLayout.addStretch()
=== modified file 'openlp/plugins/custom/forms/editcustomdialog.py'
--- openlp/plugins/custom/forms/editcustomdialog.py 2011-02-04 19:27:25 +0000
+++ openlp/plugins/custom/forms/editcustomdialog.py 2011-02-05 01:34:54 +0000
@@ -27,8 +27,8 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate
-from openlp.core.lib.ui import save_cancel_button_box, delete_push_button, \
- up_down_push_button_set
+from openlp.core.lib.ui import create_save_cancel_button_box, \
+ create_delete_push_button, create_up_down_push_button_set
class Ui_CustomEditDialog(object):
def setupUi(self, customEditDialog):
@@ -66,11 +66,11 @@
self.editAllButton = QtGui.QPushButton(customEditDialog)
self.editAllButton.setObjectName(u'editAllButton')
self.buttonLayout.addWidget(self.editAllButton)
- self.deleteButton = delete_push_button(customEditDialog)
+ self.deleteButton = create_delete_push_button(customEditDialog)
self.deleteButton.setEnabled(False)
self.buttonLayout.addWidget(self.deleteButton)
self.buttonLayout.addStretch()
- self.upButton, self.downButton = up_down_push_button_set(
+ self.upButton, self.downButton = create_up_down_push_button_set(
customEditDialog)
self.upButton.setEnabled(False)
self.downButton.setEnabled(False)
@@ -94,7 +94,7 @@
self.creditLabel.setBuddy(self.creditEdit)
self.bottomFormLayout.addRow(self.creditLabel, self.creditEdit)
self.dialogLayout.addLayout(self.bottomFormLayout)
- self.buttonBox = save_cancel_button_box(customEditDialog)
+ self.buttonBox = create_save_cancel_button_box(customEditDialog)
self.previewButton = QtGui.QPushButton()
self.buttonBox.addButton(
self.previewButton, QtGui.QDialogButtonBox.ActionRole)
=== modified file 'openlp/plugins/custom/forms/editcustomslidedialog.py'
--- openlp/plugins/custom/forms/editcustomslidedialog.py 2011-02-02 19:30:06 +0000
+++ openlp/plugins/custom/forms/editcustomslidedialog.py 2011-02-05 01:34:54 +0000
@@ -27,7 +27,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate, SpellTextEdit
-from openlp.core.lib.ui import save_cancel_button_box
+from openlp.core.lib.ui import create_save_cancel_button_box
class Ui_CustomSlideEditDialog(object):
def setupUi(self, customSlideEditDialog):
@@ -37,7 +37,7 @@
self.slideTextEdit = SpellTextEdit(self)
self.slideTextEdit.setObjectName(u'slideTextEdit')
self.dialogLayout.addWidget(self.slideTextEdit)
- self.buttonBox = save_cancel_button_box(customSlideEditDialog)
+ self.buttonBox = create_save_cancel_button_box(customSlideEditDialog)
self.splitButton = QtGui.QPushButton(customSlideEditDialog)
self.splitButton.setObjectName(u'splitButton')
self.buttonBox.addButton(self.splitButton,
=== modified file 'openlp/plugins/presentations/presentationplugin.py'
--- openlp/plugins/presentations/presentationplugin.py 2010-12-31 02:17:41 +0000
+++ openlp/plugins/presentations/presentationplugin.py 2011-02-05 01:34:54 +0000
@@ -74,7 +74,11 @@
self.insertToolboxItem()
for controller in self.controllers:
if self.controllers[controller].enabled():
- self.controllers[controller].start_process()
+ try:
+ self.controllers[controller].start_process()
+ except:
+ log.exception(u'Failed to start controller process')
+ self.controllers[controller].available = False
self.mediaItem.buildFileMaskString()
def finalise(self):
=== modified file 'openlp/plugins/songs/forms/authorsdialog.py'
--- openlp/plugins/songs/forms/authorsdialog.py 2011-02-02 19:30:06 +0000
+++ openlp/plugins/songs/forms/authorsdialog.py 2011-02-05 01:34:54 +0000
@@ -27,7 +27,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
-from openlp.core.lib.ui import save_cancel_button_box
+from openlp.core.lib.ui import create_save_cancel_button_box
class Ui_AuthorsDialog(object):
def setupUi(self, authorsDialog):
@@ -56,7 +56,8 @@
self.displayLabel.setBuddy(self.displayEdit)
self.authorLayout.addRow(self.displayLabel, self.displayEdit)
self.dialogLayout.addLayout(self.authorLayout)
- self.dialogLayout.addWidget(save_cancel_button_box(authorsDialog))
+ self.dialogLayout.addWidget(
+ create_save_cancel_button_box(authorsDialog))
self.retranslateUi(authorsDialog)
authorsDialog.setMaximumHeight(authorsDialog.sizeHint().height())
QtCore.QMetaObject.connectSlotsByName(authorsDialog)
=== modified file 'openlp/plugins/songs/forms/editsongdialog.py'
--- openlp/plugins/songs/forms/editsongdialog.py 2011-02-02 19:30:06 +0000
+++ openlp/plugins/songs/forms/editsongdialog.py 2011-02-05 01:34:54 +0000
@@ -27,7 +27,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate
-from openlp.core.lib.ui import save_cancel_button_box
+from openlp.core.lib.ui import create_save_cancel_button_box
class Ui_EditSongDialog(object):
def setupUi(self, editSongDialog):
@@ -241,7 +241,7 @@
self.themeTabLayout.addWidget(self.commentsGroupBox)
self.songTabWidget.addTab(self.themeTab, u'')
self.dialogLayout.addWidget(self.songTabWidget)
- self.buttonBox = save_cancel_button_box(editSongDialog)
+ self.buttonBox = create_save_cancel_button_box(editSongDialog)
self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(editSongDialog)
QtCore.QMetaObject.connectSlotsByName(editSongDialog)
=== modified file 'openlp/plugins/songs/forms/editversedialog.py'
--- openlp/plugins/songs/forms/editversedialog.py 2011-02-02 19:30:06 +0000
+++ openlp/plugins/songs/forms/editversedialog.py 2011-02-05 01:34:54 +0000
@@ -27,7 +27,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate, SpellTextEdit
-from openlp.core.lib.ui import save_cancel_button_box
+from openlp.core.lib.ui import create_save_cancel_button_box
from openlp.plugins.songs.lib import VerseType
class Ui_EditVerseDialog(object):
@@ -60,7 +60,8 @@
self.verseTypeLayout.addWidget(self.insertButton)
self.verseTypeLayout.addStretch()
self.dialogLayout.addLayout(self.verseTypeLayout)
- self.dialogLayout.addWidget(save_cancel_button_box(editVerseDialog))
+ self.dialogLayout.addWidget(
+ create_save_cancel_button_box(editVerseDialog))
self.retranslateUi(editVerseDialog)
QtCore.QMetaObject.connectSlotsByName(editVerseDialog)
=== modified file 'openlp/plugins/songs/forms/songbookdialog.py'
--- openlp/plugins/songs/forms/songbookdialog.py 2011-02-02 19:30:06 +0000
+++ openlp/plugins/songs/forms/songbookdialog.py 2011-02-05 01:34:54 +0000
@@ -27,7 +27,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
-from openlp.core.lib.ui import save_cancel_button_box
+from openlp.core.lib.ui import create_save_cancel_button_box
class Ui_SongBookDialog(object):
def setupUi(self, songBookDialog):
@@ -50,7 +50,8 @@
self.publisherLabel.setBuddy(self.publisherEdit)
self.bookLayout.addRow(self.publisherLabel, self.publisherEdit)
self.dialogLayout.addLayout(self.bookLayout)
- self.dialogLayout.addWidget(save_cancel_button_box(songBookDialog))
+ self.dialogLayout.addWidget(
+ create_save_cancel_button_box(songBookDialog))
self.retranslateUi(songBookDialog)
songBookDialog.setMaximumHeight(songBookDialog.sizeHint().height())
QtCore.QMetaObject.connectSlotsByName(songBookDialog)
=== modified file 'openlp/plugins/songs/forms/topicsdialog.py'
--- openlp/plugins/songs/forms/topicsdialog.py 2011-02-02 19:30:06 +0000
+++ openlp/plugins/songs/forms/topicsdialog.py 2011-02-05 01:34:54 +0000
@@ -27,7 +27,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
-from openlp.core.lib.ui import save_cancel_button_box
+from openlp.core.lib.ui import create_save_cancel_button_box
class Ui_TopicsDialog(object):
def setupUi(self, topicsDialog):
@@ -44,7 +44,8 @@
self.nameLabel.setBuddy(self.nameEdit)
self.nameLayout.addRow(self.nameLabel, self.nameEdit)
self.dialogLayout.addLayout(self.nameLayout)
- self.dialogLayout.addWidget(save_cancel_button_box(topicsDialog))
+ self.dialogLayout.addWidget(
+ create_save_cancel_button_box(topicsDialog))
self.retranslateUi(topicsDialog)
topicsDialog.setMaximumHeight(topicsDialog.sizeHint().height())
QtCore.QMetaObject.connectSlotsByName(topicsDialog)
Follow ups