forked from openlp/openlp
parent
368987bb67
commit
4ee247c8b1
|
@ -132,9 +132,9 @@ class OpenLP(QtGui.QApplication):
|
|||
if update_check:
|
||||
VersionThread(self.mainWindow).start()
|
||||
for plugin in self.mainWindow.pluginManager.plugins:
|
||||
if plugin.name == u'Bibles' and plugin.isActive() and len(
|
||||
SettingsManager.get_files(u'bibles/bibles', u'.sqlite')) == 0 \
|
||||
and len(SettingsManager.get_files(u'bibles', u'.sqlite')) > 0:
|
||||
if plugin.name == u'Bibles' and plugin.isActive() and not \
|
||||
len(SettingsManager.get_files( u'bibles/bibles', u'.sqlite')) \
|
||||
and SettingsManager.get_files(u'bibles', u'.sqlite'):
|
||||
if QtGui.QMessageBox.information(self.mainWindow,
|
||||
translate('OpenLP', 'Information'), translate('OpenLP',
|
||||
'Bible format has changed.\nYou have to upgrade your '
|
||||
|
|
|
@ -637,9 +637,9 @@ class BibleImportForm(OpenLPWizard):
|
|||
bibles = BiblesResourcesDB.get_webbibles(
|
||||
WebDownload.Names[download_type])
|
||||
for bible in bibles:
|
||||
ver = bible[u'name']
|
||||
version = bible[u'name']
|
||||
name = bible[u'abbreviation']
|
||||
self.web_bible_list[download_type][ver] = name.strip()
|
||||
self.web_bible_list[download_type][version] = name.strip()
|
||||
|
||||
def preWizard(self):
|
||||
"""
|
||||
|
@ -720,4 +720,5 @@ class BibleImportForm(OpenLPWizard):
|
|||
self.progressLabel.setText(translate(
|
||||
'BiblesPlugin.ImportWizardForm', 'Your Bible import failed.'))
|
||||
del self.manager.db_cache[importer.name]
|
||||
delete_database(self.plugin.settingsSection, importer.file)
|
||||
delete_database(AppLocation.get_section_data_path(u'bibles/bibles'),
|
||||
importer.file)
|
||||
|
|
|
@ -98,11 +98,11 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||
self.stop_import_flag = True
|
||||
|
||||
def onCheckBoxIndexChanged(self, index):
|
||||
'''
|
||||
"""
|
||||
Show/ Hide warnings if CheckBox state has changed
|
||||
'''
|
||||
"""
|
||||
for number, filename in enumerate(self.files):
|
||||
if not self.checkBox[number].checkState() == 2:
|
||||
if not self.checkBox[number].checkState() == QtCore.Qt.Checked:
|
||||
self.verticalWidget[number].hide()
|
||||
self.formWidget[number].hide()
|
||||
else:
|
||||
|
@ -134,15 +134,15 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||
self.next()
|
||||
|
||||
def onFinishButton(self):
|
||||
'''
|
||||
"""
|
||||
Some cleanup while finishing
|
||||
'''
|
||||
if self.deleteCheckBox.checkState() == 2 or \
|
||||
self.deleteAllCheckBox.checkState() == 2:
|
||||
"""
|
||||
if self.deleteCheckBox.checkState() == QtCore.Qt.Checked or \
|
||||
self.deleteAllCheckBox.checkState() == QtCore.Qt.Checked:
|
||||
for number, filename in enumerate(self.files):
|
||||
if self.deleteAllCheckBox.checkState() == 2 or \
|
||||
(self.checkBox[number].checkState() == 2 and \
|
||||
self.success[number] == True):
|
||||
if self.deleteAllCheckBox.checkState() == QtCore.Qt.Checked or \
|
||||
(self.checkBox[number].checkState() == QtCore.Qt.Checked \
|
||||
and self.success[number]):
|
||||
delete_file(os.path.join(self.oldpath, filename))
|
||||
|
||||
def customInit(self):
|
||||
|
@ -204,7 +204,7 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||
checkBoxName = u'checkBox['+unicode(number)+u']'
|
||||
self.checkBox[number].setObjectName(checkBoxName)
|
||||
self.checkBox[number].setText(bible.get_name())
|
||||
self.checkBox[number].setCheckState(2)
|
||||
self.checkBox[number].setCheckState(QtCore.Qt.Checked)
|
||||
self.formLayout.addWidget(self.checkBox[number])
|
||||
self.verticalWidget[number] = QtGui.QWidget(self.scrollAreaContents)
|
||||
verticalWidgetName = u'verticalWidget['+unicode(number)+u']'
|
||||
|
@ -356,7 +356,7 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||
return True
|
||||
elif self.currentPage() == self.selectPage:
|
||||
for number, filename in enumerate(self.files):
|
||||
if not self.checkBox[number].checkState() == 2:
|
||||
if not self.checkBox[number].checkState() == QtCore.Qt.Checked:
|
||||
continue
|
||||
version_name = unicode(self.versionNameEdit[number].text())
|
||||
oldbible = OldBibleDB(self.mediaItem, path=self.oldpath,
|
||||
|
@ -424,7 +424,7 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||
self.finishButton.setVisible(False)
|
||||
self.cancelButton.setVisible(True)
|
||||
for number, filename in enumerate(self.files):
|
||||
self.checkBox[number].setCheckState(2)
|
||||
self.checkBox[number].setCheckState(QtCore.Qt.Checked)
|
||||
if os.path.exists(os.path.join(self.newpath, filename)):
|
||||
self.verticalWidget[number].show()
|
||||
self.formWidget[number].show()
|
||||
|
@ -434,9 +434,9 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||
self.progressBar.show()
|
||||
self.progressLabelAfter.hide()
|
||||
self.deleteCheckBox.hide()
|
||||
self.deleteCheckBox.setCheckState(0)
|
||||
self.deleteCheckBox.setCheckState(QtCore.Qt.Unchecked)
|
||||
self.deleteAllCheckBox.hide()
|
||||
self.deleteAllCheckBox.setCheckState(0)
|
||||
self.deleteAllCheckBox.setCheckState(QtCore.Qt.Unchecked)
|
||||
self.restart()
|
||||
settings.endGroup()
|
||||
|
||||
|
@ -464,13 +464,13 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||
return
|
||||
self.maxBibles = 0
|
||||
for number, file in enumerate(self.files):
|
||||
if self.checkBox[number].checkState() == 2:
|
||||
if self.checkBox[number].checkState() == QtCore.Qt.Checked:
|
||||
self.maxBibles += 1
|
||||
number = 0
|
||||
for biblenumber, filename in enumerate(self.files):
|
||||
bible_failed = False
|
||||
self.success[biblenumber] = False
|
||||
if not self.checkBox[biblenumber].checkState() == 2:
|
||||
if not self.checkBox[biblenumber].checkState() == QtCore.Qt.Checked:
|
||||
continue
|
||||
self.progressBar.reset()
|
||||
oldbible = OldBibleDB(self.mediaItem, path=self.oldpath,
|
||||
|
@ -655,7 +655,8 @@ class BibleUpgradeForm(OpenLPWizard):
|
|||
for number, success in self.success.iteritems():
|
||||
if success == True:
|
||||
successful_import += 1
|
||||
elif success == False and self.checkBox[number].checkState() == 2:
|
||||
elif success == False and self.checkBox[number].checkState() == \
|
||||
QtCore.Qt.Checked:
|
||||
failed_import += 1
|
||||
if failed_import > 0:
|
||||
failed_import_text = unicode(translate(
|
||||
|
|
|
@ -80,15 +80,15 @@ class Ui_BookNameDialog(object):
|
|||
self.verticalLayout.addWidget(self.infoLabelTestaments)
|
||||
self.checkBoxOldTestament = QtGui.QCheckBox(self.widget)
|
||||
self.checkBoxOldTestament.setObjectName(u'OldTestament')
|
||||
self.checkBoxOldTestament.setCheckState(2)
|
||||
self.checkBoxOldTestament.setCheckState(QtCore.Qt.Checked)
|
||||
self.verticalLayout.addWidget(self.checkBoxOldTestament)
|
||||
self.checkBoxNewTestament = QtGui.QCheckBox(self.widget)
|
||||
self.checkBoxNewTestament.setObjectName(u'OldTestament')
|
||||
self.checkBoxNewTestament.setCheckState(2)
|
||||
self.checkBoxNewTestament.setCheckState(QtCore.Qt.Checked)
|
||||
self.verticalLayout.addWidget(self.checkBoxNewTestament)
|
||||
self.checkBoxApocrypha = QtGui.QCheckBox(self.widget)
|
||||
self.checkBoxApocrypha.setObjectName(u'OldTestament')
|
||||
self.checkBoxApocrypha.setCheckState(2)
|
||||
self.checkBoxApocrypha.setCheckState(QtCore.Qt.Checked)
|
||||
self.verticalLayout.addWidget(self.checkBoxApocrypha)
|
||||
self.verticalLayout.addWidget(
|
||||
create_accept_reject_button_box(bookNameDialog))
|
||||
|
|
|
@ -79,7 +79,6 @@ class BookNameForm(QDialog, Ui_BookNameDialog):
|
|||
'''
|
||||
Reload the Combobox items
|
||||
'''
|
||||
items = []
|
||||
self.requestComboBox.clear()
|
||||
self.requestComboBox.addItem(u'')
|
||||
items = BiblesResourcesDB.get_books()
|
||||
|
@ -89,26 +88,26 @@ class BookNameForm(QDialog, Ui_BookNameDialog):
|
|||
if book.book_reference_id == item[u'id']:
|
||||
addBook = False
|
||||
break
|
||||
if self.checkBoxOldTestament.checkState() == 0 and \
|
||||
item[u'testament_id'] == 1:
|
||||
if self.checkBoxOldTestament.checkState() == QtCore.Qt.Unchecked \
|
||||
and item[u'testament_id'] == 1:
|
||||
addBook = False
|
||||
elif self.checkBoxNewTestament.checkState() == 0 and \
|
||||
item[u'testament_id'] == 2:
|
||||
elif self.checkBoxNewTestament.checkState() == QtCore.Qt.Unchecked \
|
||||
and item[u'testament_id'] == 2:
|
||||
addBook = False
|
||||
elif self.checkBoxApocrypha.checkState() == 0 and \
|
||||
item[u'testament_id'] == 3:
|
||||
elif self.checkBoxApocrypha.checkState() == QtCore.Qt.Unchecked \
|
||||
and item[u'testament_id'] == 3:
|
||||
addBook = False
|
||||
if addBook == True:
|
||||
if addBook:
|
||||
self.requestComboBox.addItem(item[u'name'])
|
||||
|
||||
def exec_(self, name, books, maxbooks):
|
||||
self.books = books
|
||||
log.debug(maxbooks)
|
||||
if maxbooks <= 27:
|
||||
self.checkBoxOldTestament.setCheckState(0)
|
||||
self.checkBoxApocrypha.setCheckState(0)
|
||||
self.checkBoxOldTestament.setCheckState(QtCore.Qt.Unchecked)
|
||||
self.checkBoxApocrypha.setCheckState(QtCore.Qt.Unchecked)
|
||||
elif maxbooks <= 66:
|
||||
self.checkBoxApocrypha.setCheckState(0)
|
||||
self.checkBoxApocrypha.setCheckState(QtCore.Qt.Unchecked)
|
||||
self.reloadComboBox()
|
||||
self.requestLabel.setText(name)
|
||||
return QDialog.exec_(self)
|
||||
|
|
|
@ -53,7 +53,6 @@ class LanguageForm(QDialog, Ui_LanguageDialog):
|
|||
self.setupUi(self)
|
||||
|
||||
def exec_(self):
|
||||
items = []
|
||||
self.requestComboBox.addItem(u'')
|
||||
items = BiblesResourcesDB.get_languages()
|
||||
for item in items:
|
||||
|
|
|
@ -476,9 +476,9 @@ class BibleDB(QtCore.QObject, Manager):
|
|||
log.debug(u'BibleDB.get_language()')
|
||||
from openlp.plugins.bibles.forms import LanguageForm
|
||||
language = None
|
||||
lang = LanguageForm(self.wizard)
|
||||
if lang.exec_():
|
||||
language = unicode(lang.requestComboBox.currentText())
|
||||
language_form = LanguageForm(self.wizard)
|
||||
if language_form.exec_():
|
||||
language = unicode(language_form.requestComboBox.currentText())
|
||||
if not language:
|
||||
return False
|
||||
language = BiblesResourcesDB.get_language(language)
|
||||
|
@ -550,11 +550,11 @@ class BiblesResourcesDB(QtCore.QObject, Manager):
|
|||
u'abbreviation, chapters FROM book_reference ORDER BY id')
|
||||
return [
|
||||
{
|
||||
u'id': book[0],
|
||||
u'testament_id': book[1],
|
||||
u'name': unicode(book[2]),
|
||||
u'abbreviation': unicode(book[3]),
|
||||
u'chapters': book[4]
|
||||
u'id': book[0],
|
||||
u'testament_id': book[1],
|
||||
u'name': unicode(book[2]),
|
||||
u'abbreviation': unicode(book[3]),
|
||||
u'chapters': book[4]
|
||||
}
|
||||
for book in books
|
||||
]
|
||||
|
|
|
@ -419,9 +419,11 @@ class HTTPBible(BibleDB):
|
|||
'failed' % self.filename)
|
||||
return False
|
||||
for book in books:
|
||||
if self.stop_import_flag:
|
||||
break
|
||||
self.wizard.incrementProgressBar(unicode(translate(
|
||||
'BiblesPlugin.HTTPBible', 'Importing %s...',
|
||||
'Importing <book name>...')) % book)
|
||||
'BiblesPlugin.HTTPBible', 'Importing %s...',
|
||||
'Importing <book name>...')) % book)
|
||||
book_ref_id = self.get_book_ref_id_by_name(book, len(books),
|
||||
language_id)
|
||||
if not book_ref_id:
|
||||
|
@ -432,7 +434,10 @@ class HTTPBible(BibleDB):
|
|||
log.debug(u'Book details: Name:%s; id:%s; testament_id:%s',
|
||||
book, book_ref_id, book_details[u'testament_id'])
|
||||
self.create_book(book, book_ref_id, book_details[u'testament_id'])
|
||||
return True
|
||||
if self.stop_import_flag:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def get_verses(self, reference_list):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue