From b0b127022cc1e7c48b0d4558d505341615c606b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Armin=20K=C3=B6hler?= Date: Wed, 20 Apr 2011 11:00:29 +0200 Subject: [PATCH] bug fixes add some additional Apocrypha books --- .../plugins/bibles/forms/bibleimportform.py | 24 ++++++++++++++++++ .../plugins/bibles/forms/biblereimportform.py | 11 ++++---- openlp/plugins/bibles/forms/booknameform.py | 3 +-- openlp/plugins/bibles/lib/mediaitem.py | 6 ++--- .../bibles/resources/bibles_resources.sqlite | Bin 101376 -> 101376 bytes 5 files changed, 34 insertions(+), 10 deletions(-) diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index 57a38538f..a85230611 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -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 diff --git a/openlp/plugins/bibles/forms/biblereimportform.py b/openlp/plugins/bibles/forms/biblereimportform.py index 48af1c558..5895f710a 100644 --- a/openlp/plugins/bibles/forms/biblereimportform.py +++ b/openlp/plugins/bibles/forms/biblereimportform.py @@ -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'' diff --git a/openlp/plugins/bibles/forms/booknameform.py b/openlp/plugins/bibles/forms/booknameform.py index 58603226c..b8bdbb493 100644 --- a/openlp/plugins/bibles/forms/booknameform.py +++ b/openlp/plugins/bibles/forms/booknameform.py @@ -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']) diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 1b7bf90ce..ec65a37d0 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -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): diff --git a/openlp/plugins/bibles/resources/bibles_resources.sqlite b/openlp/plugins/bibles/resources/bibles_resources.sqlite index 23c89b5df80e39da39e81eb94cc6a0e9b8dd1474..4645fcf9ca76a4d0aecb2a5d227198e2f2a696bc 100644 GIT binary patch delta 1861 zcma)6du)?c6hDt{LtMugg>Bthx~&`C?7FslF(6|_!O^iN4q1YM!G=S|Fyo;i12@ru z2F==Q$YO}X0>MXQx)LL(iTEJkAAo=hiG&d}5J01dAx2R=x9uhp{;g-@W+dXUZL+Xg#9cqf%g4n9g#byL^j4C$ndN6xJ zg;5-)!y@3ze3akfS9v`@#%?yzFLauQsGqh_3;D$riKBxU#HVl`CcyRqoz^?L1UxeS-LNd4g{Qo|m*I^c1r3k8|#6B)x!r&?LyRQ`f=n%c6X)EM;@q%qf{d&k%ZzP}^XGBs22H>c@PuI+1Txy9#XT z^?dUZEt)*&0?MKa%%P=l4*k@Lr*J22qrEtpzJO1$l!oy=d=3pT0Ndy~{SG&w3vY4^ zPhk(ma}6)$r+F*)@qRwcC$XI`^3V80pvUIZLYX6%X@>?gmthgu!lzy#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