correct some words and code

changed behaviour if the "cancel" button is pressed while upgrading
This commit is contained in:
Armin Köhler 2011-05-26 09:25:17 +02:00
parent 2930510461
commit 6486d41b8c
3 changed files with 28 additions and 28 deletions

View File

@ -84,7 +84,7 @@ class BiblePlugin(Plugin):
if QtGui.QMessageBox.information(self.formparent,
translate('OpenLP', 'Information'), translate('OpenLP',
'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.No)) == QtGui.QMessageBox.Yes:
self.onToolsUpgradeItemTriggered()

View File

@ -111,6 +111,8 @@ class BibleUpgradeForm(OpenLPWizard):
"""
log.debug(u'Wizard cancelled by user')
self.stop_import_flag = True
if not self.currentPage() == self.progressPage:
self.done(QtGui.QDialog.Rejected)
def onCurrentIdChanged(self, pageId):
"""
@ -413,7 +415,7 @@ class BibleUpgradeForm(OpenLPWizard):
OpenLPWizard.preWizard(self)
self.progressLabel.setText(translate(
'BiblesPlugin.UpgradeWizardForm',
'Starting upgrading bible(s)...'))
'Starting upgrading Bible(s)...'))
Receiver.send_message(u'openlp_process_events')
def performWizard(self):
@ -450,7 +452,7 @@ class BibleUpgradeForm(OpenLPWizard):
self.incrementProgressBar(unicode(translate(
'BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nFailed')) %
(number+1, self.maxBibles, name),
(number + 1, self.maxBibles, name),
self.progressBar.maximum() - self.progressBar.value())
number += 1
continue
@ -503,8 +505,8 @@ class BibleUpgradeForm(OpenLPWizard):
self.incrementProgressBar(unicode(translate(
'BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nFailed')) %
(number+1, self.maxBibles, name),
self.progressBar.maximum()-self.progressBar.value())
(number + 1, self.maxBibles, name),
self.progressBar.maximum() - self.progressBar.value())
number += 1
continue
bible = BiblesResourcesDB.get_webbible(
@ -517,16 +519,15 @@ class BibleUpgradeForm(OpenLPWizard):
else:
language_id = self.newbibles[number].get_language(name)
if not language_id:
log.exception(u'Upgrading from "%s" '\
'failed' % filename)
log.exception(u'Upgrading from "%s" failed' % filename)
delete_database(self.path,
clean_filename(self.newbibles[number].get_name()))
del self.newbibles[number]
self.incrementProgressBar(unicode(translate(
'BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nFailed')) %
(number+1, self.maxBibles, name),
self.progressBar.maximum()-self.progressBar.value())
(number + 1, self.maxBibles, name),
self.progressBar.maximum() - self.progressBar.value())
number += 1
continue
self.progressBar.setMaximum(len(books))
@ -538,7 +539,7 @@ class BibleUpgradeForm(OpenLPWizard):
'BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\n'
'Upgrading %s ...')) %
(number+1, self.maxBibles, name, book))
(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:
@ -560,16 +561,15 @@ class BibleUpgradeForm(OpenLPWizard):
if not language_id:
language_id = self.newbibles[number].get_language(name)
if not language_id:
log.exception(u'Upgrading books from "%s" '\
'failed' % name)
log.exception(u'Upgrading books from "%s" failed' % name)
delete_database(self.path,
clean_filename(self.newbibles[number].get_name()))
del self.newbibles[number]
self.incrementProgressBar(unicode(translate(
'BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nFailed')) %
(number+1, self.maxBibles, name),
self.progressBar.maximum()-self.progressBar.value())
(number + 1, self.maxBibles, name),
self.progressBar.maximum() - self.progressBar.value())
number += 1
continue
books = oldbible.get_books()
@ -582,7 +582,7 @@ class BibleUpgradeForm(OpenLPWizard):
'BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\n'
'Upgrading %s ...')) %
(number+1, self.maxBibles, name, book[u'name']))
(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)
@ -614,14 +614,14 @@ class BibleUpgradeForm(OpenLPWizard):
'BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\n'
'Done')) %
(number+1, self.maxBibles, name))
(number + 1, self.maxBibles, name))
self.success[biblenumber] = True
else:
self.incrementProgressBar(unicode(translate(
'BiblesPlugin.UpgradeWizardForm',
'Upgrading Bible %s of %s: "%s"\nFailed')) %
(number+1, self.maxBibles, name),
self.progressBar.maximum()-self.progressBar.value())
(number + 1, self.maxBibles, name),
self.progressBar.maximum() - self.progressBar.value())
delete_database(self.path,
clean_filename(self.newbibles[number].get_name()))
number += 1

View File

@ -58,10 +58,10 @@ class BGExtract(object):
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``
The version of the bible like 31 for New International version.
The version of the Bible like 31 for New International version.
``bookname``
Name of the Book.
@ -133,10 +133,10 @@ class BGExtract(object):
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``
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)
url_params = urllib.urlencode(
@ -157,7 +157,7 @@ class BGExtract(object):
try:
soup = BeautifulSoup(soup)
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:
send_error_message(u'parse')
return None
@ -224,11 +224,11 @@ class BSExtract(object):
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.
``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)
chapter_url = u'http://m.bibleserver.com/overlay/selectBook?'\
@ -261,7 +261,7 @@ class CWExtract(object):
Access and decode bibles via the Crosswalk website
``version``
The version of the bible like niv for New International Version
The version of the Bible like niv for New International Version
``bookname``
Text name of in english e.g. 'gen' for Genesis
@ -320,7 +320,7 @@ class CWExtract(object):
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``
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.incrementProgressBar(unicode(translate(
'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 name', self.download_name)
if self.proxy_server: