diff --git a/openlp/plugins/bibles/forms/bibleupgradeform.py b/openlp/plugins/bibles/forms/bibleupgradeform.py index 7b7c259ac..875396de6 100644 --- a/openlp/plugins/bibles/forms/bibleupgradeform.py +++ b/openlp/plugins/bibles/forms/bibleupgradeform.py @@ -623,7 +623,7 @@ class BibleUpgradeForm(OpenLPWizard): (number + 1, self.maxBibles, name), self.progressBar.maximum() - self.progressBar.value()) delete_database(self.path, - clean_filename(self.newbibles[number].get_name())) + clean_filename(name)) number += 1 self.mediaItem.reloadBibles() successful_import = 0 diff --git a/openlp/plugins/bibles/forms/booknamedialog.py b/openlp/plugins/bibles/forms/booknamedialog.py index 632007013..d2901ce23 100644 --- a/openlp/plugins/bibles/forms/booknamedialog.py +++ b/openlp/plugins/bibles/forms/booknamedialog.py @@ -27,92 +27,88 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import translate -from openlp.core.lib.ui import create_accept_reject_button_box class Ui_BookNameDialog(object): def setupUi(self, bookNameDialog): - bookNameDialog.setObjectName(u'BookNameDialog') - bookNameDialog.resize(400, 275) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, - QtGui.QSizePolicy.MinimumExpanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(bookNameDialog.sizePolicy() - .hasHeightForWidth()) - bookNameDialog.setSizePolicy(sizePolicy) - self.widget = QtGui.QWidget(bookNameDialog) - self.widget.setGeometry(QtCore.QRect(10, 15, 381, 251)) - self.widget.setObjectName(u'widget') - self.verticalLayout = QtGui.QVBoxLayout(self.widget) - self.verticalLayout.setObjectName(u'verticalLayout') - self.headlineLabel = QtGui.QLabel(self.widget) - font = QtGui.QFont() - font.setFamily(u'Arial') - font.setPointSize(11) - font.setWeight(75) - font.setBold(True) - self.headlineLabel.setFont(font) - self.headlineLabel.setObjectName(u'HeadlineLabel') - self.verticalLayout.addWidget(self.headlineLabel) - self.infoLabel = QtGui.QLabel(self.widget) - self.infoLabel.setObjectName(u'InfoLabel') - self.verticalLayout.addWidget(self.infoLabel) - self.formLayout = QtGui.QFormLayout() - self.formLayout.setObjectName(u'formLayout') - self.requestLabel = QtGui.QLabel(self.widget) - self.requestLabel.setObjectName(u'RequestLabel') - self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, - self.requestLabel) - self.requestComboBox = QtGui.QComboBox(self.widget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, - QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.requestComboBox.sizePolicy() - .hasHeightForWidth()) - self.requestComboBox.setSizePolicy(sizePolicy) - self.requestComboBox.setObjectName(u'RequestComboBox') - self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, - self.requestComboBox) - self.verticalLayout.addLayout(self.formLayout) - self.infoLabelTestaments = QtGui.QLabel(self.widget) - self.infoLabelTestaments.setObjectName(u'InfoLabelTestaments') - self.verticalLayout.addWidget(self.infoLabelTestaments) - self.checkBoxOldTestament = QtGui.QCheckBox(self.widget) - self.checkBoxOldTestament.setObjectName(u'OldTestament') - 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(QtCore.Qt.Checked) - self.verticalLayout.addWidget(self.checkBoxNewTestament) - self.checkBoxApocrypha = QtGui.QCheckBox(self.widget) - self.checkBoxApocrypha.setObjectName(u'OldTestament') - self.checkBoxApocrypha.setCheckState(QtCore.Qt.Checked) - self.verticalLayout.addWidget(self.checkBoxApocrypha) - self.verticalLayout.addWidget( - create_accept_reject_button_box(bookNameDialog)) - spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, - QtGui.QSizePolicy.Expanding) - self.verticalLayout.addItem(spacerItem) + bookNameDialog.setObjectName(u'bookNameDialog') + bookNameDialog.resize(400, 271) + self.bookNameLayout = QtGui.QVBoxLayout(bookNameDialog) + self.bookNameLayout.setSpacing(8) + self.bookNameLayout.setMargin(8) + self.bookNameLayout.setObjectName(u'bookNameLayout') + self.infoLabel = QtGui.QLabel(bookNameDialog) + self.infoLabel.setWordWrap(True) + self.infoLabel.setObjectName(u'infoLabel') + self.bookNameLayout.addWidget(self.infoLabel) + self.correspondingLayout = QtGui.QGridLayout() + self.correspondingLayout.setSpacing(8) + self.correspondingLayout.setObjectName(u'correspondingLayout') + self.currentLabel = QtGui.QLabel(bookNameDialog) + self.currentLabel.setObjectName(u'currentLabel') + self.correspondingLayout.addWidget(self.currentLabel, 0, 0, 1, 1) + self.currentLineEdit = QtGui.QLineEdit(bookNameDialog) + self.currentLineEdit.setReadOnly(True) + self.currentLineEdit.setObjectName(u'currentLineEdit') + self.correspondingLayout.addWidget(self.currentLineEdit, 0, 1, 1, 1) + self.correspondingLabel = QtGui.QLabel(bookNameDialog) + self.correspondingLabel.setObjectName(u'correspondingLabel') + self.correspondingLayout.addWidget( + self.correspondingLabel, 1, 0, 1, 1) + self.correspondingComboBox = QtGui.QComboBox(bookNameDialog) + self.correspondingComboBox.setObjectName(u'correspondingComboBox') + self.correspondingLayout.addWidget( + self.correspondingComboBox, 1, 1, 1, 1) + self.bookNameLayout.addLayout(self.correspondingLayout) + self.optionsGroupBox = QtGui.QGroupBox(bookNameDialog) + self.optionsGroupBox.setObjectName(u'optionsGroupBox') + self.optionsLayout = QtGui.QVBoxLayout(self.optionsGroupBox) + self.optionsLayout.setSpacing(8) + self.optionsLayout.setMargin(8) + self.optionsLayout.setObjectName(u'optionsLayout') + self.oldTestamentCheckBox = QtGui.QCheckBox(self.optionsGroupBox) + self.oldTestamentCheckBox.setObjectName(u'oldTestamentCheckBox') + self.oldTestamentCheckBox.setCheckState(QtCore.Qt.Checked) + self.optionsLayout.addWidget(self.oldTestamentCheckBox) + self.newTestamentCheckBox = QtGui.QCheckBox(self.optionsGroupBox) + self.newTestamentCheckBox.setObjectName(u'newTestamentCheckBox') + self.newTestamentCheckBox.setCheckState(QtCore.Qt.Checked) + self.optionsLayout.addWidget(self.newTestamentCheckBox) + self.apocryphaCheckBox = QtGui.QCheckBox(self.optionsGroupBox) + self.apocryphaCheckBox.setObjectName(u'apocryphaCheckBox') + self.apocryphaCheckBox.setCheckState(QtCore.Qt.Checked) + self.optionsLayout.addWidget(self.apocryphaCheckBox) + self.bookNameLayout.addWidget(self.optionsGroupBox) + self.buttonBox = QtGui.QDialogButtonBox(bookNameDialog) + self.buttonBox.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox.setStandardButtons( + QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) + self.buttonBox.setObjectName(u'buttonBox') + self.bookNameLayout.addWidget(self.buttonBox) + self.retranslateUi(bookNameDialog) - QtCore.QMetaObject.connectSlotsByName(self) + QtCore.QObject.connect( + self.buttonBox, QtCore.SIGNAL(u'accepted()'), + bookNameDialog.accept) + QtCore.QObject.connect( + self.buttonBox, QtCore.SIGNAL(u'rejected()'), + bookNameDialog.reject) + QtCore.QMetaObject.connectSlotsByName(bookNameDialog) def retranslateUi(self, bookNameDialog): - bookNameDialog.setWindowTitle( - translate('BiblesPlugin.BookNameDialog', 'Select Book')) - self.headlineLabel.setText( - translate('BiblesPlugin.BookNameDialog', 'Select Book:')) + bookNameDialog.setWindowTitle(translate('BiblesPlugin.BookNameDialog', + 'Select Book Name')) self.infoLabel.setText(translate('BiblesPlugin.BookNameDialog', - 'The following books cannot be clearly attributed. \n' - 'Please select which book it is.')) - self.requestLabel.setText(translate('BiblesPlugin.BookNameDialog', - 'Book:')) - self.infoLabelTestaments.setText(translate( - 'BiblesPlugin.BookNameDialog', 'Show books from:')) - self.checkBoxOldTestament.setText(translate( + 'The following book name cannot be matched up internally. Please ' + 'select the corresponding English name from the list.')) + self.currentLabel.setText(translate('BiblesPlugin.BookNameDialog', + 'Current name:')) + self.correspondingLabel.setText(translate( + 'BiblesPlugin.BookNameDialog', 'Corresponding name:')) + self.optionsGroupBox.setTitle(translate('BiblesPlugin.BookNameDialog', + 'Show Books From')) + self.oldTestamentCheckBox.setText(translate( 'BiblesPlugin.BookNameDialog', 'Old Testament')) - self.checkBoxNewTestament.setText(translate( + self.newTestamentCheckBox.setText(translate( 'BiblesPlugin.BookNameDialog', 'New Testament')) - self.checkBoxApocrypha.setText(translate('BiblesPlugin.BookNameDialog', + self.apocryphaCheckBox.setText(translate('BiblesPlugin.BookNameDialog', 'Apocrypha')) diff --git a/openlp/plugins/bibles/forms/booknameform.py b/openlp/plugins/bibles/forms/booknameform.py index fdb383a8c..df4943656 100644 --- a/openlp/plugins/bibles/forms/booknameform.py +++ b/openlp/plugins/bibles/forms/booknameform.py @@ -59,13 +59,13 @@ class BookNameForm(QDialog, Ui_BookNameDialog): """ Set up the signals used in the booknameform. """ - QtCore.QObject.connect(self.checkBoxOldTestament, + QtCore.QObject.connect(self.oldTestamentCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onCheckBoxIndexChanged) - QtCore.QObject.connect(self.checkBoxNewTestament, + QtCore.QObject.connect(self.newTestamentCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onCheckBoxIndexChanged) - QtCore.QObject.connect(self.checkBoxApocrypha, + QtCore.QObject.connect(self.apocryphaCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onCheckBoxIndexChanged) @@ -79,8 +79,8 @@ class BookNameForm(QDialog, Ui_BookNameDialog): ''' Reload the Combobox items ''' - self.requestComboBox.clear() - self.requestComboBox.addItem(u'') + self.correspondingComboBox.clear() + self.correspondingComboBox.addItem(u'') items = BiblesResourcesDB.get_books() for item in items: addBook = True @@ -88,36 +88,36 @@ class BookNameForm(QDialog, Ui_BookNameDialog): if book.book_reference_id == item[u'id']: addBook = False break - if self.checkBoxOldTestament.checkState() == QtCore.Qt.Unchecked \ + if self.oldTestamentCheckBox.checkState() == QtCore.Qt.Unchecked \ and item[u'testament_id'] == 1: addBook = False - elif self.checkBoxNewTestament.checkState() == QtCore.Qt.Unchecked \ + elif self.newTestamentCheckBox.checkState() == QtCore.Qt.Unchecked \ and item[u'testament_id'] == 2: addBook = False - elif self.checkBoxApocrypha.checkState() == QtCore.Qt.Unchecked \ + elif self.apocryphaCheckBox.checkState() == QtCore.Qt.Unchecked \ and item[u'testament_id'] == 3: addBook = False if addBook: - self.requestComboBox.addItem(item[u'name']) + self.correspondingComboBox.addItem(item[u'name']) def exec_(self, name, books, maxbooks): self.books = books log.debug(maxbooks) if maxbooks <= 27: - self.checkBoxOldTestament.setCheckState(QtCore.Qt.Unchecked) - self.checkBoxApocrypha.setCheckState(QtCore.Qt.Unchecked) + self.oldTestamentCheckBox.setCheckState(QtCore.Qt.Unchecked) + self.apocryphaCheckBox.setCheckState(QtCore.Qt.Unchecked) elif maxbooks <= 66: - self.checkBoxApocrypha.setCheckState(QtCore.Qt.Unchecked) + self.apocryphaCheckBox.setCheckState(QtCore.Qt.Unchecked) self.reloadComboBox() - self.requestLabel.setText(name) + self.currentLineEdit.setText(name) return QDialog.exec_(self) def accept(self): - if self.requestComboBox.currentText() == u'': + if self.correspondingComboBox.currentText() == u'': critical_error_message_box( message=translate('BiblesPlugin.BookNameForm', 'You need to select a book.')) - self.requestComboBox.setFocus() + self.correspondingComboBox.setFocus() return False else: return QDialog.accept(self) diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index c557d8047..864c002f5 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -343,7 +343,8 @@ class BibleDB(QtCore.QObject, Manager): book_ref = None book_name = BookNameForm(self.wizard) if book_name.exec_(book, self.get_books(), maxbooks): - book_ref = unicode(book_name.requestComboBox.currentText()) + book_ref = unicode( + book_name.correspondingComboBox.currentText()) if not book_ref: return None else: