diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index 16607d569..4d43ab76d 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -80,8 +80,7 @@ class BiblePlugin(Plugin): """ Perform tasks on application starup """ - if not len(self.manager.db_cache) and \ - len(self.manager.old_bible_databases): + if len(self.manager.old_bible_databases): if QtGui.QMessageBox.information(self.formparent, translate('OpenLP', 'Information'), translate('OpenLP', 'Bible format has changed.\nYou have to upgrade your ' @@ -114,7 +113,7 @@ class BiblePlugin(Plugin): The actual **Tools** menu item, so that your actions can use it as their parent. """ - log.info(u'add tools menu') + log.debug(u'add tools menu') self.toolsUpgradeItem = QtGui.QAction(tools_menu) self.toolsUpgradeItem.setObjectName(u'toolsUpgradeItem') self.toolsUpgradeItem.setText( diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index 81db1597d..cd793f7e7 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -31,7 +31,6 @@ import csv import logging import os import os.path -import re from PyQt4 import QtCore, QtGui diff --git a/openlp/plugins/bibles/forms/bibleupgradeform.py b/openlp/plugins/bibles/forms/bibleupgradeform.py index 4a8ad488d..3ddf66f10 100644 --- a/openlp/plugins/bibles/forms/bibleupgradeform.py +++ b/openlp/plugins/bibles/forms/bibleupgradeform.py @@ -305,7 +305,8 @@ class BibleUpgradeForm(OpenLPWizard): self.versionInfoLabel[number].setText( translate('BiblesPlugin.UpgradeWizardForm', 'This ' 'Bible still exists. Please change the name or uncheck it.')) - self.progressPage.setTitle(WizardStrings.Importing) + self.progressPage.setTitle(translate('BiblesPlugin.UpgradeWizardForm', + 'Upgrading')) self.progressPage.setSubTitle( translate('BiblesPlugin.UpgradeWizardForm', 'Please wait while your Bibles are upgraded.')) @@ -459,7 +460,7 @@ class BibleUpgradeForm(OpenLPWizard): continue self.progressLabel.setText(unicode(translate( 'BiblesPlugin.UpgradeWizardForm', - 'Upgrading Bible %s of %s: "%s"\nImporting ...')) % + 'Upgrading Bible %s of %s: "%s"\nUpgrading ...')) % (number + 1, self.maxBibles, name)) if os.path.exists(os.path.join(self.path, filename)): name = unicode(self.versionNameEdit[biblenumber].text()) @@ -489,7 +490,7 @@ class BibleUpgradeForm(OpenLPWizard): handler = BSExtract(proxy_server) books = handler.get_books_from_http(meta_data[u'download name']) if not books: - log.exception(u'Importing books from %s - download '\ + log.exception(u'Upgrading books from %s - download '\ u'name: "%s" failed' % ( meta_data[u'download source'], meta_data[u'download name'])) @@ -518,7 +519,7 @@ class BibleUpgradeForm(OpenLPWizard): self.newbibles[number].create_meta(u'language_id', language_id) else: - language_id = self.newbibles[number].get_language() + language_id = self.newbibles[number].get_language(name) if not language_id: log.exception(u'Upgrading from "%s" '\ 'failed' % filename) @@ -539,12 +540,12 @@ class BibleUpgradeForm(OpenLPWizard): self.incrementProgressBar(unicode(translate( 'BiblesPlugin.UpgradeWizardForm', 'Upgrading Bible %s of %s: "%s"\n' - 'Importing %s ...')) % + 'Upgrading %s ...')) % (number+1, self.maxBibles, name, book)) book_ref_id = self.newbibles[number].\ get_book_ref_id_by_name(book, len(books), language_id) if not book_ref_id: - log.exception(u'Importing books from %s - download '\ + log.exception(u'Upgrading books from %s - download '\ u'name: "%s" aborted by user' % ( meta_data[u'download source'], meta_data[u'download name'])) @@ -560,9 +561,9 @@ class BibleUpgradeForm(OpenLPWizard): language_id = self.newbibles[number].get_object(BibleMeta, u'language_id') if not language_id: - language_id = self.newbibles[number].get_language() + language_id = self.newbibles[number].get_language(name) if not language_id: - log.exception(u'Importing books from "%s" '\ + log.exception(u'Upgrading books from "%s" '\ 'failed' % name) delete_database(self.path, clean_filename(self.newbibles[number].get_name())) @@ -582,13 +583,13 @@ class BibleUpgradeForm(OpenLPWizard): self.incrementProgressBar(unicode(translate( 'BiblesPlugin.UpgradeWizardForm', 'Upgrading Bible %s of %s: "%s"\n' - 'Importing %s ...')) % + 'Upgrading %s ...')) % (number+1, self.maxBibles, name, book[u'name'])) book_ref_id = self.newbibles[number].\ get_book_ref_id_by_name(book[u'name'], len(books), language_id) if not book_ref_id: - log.exception(u'Importing books from %s " '\ + log.exception(u'Upgrading books from %s " '\ 'failed - aborted by user' % name) delete_database(self.path, clean_filename(self.newbibles[number].get_name())) diff --git a/openlp/plugins/bibles/forms/booknamedialog.py b/openlp/plugins/bibles/forms/booknamedialog.py index 20e96b922..632007013 100644 --- a/openlp/plugins/bibles/forms/booknamedialog.py +++ b/openlp/plugins/bibles/forms/booknamedialog.py @@ -100,12 +100,12 @@ class Ui_BookNameDialog(object): def retranslateUi(self, bookNameDialog): bookNameDialog.setWindowTitle( - translate('BiblesPlugin.BookNameDialog', 'Choose Book')) + translate('BiblesPlugin.BookNameDialog', 'Select Book')) self.headlineLabel.setText( - translate('BiblesPlugin.BookNameDialog', 'Choose Book:')) + translate('BiblesPlugin.BookNameDialog', 'Select Book:')) self.infoLabel.setText(translate('BiblesPlugin.BookNameDialog', 'The following books cannot be clearly attributed. \n' - 'Please choose which book it is.')) + 'Please select which book it is.')) self.requestLabel.setText(translate('BiblesPlugin.BookNameDialog', 'Book:')) self.infoLabelTestaments.setText(translate( diff --git a/openlp/plugins/bibles/forms/booknameform.py b/openlp/plugins/bibles/forms/booknameform.py index 425e20e41..fdb383a8c 100644 --- a/openlp/plugins/bibles/forms/booknameform.py +++ b/openlp/plugins/bibles/forms/booknameform.py @@ -116,7 +116,7 @@ class BookNameForm(QDialog, Ui_BookNameDialog): if self.requestComboBox.currentText() == u'': critical_error_message_box( message=translate('BiblesPlugin.BookNameForm', - 'You need to choose a book.')) + 'You need to select a book.')) self.requestComboBox.setFocus() return False else: diff --git a/openlp/plugins/bibles/forms/languagedialog.py b/openlp/plugins/bibles/forms/languagedialog.py index 7f3580279..0edcb74d8 100644 --- a/openlp/plugins/bibles/forms/languagedialog.py +++ b/openlp/plugins/bibles/forms/languagedialog.py @@ -85,10 +85,10 @@ class Ui_LanguageDialog(object): def retranslateUi(self, languageDialog): languageDialog.setWindowTitle( - translate('BiblesPlugin.LanguageDialog', 'Choose Language')) + translate('BiblesPlugin.LanguageDialog', 'Select Language')) self.headlineLabel.setText( - translate('BiblesPlugin.LanguageDialog', 'Choose Language:')) + translate('BiblesPlugin.LanguageDialog', 'Select Language:')) self.infoLabel.setText(translate('BiblesPlugin.LanguageDialog', - 'Please choose the Bible\'s language')) + 'Please select the Bible\'s language')) self.requestLabel.setText(translate('BiblesPlugin.languageDialog', 'Language:')) diff --git a/openlp/plugins/bibles/forms/languageform.py b/openlp/plugins/bibles/forms/languageform.py index 6235c6385..0e2c3f003 100644 --- a/openlp/plugins/bibles/forms/languageform.py +++ b/openlp/plugins/bibles/forms/languageform.py @@ -52,8 +52,13 @@ class LanguageForm(QDialog, Ui_LanguageDialog): QDialog.__init__(self, parent) self.setupUi(self) - def exec_(self): + def exec_(self, bible_name): self.requestComboBox.addItem(u'') + if bible_name: + self.infoLabel.setText(unicode(translate( + 'BiblesPlugin.LanguageDialog', + 'Please select the language for Bible:\n"%s"')) % + bible_name) items = BiblesResourcesDB.get_languages() for item in items: self.requestComboBox.addItem(item[u'name']) @@ -63,7 +68,7 @@ class LanguageForm(QDialog, Ui_LanguageDialog): if self.requestComboBox.currentText() == u'': critical_error_message_box( message=translate('BiblesPlugin.LanguageForm', - 'You need to choose a language.')) + 'You need to select a language.')) self.requestComboBox.setFocus() return False else: diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index 8902593ca..7278da42f 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -396,7 +396,7 @@ class BibleDB(QtCore.QObject, Manager): .all() verse_list.extend(verses) else: - log.debug(u'OpenLP failed to find book %s', book) + log.debug(u'OpenLP failed to find book with id "%s"', book_id) if show_error: critical_error_message_box( translate('BiblesPlugin', 'No Book Found'), @@ -466,10 +466,10 @@ class BibleDB(QtCore.QObject, Manager): else: return count - def get_language(self): + def get_language(self, bible_name=None): """ If no language is given it calls a dialog window where the user could - choose the bible language. + select the bible language. Return the language id of a bible. ``book`` @@ -479,7 +479,7 @@ class BibleDB(QtCore.QObject, Manager): from openlp.plugins.bibles.forms import LanguageForm language = None language_form = LanguageForm(self.wizard) - if language_form.exec_(): + if language_form.exec_(bible_name): language = unicode(language_form.requestComboBox.currentText()) if not language: return False @@ -488,9 +488,10 @@ class BibleDB(QtCore.QObject, Manager): self.create_meta(u'language_id', language_id) return language_id - def find_old_database(self): + def is_old_database(self): """ - Returns true if it is an old bible database. + Returns ``True`` if it is a bible database, which has been created + prior to 1.9.6. """ try: columns = self.session.query(Book).all() diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index 6b854eb44..7086c02c5 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -154,7 +154,7 @@ class BibleManager(object): delete_file(os.path.join(self.path, filename)) continue # Find old database versions - if bible.find_old_database(): + if bible.is_old_database(): self.old_bible_databases.append(filename) continue log.debug(u'Bible Name: "%s"', name)