From 9d8b40d1c233d46ed827f3f13c28bcab300a064b Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Thu, 6 Jan 2011 22:34:46 +0200 Subject: [PATCH 1/7] Fix some overlooked bugs from the change in the way service files are saved. --- openlp/core/ui/servicemanager.py | 9 +++++---- openlp/core/ui/settingsform.py | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index e1aa126ae..a9bf232d4 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -28,6 +28,7 @@ import os import logging import cPickle import zipfile +from pprint import pformat log = logging.getLogger(__name__) @@ -307,7 +308,7 @@ class ServiceManager(QtGui.QWidget): Setter for service file. """ self._fileName = unicode(fileName) - self.parent.setServiceModified(self.isModified, self.shortFileName()) + self.parent.setServiceModified(self.isModified(), self.shortFileName()) QtCore.QSettings(). \ setValue(u'service/last file',QtCore.QVariant(fileName)) @@ -685,7 +686,7 @@ class ServiceManager(QtGui.QWidget): # Top Item was selected so set the last one if setLastItem: lastItem.setSelected(True) - self.isModified = True + self.setModified(True) def onMoveSelectionDown(self): """ @@ -708,7 +709,7 @@ class ServiceManager(QtGui.QWidget): serviceIterator += 1 if setSelected: firstItem.setSelected(True) - self.isModified = True + self.setModified(True) def onCollapseAll(self): """ @@ -752,7 +753,7 @@ class ServiceManager(QtGui.QWidget): self.serviceItems.remove(self.serviceItems[item]) self.serviceItems.insert(0, temp) self.repaintServiceList(0, count) - self.isModified = True + self.setModified(True) def onServiceUp(self): """ diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index 86e3c6150..068057902 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -98,4 +98,4 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): Run any post-setup code for the tabs on the form """ for tabIndex in range(0, self.settingsTabWidget.count()): - self.settingsTabWidget.widget(tabIndex).postSetUp() \ No newline at end of file + self.settingsTabWidget.widget(tabIndex).postSetUp() From 3454f95ddf8eb3368b60538d1d416ba40310edc8 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Thu, 6 Jan 2011 20:48:22 +0000 Subject: [PATCH 2/7] Cleanups --- openlp.pyw | 2 +- openlp/core/lib/searchedit.py | 2 +- openlp/plugins/alerts/forms/alertform.py | 8 ++++---- openlp/plugins/bibles/lib/db.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index f3455962d..a1a616462 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -182,7 +182,7 @@ class OpenLP(QtGui.QApplication): screens = ScreenList() # Decide how many screens we have and their size for screen in xrange(0, self.desktop().numScreens()): - size = self.desktop().screenGeometry(screen); + size = self.desktop().screenGeometry(screen) screens.add_screen({u'number': screen, u'size': size, u'primary': (self.desktop().primaryScreen() == screen)}) diff --git a/openlp/core/lib/searchedit.py b/openlp/core/lib/searchedit.py index 07279aea5..c69e1f15b 100644 --- a/openlp/core/lib/searchedit.py +++ b/openlp/core/lib/searchedit.py @@ -78,7 +78,7 @@ class SearchEdit(QtGui.QLineEdit): else: self.setStyleSheet(u'QLineEdit { padding-right: %spx; } ' % \ rightPadding) - msz = self.minimumSizeHint(); + msz = self.minimumSizeHint() self.setMinimumSize( max(msz.width(), self.clearButton.width() + (frameWidth * 2) + 2), diff --git a/openlp/plugins/alerts/forms/alertform.py b/openlp/plugins/alerts/forms/alertform.py index bd03b9171..1d6a566fd 100644 --- a/openlp/plugins/alerts/forms/alertform.py +++ b/openlp/plugins/alerts/forms/alertform.py @@ -177,8 +177,8 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog): 'parameter to be replaced.\nDo you want to continue anyway?'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No: - self.parameterEdit.setFocus() - return False + self.parameterEdit.setFocus() + return False # The ParameterEdit field is not empty, but we have not found '<>' # in the alert text. elif text.find(u'<>') == -1 and self.parameterEdit.text() and \ @@ -188,8 +188,8 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog): ' contain \'<>\'.\nDo want to continue anyway?'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No: - self.parameterEdit.setFocus() - return False + self.parameterEdit.setFocus() + return False text = text.replace(u'<>', unicode(self.parameterEdit.text())) self.parent.alertsmanager.displayAlert(text) return True diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index 62068437a..9f4376da1 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -28,7 +28,7 @@ import logging import chardet import re -from PyQt4 import QtCore, QtGui +from PyQt4 import QtCore from sqlalchemy import Column, ForeignKey, or_, Table, types from sqlalchemy.orm import class_mapper, mapper, relation from sqlalchemy.orm.exc import UnmappedClassError From 120ec38557f7f441f00598daeb1908bdc6cf5517 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Thu, 6 Jan 2011 23:47:28 +0000 Subject: [PATCH 3/7] and cleanups --- openlp/plugins/bibles/lib/http.py | 2 +- openlp/plugins/bibles/lib/manager.py | 2 +- openlp/plugins/images/lib/mediaitem.py | 3 +-- openlp/plugins/media/lib/mediaitem.py | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index 6f26434de..ef663dfbe 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -230,7 +230,7 @@ class BGExtract(object): Receiver.send_message(u'openlp_process_events') footnotes = soup.findAll(u'sup', u'footnote') if footnotes: - [footnote.extract() for footnote in footnotes] + [footnote.extract() for footnote in footnotes] cleanup = [(re.compile('\s+'), lambda match: ' ')] verses = BeautifulSoup(str(soup), markupMassage=cleanup) content = verses.find(u'div', u'result-text-style-normal') diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index 15f171608..8e1dadd0e 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -26,7 +26,7 @@ import logging -from PyQt4 import QtCore, QtGui +from PyQt4 import QtCore from openlp.core.lib import Receiver, SettingsManager, translate from openlp.core.utils import AppLocation diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 89e27e2fb..9f6d6c6df 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -30,8 +30,7 @@ import os from PyQt4 import QtCore, QtGui from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \ - context_menu_action, ItemCapabilities, SettingsManager, translate, \ - check_item_selected, Receiver + ItemCapabilities, SettingsManager, translate, check_item_selected, Receiver from openlp.core.utils import AppLocation, get_images_filter log = logging.getLogger(__name__) diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index fd8c6c97d..cc75dfc2b 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \ ItemCapabilities, SettingsManager, translate, check_item_selected, \ - context_menu_action, Receiver + Receiver log = logging.getLogger(__name__) From dfb2d6be8e95739a4241fde5a773c8f96269465f Mon Sep 17 00:00:00 2001 From: M2j Date: Fri, 7 Jan 2011 14:43:03 +0100 Subject: [PATCH 4/7] Added validators for CCL number and theme name (file name) --- openlp/core/ui/filerenamedialog.py | 2 ++ openlp/core/ui/generaltab.py | 1 + openlp/core/ui/themewizard.py | 2 ++ openlp/plugins/songs/forms/editsongdialog.py | 1 + 4 files changed, 6 insertions(+) diff --git a/openlp/core/ui/filerenamedialog.py b/openlp/core/ui/filerenamedialog.py index 43bd09a4d..c9a8a7633 100644 --- a/openlp/core/ui/filerenamedialog.py +++ b/openlp/core/ui/filerenamedialog.py @@ -38,6 +38,8 @@ class Ui_FileRenameDialog(object): self.fileNameLabel.setObjectName(u'fileNameLabel') self.dialogLayout.addWidget(self.fileNameLabel, 0, 0) self.fileNameEdit = QtGui.QLineEdit(FileRenameDialog) + self.fileNameEdit.setValidator(QtGui.QRegExpValidator( + QtCore.QRegExp(r'[^/\\?*|<>\[\]":<>+%]+'), self)) self.fileNameEdit.setObjectName(u'fileNameEdit') self.dialogLayout.addWidget(self.fileNameEdit, 0, 1) self.buttonBox = QtGui.QDialogButtonBox(FileRenameDialog) diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index 15789b0d6..773637481 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -139,6 +139,7 @@ class GeneralTab(SettingsTab): self.numberLabel = QtGui.QLabel(self.ccliGroupBox) self.numberLabel.setObjectName(u'numberLabel') self.numberEdit = QtGui.QLineEdit(self.ccliGroupBox) + self.numberEdit.setValidator(QtGui.QIntValidator()) self.numberEdit.setObjectName(u'numberEdit') self.ccliLayout.addRow(self.numberLabel, self.numberEdit) self.usernameLabel = QtGui.QLabel(self.ccliGroupBox) diff --git a/openlp/core/ui/themewizard.py b/openlp/core/ui/themewizard.py index 691b5e568..1bf0a0038 100644 --- a/openlp/core/ui/themewizard.py +++ b/openlp/core/ui/themewizard.py @@ -360,6 +360,8 @@ class Ui_ThemeWizard(object): self.themeNameLabel = QtGui.QLabel(self.previewPage) self.themeNameLabel.setObjectName(u'ThemeNameLabel') self.themeNameEdit = QtGui.QLineEdit(self.previewPage) + self.themeNameEdit.setValidator(QtGui.QRegExpValidator( + QtCore.QRegExp(r'[^/\\?*|<>\[\]":<>+%]+'), self)) self.themeNameEdit.setObjectName(u'ThemeNameEdit') self.themeNameLayout.addRow(self.themeNameLabel, self.themeNameEdit) self.previewLayout.addLayout(self.themeNameLayout) diff --git a/openlp/plugins/songs/forms/editsongdialog.py b/openlp/plugins/songs/forms/editsongdialog.py index ac74c9c4e..c0ccd5d6a 100644 --- a/openlp/plugins/songs/forms/editsongdialog.py +++ b/openlp/plugins/songs/forms/editsongdialog.py @@ -245,6 +245,7 @@ class Ui_EditSongDialog(object): self.CCLILabel.setObjectName(u'CCLILabel') self.CCLILayout.addWidget(self.CCLILabel) self.CCLNumberEdit = QtGui.QLineEdit(self.rightsGroupBox) + self.CCLNumberEdit.setValidator(QtGui.QIntValidator()) self.CCLNumberEdit.setObjectName(u'CCLNumberEdit') self.CCLILayout.addWidget(self.CCLNumberEdit) self.rightsLayout.addLayout(self.CCLILayout) From c2b1dd9f2f6c1062dec49a0ffa57797654b879b5 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Sat, 8 Jan 2011 02:44:12 +0000 Subject: [PATCH 5/7] More cleanups --- openlp/core/lib/__init__.py | 3 ++- openlp/core/lib/mediamanageritem.py | 3 ++- openlp/core/ui/servicemanager.py | 5 ++--- openlp/core/ui/themewizard.py | 9 ++++++--- openlp/plugins/bibles/lib/manager.py | 8 ++++---- openlp/plugins/presentations/lib/presentationtab.py | 3 ++- 6 files changed, 18 insertions(+), 13 deletions(-) diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index ebbe31597..2bcb25d85 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -102,7 +102,8 @@ def translate(context, text, comment=None, An identifying string for when the same text is used in different roles within the same context. """ - return QtCore.QCoreApplication.translate(context, text, comment, encoding, n) + return QtCore.QCoreApplication.translate(context, text, comment, encoding, + n) def get_text_file_string(text_file): """ diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index c92960163..2d6bcce46 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -176,7 +176,8 @@ class MediaManagerItem(QtGui.QWidget): # break compatability), but it makes sense for the icon to # come before the tooltip (as you have to have an icon, but # not neccesarily a tooltip) - return self.toolbar.addToolbarButton(title, icon, tooltip, slot, checkable) + return self.toolbar.addToolbarButton(title, icon, tooltip, slot, + checkable) def addToolbarSeparator(self): """ diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index a9bf232d4..d918a7083 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -28,7 +28,6 @@ import os import logging import cPickle import zipfile -from pprint import pformat log = logging.getLogger(__name__) @@ -986,8 +985,8 @@ class ServiceManager(QtGui.QWidget): u'expanded':expand}) self.repaintServiceList(len(self.serviceItems) + 1, 0) else: - self.serviceItems.insert(self.dropPosition, {u'service_item': item, - u'order': self.dropPosition, + self.serviceItems.insert(self.dropPosition, + {u'service_item': item, u'order': self.dropPosition, u'expanded':expand}) self.repaintServiceList(self.dropPosition, 0) # if rebuilding list make sure live is fixed. diff --git a/openlp/core/ui/themewizard.py b/openlp/core/ui/themewizard.py index 1bf0a0038..ae2a4e1bd 100644 --- a/openlp/core/ui/themewizard.py +++ b/openlp/core/ui/themewizard.py @@ -249,7 +249,8 @@ class Ui_ThemeWizard(object): self.footerSizeSpinBox.setMaximum(999) self.footerSizeSpinBox.setValue(10) self.footerSizeSpinBox.setObjectName(u'FooterSizeSpinBox') - self.footerAreaLayout.addRow(self.footerSizeLabel, self.footerSizeSpinBox) + self.footerAreaLayout.addRow(self.footerSizeLabel, + self.footerSizeSpinBox) ThemeWizard.addPage(self.footerAreaPage) # Alignment Page self.alignmentPage = QtGui.QWizardPage() @@ -317,9 +318,11 @@ class Ui_ThemeWizard(object): self.areaPositionLayout.addWidget(self.mainPositionGroupBox) self.footerPositionGroupBox = QtGui.QGroupBox(self.areaPositionPage) self.footerPositionGroupBox.setObjectName(u'FooterPositionGroupBox') - self.footerPositionLayout = QtGui.QFormLayout(self.footerPositionGroupBox) + self.footerPositionLayout = QtGui.QFormLayout( + self.footerPositionGroupBox) self.footerPositionLayout.setObjectName(u'FooterPositionLayout') - self.footerPositionCheckBox = QtGui.QCheckBox(self.footerPositionGroupBox) + self.footerPositionCheckBox = QtGui.QCheckBox(i + self.footerPositionGroupBox) self.footerPositionCheckBox.setObjectName(u'FooterPositionCheckBox') self.footerPositionLayout.addRow(self.footerPositionCheckBox) self.footerXLabel = QtGui.QLabel(self.footerPositionGroupBox) diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index 8e1dadd0e..63c6954fb 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -273,10 +273,10 @@ class BibleManager(object): Receiver.send_message(u'openlp_information_message', { u'title': translate('BiblesPlugin.BibleManager', 'Scripture Reference Error'), - u'message': translate('BiblesPlugin.BibleManager', 'Your scripture ' - 'reference is either not supported by OpenLP or is invalid. ' - 'Please make sure your reference conforms to one of the ' - 'following patterns:\n\n' + u'message': translate('BiblesPlugin.BibleManager', + 'Your scripture reference is either not supported by OpenLP ' + 'or is invalid. Please make sure your reference conforms to ' + 'one of the following patterns:\n\n' 'Book Chapter\n' 'Book Chapter-Chapter\n' 'Book Chapter:Verse-Verse\n' diff --git a/openlp/plugins/presentations/lib/presentationtab.py b/openlp/plugins/presentations/lib/presentationtab.py index c4df4f4e1..fc82600df 100644 --- a/openlp/plugins/presentations/lib/presentationtab.py +++ b/openlp/plugins/presentations/lib/presentationtab.py @@ -116,7 +116,8 @@ class PresentationTab(SettingsTab): if controller.available: checkbox = self.PresenterCheckboxes[controller.name] setting_key = self.settingsSection + u'/' + controller.name - if QtCore.QSettings().value(setting_key) != checkbox.checkState(): + if QtCore.QSettings().value(setting_key) != \ + checkbox.checkState(): changed = True QtCore.QSettings().setValue(setting_key, QtCore.QVariant(checkbox.checkState())) From 70f18fdfa4deee23d95ac5af6bfbfb6f6d7f9c04 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Sat, 8 Jan 2011 18:26:38 +0000 Subject: [PATCH 6/7] Fix typo --- openlp/core/ui/themewizard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/themewizard.py b/openlp/core/ui/themewizard.py index ae2a4e1bd..f61a44584 100644 --- a/openlp/core/ui/themewizard.py +++ b/openlp/core/ui/themewizard.py @@ -321,7 +321,7 @@ class Ui_ThemeWizard(object): self.footerPositionLayout = QtGui.QFormLayout( self.footerPositionGroupBox) self.footerPositionLayout.setObjectName(u'FooterPositionLayout') - self.footerPositionCheckBox = QtGui.QCheckBox(i + self.footerPositionCheckBox = QtGui.QCheckBox( self.footerPositionGroupBox) self.footerPositionCheckBox.setObjectName(u'FooterPositionCheckBox') self.footerPositionLayout.addRow(self.footerPositionCheckBox) From dbfd7796ba94767de2828bdfa8d0ca2b49fb1a72 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Sat, 8 Jan 2011 18:50:06 +0000 Subject: [PATCH 7/7] Fix BibleGateway xrefs (Bug #700271) --- openlp/plugins/bibles/lib/http.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index ef663dfbe..d9210a275 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -231,6 +231,9 @@ class BGExtract(object): footnotes = soup.findAll(u'sup', u'footnote') if footnotes: [footnote.extract() for footnote in footnotes] + crossrefs = soup.findAll(u'sup', u'xref') + if crossrefs: + [crossref.extract() for crossref in crossrefs] cleanup = [(re.compile('\s+'), lambda match: ' ')] verses = BeautifulSoup(str(soup), markupMassage=cleanup) content = verses.find(u'div', u'result-text-style-normal')