changed bible importer finish message, clean ups

This commit is contained in:
Andreas Preikschat 2010-11-09 17:56:16 +01:00
parent b3794de4d1
commit 06cf6dcc20
2 changed files with 21 additions and 12 deletions

View File

@ -168,7 +168,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
license_version = unicode(self.field(u'license_version').toString()) license_version = unicode(self.field(u'license_version').toString())
license_copyright = \ license_copyright = \
unicode(self.field(u'license_copyright').toString()) unicode(self.field(u'license_copyright').toString())
if license_version == u'': if not license_version:
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'Empty Version Name'), 'Empty Version Name'),
@ -176,7 +176,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
'You need to specify a version name for your Bible.')) 'You need to specify a version name for your Bible.'))
self.VersionNameEdit.setFocus() self.VersionNameEdit.setFocus()
return False return False
elif license_copyright == u'': elif not license_copyright:
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',
'Empty Copyright'), 'Empty Copyright'),
@ -317,7 +317,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
""" """
Load the list of Crosswalk and BibleGateway bibles. Load the list of Crosswalk and BibleGateway bibles.
""" """
#Load and store Crosswalk Bibles # Load and store Crosswalk Bibles.
filepath = AppLocation.get_directory(AppLocation.PluginsDir) filepath = AppLocation.get_directory(AppLocation.PluginsDir)
filepath = os.path.join(filepath, u'bibles', u'resources') filepath = os.path.join(filepath, u'bibles', u'resources')
books_file = None books_file = None
@ -341,7 +341,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
finally: finally:
if books_file: if books_file:
books_file.close() books_file.close()
#Load and store BibleGateway Bibles # Load and store BibleGateway Bibles.
books_file = None books_file = None
try: try:
self.web_bible_list[WebDownload.BibleGateway] = {} self.web_bible_list[WebDownload.BibleGateway] = {}
@ -379,12 +379,17 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
def preImport(self): def preImport(self):
bible_type = self.field(u'source_format').toInt()[0]
self.finishButton.setVisible(False) self.finishButton.setVisible(False)
self.ImportProgressBar.setMinimum(0) self.ImportProgressBar.setMinimum(0)
self.ImportProgressBar.setMaximum(1188) self.ImportProgressBar.setMaximum(1188)
self.ImportProgressBar.setValue(0) self.ImportProgressBar.setValue(0)
self.ImportProgressLabel.setText( if bible_type == BibleFormat.WebDownload:
translate('BiblesPlugin.ImportWizardForm', 'Starting import...')) self.ImportProgressLabel.setText(translate(
'BiblesPlugin.ImportWizardForm', 'Starting Registering bible...'))
else:
self.ImportProgressLabel.setText(translate(
'BiblesPlugin.ImportWizardForm', 'Starting import...'))
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
def performImport(self): def performImport(self):
@ -438,8 +443,13 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
self.manager.save_meta_data(license_version, license_version, self.manager.save_meta_data(license_version, license_version,
license_copyright, license_permissions) license_copyright, license_permissions)
self.manager.reload_bibles() self.manager.reload_bibles()
if bible_type == BibleFormat.WebDownload:
self.ImportProgressLabel.setText( self.ImportProgressLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Finished import.')) translate('BiblesPlugin.ImportWizardForm', 'Registered '
'bible. Verses will be downloaded as required.'))
else:
self.ImportProgressLabel.setText(translate(
'BiblesPlugin.ImportWizardForm', 'Finished import.'))
else: else:
self.ImportProgressLabel.setText( self.ImportProgressLabel.setText(
translate('BiblesPlugin.ImportWizardForm', translate('BiblesPlugin.ImportWizardForm',

View File

@ -364,12 +364,11 @@ class HTTPBible(BibleDB):
if self.proxy_server: if self.proxy_server:
self.create_meta(u'proxy server', self.proxy_server) self.create_meta(u'proxy server', self.proxy_server)
if self.proxy_username: if self.proxy_username:
# store the proxy userid # Store the proxy userid.
self.create_meta(u'proxy username', self.proxy_username) self.create_meta(u'proxy username', self.proxy_username)
if self.proxy_password: if self.proxy_password:
# store the proxy password # Store the proxy password.
self.create_meta(u'proxy password', self.proxy_password) self.create_meta(u'proxy password', self.proxy_password)
self.wizard.incrementProgressBar('Registered.')
return True return True
def get_verses(self, reference_list): def get_verses(self, reference_list):
@ -417,7 +416,7 @@ class HTTPBible(BibleDB):
## to request ac and get Acts back. ## to request ac and get Acts back.
bookname = search_results.book bookname = search_results.book
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
# check to see if book/chapter exists # Check to see if book/chapter exists.
db_book = self.get_book(bookname) db_book = self.get_book(bookname)
self.create_chapter(db_book.id, search_results.chapter, self.create_chapter(db_book.id, search_results.chapter,
search_results.verselist) search_results.verselist)