From dbe9fc51aa16cd6ef23bc579dea42b7b45d244d1 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 1 Apr 2012 13:16:08 +0200 Subject: [PATCH 1/4] clean ups --- openlp/plugins/bibles/lib/mediaitem.py | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 25ddc695c..abd665929 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -242,9 +242,9 @@ class BibleMediaItem(MediaManagerItem): self.addSearchFields(u'advanced', UiStrings().Advanced) # Combo Boxes QtCore.QObject.connect(self.quickVersionComboBox, - QtCore.SIGNAL(u'activated(int)'), self.onQuickVersionComboBox) + QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter) QtCore.QObject.connect(self.quickSecondComboBox, - QtCore.SIGNAL(u'activated(int)'), self.onQuickSecondComboBox) + QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter) QtCore.QObject.connect(self.advancedVersionComboBox, QtCore.SIGNAL(u'activated(int)'), self.onAdvancedVersionComboBox) QtCore.QObject.connect(self.advancedSecondComboBox, @@ -379,12 +379,11 @@ class BibleMediaItem(MediaManagerItem): bibles = self.plugin.manager.get_bibles().keys() bibles.sort(cmp=locale.strcoll) # Load the bibles into the combo boxes. - for bible in bibles: - if bible: - self.quickVersionComboBox.addItem(bible) - self.quickSecondComboBox.addItem(bible) - self.advancedVersionComboBox.addItem(bible) - self.advancedSecondComboBox.addItem(bible) + tmp_bibles = [bible for bible in bibles if bible] + self.quickVersionComboBox.addItems(tmp_bibles) + self.quickSecondComboBox.addItems(tmp_bibles) + self.advancedVersionComboBox.addItems(tmp_bibles) + self.advancedSecondComboBox.addItems(tmp_bibles) # set the default value bible = QtCore.QSettings().value( self.settingsSection + u'/advanced bible', @@ -522,12 +521,6 @@ class BibleMediaItem(MediaManagerItem): books.sort(cmp=locale.strcoll) add_widget_completer(books, self.quickSearchEdit) - def onQuickVersionComboBox(self): - self.updateAutoCompleter() - - def onQuickSecondComboBox(self): - self.updateAutoCompleter() - def onImportClick(self): if not hasattr(self, u'import_wizard'): self.import_wizard = BibleImportForm(self, self.plugin.manager, @@ -996,8 +989,7 @@ class BibleMediaItem(MediaManagerItem): # last verse of the chapter or the current verse is not the # first one of the chapter. return True - else: - return False + return False def formatVerse(self, old_chapter, chapter, verse): """ From 3185e0b1016b31406afd3cc4af4e457557419212 Mon Sep 17 00:00:00 2001 From: M2j Date: Wed, 4 Apr 2012 09:26:51 +0200 Subject: [PATCH 2/4] removed whitespaces at line ends --- openlp/core/lib/eventreceiver.py | 2 +- openlp/core/lib/htmlbuilder.py | 2 +- openlp/core/lib/mediaplayer.py | 4 ++-- openlp/core/lib/ui.py | 2 +- openlp/core/ui/firsttimewizard.py | 2 +- openlp/core/ui/mainwindow.py | 4 ++-- openlp/core/utils/actions.py | 2 +- openlp/plugins/bibles/forms/__init__.py | 2 +- openlp/plugins/bibles/forms/booknamedialog.py | 10 +++++----- openlp/plugins/bibles/forms/booknameform.py | 6 +++--- openlp/plugins/bibles/forms/languagedialog.py | 4 ++-- openlp/plugins/bibles/lib/__init__.py | 8 ++++---- openlp/plugins/bibles/lib/manager.py | 2 +- openlp/plugins/bibles/lib/openlp1.py | 4 ++-- openlp/plugins/bibles/lib/opensong.py | 2 +- openlp/plugins/songs/lib/__init__.py | 2 +- openlp/plugins/songs/lib/importer.py | 2 +- openlp/plugins/songs/lib/sofimport.py | 2 +- openlp/plugins/songs/lib/wowimport.py | 2 +- 19 files changed, 32 insertions(+), 32 deletions(-) diff --git a/openlp/core/lib/eventreceiver.py b/openlp/core/lib/eventreceiver.py index 4252d5adf..f27171db4 100644 --- a/openlp/core/lib/eventreceiver.py +++ b/openlp/core/lib/eventreceiver.py @@ -111,7 +111,7 @@ class EventReceiver(QtCore.QObject): ``slidecontroller_live_spin_delay`` Pushes out the loop delay. - + ``slidecontroller_update_slide_limits`` Updates the slide_limits variable from the saved settings. diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index 16c537fc2..1181771a9 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -45,7 +45,7 @@ HTMLSRC = u""" padding: 0; border: 0; overflow: hidden; - -webkit-user-select: none; + -webkit-user-select: none; } body { %s; diff --git a/openlp/core/lib/mediaplayer.py b/openlp/core/lib/mediaplayer.py index e4c8dc88f..39b0cb16c 100644 --- a/openlp/core/lib/mediaplayer.py +++ b/openlp/core/lib/mediaplayer.py @@ -29,7 +29,7 @@ from openlp.core.ui.media import MediaState class MediaPlayer(object): """ - This is the base class media Player class to provide OpenLP with a pluggable media display + This is the base class media Player class to provide OpenLP with a pluggable media display framework. """ @@ -65,7 +65,7 @@ class MediaPlayer(object): def resize(self, display): """ - If the main display size or position is changed, the media widgets + If the main display size or position is changed, the media widgets should also resized """ pass diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 7f2ba9a32..7f411f3dc 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -261,7 +261,7 @@ def create_horizontal_adjusting_combo_box(parent, name): def create_button(parent, name, **kwargs): """ Return an button with the object name set and the given parameters. - + ``parent`` A QtCore.QWidget for the buttons parent (required). diff --git a/openlp/core/ui/firsttimewizard.py b/openlp/core/ui/firsttimewizard.py index d2741838a..8a0306e28 100644 --- a/openlp/core/ui/firsttimewizard.py +++ b/openlp/core/ui/firsttimewizard.py @@ -263,5 +263,5 @@ class Ui_FirstTimeWizard(object): 'Select default theme:')) self.progressLabel.setText(translate('OpenLP.FirstTimeWizard', 'Starting configuration process...')) - FirstTimeWizard.setButtonText(QtGui.QWizard.CustomButton1, + FirstTimeWizard.setButtonText(QtGui.QWizard.CustomButton1, translate('OpenLP.FirstTimeWizard', 'Finish')) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 7d84c7b84..9662a8fcc 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -1310,7 +1310,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): """ log.debug(u'Loading QSettings') # Migrate Wrap Settings to Slide Limits Settings - if QtCore.QSettings().contains(self.generalSettingsSection + + if QtCore.QSettings().contains(self.generalSettingsSection + u'/enable slide loop'): if QtCore.QSettings().value(self.generalSettingsSection + u'/enable slide loop', QtCore.QVariant(True)).toBool(): @@ -1319,7 +1319,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): else: QtCore.QSettings().setValue(self.advancedlSettingsSection + u'/slide limits', QtCore.QVariant(SlideLimits.End)) - QtCore.QSettings().remove(self.generalSettingsSection + + QtCore.QSettings().remove(self.generalSettingsSection + u'/enable slide loop') Receiver.send_message(u'slidecontroller_update_slide_limits') settings = QtCore.QSettings() diff --git a/openlp/core/utils/actions.py b/openlp/core/utils/actions.py index 26f96de37..1a7d99fa5 100644 --- a/openlp/core/utils/actions.py +++ b/openlp/core/utils/actions.py @@ -369,7 +369,7 @@ class ActionList(object): elif action in self.getAllChildObjects(existing_action.parent()): return False return True - + def getAllChildObjects(self, qobject): """ Goes recursively through the children of ``qobject`` and returns a list diff --git a/openlp/plugins/bibles/forms/__init__.py b/openlp/plugins/bibles/forms/__init__.py index 89bfbfff3..69cc839fb 100644 --- a/openlp/plugins/bibles/forms/__init__.py +++ b/openlp/plugins/bibles/forms/__init__.py @@ -56,5 +56,5 @@ from languageform import LanguageForm from bibleimportform import BibleImportForm from bibleupgradeform import BibleUpgradeForm -__all__ = [u'BookNameForm', u'LanguageForm', u'BibleImportForm', +__all__ = [u'BookNameForm', u'LanguageForm', u'BibleImportForm', u'BibleUpgradeForm'] diff --git a/openlp/plugins/bibles/forms/booknamedialog.py b/openlp/plugins/bibles/forms/booknamedialog.py index 84d563826..db056cce3 100644 --- a/openlp/plugins/bibles/forms/booknamedialog.py +++ b/openlp/plugins/bibles/forms/booknamedialog.py @@ -86,20 +86,20 @@ class Ui_BookNameDialog(object): self.retranslateUi(bookNameDialog) def retranslateUi(self, bookNameDialog): - bookNameDialog.setWindowTitle(translate('BiblesPlugin.BookNameDialog', + bookNameDialog.setWindowTitle(translate('BiblesPlugin.BookNameDialog', 'Select Book Name')) - self.infoLabel.setText(translate('BiblesPlugin.BookNameDialog', + self.infoLabel.setText(translate('BiblesPlugin.BookNameDialog', 'The following book name cannot be matched up internally. Please ' 'select the corresponding English name from the list.')) - self.currentLabel.setText(translate('BiblesPlugin.BookNameDialog', + self.currentLabel.setText(translate('BiblesPlugin.BookNameDialog', 'Current name:')) self.correspondingLabel.setText(translate( 'BiblesPlugin.BookNameDialog', 'Corresponding name:')) - self.optionsGroupBox.setTitle(translate('BiblesPlugin.BookNameDialog', + self.optionsGroupBox.setTitle(translate('BiblesPlugin.BookNameDialog', 'Show Books From')) self.oldTestamentCheckBox.setText(translate( 'BiblesPlugin.BookNameDialog', 'Old Testament')) self.newTestamentCheckBox.setText(translate( 'BiblesPlugin.BookNameDialog', 'New Testament')) - self.apocryphaCheckBox.setText(translate('BiblesPlugin.BookNameDialog', + self.apocryphaCheckBox.setText(translate('BiblesPlugin.BookNameDialog', 'Apocrypha')) diff --git a/openlp/plugins/bibles/forms/booknameform.py b/openlp/plugins/bibles/forms/booknameform.py index e786d720a..f08d2c637 100644 --- a/openlp/plugins/bibles/forms/booknameform.py +++ b/openlp/plugins/bibles/forms/booknameform.py @@ -42,11 +42,11 @@ log = logging.getLogger(__name__) class BookNameForm(QDialog, Ui_BookNameDialog): """ - Class to manage a dialog which help the user to refer a book name a + Class to manage a dialog which help the user to refer a book name a to a english book name """ log.info(u'BookNameForm loaded') - + def __init__(self, parent = None): """ Constructor @@ -111,7 +111,7 @@ class BookNameForm(QDialog, Ui_BookNameDialog): self.currentBookLabel.setText(unicode(name)) self.correspondingComboBox.setFocus() return QDialog.exec_(self) - + def accept(self): if self.correspondingComboBox.currentText() == u'': critical_error_message_box( diff --git a/openlp/plugins/bibles/forms/languagedialog.py b/openlp/plugins/bibles/forms/languagedialog.py index b355c09f7..f3c831410 100644 --- a/openlp/plugins/bibles/forms/languagedialog.py +++ b/openlp/plugins/bibles/forms/languagedialog.py @@ -71,8 +71,8 @@ class Ui_LanguageDialog(object): languageDialog.setWindowTitle( translate('BiblesPlugin.LanguageDialog', 'Select Language')) self.bibleLabel.setText(translate('BiblesPlugin.LanguageDialog', '')) - self.infoLabel.setText(translate('BiblesPlugin.LanguageDialog', + self.infoLabel.setText(translate('BiblesPlugin.LanguageDialog', 'OpenLP is unable to determine the language of this translation ' 'of the Bible. Please select the language from the list below.')) - self.languageLabel.setText(translate('BiblesPlugin.LanguageDialog', + self.languageLabel.setText(translate('BiblesPlugin.LanguageDialog', 'Language:')) diff --git a/openlp/plugins/bibles/lib/__init__.py b/openlp/plugins/bibles/lib/__init__.py index 8d51afdee..587e7b8b0 100644 --- a/openlp/plugins/bibles/lib/__init__.py +++ b/openlp/plugins/bibles/lib/__init__.py @@ -259,14 +259,14 @@ def parse_reference(reference, bible, language_selection, book_ref_id=False): ``reference`` A string. The Bible reference to parse. - + ``bible`` A object. The Bible database object. - + ``language_selection`` An int. The language selection the user has choosen in settings section. - + ``book_ref_id`` A string. The book reference id. @@ -382,7 +382,7 @@ def parse_reference(reference, bible, language_selection, book_ref_id=False): lambda value: regex_book.match(value[u'name']), books) if not book_list: book_list = books - for value in book_list: + for value in book_list: if bible.get_book_by_book_ref_id(value[u'id']): book_ref_id = value[u'id'] break diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index c9f564b2c..577589555 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -293,7 +293,7 @@ class BibleManager(object): - Genesis 1:1-10,15-20 - Genesis 1:1-2:10 - Genesis 1:1-10,2:1-10 - + ``book_ref_id`` Unicode. The book referece id from the book in versetext. For second bible this is necessary. diff --git a/openlp/plugins/bibles/lib/openlp1.py b/openlp/plugins/bibles/lib/openlp1.py index 25aa109de..2b9dc5933 100644 --- a/openlp/plugins/bibles/lib/openlp1.py +++ b/openlp/plugins/bibles/lib/openlp1.py @@ -87,14 +87,14 @@ class OpenLP1Bible(BibleDB): testament_id = int(book[1]) name = unicode(book[2], u'cp1252') abbreviation = unicode(book[3], u'cp1252') - book_ref_id = self.get_book_ref_id_by_name(name, len(books), + book_ref_id = self.get_book_ref_id_by_name(name, len(books), language_id) if not book_ref_id: log.exception(u'Importing books from "%s" '\ 'failed' % self.filename) return False book_details = BiblesResourcesDB.get_book_by_id(book_ref_id) - db_book = self.create_book(name, book_ref_id, + db_book = self.create_book(name, book_ref_id, book_details[u'testament_id']) # Update the progess bar. self.wizard.incrementProgressBar(WizardStrings.ImportingType % name) diff --git a/openlp/plugins/bibles/lib/opensong.py b/openlp/plugins/bibles/lib/opensong.py index ab03ef22f..856e9057e 100644 --- a/openlp/plugins/bibles/lib/opensong.py +++ b/openlp/plugins/bibles/lib/opensong.py @@ -77,7 +77,7 @@ class OpenSongBible(BibleDB): 'failed' % self.filename) return False book_details = BiblesResourcesDB.get_book_by_id(book_ref_id) - db_book = self.create_book(unicode(book.attrib[u'n']), + db_book = self.create_book(unicode(book.attrib[u'n']), book_ref_id, book_details[u'testament_id']) for chapter in book.c: if self.stop_import_flag: diff --git a/openlp/plugins/songs/lib/__init__.py b/openlp/plugins/songs/lib/__init__.py index e04b1c5a2..91e21bb19 100644 --- a/openlp/plugins/songs/lib/__init__.py +++ b/openlp/plugins/songs/lib/__init__.py @@ -257,7 +257,7 @@ def clean_string(string): Strips punctuation from the passed string to assist searching """ return WHITESPACE.sub(u' ', APOSTROPHE.sub(u'', string)).lower() - + def clean_title(title): """ Cleans the song title by removing Unicode control chars groups C0 & C1, diff --git a/openlp/plugins/songs/lib/importer.py b/openlp/plugins/songs/lib/importer.py index 867b28c91..b66bfd618 100644 --- a/openlp/plugins/songs/lib/importer.py +++ b/openlp/plugins/songs/lib/importer.py @@ -131,7 +131,7 @@ class SongFormat(object): SongFormat.Generic, SongFormat.CCLI, SongFormat.EasySlides, - SongFormat.EasyWorship, + SongFormat.EasyWorship, SongFormat.FoilPresenter, SongFormat.OpenSong, SongFormat.SongBeamer, diff --git a/openlp/plugins/songs/lib/sofimport.py b/openlp/plugins/songs/lib/sofimport.py index cf87ba00b..f6293caa4 100644 --- a/openlp/plugins/songs/lib/sofimport.py +++ b/openlp/plugins/songs/lib/sofimport.py @@ -345,7 +345,7 @@ class SofImport(OooImport): u'I\'M', u'I\'LL', u'SAVIOUR', u'O', u'YOU\'RE', u'HE', u'HIS', u'HIM', u'ZION', u'EMMANUEL', u'MAJESTY', u'JESUS\'', u'JIREH', u'JUDAH', u'LION', u'LORD\'S', u'ABRAHAM', u'GOD\'S', - u'FATHER\'S', u'ELIJAH' u'MARTHA', u'CHRISTMAS', u'ALPHA', + u'FATHER\'S', u'ELIJAH' u'MARTHA', u'CHRISTMAS', u'ALPHA', u'OMEGA'): textarr[i] = textarr[i].capitalize() else: diff --git a/openlp/plugins/songs/lib/wowimport.py b/openlp/plugins/songs/lib/wowimport.py index 625dd8de2..99f448736 100644 --- a/openlp/plugins/songs/lib/wowimport.py +++ b/openlp/plugins/songs/lib/wowimport.py @@ -53,7 +53,7 @@ class WowImport(SongImport): * A block can be a verse, chorus or bridge. File Header: - Bytes are counted from one, i.e. the first byte is byte 1. The first 19 + Bytes are counted from one, i.e. the first byte is byte 1. The first 19 bytes should be "WoW File \\nSong Words" The bytes after this and up to the 56th byte, can change but no real meaning has been found. The 56th byte specifies how many blocks there are. The first block starts From bca06c4a7a02876f705378b871f4fd6b67c3189e Mon Sep 17 00:00:00 2001 From: M2j Date: Thu, 5 Apr 2012 00:41:18 +0200 Subject: [PATCH 3/4] fix: wrong method name --- openlp/core/ui/exceptiondialog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/exceptiondialog.py b/openlp/core/ui/exceptiondialog.py index 6d0a56ab9..0f9ecaf97 100644 --- a/openlp/core/ui/exceptiondialog.py +++ b/openlp/core/ui/exceptiondialog.py @@ -69,7 +69,7 @@ class Ui_ExceptionDialog(object): self.saveReportButton = create_button(exceptionDialog, u'saveReportButton', icon=u':/general/general_save.png', click=self.onSaveReportButtonClicked) - self.attachFileButton = create_icon(exceptionDialog, + self.attachFileButton = create_button(exceptionDialog, u'attachFileButton', icon=u':/general/general_open.png', click=self.onAttachFileButtonClicked) self.buttonBox = create_button_box(exceptionDialog, u'buttonBox', From 704795830db7fa0488d74788907cd133fc8cfa98 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 5 Apr 2012 17:16:47 +0200 Subject: [PATCH 4/4] use filter instead of list comprehension --- openlp/plugins/bibles/lib/mediaitem.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index abd665929..316b66e39 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -377,13 +377,13 @@ class BibleMediaItem(MediaManagerItem): self.advancedSecondComboBox.addItem(u'') # Get all bibles and sort the list. bibles = self.plugin.manager.get_bibles().keys() + bibles = filter(None, bibles) bibles.sort(cmp=locale.strcoll) # Load the bibles into the combo boxes. - tmp_bibles = [bible for bible in bibles if bible] - self.quickVersionComboBox.addItems(tmp_bibles) - self.quickSecondComboBox.addItems(tmp_bibles) - self.advancedVersionComboBox.addItems(tmp_bibles) - self.advancedSecondComboBox.addItems(tmp_bibles) + self.quickVersionComboBox.addItems(bibles) + self.quickSecondComboBox.addItems(bibles) + self.advancedVersionComboBox.addItems(bibles) + self.advancedSecondComboBox.addItems(bibles) # set the default value bible = QtCore.QSettings().value( self.settingsSection + u'/advanced bible',