forked from openlp/openlp
correct some words and code
changed behaviour if the "cancel" button is pressed while upgrading
This commit is contained in:
parent
2930510461
commit
6486d41b8c
@ -84,7 +84,7 @@ class BiblePlugin(Plugin):
|
|||||||
if QtGui.QMessageBox.information(self.formparent,
|
if QtGui.QMessageBox.information(self.formparent,
|
||||||
translate('OpenLP', 'Information'), translate('OpenLP',
|
translate('OpenLP', 'Information'), translate('OpenLP',
|
||||||
'Bible format has changed.\nYou have to upgrade your '
|
'Bible format has changed.\nYou have to upgrade your '
|
||||||
'existing bibles.\nShould OpenLP upgrade now?'),
|
'existing Bibles.\nShould OpenLP upgrade now?'),
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
||||||
QtGui.QMessageBox.No)) == QtGui.QMessageBox.Yes:
|
QtGui.QMessageBox.No)) == QtGui.QMessageBox.Yes:
|
||||||
self.onToolsUpgradeItemTriggered()
|
self.onToolsUpgradeItemTriggered()
|
||||||
|
@ -111,6 +111,8 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'Wizard cancelled by user')
|
log.debug(u'Wizard cancelled by user')
|
||||||
self.stop_import_flag = True
|
self.stop_import_flag = True
|
||||||
|
if not self.currentPage() == self.progressPage:
|
||||||
|
self.done(QtGui.QDialog.Rejected)
|
||||||
|
|
||||||
def onCurrentIdChanged(self, pageId):
|
def onCurrentIdChanged(self, pageId):
|
||||||
"""
|
"""
|
||||||
@ -413,7 +415,7 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
OpenLPWizard.preWizard(self)
|
OpenLPWizard.preWizard(self)
|
||||||
self.progressLabel.setText(translate(
|
self.progressLabel.setText(translate(
|
||||||
'BiblesPlugin.UpgradeWizardForm',
|
'BiblesPlugin.UpgradeWizardForm',
|
||||||
'Starting upgrading bible(s)...'))
|
'Starting upgrading Bible(s)...'))
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
|
|
||||||
def performWizard(self):
|
def performWizard(self):
|
||||||
@ -450,7 +452,7 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
self.incrementProgressBar(unicode(translate(
|
self.incrementProgressBar(unicode(translate(
|
||||||
'BiblesPlugin.UpgradeWizardForm',
|
'BiblesPlugin.UpgradeWizardForm',
|
||||||
'Upgrading Bible %s of %s: "%s"\nFailed')) %
|
'Upgrading Bible %s of %s: "%s"\nFailed')) %
|
||||||
(number+1, self.maxBibles, name),
|
(number + 1, self.maxBibles, name),
|
||||||
self.progressBar.maximum() - self.progressBar.value())
|
self.progressBar.maximum() - self.progressBar.value())
|
||||||
number += 1
|
number += 1
|
||||||
continue
|
continue
|
||||||
@ -503,8 +505,8 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
self.incrementProgressBar(unicode(translate(
|
self.incrementProgressBar(unicode(translate(
|
||||||
'BiblesPlugin.UpgradeWizardForm',
|
'BiblesPlugin.UpgradeWizardForm',
|
||||||
'Upgrading Bible %s of %s: "%s"\nFailed')) %
|
'Upgrading Bible %s of %s: "%s"\nFailed')) %
|
||||||
(number+1, self.maxBibles, name),
|
(number + 1, self.maxBibles, name),
|
||||||
self.progressBar.maximum()-self.progressBar.value())
|
self.progressBar.maximum() - self.progressBar.value())
|
||||||
number += 1
|
number += 1
|
||||||
continue
|
continue
|
||||||
bible = BiblesResourcesDB.get_webbible(
|
bible = BiblesResourcesDB.get_webbible(
|
||||||
@ -517,16 +519,15 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
else:
|
else:
|
||||||
language_id = self.newbibles[number].get_language(name)
|
language_id = self.newbibles[number].get_language(name)
|
||||||
if not language_id:
|
if not language_id:
|
||||||
log.exception(u'Upgrading from "%s" '\
|
log.exception(u'Upgrading from "%s" failed' % filename)
|
||||||
'failed' % filename)
|
|
||||||
delete_database(self.path,
|
delete_database(self.path,
|
||||||
clean_filename(self.newbibles[number].get_name()))
|
clean_filename(self.newbibles[number].get_name()))
|
||||||
del self.newbibles[number]
|
del self.newbibles[number]
|
||||||
self.incrementProgressBar(unicode(translate(
|
self.incrementProgressBar(unicode(translate(
|
||||||
'BiblesPlugin.UpgradeWizardForm',
|
'BiblesPlugin.UpgradeWizardForm',
|
||||||
'Upgrading Bible %s of %s: "%s"\nFailed')) %
|
'Upgrading Bible %s of %s: "%s"\nFailed')) %
|
||||||
(number+1, self.maxBibles, name),
|
(number + 1, self.maxBibles, name),
|
||||||
self.progressBar.maximum()-self.progressBar.value())
|
self.progressBar.maximum() - self.progressBar.value())
|
||||||
number += 1
|
number += 1
|
||||||
continue
|
continue
|
||||||
self.progressBar.setMaximum(len(books))
|
self.progressBar.setMaximum(len(books))
|
||||||
@ -538,7 +539,7 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
'BiblesPlugin.UpgradeWizardForm',
|
'BiblesPlugin.UpgradeWizardForm',
|
||||||
'Upgrading Bible %s of %s: "%s"\n'
|
'Upgrading Bible %s of %s: "%s"\n'
|
||||||
'Upgrading %s ...')) %
|
'Upgrading %s ...')) %
|
||||||
(number+1, self.maxBibles, name, book))
|
(number + 1, self.maxBibles, name, book))
|
||||||
book_ref_id = self.newbibles[number].\
|
book_ref_id = self.newbibles[number].\
|
||||||
get_book_ref_id_by_name(book, len(books), language_id)
|
get_book_ref_id_by_name(book, len(books), language_id)
|
||||||
if not book_ref_id:
|
if not book_ref_id:
|
||||||
@ -560,16 +561,15 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
if not language_id:
|
if not language_id:
|
||||||
language_id = self.newbibles[number].get_language(name)
|
language_id = self.newbibles[number].get_language(name)
|
||||||
if not language_id:
|
if not language_id:
|
||||||
log.exception(u'Upgrading books from "%s" '\
|
log.exception(u'Upgrading books from "%s" failed' % name)
|
||||||
'failed' % name)
|
|
||||||
delete_database(self.path,
|
delete_database(self.path,
|
||||||
clean_filename(self.newbibles[number].get_name()))
|
clean_filename(self.newbibles[number].get_name()))
|
||||||
del self.newbibles[number]
|
del self.newbibles[number]
|
||||||
self.incrementProgressBar(unicode(translate(
|
self.incrementProgressBar(unicode(translate(
|
||||||
'BiblesPlugin.UpgradeWizardForm',
|
'BiblesPlugin.UpgradeWizardForm',
|
||||||
'Upgrading Bible %s of %s: "%s"\nFailed')) %
|
'Upgrading Bible %s of %s: "%s"\nFailed')) %
|
||||||
(number+1, self.maxBibles, name),
|
(number + 1, self.maxBibles, name),
|
||||||
self.progressBar.maximum()-self.progressBar.value())
|
self.progressBar.maximum() - self.progressBar.value())
|
||||||
number += 1
|
number += 1
|
||||||
continue
|
continue
|
||||||
books = oldbible.get_books()
|
books = oldbible.get_books()
|
||||||
@ -582,7 +582,7 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
'BiblesPlugin.UpgradeWizardForm',
|
'BiblesPlugin.UpgradeWizardForm',
|
||||||
'Upgrading Bible %s of %s: "%s"\n'
|
'Upgrading Bible %s of %s: "%s"\n'
|
||||||
'Upgrading %s ...')) %
|
'Upgrading %s ...')) %
|
||||||
(number+1, self.maxBibles, name, book[u'name']))
|
(number + 1, self.maxBibles, name, book[u'name']))
|
||||||
book_ref_id = self.newbibles[number].\
|
book_ref_id = self.newbibles[number].\
|
||||||
get_book_ref_id_by_name(book[u'name'], len(books),
|
get_book_ref_id_by_name(book[u'name'], len(books),
|
||||||
language_id)
|
language_id)
|
||||||
@ -614,14 +614,14 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||||||
'BiblesPlugin.UpgradeWizardForm',
|
'BiblesPlugin.UpgradeWizardForm',
|
||||||
'Upgrading Bible %s of %s: "%s"\n'
|
'Upgrading Bible %s of %s: "%s"\n'
|
||||||
'Done')) %
|
'Done')) %
|
||||||
(number+1, self.maxBibles, name))
|
(number + 1, self.maxBibles, name))
|
||||||
self.success[biblenumber] = True
|
self.success[biblenumber] = True
|
||||||
else:
|
else:
|
||||||
self.incrementProgressBar(unicode(translate(
|
self.incrementProgressBar(unicode(translate(
|
||||||
'BiblesPlugin.UpgradeWizardForm',
|
'BiblesPlugin.UpgradeWizardForm',
|
||||||
'Upgrading Bible %s of %s: "%s"\nFailed')) %
|
'Upgrading Bible %s of %s: "%s"\nFailed')) %
|
||||||
(number+1, self.maxBibles, name),
|
(number + 1, self.maxBibles, name),
|
||||||
self.progressBar.maximum()-self.progressBar.value())
|
self.progressBar.maximum() - self.progressBar.value())
|
||||||
delete_database(self.path,
|
delete_database(self.path,
|
||||||
clean_filename(self.newbibles[number].get_name()))
|
clean_filename(self.newbibles[number].get_name()))
|
||||||
number += 1
|
number += 1
|
||||||
|
@ -58,10 +58,10 @@ class BGExtract(object):
|
|||||||
|
|
||||||
def get_bible_chapter(self, version, bookname, chapter):
|
def get_bible_chapter(self, version, bookname, chapter):
|
||||||
"""
|
"""
|
||||||
Access and decode bibles via the BibleGateway website.
|
Access and decode Bibles via the BibleGateway website.
|
||||||
|
|
||||||
``version``
|
``version``
|
||||||
The version of the bible like 31 for New International version.
|
The version of the Bible like 31 for New International version.
|
||||||
|
|
||||||
``bookname``
|
``bookname``
|
||||||
Name of the Book.
|
Name of the Book.
|
||||||
@ -133,10 +133,10 @@ class BGExtract(object):
|
|||||||
|
|
||||||
def get_books_from_http(self, version):
|
def get_books_from_http(self, version):
|
||||||
"""
|
"""
|
||||||
Load a list of all books a bible contaions from BibleGateway website.
|
Load a list of all books a Bible contaions from BibleGateway website.
|
||||||
|
|
||||||
``version``
|
``version``
|
||||||
The version of the bible like NIV for New International Version
|
The version of the Bible like NIV for New International Version
|
||||||
"""
|
"""
|
||||||
log.debug(u'BGExtract.get_books_from_http("%s")', version)
|
log.debug(u'BGExtract.get_books_from_http("%s")', version)
|
||||||
url_params = urllib.urlencode(
|
url_params = urllib.urlencode(
|
||||||
@ -157,7 +157,7 @@ class BGExtract(object):
|
|||||||
try:
|
try:
|
||||||
soup = BeautifulSoup(soup)
|
soup = BeautifulSoup(soup)
|
||||||
except HTMLParseError:
|
except HTMLParseError:
|
||||||
log.exception(u'BeautifulSoup could not parse the bible page.')
|
log.exception(u'BeautifulSoup could not parse the Bible page.')
|
||||||
if not soup:
|
if not soup:
|
||||||
send_error_message(u'parse')
|
send_error_message(u'parse')
|
||||||
return None
|
return None
|
||||||
@ -224,11 +224,11 @@ class BSExtract(object):
|
|||||||
|
|
||||||
def get_books_from_http(self, version):
|
def get_books_from_http(self, version):
|
||||||
"""
|
"""
|
||||||
Load a list of all books a bible contains from Bibleserver mobile
|
Load a list of all books a Bible contains from Bibleserver mobile
|
||||||
website.
|
website.
|
||||||
|
|
||||||
``version``
|
``version``
|
||||||
The version of the bible like NIV for New International Version
|
The version of the Bible like NIV for New International Version
|
||||||
"""
|
"""
|
||||||
log.debug(u'BSExtract.get_books_from_http("%s")', version)
|
log.debug(u'BSExtract.get_books_from_http("%s")', version)
|
||||||
chapter_url = u'http://m.bibleserver.com/overlay/selectBook?'\
|
chapter_url = u'http://m.bibleserver.com/overlay/selectBook?'\
|
||||||
@ -261,7 +261,7 @@ class CWExtract(object):
|
|||||||
Access and decode bibles via the Crosswalk website
|
Access and decode bibles via the Crosswalk website
|
||||||
|
|
||||||
``version``
|
``version``
|
||||||
The version of the bible like niv for New International Version
|
The version of the Bible like niv for New International Version
|
||||||
|
|
||||||
``bookname``
|
``bookname``
|
||||||
Text name of in english e.g. 'gen' for Genesis
|
Text name of in english e.g. 'gen' for Genesis
|
||||||
@ -320,7 +320,7 @@ class CWExtract(object):
|
|||||||
|
|
||||||
def get_books_from_http(self, version):
|
def get_books_from_http(self, version):
|
||||||
"""
|
"""
|
||||||
Load a list of all books a bible contain from the Crosswalk website.
|
Load a list of all books a Bible contain from the Crosswalk website.
|
||||||
|
|
||||||
``version``
|
``version``
|
||||||
The version of the bible like NIV for New International Version
|
The version of the bible like NIV for New International Version
|
||||||
@ -383,7 +383,7 @@ class HTTPBible(BibleDB):
|
|||||||
self.wizard.progressBar.setMaximum(68)
|
self.wizard.progressBar.setMaximum(68)
|
||||||
self.wizard.incrementProgressBar(unicode(translate(
|
self.wizard.incrementProgressBar(unicode(translate(
|
||||||
'BiblesPlugin.HTTPBible',
|
'BiblesPlugin.HTTPBible',
|
||||||
'Registering bible and loading books...')))
|
'Registering Bible and loading books...')))
|
||||||
self.create_meta(u'download source', self.download_source)
|
self.create_meta(u'download source', self.download_source)
|
||||||
self.create_meta(u'download name', self.download_name)
|
self.create_meta(u'download name', self.download_name)
|
||||||
if self.proxy_server:
|
if self.proxy_server:
|
||||||
|
Loading…
Reference in New Issue
Block a user