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