bug fixes

add some additional Apocrypha books
This commit is contained in:
Armin Köhler 2011-04-20 11:00:29 +02:00
parent a0643be598
commit b0b127022c
5 changed files with 34 additions and 10 deletions

View File

@ -30,6 +30,7 @@ import csv
import logging
import os
import os.path
import re
from PyQt4 import QtCore, QtGui
@ -471,6 +472,7 @@ class BibleImportForm(OpenLPWizard):
license_version = unicode(self.field(u'license_version').toString())
license_copyright = \
unicode(self.field(u'license_copyright').toString())
path = AppLocation.get_section_data_path(u'bibles/bibles')
if not license_version:
critical_error_message_box(UiStrings().EmptyField,
translate('BiblesPlugin.ImportWizardForm',
@ -492,10 +494,32 @@ class BibleImportForm(OpenLPWizard):
'a different Bible or first delete the existing one.'))
self.versionNameEdit.setFocus()
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
if self.currentPage() == self.progressPage:
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):
"""
Setup the list of Bibles when you select a different source on the web

View File

@ -310,7 +310,7 @@ class BibleReImportForm(OpenLPWizard):
the wizard is progressing with its task.
"""
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.setObjectName(u'progressLabelAfter')
self.progressLayout.addWidget(self.progressLabelAfter)
@ -663,22 +663,23 @@ class BibleReImportForm(OpenLPWizard):
elif success == False and self.checkBox[number].checkState() == 2:
failed_import += 1
if failed_import > 0:
failed_import_text = u' And ' + unicode(failed_import) + \
u' reimport fails.'
failed_import_text = unicode(translate(
'BiblesPlugin.ReImportWizardForm',
' - %s reimport fail')) % failed_import
else:
failed_import_text = u''
if successful_import > 0:
if include_webbible:
self.progressLabel.setText(unicode(
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 '
'internet connection is required.')) %
(successful_import, failed_import_text))
else:
self.progressLabel.setText(unicode(
translate('BiblesPlugin.ReImportWizardForm', 'Reimport %s '
'bibles successful.%s')) % (successful_import,
'bible(s) successful.%s')) % (successful_import,
failed_import_text))
self.deleteCheckBox.setVisible(1)
bibles = u''

View File

@ -56,8 +56,7 @@ class BookNameForm(QDialog, Ui_BookNameDialog):
def exec_(self, name):
items = []
self.requestComboBox.addItem(u'')
self.requestLabel.setText(
translate('BiblesPlugin.BookNameForm', name))
self.requestLabel.setText(name)
items = BiblesResourcesDB.get_books()
for item in items:
self.requestComboBox.addItem(item[u'name'])

View File

@ -311,11 +311,11 @@ class BibleMediaItem(MediaManagerItem):
self.reloadBibles()
def onReImportClick(self):
if not hasattr(self, u'import_wizard'):
self.import_wizard = BibleReImportForm(self, self.parent.manager,
if not hasattr(self, u'reimport_wizard'):
self.reimport_wizard = BibleReImportForm(self, self.parent.manager,
self.parent)
# If the import was not cancelled then reload.
if self.import_wizard.exec_():
if self.reimport_wizard.exec_():
self.reloadBibles()
def loadBibles(self):