This commit is contained in:
Andreas Preikschat 2010-12-11 10:36:06 +01:00
commit 1adcf1a43a
12 changed files with 586 additions and 437 deletions

View File

@ -84,21 +84,24 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
self.manager.set_process_dialog(self)
self.web_bible_list = {}
self.loadWebBibles()
QtCore.QObject.connect(self.LocationComboBox,
QtCore.QObject.connect(self.locationComboBox,
QtCore.SIGNAL(u'currentIndexChanged(int)'),
self.onLocationComboBoxChanged)
QtCore.QObject.connect(self.OsisFileButton,
QtCore.QObject.connect(self.osisFileButton,
QtCore.SIGNAL(u'clicked()'),
self.onOsisFileButtonClicked)
QtCore.QObject.connect(self.BooksFileButton,
QtCore.QObject.connect(self.booksFileButton,
QtCore.SIGNAL(u'clicked()'),
self.onBooksFileButtonClicked)
QtCore.QObject.connect(self.CsvVersesFileButton,
QtCore.QObject.connect(self.csvVersesFileButton,
QtCore.SIGNAL(u'clicked()'),
self.onCsvVersesFileButtonClicked)
QtCore.QObject.connect(self.OpenSongBrowseButton,
QtCore.QObject.connect(self.openSongBrowseButton,
QtCore.SIGNAL(u'clicked()'),
self.onOpenSongBrowseButtonClicked)
QtCore.QObject.connect(self.openlp1FileButton,
QtCore.SIGNAL(u'clicked()'),
self.onOpenlp1FileButtonClicked)
QtCore.QObject.connect(self.cancelButton,
QtCore.SIGNAL(u'clicked(bool)'),
self.onCancelButtonClicked)
@ -113,6 +116,16 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
self.setDefaults()
return QtGui.QWizard.exec_(self)
def reject(self):
"""
Stop the import on cancel button, close button or ESC key.
"""
log.debug('Import canceled by user.')
if self.currentId() == 3:
Receiver.send_message(u'bibles_stop_import')
else:
self.done(QtGui.QDialog.Rejected)
def validateCurrentPage(self):
"""
Validate the current page before moving on to the next page.
@ -123,7 +136,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
elif self.currentId() == 1:
# Select page
if self.field(u'source_format').toInt()[0] == BibleFormat.OSIS:
if self.field(u'osis_location').toString() == u'':
if not self.field(u'osis_location').toString():
QtGui.QMessageBox.critical(self,
translate('BiblesPlugin.ImportWizardForm',
'Invalid Bible Location'),
@ -140,7 +153,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file with books of '
'the Bible to use in the import.'))
self.BooksLocationEdit.setFocus()
self.booksLocationEdit.setFocus()
return False
elif not self.field(u'csv_versefile').toString():
QtGui.QMessageBox.critical(self,
@ -149,7 +162,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file of Bible '
'verses to import.'))
self.CsvVerseLocationEdit.setFocus()
self.csvVerseLocationEdit.setFocus()
return False
elif self.field(u'source_format').toInt()[0] == \
BibleFormat.OpenSong:
@ -160,7 +173,17 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
translate('BiblesPlugin.ImportWizardForm',
'You need to specify an OpenSong Bible '
'file to import.'))
self.OpenSongFileEdit.setFocus()
self.openSongFileEdit.setFocus()
return False
elif self.field(u'source_format').toInt()[0] == BibleFormat.OpenLP1:
if not self.field(u'openlp1_location').toString():
QtGui.QMessageBox.critical(self,
translate('BiblesPlugin.ImportWizardForm',
'Invalid Bible Location'),
translate('BiblesPlugin.ImportWizardForm',
'You need to specify a file to import your '
'Bible from.'))
self.openlp1LocationEdit.setFocus()
return False
return True
elif self.currentId() == 2:
@ -174,7 +197,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
'Empty Version Name'),
translate('BiblesPlugin.ImportWizardForm',
'You need to specify a version name for your Bible.'))
self.VersionNameEdit.setFocus()
self.versionNameEdit.setFocus()
return False
elif not license_copyright:
QtGui.QMessageBox.critical(self,
@ -183,7 +206,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
translate('BiblesPlugin.ImportWizardForm',
'You need to set a copyright for your Bible. '
'Bibles in the Public Domain need to be marked as such.'))
self.CopyrightEdit.setFocus()
self.copyrightEdit.setFocus()
return False
elif self.manager.exists(license_version):
QtGui.QMessageBox.critical(self,
@ -191,7 +214,7 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
translate('BiblesPlugin.ImportWizardForm',
'This Bible already exists. Please import '
'a different Bible or first delete the existing one.'))
self.VersionNameEdit.setFocus()
self.versionNameEdit.setFocus()
return False
return True
if self.currentId() == 3:
@ -206,12 +229,12 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
``index``
The index of the combo box.
"""
self.BibleComboBox.clear()
self.bibleComboBox.clear()
bibles = [unicode(translate('BiblesPlugin.ImportWizardForm', bible)) for
bible in self.web_bible_list[index].keys()]
bibles.sort()
for bible in bibles:
self.BibleComboBox.addItem(bible)
self.bibleComboBox.addItem(bible)
def onOsisFileButtonClicked(self):
"""
@ -227,14 +250,14 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
"""
self.getFileName(
translate('BiblesPlugin.ImportWizardForm', 'Open Books CSV File'),
self.BooksLocationEdit)
self.booksLocationEdit)
def onCsvVersesFileButtonClicked(self):
"""
Show the file open dialog for the verses CSV file.
"""
self.getFileName(translate('BiblesPlugin.ImportWizardForm',
'Open Verses CSV File'), self.CsvVerseLocationEdit)
'Open Verses CSV File'), self.csvVerseLocationEdit)
def onOpenSongBrowseButtonClicked(self):
"""
@ -242,15 +265,15 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
"""
self.getFileName(
translate('BiblesPlugin.ImportWizardForm', 'Open OpenSong Bible'),
self.OpenSongFileEdit)
self.openSongFileEdit)
def onCancelButtonClicked(self, checked):
def onOpenlp1FileButtonClicked(self):
"""
Stop the import on pressing the cancel button.
Show the file open dialog for the openlp.org 1.x file.
"""
log.debug('Cancel button pressed!')
if self.currentId() == 3:
Receiver.send_message(u'bibles_stop_import')
self.getFileName(
translate('BiblesPlugin.ImportWizardForm',
'Open openlp.org 1.x Bible'), self.openlp1LocationEdit)
def onCurrentIdChanged(self, pageId):
if pageId == 3:
@ -259,32 +282,25 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
self.postImport()
def registerFields(self):
self.SelectPage.registerField(
u'source_format', self.FormatComboBox)
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_permissions', self.PermissionsEdit)
self.selectPage.registerField(u'source_format', self.formatComboBox)
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.selectPage.registerField(
u'openlp1_location', self.openlp1LocationEdit)
self.licenseDetailsPage.registerField(
u'license_version', self.versionNameEdit)
self.licenseDetailsPage.registerField(
u'license_copyright', self.copyrightEdit)
self.licenseDetailsPage.registerField(
u'license_permissions', self.permissionsEdit)
def setDefaults(self):
settings = QtCore.QSettings()
@ -299,19 +315,20 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
self.setField(u'opensong_file', QtCore.QVariant(''))
self.setField(u'web_location', QtCore.QVariant(WebDownload.Crosswalk))
self.setField(u'web_biblename',
QtCore.QVariant(self.BibleComboBox.currentIndex()))
QtCore.QVariant(self.bibleComboBox.currentIndex()))
self.setField(u'proxy_server',
settings.value(u'proxy address', QtCore.QVariant(u'')))
self.setField(u'proxy_username',
settings.value(u'proxy username', QtCore.QVariant(u'')))
self.setField(u'proxy_password',
settings.value(u'proxy password', QtCore.QVariant(u'')))
self.setField(u'openlp1_location', QtCore.QVariant(''))
self.setField(u'license_version',
QtCore.QVariant(self.VersionNameEdit.text()))
QtCore.QVariant(self.versionNameEdit.text()))
self.setField(u'license_copyright',
QtCore.QVariant(self.CopyrightEdit.text()))
QtCore.QVariant(self.copyrightEdit.text()))
self.setField(u'license_permissions',
QtCore.QVariant(self.PermissionsEdit.text()))
QtCore.QVariant(self.permissionsEdit.text()))
self.onLocationComboBoxChanged(WebDownload.Crosswalk)
settings.endGroup()
@ -376,26 +393,32 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
def incrementProgressBar(self, status_text):
log.debug(u'IncrementBar %s', status_text)
self.ImportProgressLabel.setText(status_text)
self.ImportProgressBar.setValue(self.ImportProgressBar.value() + 1)
self.importProgressLabel.setText(status_text)
self.importProgressBar.setValue(self.importProgressBar.value() + 1)
Receiver.send_message(u'openlp_process_events')
def preImport(self):
"""
Prepare the UI for the import.
"""
bible_type = self.field(u'source_format').toInt()[0]
self.finishButton.setVisible(False)
self.ImportProgressBar.setMinimum(0)
self.ImportProgressBar.setMaximum(1188)
self.ImportProgressBar.setValue(0)
self.importProgressBar.setMinimum(0)
self.importProgressBar.setMaximum(1188)
self.importProgressBar.setValue(0)
if bible_type == BibleFormat.WebDownload:
self.ImportProgressLabel.setText(translate(
self.importProgressLabel.setText(translate(
'BiblesPlugin.ImportWizardForm',
'Starting Registering bible...'))
else:
self.ImportProgressLabel.setText(translate(
self.importProgressLabel.setText(translate(
'BiblesPlugin.ImportWizardForm', 'Starting import...'))
Receiver.send_message(u'openlp_process_events')
def performImport(self):
"""
Perform the actual import.
"""
bible_type = self.field(u'source_format').toInt()[0]
license_version = unicode(self.field(u'license_version').toString())
license_copyright = unicode(self.field(u'license_copyright').toString())
@ -423,9 +446,9 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
)
elif bible_type == BibleFormat.WebDownload:
# Import a bible from the web.
self.ImportProgressBar.setMaximum(1)
self.importProgressBar.setMaximum(1)
download_location = self.field(u'web_location').toInt()[0]
bible_version = unicode(self.BibleComboBox.currentText())
bible_version = unicode(self.bibleComboBox.currentText())
if download_location == WebDownload.Crosswalk:
bible = \
self.web_bible_list[WebDownload.Crosswalk][bible_version]
@ -442,26 +465,31 @@ class BibleImportForm(QtGui.QWizard, Ui_BibleImportWizard):
unicode(self.field(u'proxy_username').toString()),
proxy_password=unicode(self.field(u'proxy_password').toString())
)
elif bible_type == BibleFormat.OpenLP1:
# Import an openlp.org 1.x bible.
importer = self.manager.import_bible(BibleFormat.OpenLP1,
name=license_version,
filename=unicode(self.field(u'openlp1_location').toString())
)
if importer.do_import():
self.manager.save_meta_data(license_version, license_version,
license_copyright, license_permissions)
self.manager.reload_bibles()
if bible_type == BibleFormat.WebDownload:
self.ImportProgressLabel.setText(
self.importProgressLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Registered '
'bible. Please note, that verses will be downloaded on\n'
'demand and thus an internet connection is required.'))
else:
self.ImportProgressLabel.setText(translate(
self.importProgressLabel.setText(translate(
'BiblesPlugin.ImportWizardForm', 'Finished import.'))
else:
self.ImportProgressLabel.setText(
translate('BiblesPlugin.ImportWizardForm',
'Your Bible import failed.'))
self.importProgressLabel.setText(translate(
'BiblesPlugin.ImportWizardForm', 'Your Bible import failed.'))
delete_database(self.bibleplugin.settingsSection, importer.file)
def postImport(self):
self.ImportProgressBar.setValue(self.ImportProgressBar.maximum())
self.importProgressBar.setValue(self.importProgressBar.maximum())
self.finishButton.setVisible(True)
self.cancelButton.setVisible(False)
Receiver.send_message(u'openlp_process_events')

View File

@ -29,356 +29,391 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate
class Ui_BibleImportWizard(object):
def setupUi(self, BibleImportWizard):
BibleImportWizard.setObjectName(u'BibleImportWizard')
BibleImportWizard.resize(550, 386)
BibleImportWizard.setModal(True)
BibleImportWizard.setWizardStyle(QtGui.QWizard.ModernStyle)
BibleImportWizard.setOptions(
def setupUi(self, bibleImportWizard):
bibleImportWizard.setObjectName(u'bibleImportWizard')
bibleImportWizard.resize(550, 386)
bibleImportWizard.setModal(True)
bibleImportWizard.setWizardStyle(QtGui.QWizard.ModernStyle)
bibleImportWizard.setOptions(
QtGui.QWizard.IndependentPages |
QtGui.QWizard.NoBackButtonOnStartPage |
QtGui.QWizard.NoBackButtonOnLastPage)
self.WelcomePage = QtGui.QWizardPage()
self.WelcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap,
# Welcome page
self.welcomePage = QtGui.QWizardPage()
self.welcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap,
QtGui.QPixmap(u':/wizards/wizard_importbible.bmp'))
self.WelcomePage.setObjectName(u'WelcomePage')
self.WelcomeLayout = QtGui.QVBoxLayout(self.WelcomePage)
self.WelcomeLayout.setSpacing(8)
self.WelcomeLayout.setMargin(0)
self.WelcomeLayout.setObjectName(u'WelcomeLayout')
self.TitleLabel = QtGui.QLabel(self.WelcomePage)
self.TitleLabel.setObjectName(u'TitleLabel')
self.WelcomeLayout.addWidget(self.TitleLabel)
self.welcomePage.setObjectName(u'WelcomePage')
self.welcomeLayout = QtGui.QVBoxLayout(self.welcomePage)
self.welcomeLayout.setSpacing(8)
self.welcomeLayout.setMargin(0)
self.welcomeLayout.setObjectName(u'WelcomeLayout')
self.titleLabel = QtGui.QLabel(self.welcomePage)
self.titleLabel.setObjectName(u'TitleLabel')
self.welcomeLayout.addWidget(self.titleLabel)
spacerItem = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
self.WelcomeLayout.addItem(spacerItem)
self.InformationLabel = QtGui.QLabel(self.WelcomePage)
self.InformationLabel.setWordWrap(True)
self.InformationLabel.setMargin(10)
self.InformationLabel.setObjectName(u'InformationLabel')
self.WelcomeLayout.addWidget(self.InformationLabel)
self.welcomeLayout.addItem(spacerItem)
self.informationLabel = QtGui.QLabel(self.welcomePage)
self.informationLabel.setWordWrap(True)
self.informationLabel.setMargin(10)
self.informationLabel.setObjectName(u'InformationLabel')
self.welcomeLayout.addWidget(self.informationLabel)
spacerItem1 = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.WelcomeLayout.addItem(spacerItem1)
BibleImportWizard.addPage(self.WelcomePage)
self.SelectPage = QtGui.QWizardPage()
self.SelectPage.setObjectName(u'SelectPage')
self.selectPageLayout = QtGui.QVBoxLayout(self.SelectPage)
self.welcomeLayout.addItem(spacerItem1)
bibleImportWizard.addPage(self.welcomePage)
# Select page
self.selectPage = QtGui.QWizardPage()
self.selectPage.setObjectName(u'SelectPage')
self.selectPageLayout = QtGui.QVBoxLayout(self.selectPage)
self.selectPageLayout.setSpacing(8)
self.selectPageLayout.setMargin(20)
self.selectPageLayout.setObjectName(u'selectPageLayout')
self.FormatSelectLayout = QtGui.QHBoxLayout()
self.FormatSelectLayout.setSpacing(8)
self.FormatSelectLayout.setObjectName(u'FormatSelectLayout')
self.FormatLabel = QtGui.QLabel(self.SelectPage)
self.FormatLabel.setObjectName(u'FormatLabel')
self.FormatSelectLayout.addWidget(self.FormatLabel)
self.FormatComboBox = QtGui.QComboBox(self.SelectPage)
self.FormatComboBox.setObjectName(u'FormatComboBox')
self.FormatComboBox.addItem(u'')
self.FormatComboBox.addItem(u'')
self.FormatComboBox.addItem(u'')
self.FormatComboBox.addItem(u'')
self.FormatSelectLayout.addWidget(self.FormatComboBox)
self.formatSelectLayout = QtGui.QHBoxLayout()
self.formatSelectLayout.setSpacing(8)
self.formatSelectLayout.setObjectName(u'FormatSelectLayout')
self.formatLabel = QtGui.QLabel(self.selectPage)
self.formatLabel.setObjectName(u'FormatLabel')
self.formatSelectLayout.addWidget(self.formatLabel)
self.formatComboBox = QtGui.QComboBox(self.selectPage)
self.formatComboBox.setObjectName(u'FormatComboBox')
self.formatComboBox.addItem(u'')
self.formatComboBox.addItem(u'')
self.formatComboBox.addItem(u'')
self.formatComboBox.addItem(u'')
self.formatComboBox.addItem(u'')
self.formatSelectLayout.addWidget(self.formatComboBox)
spacerItem2 = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.FormatSelectLayout.addItem(spacerItem2)
self.selectPageLayout.addLayout(self.FormatSelectLayout)
self.FormatWidget = QtGui.QStackedWidget(self.SelectPage)
self.FormatWidget.setObjectName(u'FormatWidget')
self.OsisPage = QtGui.QWidget()
self.OsisPage.setObjectName(u'OsisPage')
self.OsisLayout = QtGui.QFormLayout(self.OsisPage)
self.OsisLayout.setFieldGrowthPolicy(
QtGui.QFormLayout.ExpandingFieldsGrow)
self.OsisLayout.setMargin(0)
self.OsisLayout.setSpacing(8)
self.OsisLayout.setObjectName(u'OsisLayout')
self.OsisLocationLabel = QtGui.QLabel(self.OsisPage)
self.OsisLocationLabel.setObjectName(u'OsisLocationLabel')
self.OsisLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
self.OsisLocationLabel)
self.OsisLocationLayout = QtGui.QHBoxLayout()
self.OsisLocationLayout.setSpacing(8)
self.OsisLocationLayout.setObjectName(u'OsisLocationLayout')
self.OSISLocationEdit = QtGui.QLineEdit(self.OsisPage)
self.OSISLocationEdit.setObjectName(u'OSISLocationEdit')
self.OsisLocationLayout.addWidget(self.OSISLocationEdit)
self.OsisFileButton = QtGui.QToolButton(self.OsisPage)
self.OsisFileButton.setMaximumSize(QtCore.QSize(32, 16777215))
self.formatSelectLayout.addItem(spacerItem2)
self.selectPageLayout.addLayout(self.formatSelectLayout)
self.formatWidget = QtGui.QStackedWidget(self.selectPage)
self.formatWidget.setObjectName(u'FormatWidget')
generalIcon = build_icon(u':/general/general_open.png')
self.OsisFileButton.setIcon(generalIcon)
self.OsisFileButton.setObjectName(u'OsisFileButton')
self.OsisLocationLayout.addWidget(self.OsisFileButton)
self.OsisLayout.setLayout(1, QtGui.QFormLayout.FieldRole,
self.OsisLocationLayout)
self.FormatWidget.addWidget(self.OsisPage)
self.CsvPage = QtGui.QWidget()
self.CsvPage.setObjectName(u'CsvPage')
self.CsvSourceLayout = QtGui.QFormLayout(self.CsvPage)
self.CsvSourceLayout.setFieldGrowthPolicy(
self.osisPage = QtGui.QWidget()
self.osisPage.setObjectName(u'OsisPage')
self.osisLayout = QtGui.QFormLayout(self.osisPage)
self.osisLayout.setFieldGrowthPolicy(
QtGui.QFormLayout.ExpandingFieldsGrow)
self.CsvSourceLayout.setLabelAlignment(QtCore.Qt.AlignBottom |
self.osisLayout.setMargin(0)
self.osisLayout.setSpacing(8)
self.osisLayout.setObjectName(u'OsisLayout')
self.osisLocationLabel = QtGui.QLabel(self.osisPage)
self.osisLocationLabel.setObjectName(u'OsisLocationLabel')
self.osisLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
self.osisLocationLabel)
self.osisLocationLayout = QtGui.QHBoxLayout()
self.osisLocationLayout.setSpacing(8)
self.osisLocationLayout.setObjectName(u'OsisLocationLayout')
self.OSISLocationEdit = QtGui.QLineEdit(self.osisPage)
self.OSISLocationEdit.setObjectName(u'OSISLocationEdit')
self.osisLocationLayout.addWidget(self.OSISLocationEdit)
self.osisFileButton = QtGui.QToolButton(self.osisPage)
self.osisFileButton.setMaximumSize(QtCore.QSize(32, 16777215))
self.osisFileButton.setIcon(generalIcon)
self.osisFileButton.setObjectName(u'OsisFileButton')
self.osisLocationLayout.addWidget(self.osisFileButton)
self.osisLayout.setLayout(1, QtGui.QFormLayout.FieldRole,
self.osisLocationLayout)
self.formatWidget.addWidget(self.osisPage)
self.csvPage = QtGui.QWidget()
self.csvPage.setObjectName(u'CsvPage')
self.csvSourceLayout = QtGui.QFormLayout(self.csvPage)
self.csvSourceLayout.setFieldGrowthPolicy(
QtGui.QFormLayout.ExpandingFieldsGrow)
self.csvSourceLayout.setLabelAlignment(QtCore.Qt.AlignBottom |
QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing)
self.CsvSourceLayout.setFormAlignment(QtCore.Qt.AlignLeading |
self.csvSourceLayout.setFormAlignment(QtCore.Qt.AlignLeading |
QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
self.CsvSourceLayout.setMargin(0)
self.CsvSourceLayout.setSpacing(8)
self.CsvSourceLayout.setObjectName(u'CsvSourceLayout')
self.BooksLocationLabel = QtGui.QLabel(self.CsvPage)
self.BooksLocationLabel.setObjectName(u'BooksLocationLabel')
self.CsvSourceLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
self.BooksLocationLabel)
self.CsvBooksLayout = QtGui.QHBoxLayout()
self.CsvBooksLayout.setSpacing(8)
self.CsvBooksLayout.setObjectName(u'CsvBooksLayout')
self.BooksLocationEdit = QtGui.QLineEdit(self.CsvPage)
self.BooksLocationEdit.setObjectName(u'BooksLocationEdit')
self.CsvBooksLayout.addWidget(self.BooksLocationEdit)
self.BooksFileButton = QtGui.QToolButton(self.CsvPage)
self.BooksFileButton.setMaximumSize(QtCore.QSize(32, 16777215))
self.BooksFileButton.setIcon(generalIcon)
self.BooksFileButton.setObjectName(u'BooksFileButton')
self.CsvBooksLayout.addWidget(self.BooksFileButton)
self.CsvSourceLayout.setLayout(0, QtGui.QFormLayout.FieldRole,
self.CsvBooksLayout)
self.VerseLocationLabel = QtGui.QLabel(self.CsvPage)
self.VerseLocationLabel.setObjectName(u'VerseLocationLabel')
self.CsvSourceLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
self.VerseLocationLabel)
self.CsvVerseLayout = QtGui.QHBoxLayout()
self.CsvVerseLayout.setSpacing(8)
self.CsvVerseLayout.setObjectName(u'CsvVerseLayout')
self.CsvVerseLocationEdit = QtGui.QLineEdit(self.CsvPage)
self.CsvVerseLocationEdit.setObjectName(u'CsvVerseLocationEdit')
self.CsvVerseLayout.addWidget(self.CsvVerseLocationEdit)
self.CsvVersesFileButton = QtGui.QToolButton(self.CsvPage)
self.CsvVersesFileButton.setMaximumSize(QtCore.QSize(32, 16777215))
self.CsvVersesFileButton.setIcon(generalIcon)
self.CsvVersesFileButton.setObjectName(u'CsvVersesFileButton')
self.CsvVerseLayout.addWidget(self.CsvVersesFileButton)
self.CsvSourceLayout.setLayout(1, QtGui.QFormLayout.FieldRole,
self.CsvVerseLayout)
self.FormatWidget.addWidget(self.CsvPage)
self.OpenSongPage = QtGui.QWidget()
self.OpenSongPage.setObjectName(u'OpenSongPage')
self.OpenSongLayout = QtGui.QFormLayout(self.OpenSongPage)
self.OpenSongLayout.setMargin(0)
self.OpenSongLayout.setSpacing(8)
self.OpenSongLayout.setObjectName(u'OpenSongLayout')
self.OpenSongFileLabel = QtGui.QLabel(self.OpenSongPage)
self.OpenSongFileLabel.setObjectName(u'OpenSongFileLabel')
self.OpenSongLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
self.OpenSongFileLabel)
self.OpenSongFileLayout = QtGui.QHBoxLayout()
self.OpenSongFileLayout.setSpacing(8)
self.OpenSongFileLayout.setObjectName(u'OpenSongFileLayout')
self.OpenSongFileEdit = QtGui.QLineEdit(self.OpenSongPage)
self.OpenSongFileEdit.setObjectName(u'OpenSongFileEdit')
self.OpenSongFileLayout.addWidget(self.OpenSongFileEdit)
self.OpenSongBrowseButton = QtGui.QToolButton(self.OpenSongPage)
self.OpenSongBrowseButton.setIcon(generalIcon)
self.OpenSongBrowseButton.setObjectName(u'OpenSongBrowseButton')
self.OpenSongFileLayout.addWidget(self.OpenSongBrowseButton)
self.OpenSongLayout.setLayout(0, QtGui.QFormLayout.FieldRole,
self.OpenSongFileLayout)
self.FormatWidget.addWidget(self.OpenSongPage)
self.WebDownloadPage = QtGui.QWidget()
self.WebDownloadPage.setObjectName(u'WebDownloadPage')
self.WebDownloadLayout = QtGui.QVBoxLayout(self.WebDownloadPage)
self.WebDownloadLayout.setSpacing(8)
self.WebDownloadLayout.setMargin(0)
self.WebDownloadLayout.setObjectName(u'WebDownloadLayout')
self.WebDownloadTabWidget = QtGui.QTabWidget(self.WebDownloadPage)
self.WebDownloadTabWidget.setObjectName(u'WebDownloadTabWidget')
self.DownloadOptionsTab = QtGui.QWidget()
self.DownloadOptionsTab.setObjectName(u'DownloadOptionsTab')
self.DownloadOptionsLayout = QtGui.QFormLayout(self.DownloadOptionsTab)
self.DownloadOptionsLayout.setMargin(8)
self.DownloadOptionsLayout.setSpacing(8)
self.DownloadOptionsLayout.setObjectName(u'DownloadOptionsLayout')
self.LocationLabel = QtGui.QLabel(self.DownloadOptionsTab)
self.LocationLabel.setObjectName(u'LocationLabel')
self.DownloadOptionsLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
self.LocationLabel)
self.LocationComboBox = QtGui.QComboBox(self.DownloadOptionsTab)
self.LocationComboBox.setObjectName(u'LocationComboBox')
self.LocationComboBox.addItem(u'')
self.LocationComboBox.addItem(u'')
self.DownloadOptionsLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
self.LocationComboBox)
self.BibleLabel = QtGui.QLabel(self.DownloadOptionsTab)
self.BibleLabel.setObjectName(u'BibleLabel')
self.DownloadOptionsLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
self.BibleLabel)
self.BibleComboBox = QtGui.QComboBox(self.DownloadOptionsTab)
self.BibleComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
self.BibleComboBox.setObjectName(u'BibleComboBox')
self.BibleComboBox.addItem(u'')
self.BibleComboBox.addItem(u'')
self.BibleComboBox.addItem(u'')
self.DownloadOptionsLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
self.BibleComboBox)
self.WebDownloadTabWidget.addTab(self.DownloadOptionsTab, u'')
self.ProxyServerTab = QtGui.QWidget()
self.ProxyServerTab.setObjectName(u'ProxyServerTab')
self.ProxyServerLayout = QtGui.QFormLayout(self.ProxyServerTab)
self.ProxyServerLayout.setObjectName(u'ProxyServerLayout')
self.AddressLabel = QtGui.QLabel(self.ProxyServerTab)
self.AddressLabel.setObjectName(u'AddressLabel')
self.ProxyServerLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
self.AddressLabel)
self.AddressEdit = QtGui.QLineEdit(self.ProxyServerTab)
self.AddressEdit.setObjectName(u'AddressEdit')
self.ProxyServerLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
self.AddressEdit)
self.UsernameLabel = QtGui.QLabel(self.ProxyServerTab)
self.UsernameLabel.setObjectName(u'UsernameLabel')
self.ProxyServerLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
self.UsernameLabel)
self.UsernameEdit = QtGui.QLineEdit(self.ProxyServerTab)
self.UsernameEdit.setObjectName(u'UsernameEdit')
self.ProxyServerLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
self.UsernameEdit)
self.PasswordLabel = QtGui.QLabel(self.ProxyServerTab)
self.PasswordLabel.setObjectName(u'PasswordLabel')
self.ProxyServerLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
self.PasswordLabel)
self.PasswordEdit = QtGui.QLineEdit(self.ProxyServerTab)
self.PasswordEdit.setObjectName(u'PasswordEdit')
self.ProxyServerLayout.setWidget(2, QtGui.QFormLayout.FieldRole,
self.PasswordEdit)
self.WebDownloadTabWidget.addTab(self.ProxyServerTab, u'')
self.WebDownloadLayout.addWidget(self.WebDownloadTabWidget)
self.FormatWidget.addWidget(self.WebDownloadPage)
self.selectPageLayout.addWidget(self.FormatWidget)
BibleImportWizard.addPage(self.SelectPage)
self.LicenseDetailsPage = QtGui.QWizardPage()
self.LicenseDetailsPage.setObjectName(u'LicenseDetailsPage')
self.LicenseDetailsLayout = QtGui.QFormLayout(self.LicenseDetailsPage)
self.LicenseDetailsLayout.setMargin(20)
self.LicenseDetailsLayout.setSpacing(8)
self.LicenseDetailsLayout.setObjectName(u'LicenseDetailsLayout')
self.VersionNameLabel = QtGui.QLabel(self.LicenseDetailsPage)
self.VersionNameLabel.setObjectName(u'VersionNameLabel')
self.LicenseDetailsLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
self.VersionNameLabel)
self.VersionNameEdit = QtGui.QLineEdit(self.LicenseDetailsPage)
self.VersionNameEdit.setObjectName(u'VersionNameEdit')
self.LicenseDetailsLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
self.VersionNameEdit)
self.CopyrightLabel = QtGui.QLabel(self.LicenseDetailsPage)
self.CopyrightLabel.setObjectName(u'CopyrightLabel')
self.LicenseDetailsLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
self.CopyrightLabel)
self.CopyrightEdit = QtGui.QLineEdit(self.LicenseDetailsPage)
self.CopyrightEdit.setObjectName(u'CopyrightEdit')
self.LicenseDetailsLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
self.CopyrightEdit)
self.PermissionsLabel = QtGui.QLabel(self.LicenseDetailsPage)
self.PermissionsLabel.setObjectName(u'PermissionsLabel')
self.LicenseDetailsLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
self.PermissionsLabel)
self.PermissionsEdit = QtGui.QLineEdit(self.LicenseDetailsPage)
self.PermissionsEdit.setObjectName(u'PermissionsEdit')
self.LicenseDetailsLayout.setWidget(2, QtGui.QFormLayout.FieldRole,
self.PermissionsEdit)
BibleImportWizard.addPage(self.LicenseDetailsPage)
self.ImportPage = QtGui.QWizardPage()
self.ImportPage.setObjectName(u'ImportPage')
self.ImportLayout = QtGui.QVBoxLayout(self.ImportPage)
self.ImportLayout.setSpacing(8)
self.ImportLayout.setMargin(50)
self.ImportLayout.setObjectName(u'ImportLayout')
self.ImportProgressLabel = QtGui.QLabel(self.ImportPage)
self.ImportProgressLabel.setObjectName(u'ImportProgressLabel')
self.ImportLayout.addWidget(self.ImportProgressLabel)
self.ImportProgressBar = QtGui.QProgressBar(self.ImportPage)
self.ImportProgressBar.setValue(0)
self.ImportProgressBar.setObjectName(u'ImportProgressBar')
self.ImportLayout.addWidget(self.ImportProgressBar)
BibleImportWizard.addPage(self.ImportPage)
self.csvSourceLayout.setMargin(0)
self.csvSourceLayout.setSpacing(8)
self.csvSourceLayout.setObjectName(u'CsvSourceLayout')
self.booksLocationLabel = QtGui.QLabel(self.csvPage)
self.booksLocationLabel.setObjectName(u'BooksLocationLabel')
self.csvSourceLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
self.booksLocationLabel)
self.csvBooksLayout = QtGui.QHBoxLayout()
self.csvBooksLayout.setSpacing(8)
self.csvBooksLayout.setObjectName(u'CsvBooksLayout')
self.booksLocationEdit = QtGui.QLineEdit(self.csvPage)
self.booksLocationEdit.setObjectName(u'BooksLocationEdit')
self.csvBooksLayout.addWidget(self.booksLocationEdit)
self.booksFileButton = QtGui.QToolButton(self.csvPage)
self.booksFileButton.setMaximumSize(QtCore.QSize(32, 16777215))
self.booksFileButton.setIcon(generalIcon)
self.booksFileButton.setObjectName(u'BooksFileButton')
self.csvBooksLayout.addWidget(self.booksFileButton)
self.csvSourceLayout.setLayout(0, QtGui.QFormLayout.FieldRole,
self.csvBooksLayout)
self.verseLocationLabel = QtGui.QLabel(self.csvPage)
self.verseLocationLabel.setObjectName(u'VerseLocationLabel')
self.csvSourceLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
self.verseLocationLabel)
self.csvVerseLayout = QtGui.QHBoxLayout()
self.csvVerseLayout.setSpacing(8)
self.csvVerseLayout.setObjectName(u'CsvVerseLayout')
self.csvVerseLocationEdit = QtGui.QLineEdit(self.csvPage)
self.csvVerseLocationEdit.setObjectName(u'CsvVerseLocationEdit')
self.csvVerseLayout.addWidget(self.csvVerseLocationEdit)
self.csvVersesFileButton = QtGui.QToolButton(self.csvPage)
self.csvVersesFileButton.setMaximumSize(QtCore.QSize(32, 16777215))
self.csvVersesFileButton.setIcon(generalIcon)
self.csvVersesFileButton.setObjectName(u'CsvVersesFileButton')
self.csvVerseLayout.addWidget(self.csvVersesFileButton)
self.csvSourceLayout.setLayout(1, QtGui.QFormLayout.FieldRole,
self.csvVerseLayout)
self.formatWidget.addWidget(self.csvPage)
self.openSongPage = QtGui.QWidget()
self.openSongPage.setObjectName(u'OpenSongPage')
self.openSongLayout = QtGui.QFormLayout(self.openSongPage)
self.openSongLayout.setMargin(0)
self.openSongLayout.setSpacing(8)
self.openSongLayout.setObjectName(u'OpenSongLayout')
self.openSongFileLabel = QtGui.QLabel(self.openSongPage)
self.openSongFileLabel.setObjectName(u'OpenSongFileLabel')
self.openSongLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
self.openSongFileLabel)
self.openSongFileLayout = QtGui.QHBoxLayout()
self.openSongFileLayout.setSpacing(8)
self.openSongFileLayout.setObjectName(u'OpenSongFileLayout')
self.openSongFileEdit = QtGui.QLineEdit(self.openSongPage)
self.openSongFileEdit.setObjectName(u'OpenSongFileEdit')
self.openSongFileLayout.addWidget(self.openSongFileEdit)
self.openSongBrowseButton = QtGui.QToolButton(self.openSongPage)
self.openSongBrowseButton.setIcon(generalIcon)
self.openSongBrowseButton.setObjectName(u'OpenSongBrowseButton')
self.openSongFileLayout.addWidget(self.openSongBrowseButton)
self.openSongLayout.setLayout(0, QtGui.QFormLayout.FieldRole,
self.openSongFileLayout)
self.formatWidget.addWidget(self.openSongPage)
self.webDownloadPage = QtGui.QWidget()
self.webDownloadPage.setObjectName(u'WebDownloadPage')
self.webDownloadLayout = QtGui.QVBoxLayout(self.webDownloadPage)
self.webDownloadLayout.setSpacing(8)
self.webDownloadLayout.setMargin(0)
self.webDownloadLayout.setObjectName(u'WebDownloadLayout')
self.webDownloadTabWidget = QtGui.QTabWidget(self.webDownloadPage)
self.webDownloadTabWidget.setObjectName(u'WebDownloadTabWidget')
self.downloadOptionsTab = QtGui.QWidget()
self.downloadOptionsTab.setObjectName(u'DownloadOptionsTab')
self.downloadOptionsLayout = QtGui.QFormLayout(self.downloadOptionsTab)
self.downloadOptionsLayout.setMargin(8)
self.downloadOptionsLayout.setSpacing(8)
self.downloadOptionsLayout.setObjectName(u'DownloadOptionsLayout')
self.locationLabel = QtGui.QLabel(self.downloadOptionsTab)
self.locationLabel.setObjectName(u'LocationLabel')
self.downloadOptionsLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
self.locationLabel)
self.locationComboBox = QtGui.QComboBox(self.downloadOptionsTab)
self.locationComboBox.setObjectName(u'LocationComboBox')
self.locationComboBox.addItem(u'')
self.locationComboBox.addItem(u'')
self.downloadOptionsLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
self.locationComboBox)
self.bibleLabel = QtGui.QLabel(self.downloadOptionsTab)
self.bibleLabel.setObjectName(u'BibleLabel')
self.downloadOptionsLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
self.bibleLabel)
self.bibleComboBox = QtGui.QComboBox(self.downloadOptionsTab)
self.bibleComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
self.bibleComboBox.setObjectName(u'BibleComboBox')
self.bibleComboBox.addItem(u'')
self.bibleComboBox.addItem(u'')
self.bibleComboBox.addItem(u'')
self.downloadOptionsLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
self.bibleComboBox)
self.webDownloadTabWidget.addTab(self.downloadOptionsTab, u'')
self.proxyServerTab = QtGui.QWidget()
self.proxyServerTab.setObjectName(u'ProxyServerTab')
self.proxyServerLayout = QtGui.QFormLayout(self.proxyServerTab)
self.proxyServerLayout.setObjectName(u'ProxyServerLayout')
self.addressLabel = QtGui.QLabel(self.proxyServerTab)
self.addressLabel.setObjectName(u'AddressLabel')
self.proxyServerLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
self.addressLabel)
self.addressEdit = QtGui.QLineEdit(self.proxyServerTab)
self.addressEdit.setObjectName(u'AddressEdit')
self.proxyServerLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
self.addressEdit)
self.usernameLabel = QtGui.QLabel(self.proxyServerTab)
self.usernameLabel.setObjectName(u'UsernameLabel')
self.proxyServerLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
self.usernameLabel)
self.usernameEdit = QtGui.QLineEdit(self.proxyServerTab)
self.usernameEdit.setObjectName(u'UsernameEdit')
self.proxyServerLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
self.usernameEdit)
self.passwordLabel = QtGui.QLabel(self.proxyServerTab)
self.passwordLabel.setObjectName(u'PasswordLabel')
self.proxyServerLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
self.passwordLabel)
self.passwordEdit = QtGui.QLineEdit(self.proxyServerTab)
self.passwordEdit.setObjectName(u'PasswordEdit')
self.proxyServerLayout.setWidget(2, QtGui.QFormLayout.FieldRole,
self.passwordEdit)
self.webDownloadTabWidget.addTab(self.proxyServerTab, u'')
self.webDownloadLayout.addWidget(self.webDownloadTabWidget)
self.formatWidget.addWidget(self.webDownloadPage)
self.openlp1Page = QtGui.QWidget()
self.openlp1Page.setObjectName(u'Openlp1Page')
self.openlp1Layout = QtGui.QFormLayout(self.openlp1Page)
self.openlp1Layout.setFieldGrowthPolicy(
QtGui.QFormLayout.ExpandingFieldsGrow)
self.openlp1Layout.setMargin(0)
self.openlp1Layout.setSpacing(8)
self.openlp1Layout.setObjectName(u'Openlp1Layout')
self.openlp1LocationLabel = QtGui.QLabel(self.openlp1Page)
self.openlp1LocationLabel.setObjectName(u'Openlp1LocationLabel')
self.openlp1Layout.setWidget(1, QtGui.QFormLayout.LabelRole,
self.openlp1LocationLabel)
self.openlp1LocationLayout = QtGui.QHBoxLayout()
self.openlp1LocationLayout.setSpacing(8)
self.openlp1LocationLayout.setObjectName(u'Openlp1LocationLayout')
self.openlp1LocationEdit = QtGui.QLineEdit(self.openlp1Page)
self.openlp1LocationEdit.setObjectName(u'Openlp1LocationEdit')
self.openlp1LocationLayout.addWidget(self.openlp1LocationEdit)
self.openlp1FileButton = QtGui.QToolButton(self.openlp1Page)
self.openlp1FileButton.setMaximumSize(QtCore.QSize(32, 16777215))
self.openlp1FileButton.setIcon(generalIcon)
self.openlp1FileButton.setObjectName(u'Openlp1FileButton')
self.openlp1LocationLayout.addWidget(self.openlp1FileButton)
self.openlp1Layout.setLayout(1, QtGui.QFormLayout.FieldRole,
self.openlp1LocationLayout)
self.formatWidget.addWidget(self.openlp1Page)
self.selectPageLayout.addWidget(self.formatWidget)
bibleImportWizard.addPage(self.selectPage)
# License page
self.licenseDetailsPage = QtGui.QWizardPage()
self.licenseDetailsPage.setObjectName(u'LicenseDetailsPage')
self.licenseDetailsLayout = QtGui.QFormLayout(self.licenseDetailsPage)
self.licenseDetailsLayout.setMargin(20)
self.licenseDetailsLayout.setSpacing(8)
self.licenseDetailsLayout.setObjectName(u'LicenseDetailsLayout')
self.versionNameLabel = QtGui.QLabel(self.licenseDetailsPage)
self.versionNameLabel.setObjectName(u'VersionNameLabel')
self.licenseDetailsLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
self.versionNameLabel)
self.versionNameEdit = QtGui.QLineEdit(self.licenseDetailsPage)
self.versionNameEdit.setObjectName(u'VersionNameEdit')
self.licenseDetailsLayout.setWidget(0, QtGui.QFormLayout.FieldRole,
self.versionNameEdit)
self.copyrightLabel = QtGui.QLabel(self.licenseDetailsPage)
self.copyrightLabel.setObjectName(u'CopyrightLabel')
self.licenseDetailsLayout.setWidget(1, QtGui.QFormLayout.LabelRole,
self.copyrightLabel)
self.copyrightEdit = QtGui.QLineEdit(self.licenseDetailsPage)
self.copyrightEdit.setObjectName(u'CopyrightEdit')
self.licenseDetailsLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
self.copyrightEdit)
self.permissionsLabel = QtGui.QLabel(self.licenseDetailsPage)
self.permissionsLabel.setObjectName(u'PermissionsLabel')
self.licenseDetailsLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
self.permissionsLabel)
self.permissionsEdit = QtGui.QLineEdit(self.licenseDetailsPage)
self.permissionsEdit.setObjectName(u'PermissionsEdit')
self.licenseDetailsLayout.setWidget(2, QtGui.QFormLayout.FieldRole,
self.permissionsEdit)
bibleImportWizard.addPage(self.licenseDetailsPage)
# Progress page
self.importPage = QtGui.QWizardPage()
self.importPage.setObjectName(u'ImportPage')
self.importLayout = QtGui.QVBoxLayout(self.importPage)
self.importLayout.setSpacing(8)
self.importLayout.setMargin(50)
self.importLayout.setObjectName(u'ImportLayout')
self.importProgressLabel = QtGui.QLabel(self.importPage)
self.importProgressLabel.setObjectName(u'ImportProgressLabel')
self.importLayout.addWidget(self.importProgressLabel)
self.importProgressBar = QtGui.QProgressBar(self.importPage)
self.importProgressBar.setValue(0)
self.importProgressBar.setObjectName(u'ImportProgressBar')
self.importLayout.addWidget(self.importProgressBar)
bibleImportWizard.addPage(self.importPage)
self.retranslateUi(BibleImportWizard)
self.FormatWidget.setCurrentIndex(0)
self.WebDownloadTabWidget.setCurrentIndex(0)
QtCore.QObject.connect(self.FormatComboBox,
self.retranslateUi(bibleImportWizard)
self.formatWidget.setCurrentIndex(0)
self.webDownloadTabWidget.setCurrentIndex(0)
QtCore.QObject.connect(self.formatComboBox,
QtCore.SIGNAL(u'currentIndexChanged(int)'),
self.FormatWidget.setCurrentIndex)
QtCore.QMetaObject.connectSlotsByName(BibleImportWizard)
self.formatWidget.setCurrentIndex)
QtCore.QMetaObject.connectSlotsByName(bibleImportWizard)
def retranslateUi(self, BibleImportWizard):
BibleImportWizard.setWindowTitle(
def retranslateUi(self, bibleImportWizard):
bibleImportWizard.setWindowTitle(
translate('BiblesPlugin.ImportWizardForm', 'Bible Import Wizard'))
self.TitleLabel.setText(
self.titleLabel.setText(
u'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
translate('BiblesPlugin.ImportWizardForm',
'Welcome to the Bible Import Wizard'))
self.InformationLabel.setText(
self.informationLabel.setText(
translate('BiblesPlugin.ImportWizardForm',
'This wizard will help you to import Bibles from a '
'variety of formats. Click the next button below to start the '
'process by selecting a format to import from.'))
self.SelectPage.setTitle(translate('BiblesPlugin.ImportWizardForm',
self.selectPage.setTitle(translate('BiblesPlugin.ImportWizardForm',
'Select Import Source'))
self.SelectPage.setSubTitle(
self.selectPage.setSubTitle(
translate('BiblesPlugin.ImportWizardForm',
'Select the import format, and where to import from.'))
self.FormatLabel.setText(
self.formatLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Format:'))
self.FormatComboBox.setItemText(0,
self.formatComboBox.setItemText(0,
translate('BiblesPlugin.ImportWizardForm', 'OSIS'))
self.FormatComboBox.setItemText(1,
self.formatComboBox.setItemText(1,
translate('BiblesPlugin.ImportWizardForm', 'CSV'))
self.FormatComboBox.setItemText(2,
self.formatComboBox.setItemText(2,
translate('BiblesPlugin.ImportWizardForm', 'OpenSong'))
self.FormatComboBox.setItemText(3,
self.formatComboBox.setItemText(3,
translate('BiblesPlugin.ImportWizardForm', 'Web Download'))
self.OsisLocationLabel.setText(
self.formatComboBox.setItemText(4,
translate('BiblesPlugin.ImportWizardForm', 'openlp.org 1.x'))
self.openlp1LocationLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'File location:'))
self.BooksLocationLabel.setText(
self.osisLocationLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'File location:'))
self.booksLocationLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Books location:'))
self.VerseLocationLabel.setText(
self.verseLocationLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Verse location:'))
self.OpenSongFileLabel.setText(
self.openSongFileLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Bible filename:'))
self.LocationLabel.setText(
self.locationLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Location:'))
self.LocationComboBox.setItemText(0,
self.locationComboBox.setItemText(0,
translate('BiblesPlugin.ImportWizardForm', 'Crosswalk'))
self.LocationComboBox.setItemText(1,
self.locationComboBox.setItemText(1,
translate('BiblesPlugin.ImportWizardForm', 'BibleGateway'))
self.BibleLabel.setText(
self.bibleLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Bible:'))
self.WebDownloadTabWidget.setTabText(
self.WebDownloadTabWidget.indexOf(self.DownloadOptionsTab),
self.webDownloadTabWidget.setTabText(
self.webDownloadTabWidget.indexOf(self.downloadOptionsTab),
translate('BiblesPlugin.ImportWizardForm', 'Download Options'))
self.AddressLabel.setText(
self.addressLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Server:'))
self.UsernameLabel.setText(
self.usernameLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Username:'))
self.PasswordLabel.setText(
self.passwordLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Password:'))
self.WebDownloadTabWidget.setTabText(
self.WebDownloadTabWidget.indexOf(self.ProxyServerTab),
self.webDownloadTabWidget.setTabText(
self.webDownloadTabWidget.indexOf(self.proxyServerTab),
translate('BiblesPlugin.ImportWizardForm',
'Proxy Server (Optional)'))
self.LicenseDetailsPage.setTitle(
self.licenseDetailsPage.setTitle(
translate('BiblesPlugin.ImportWizardForm', 'License Details'))
self.LicenseDetailsPage.setSubTitle(
self.licenseDetailsPage.setSubTitle(
translate('BiblesPlugin.ImportWizardForm',
'Set up the Bible\'s license details.'))
self.VersionNameLabel.setText(
self.versionNameLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Version name:'))
self.CopyrightLabel.setText(
self.copyrightLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Copyright:'))
self.PermissionsLabel.setText(
self.permissionsLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Permissions:'))
self.ImportPage.setTitle(
self.importPage.setTitle(
translate('BiblesPlugin.ImportWizardForm', 'Importing'))
self.ImportPage.setSubTitle(
self.importPage.setSubTitle(
translate('BiblesPlugin.ImportWizardForm',
'Please wait while your Bible is imported.'))
self.ImportProgressLabel.setText(
self.importProgressLabel.setText(
translate('BiblesPlugin.ImportWizardForm', 'Ready.'))
self.ImportProgressBar.setFormat(u'%p%')
self.importProgressBar.setFormat(u'%p%')

View File

@ -30,7 +30,7 @@ import csv
from PyQt4 import QtCore
from openlp.core.lib import Receiver
from openlp.core.lib import Receiver, translate
from db import BibleDB
log = logging.getLogger(__name__)
@ -46,21 +46,19 @@ class CSVBible(BibleDB):
This class assumes the files contain all the information and
a clean bible is being loaded.
"""
BibleDB.__init__(self, parent, **kwargs)
log.info(self.__class__.__name__)
if u'booksfile' not in kwargs:
raise KeyError(u'You have to supply a file to import books from.')
BibleDB.__init__(self, parent, **kwargs)
self.booksfile = kwargs[u'booksfile']
if u'versefile' not in kwargs:
raise KeyError(u'You have to supply a file to import verses from.')
self.versesfile = kwargs[u'versefile']
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'bibles_stop_import'), self.stop_import)
def do_import(self):
#Populate the Tables
success = True
books_file = None
book_ptr = None
verse_file = None
# Populate the Tables
try:
books_file = open(self.booksfile, 'r')
dialect = csv.Sniffer().sniff(books_file.read(1024))
@ -82,9 +80,7 @@ class CSVBible(BibleDB):
books_file.close()
if not success:
return False
verse_file = None
try:
book_ptr = None
verse_file = open(self.versesfile, 'r')
dialect = csv.Sniffer().sniff(verse_file.read(1024))
verse_file.seek(0)
@ -96,8 +92,9 @@ class CSVBible(BibleDB):
if book_ptr != line[0]:
book = self.get_book(line[0])
book_ptr = book.name
self.wizard.incrementProgressBar(
u'Importing %s %s' % (book.name, line[1]))
self.wizard.incrementProgressBar(u'%s %s %s...' % (
translate('BiblesPlugin.CSVImport', 'Importing'),
book.name, line[1]))
self.session.commit()
self.create_verse(book.id, line[1], line[2],
unicode(line[3], details['encoding']))
@ -110,7 +107,6 @@ class CSVBible(BibleDB):
if verse_file:
verse_file.close()
if self.stop_import_flag:
self.wizard.incrementProgressBar(u'Import canceled!')
return False
else:
return success

View File

@ -231,7 +231,7 @@ class BibleDB(QtCore.QObject, Manager):
def create_chapter(self, book_id, chapter, textlist):
"""
Add a chapter and it's verses to a book.
Add a chapter and its verses to a book.
``book_id``
The id of the book being appended.

View File

@ -333,24 +333,17 @@ class HTTPBible(BibleDB):
Init confirms the bible exists and stores the database path.
"""
BibleDB.__init__(self, parent, **kwargs)
if u'download_source' not in kwargs:
raise KeyError(u'Missing keyword argument "download_source"')
if u'download_name' not in kwargs:
raise KeyError(u'Missing keyword argument "download_name"')
self.download_source = kwargs[u'download_source']
self.download_name = kwargs[u'download_name']
self.proxy_server = None
self.proxy_username = None
self.proxy_password = None
if u'proxy_server' in kwargs:
self.proxy_server = kwargs[u'proxy_server']
else:
self.proxy_server = None
if u'proxy_username' in kwargs:
self.proxy_username = kwargs[u'proxy_username']
else:
self.proxy_username = None
if u'proxy_password' in kwargs:
self.proxy_password = kwargs[u'proxy_password']
else:
self.proxy_password = None
def do_import(self):
"""

View File

@ -33,10 +33,11 @@ from openlp.core.utils import AppLocation
from openlp.plugins.bibles.lib import parse_reference
from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta
from opensong import OpenSongBible
from osis import OSISBible
from csvbible import CSVBible
from http import HTTPBible
from openlp1 import OpenLP1Bible
from opensong import OpenSongBible
from osis import OSISBible
log = logging.getLogger(__name__)
@ -61,6 +62,7 @@ class BibleFormat(object):
CSV = 1
OpenSong = 2
WebDownload = 3
OpenLP1 = 4
@staticmethod
def get_class(format):
@ -78,6 +80,8 @@ class BibleFormat(object):
return OpenSongBible
elif format == BibleFormat.WebDownload:
return HTTPBible
elif format == BibleFormat.OpenLP1:
return OpenLP1Bible
else:
return None
@ -90,7 +94,8 @@ class BibleFormat(object):
BibleFormat.OSIS,
BibleFormat.CSV,
BibleFormat.OpenSong,
BibleFormat.WebDownload
BibleFormat.WebDownload,
BibleFormat.OpenLP1
]

View File

@ -0,0 +1,92 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2010 Raoul Snyman #
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
# Carsten Tinggaard, Frode Woldsund #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
import logging
import sqlite
from PyQt4 import QtCore
from openlp.core.lib import Receiver, translate
from db import BibleDB
log = logging.getLogger(__name__)
class OpenLP1Bible(BibleDB):
"""
This class provides the OpenLPv1 bible importer.
"""
def __init__(self, parent, **kwargs):
"""
Constructor.
"""
log.debug(self.__class__.__name__)
BibleDB.__init__(self, parent, **kwargs)
self.filename = kwargs[u'filename']
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'bibles_stop_import'), self.stop_import)
def do_import(self):
"""
Imports an openlp.org v1 bible.
"""
connection = None
cursor = None
try:
connection = sqlite.connect(self.filename)
cursor = connection.cursor()
except:
return False
# Create all books.
cursor.execute(u'SELECT id, testament_id, name, abbreviation FROM book')
books = cursor.fetchall()
for book in books:
if self.stop_import_flag:
connection.close()
return False
book_id = int(book[0])
testament_id = int(book[1])
name = unicode(book[2], u'cp1252')
abbreviation = unicode(book[3], u'cp1252')
self.create_book(name, abbreviation, testament_id)
# Update the progess bar.
self.wizard.incrementProgressBar(u'%s %s...' % (translate(
'BiblesPlugin.OpenLP1Import', 'Importing'), name))
# Import the verses for this book.
cursor.execute(u'SELECT chapter, verse, text || \'\' AS text FROM '
'verse WHERE book_id=%s' % book_id)
verses = cursor.fetchall()
for verse in verses:
if self.stop_import_flag:
connection.close()
return False
chapter = int(verse[0])
verse_number = int(verse[1])
text = unicode(verse[2], u'cp1252')
self.create_verse(book_id, chapter, verse_number, text)
Receiver.send_message(u'openlp_process_events')
self.session.commit()
connection.close()
return True

View File

@ -44,10 +44,8 @@ class OpenSongBible(BibleDB):
Constructor to create and set up an instance of the OpenSongBible
class. This class is used to import Bibles from OpenSong's XML format.
"""
log.debug(__name__)
log.debug(self.__class__.__name__)
BibleDB.__init__(self, parent, **kwargs)
if 'filename' not in kwargs:
raise KeyError(u'You have to supply a file name to import from.')
self.filename = kwargs['filename']
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'bibles_stop_import'), self.stop_import)
@ -59,7 +57,6 @@ class OpenSongBible(BibleDB):
log.debug(u'Starting OpenSong import from "%s"' % self.filename)
if not isinstance(self.filename, unicode):
self.filename = unicode(self.filename, u'utf8')
self.wizard.incrementProgressBar(u'Preparing for import...')
file = None
success = True
try:
@ -87,10 +84,9 @@ class OpenSongBible(BibleDB):
unicode(verse.text)
)
Receiver.send_message(u'openlp_process_events')
self.wizard.incrementProgressBar(
QtCore.QString('%s %s %s' % (
self.wizard.incrementProgressBar(u'%s %s %s...' % (
translate('BiblesPlugin.Opensong', 'Importing'),
db_book.name, chapter.attrib[u'n'])))
db_book.name, chapter.attrib[u'n']))
self.session.commit()
except IOError:
log.exception(u'Loading bible from OpenSong file failed')
@ -99,7 +95,6 @@ class OpenSongBible(BibleDB):
if file:
file.close()
if self.stop_import_flag:
self.wizard.incrementProgressBar(u'Import canceled!')
return False
else:
return success

View File

@ -33,7 +33,7 @@ import re
from PyQt4 import QtCore
from openlp.core.lib import Receiver
from openlp.core.lib import Receiver, translate
from openlp.core.utils import AppLocation
from db import BibleDB
@ -50,11 +50,11 @@ class OSISBible(BibleDB):
Constructor to create and set up an instance of the OpenSongBible
class. This class is used to import Bibles from OpenSong's XML format.
"""
log.debug(__name__)
log.debug(self.__class__.__name__)
BibleDB.__init__(self, parent, **kwargs)
if u'filename' not in kwargs:
raise KeyError(u'You have to supply a file name to import from.')
self.filename = kwargs[u'filename']
fbibles = None
self.books = {}
self.verse_regex = re.compile(
r'<verse osisID="([a-zA-Z0-9 ]*).([0-9]*).([0-9]*)">(.*?)</verse>')
self.note_regex = re.compile(r'<note(.*?)>(.*?)</note>')
@ -72,11 +72,9 @@ class OSISBible(BibleDB):
self.divineName_regex = re.compile(
r'<divineName(.*?)>(.*?)</divineName>')
self.spaces_regex = re.compile(r'([ ]{2,})')
self.books = {}
filepath = os.path.join(
AppLocation.get_directory(AppLocation.PluginsDir), u'bibles',
u'resources', u'osisbooks.csv')
fbibles = None
try:
fbibles = open(filepath, u'r')
for line in fbibles:
@ -96,9 +94,15 @@ class OSISBible(BibleDB):
Loads a Bible from file.
"""
log.debug(u'Starting OSIS import from "%s"' % self.filename)
self.wizard.incrementProgressBar(
u'Detecting encoding (this may take a few minutes)...')
detect_file = None
db_book = None
osis = None
success = True
last_chapter = 0
testament = 1
match_count = 0
self.wizard.incrementProgressBar(translate('BiblesPlugin.OsisImport',
'Detecting encoding (this may take a few minutes)...'))
try:
detect_file = open(self.filename, u'r')
details = chardet.detect(detect_file.read(1048576))
@ -108,14 +112,8 @@ class OSISBible(BibleDB):
finally:
if detect_file:
detect_file.close()
osis = None
success = True
try:
osis = codecs.open(self.filename, u'r', details['encoding'])
last_chapter = 0
testament = 1
match_count = 0
db_book = None
for file_record in osis:
if self.stop_import_flag:
break
@ -142,9 +140,9 @@ class OSISBible(BibleDB):
if last_chapter != chapter:
if last_chapter != 0:
self.session.commit()
self.wizard.incrementProgressBar(
u'Importing %s %s...' % \
(self.books[match.group(1)][0], chapter))
self.wizard.incrementProgressBar(u'%s %s %s...' % (
translate('BiblesPlugin.OsisImport', 'Importing'),
self.books[match.group(1)][0], chapter))
last_chapter = chapter
# All of this rigmarol below is because the mod2osis
# tool from the Sword library embeds XML in the OSIS
@ -171,7 +169,6 @@ class OSISBible(BibleDB):
self.create_verse(db_book.id, chapter, verse, verse_text)
Receiver.send_message(u'openlp_process_events')
self.session.commit()
self.wizard.incrementProgressBar(u'Finishing import...')
if match_count == 0:
success = False
except (ValueError, IOError):
@ -181,7 +178,6 @@ class OSISBible(BibleDB):
if osis:
osis.close()
if self.stop_import_flag:
self.wizard.incrementProgressBar(u'Import canceled!')
return False
else:
return success

View File

@ -118,9 +118,6 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
QtCore.QObject.connect(self.songBeamerRemoveButton,
QtCore.SIGNAL(u'clicked()'),
self.onSongBeamerRemoveButtonClicked)
QtCore.QObject.connect(self.cancelButton,
QtCore.SIGNAL(u'clicked(bool)'),
self.onCancelButtonClicked)
QtCore.QObject.connect(self,
QtCore.SIGNAL(u'currentIdChanged(int)'),
self.onCurrentIdChanged)
@ -132,6 +129,16 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
self.setDefaults()
return QtGui.QWizard.exec_(self)
def reject(self):
"""
Stop the import on cancel button, close button or ESC key.
"""
log.debug('Import canceled by user.')
if self.currentId() == 2:
Receiver.send_message(u'songs_stop_import')
else:
self.done(QtGui.QDialog.Rejected)
def validateCurrentPage(self):
"""
Validate the current page before moving on to the next page.
@ -394,14 +401,6 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard):
def onSongBeamerRemoveButtonClicked(self):
self.removeSelectedItems(self.songBeamerFileListWidget)
def onCancelButtonClicked(self, checked):
"""
Stop the import on pressing the cancel button.
"""
log.debug('Cancel button pressed!')
if self.currentId() == 2:
Receiver.send_message(u'songs_stop_import')
def onCurrentIdChanged(self, id):
if id == 2:
self.preImport()

View File

@ -25,6 +25,8 @@
###############################################################################
import logging
import locale
import re
from PyQt4 import QtCore, QtGui
@ -61,6 +63,7 @@ class SongMediaItem(MediaManagerItem):
# which Song is required.
self.remoteSong = -1
self.editItem = None
self.whitespace = re.compile(r'\W+', re.UNICODE)
def requiredIcons(self):
MediaManagerItem.requiredIcons(self)
@ -173,8 +176,8 @@ class SongMediaItem(MediaManagerItem):
if search_type == 0:
log.debug(u'Titles Search')
search_results = self.parent.manager.get_all_objects(Song,
Song.search_title.like(u'%' + search_keywords.lower() + u'%'),
Song.search_title.asc())
Song.search_title.like(u'%' + self.whitespace.sub(u' ',
search_keywords.lower()) + u'%'), Song.search_title.asc())
self.displayResultsSong(search_results)
elif search_type == 1:
log.debug(u'Lyrics Search')
@ -213,6 +216,7 @@ class SongMediaItem(MediaManagerItem):
def displayResultsSong(self, searchresults):
log.debug(u'display results Song')
self.listView.clear()
searchresults.sort(cmp=self.collateSongTitles)
for song in searchresults:
author_list = u''
for author in song.authors:
@ -437,3 +441,9 @@ class SongMediaItem(MediaManagerItem):
if editId != 0:
Receiver.send_message(u'service_item_update',
u'%s:%s' %(editId, uuid))
def collateSongTitles(self, song_1, song_2):
"""
Locale aware collation of song titles
"""
return locale.strcoll(unicode(song_1.title), unicode(song_2.title))

View File

@ -56,7 +56,7 @@ class SongsPlugin(Plugin):
self.manager = Manager(u'songs', init_schema)
self.icon_path = u':/plugins/plugin_songs.png'
self.icon = build_icon(self.icon_path)
self.whitespace = re.compile(r'\W+')
self.whitespace = re.compile(r'\W+', re.UNICODE)
def getSettingsTab(self):
visible_name = self.getString(StringContent.VisibleName)