This time had to bribe the Line Length Police!

This commit is contained in:
Raoul Snyman 2009-12-24 20:01:39 +02:00
parent c900ed9b5c
commit 4f09b260db

View File

@ -107,14 +107,16 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
if self.field(u'osis_biblename').toString() == u'':
QtGui.QMessageBox.critical(self,
self.trUtf8('Invalid Bible Name'),
self.trUtf8('You need to specify a name for your Bible!'),
self.trUtf8('You need to specify a name for your '
'Bible!'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.OsisBibleNameEdit.setFocus()
return False
if self.field(u'osis_location').toString() == u'':
QtGui.QMessageBox.critical(self,
self.trUtf8('Invalid Bible Location'),
self.trUtf8('You need to specify a file to import your Bible from!'),
self.trUtf8('You need to specify a file to import your '
'Bible from!'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.OSISLocationEdit.setFocus()
return False
@ -122,14 +124,16 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
if self.field(u'csv_booksfile').toString() == u'':
QtGui.QMessageBox.critical(self,
self.trUtf8('Invalid Books File'),
self.trUtf8('You need to specify a file with books of the Bible to use in the import!'),
self.trUtf8('You need to specify a file with books of '
'the Bible to use in the import!'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.BooksLocationEdit.setFocus()
return False
elif self.field(u'csv_versefile').toString() == u'':
QtGui.QMessageBox.critical(self,
self.trUtf8('Invalid Verse File'),
self.trUtf8('You need to specify a file of Bible verses to import!'),
self.trUtf8('You need to specify a file of Bible '
'verses to import!'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.CsvVerseLocationEdit.setFocus()
return False
@ -137,7 +141,8 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
if self.field(u'opensong_file').toString() == u'':
QtGui.QMessageBox.critical(self,
self.trUtf8('Invalid OpenSong Bible'),
self.trUtf8('You need to specify an OpenSong Bible file to import!'),
self.trUtf8('You need to specify an OpenSong Bible '
'file to import!'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.OpenSongFileEdit.setFocus()
return False
@ -147,14 +152,17 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
if self.field(u'license_version').toString() == u'':
QtGui.QMessageBox.critical(self,
self.trUtf8('Empty Version Name'),
self.trUtf8('You need to specify a version name for your Bible!'),
self.trUtf8('You need to specify a version name for your '
'Bible!'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.VersionNameEdit.setFocus()
return False
elif self.field(u'license_copyright').toString() == u'':
QtGui.QMessageBox.critical(self,
self.trUtf8('Empty Copyright'),
self.trUtf8('You need to set a copyright for your Bible! Bibles in the Public Domain need to be marked as such.'),
self.trUtf8('You need to set a copyright for your Bible! '
'Bibles in the Public Domain need to be marked as '
'such.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.CopyrightEdit.setFocus()
return False
@ -169,16 +177,20 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
self.BibleComboBox.addItem(unicode(self.trUtf8(bible)))
def onOsisFileButtonClicked(self):
self.getFileName(self.trUtf8('Open OSIS file'), self.OSISLocationEdit)
self.getFileName(self.trUtf8('Open OSIS file'),
self.OSISLocationEdit)
def onBooksFileButtonClicked(self):
self.getFileName(self.trUtf8('Open Books CSV file'), self.BooksLocationEdit)
self.getFileName(self.trUtf8('Open Books CSV file'),
self.BooksLocationEdit)
def onCsvVersesFileButtonClicked(self):
self.getFileName(self.trUtf8('Open Verses CSV file'), self.CsvVerseLocationEdit)
self.getFileName(self.trUtf8('Open Verses CSV file'),
self.CsvVerseLocationEdit)
def onOpenSongBrowseButtonClicked(self):
self.getFileName(self.trUtf8('Open OpenSong Bible'), self.OpenSongFileEdit)
self.getFileName(self.trUtf8('Open OpenSong Bible'),
self.OpenSongFileEdit)
def onCurrentIdChanged(self, id):
if id == 3:
@ -187,20 +199,34 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
self.postImport()
def registerFields(self):
self.SelectPage.registerField(u'source_format', self.FormatComboBox)
self.SelectPage.registerField(u'osis_biblename', self.OsisBibleNameEdit)
self.SelectPage.registerField(u'osis_location', self.OSISLocationEdit)
self.SelectPage.registerField(u'csv_booksfile', self.BooksLocationEdit)
self.SelectPage.registerField(u'csv_versefile', self.CsvVerseLocationEdit)
self.SelectPage.registerField(u'opensong_file', self.OpenSongFileEdit)
self.SelectPage.registerField(u'web_location', self.LocationComboBox)
self.SelectPage.registerField(u'web_biblename', self.BibleComboBox)
self.SelectPage.registerField(u'proxy_server', self.AddressEdit)
self.SelectPage.registerField(u'proxy_username', self.UsernameEdit)
self.SelectPage.registerField(u'proxy_password', self.PasswordEdit)
self.LicenseDetailsPage.registerField(u'license_version', self.VersionNameEdit)
self.LicenseDetailsPage.registerField(u'license_copyright', self.CopyrightEdit)
self.LicenseDetailsPage.registerField(u'license_permission', self.PermissionEdit)
self.SelectPage.registerField(
u'source_format', self.FormatComboBox)
self.SelectPage.registerField(
u'osis_biblename', self.OsisBibleNameEdit)
self.SelectPage.registerField(
u'osis_location', self.OSISLocationEdit)
self.SelectPage.registerField(
u'csv_booksfile', self.BooksLocationEdit)
self.SelectPage.registerField(
u'csv_versefile', self.CsvVerseLocationEdit)
self.SelectPage.registerField(
u'opensong_file', self.OpenSongFileEdit)
self.SelectPage.registerField(
u'web_location', self.LocationComboBox)
self.SelectPage.registerField(
u'web_biblename', self.BibleComboBox)
self.SelectPage.registerField(
u'proxy_server', self.AddressEdit)
self.SelectPage.registerField(
u'proxy_username', self.UsernameEdit)
self.SelectPage.registerField(
u'proxy_password', self.PasswordEdit)
self.LicenseDetailsPage.registerField(
u'license_version', self.VersionNameEdit)
self.LicenseDetailsPage.registerField(
u'license_copyright', self.CopyrightEdit)
self.LicenseDetailsPage.registerField(
u'license_permission', self.PermissionEdit)
def setDefaults(self):
self.setField(u'source_format', 0)
@ -211,9 +237,12 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
self.setField(u'opensong_file', u'')
self.setField(u'web_location', 0)
self.setField(u'web_biblename', self.BibleComboBox)
self.setField(u'proxy_server', self.config.get_config(u'proxy address', u''))
self.setField(u'proxy_username', self.config.get_config(u'proxy username',u''))
self.setField(u'proxy_password', self.config.get_config(u'proxy password',u''))
self.setField(u'proxy_server',
self.config.get_config(u'proxy address', u''))
self.setField(u'proxy_username',
self.config.get_config(u'proxy username',u''))
self.setField(u'proxy_password',
self.config.get_config(u'proxy password',u''))
self.setField(u'license_version', self.VersionNameEdit)
self.setField(u'license_copyright', self.CopyrightEdit)
self.setField(u'license_permission', self.PermissionEdit)
@ -232,8 +261,9 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
self.web_bible_list[DownloadLocation.Crosswalk] = {}
fbibles = open(os.path.join(filepath, u'crosswalkbooks.csv'), 'r')
for line in fbibles:
p = line.split(u',')
self.web_bible_list[DownloadLocation.Crosswalk][p[0]] = p[1].rstrip()
parts = line.split(u',')
self.web_bible_list[DownloadLocation.Crosswalk][parts[0]] = \
parts[1].rstrip()
except:
log.exception(u'Crosswalk resources missing')
finally:
@ -244,8 +274,9 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
self.web_bible_list[DownloadLocation.BibleGateway] = {}
fbibles = open(os.path.join(filepath, u'biblegateway.csv'), 'r')
for line in fbibles:
p = line.split(u',')
self.web_bible_list[DownloadLocation.BibleGateway][p[0]] = p[1].rstrip()
parts = line.split(u',')
self.web_bible_list[DownloadLocation.BibleGateway][parts[0]] = \
parts[1].rstrip()
except:
log.exception(u'Biblegateway resources missing')
finally:
@ -322,7 +353,8 @@ class ImportWizardForm(QtGui.QWizard, Ui_BibleImportWizard):
unicode(self.field(u'license_permission').toString())
)
else:
self.ImportProgressLabel.setText(self.trUtf8('Your Bible import failed.'))
self.ImportProgressLabel.setText(
self.trUtf8('Your Bible import failed.'))
self.ImportProgressBar.setValue(self.ImportProgressBar.maximum())
def postImport(self):