forked from openlp/openlp
bug fixes
add some additional Apocrypha books
This commit is contained in:
parent
a0643be598
commit
b0b127022c
@ -30,6 +30,7 @@ import csv
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
|
import re
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
@ -471,6 +472,7 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
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())
|
||||||
|
path = AppLocation.get_section_data_path(u'bibles/bibles')
|
||||||
if not license_version:
|
if not license_version:
|
||||||
critical_error_message_box(UiStrings().EmptyField,
|
critical_error_message_box(UiStrings().EmptyField,
|
||||||
translate('BiblesPlugin.ImportWizardForm',
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
@ -492,10 +494,32 @@ class BibleImportForm(OpenLPWizard):
|
|||||||
'a different Bible or first delete the existing one.'))
|
'a different Bible or first delete the existing one.'))
|
||||||
self.versionNameEdit.setFocus()
|
self.versionNameEdit.setFocus()
|
||||||
return False
|
return False
|
||||||
|
elif os.path.exists(os.path.join(path, self.clean_filename(
|
||||||
|
license_version))):
|
||||||
|
critical_error_message_box(
|
||||||
|
translate('BiblesPlugin.ImportWizardForm', 'Bible Exists'),
|
||||||
|
translate('BiblesPlugin.ImportWizardForm',
|
||||||
|
'This Bible already exists. Please import '
|
||||||
|
'a different Bible or first delete the existing one.'))
|
||||||
|
self.versionNameEdit.setFocus()
|
||||||
|
return False
|
||||||
return True
|
return True
|
||||||
if self.currentPage() == self.progressPage:
|
if self.currentPage() == self.progressPage:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def clean_filename(self, old_filename):
|
||||||
|
"""
|
||||||
|
Clean up the version name of the Bible and convert it into a valid
|
||||||
|
file name.
|
||||||
|
|
||||||
|
``old_filename``
|
||||||
|
The "dirty" file name or version name.
|
||||||
|
"""
|
||||||
|
if not isinstance(old_filename, unicode):
|
||||||
|
old_filename = unicode(old_filename, u'utf-8')
|
||||||
|
old_filename = re.sub(r'[^\w]+', u'_', old_filename).strip(u'_')
|
||||||
|
return old_filename + u'.sqlite'
|
||||||
|
|
||||||
def onWebSourceComboBoxIndexChanged(self, index):
|
def onWebSourceComboBoxIndexChanged(self, index):
|
||||||
"""
|
"""
|
||||||
Setup the list of Bibles when you select a different source on the web
|
Setup the list of Bibles when you select a different source on the web
|
||||||
|
@ -310,7 +310,7 @@ class BibleReImportForm(OpenLPWizard):
|
|||||||
the wizard is progressing with its task.
|
the wizard is progressing with its task.
|
||||||
"""
|
"""
|
||||||
OpenLPWizard.addProgressPage(self)
|
OpenLPWizard.addProgressPage(self)
|
||||||
self.progressLayout.setContentsMargins(48, 30, 48, 30)
|
self.progressLayout.setContentsMargins(48, 48, 48, 30)
|
||||||
self.progressLabelAfter = QtGui.QLabel(self.progressPage)
|
self.progressLabelAfter = QtGui.QLabel(self.progressPage)
|
||||||
self.progressLabelAfter.setObjectName(u'progressLabelAfter')
|
self.progressLabelAfter.setObjectName(u'progressLabelAfter')
|
||||||
self.progressLayout.addWidget(self.progressLabelAfter)
|
self.progressLayout.addWidget(self.progressLabelAfter)
|
||||||
@ -663,22 +663,23 @@ class BibleReImportForm(OpenLPWizard):
|
|||||||
elif success == False and self.checkBox[number].checkState() == 2:
|
elif success == False and self.checkBox[number].checkState() == 2:
|
||||||
failed_import += 1
|
failed_import += 1
|
||||||
if failed_import > 0:
|
if failed_import > 0:
|
||||||
failed_import_text = u' And ' + unicode(failed_import) + \
|
failed_import_text = unicode(translate(
|
||||||
u' reimport fails.'
|
'BiblesPlugin.ReImportWizardForm',
|
||||||
|
' - %s reimport fail')) % failed_import
|
||||||
else:
|
else:
|
||||||
failed_import_text = u''
|
failed_import_text = u''
|
||||||
if successful_import > 0:
|
if successful_import > 0:
|
||||||
if include_webbible:
|
if include_webbible:
|
||||||
self.progressLabel.setText(unicode(
|
self.progressLabel.setText(unicode(
|
||||||
translate('BiblesPlugin.ReImportWizardForm', 'Reimport %s '
|
translate('BiblesPlugin.ReImportWizardForm', 'Reimport %s '
|
||||||
'bibles successful.%s\nPlease note, that verses from '
|
'bible(s) successful%s.\nPlease note, that verses from '
|
||||||
'webbibles will be downloaded\non demand and thus an '
|
'webbibles will be downloaded\non demand and thus an '
|
||||||
'internet connection is required.')) %
|
'internet connection is required.')) %
|
||||||
(successful_import, failed_import_text))
|
(successful_import, failed_import_text))
|
||||||
else:
|
else:
|
||||||
self.progressLabel.setText(unicode(
|
self.progressLabel.setText(unicode(
|
||||||
translate('BiblesPlugin.ReImportWizardForm', 'Reimport %s '
|
translate('BiblesPlugin.ReImportWizardForm', 'Reimport %s '
|
||||||
'bibles successful.%s')) % (successful_import,
|
'bible(s) successful.%s')) % (successful_import,
|
||||||
failed_import_text))
|
failed_import_text))
|
||||||
self.deleteCheckBox.setVisible(1)
|
self.deleteCheckBox.setVisible(1)
|
||||||
bibles = u''
|
bibles = u''
|
||||||
|
@ -56,8 +56,7 @@ class BookNameForm(QDialog, Ui_BookNameDialog):
|
|||||||
def exec_(self, name):
|
def exec_(self, name):
|
||||||
items = []
|
items = []
|
||||||
self.requestComboBox.addItem(u'')
|
self.requestComboBox.addItem(u'')
|
||||||
self.requestLabel.setText(
|
self.requestLabel.setText(name)
|
||||||
translate('BiblesPlugin.BookNameForm', name))
|
|
||||||
items = BiblesResourcesDB.get_books()
|
items = BiblesResourcesDB.get_books()
|
||||||
for item in items:
|
for item in items:
|
||||||
self.requestComboBox.addItem(item[u'name'])
|
self.requestComboBox.addItem(item[u'name'])
|
||||||
|
@ -311,11 +311,11 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
self.reloadBibles()
|
self.reloadBibles()
|
||||||
|
|
||||||
def onReImportClick(self):
|
def onReImportClick(self):
|
||||||
if not hasattr(self, u'import_wizard'):
|
if not hasattr(self, u'reimport_wizard'):
|
||||||
self.import_wizard = BibleReImportForm(self, self.parent.manager,
|
self.reimport_wizard = BibleReImportForm(self, self.parent.manager,
|
||||||
self.parent)
|
self.parent)
|
||||||
# If the import was not cancelled then reload.
|
# If the import was not cancelled then reload.
|
||||||
if self.import_wizard.exec_():
|
if self.reimport_wizard.exec_():
|
||||||
self.reloadBibles()
|
self.reloadBibles()
|
||||||
|
|
||||||
def loadBibles(self):
|
def loadBibles(self):
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user