forked from openlp/openlp
Added label to warn of missing verses.
This commit is contained in:
parent
f9ba07f48d
commit
5823bfbed5
@ -280,8 +280,15 @@ class Ui_EditSongDialog(object):
|
||||
self.songTabWidget.addTab(self.audioTab, u'')
|
||||
# Last few bits
|
||||
self.dialogLayout.addWidget(self.songTabWidget)
|
||||
self.bottomLayout = QtGui.QHBoxLayout()
|
||||
self.bottomLayout.setObjectName(u'bottomLayout')
|
||||
self.warningLabel = QtGui.QLabel(editSongDialog)
|
||||
self.warningLabel.setObjectName(u'warningLabel')
|
||||
self.warningLabel.setVisible(False)
|
||||
self.bottomLayout.addWidget(self.warningLabel)
|
||||
self.buttonBox = create_accept_reject_button_box(editSongDialog)
|
||||
self.dialogLayout.addWidget(self.buttonBox)
|
||||
self.bottomLayout.addWidget(self.buttonBox)
|
||||
self.dialogLayout.addLayout(self.bottomLayout)
|
||||
self.retranslateUi(editSongDialog)
|
||||
QtCore.QMetaObject.connectSlotsByName(editSongDialog)
|
||||
|
||||
@ -349,14 +356,19 @@ class Ui_EditSongDialog(object):
|
||||
translate('SongsPlugin.EditSongForm', '&Remove'))
|
||||
self.audioRemoveAllButton.setText(
|
||||
translate('SongsPlugin.EditSongForm', 'Remove &All'))
|
||||
self.warningLabel.setText(
|
||||
translate('SongsPlugin.EditSongForm', '<strong>Warning:</strong>'
|
||||
' Not all of the verses are in use.'))
|
||||
|
||||
def editSongDialogComboBox(parent, name):
|
||||
"""
|
||||
Utility method to generate a standard combo box for this dialog.
|
||||
"""
|
||||
comboBox = QtGui.QComboBox(parent)
|
||||
comboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
|
||||
comboBox.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
comboBox.setSizeAdjustPolicy(
|
||||
QtGui.QComboBox.AdjustToMinimumContentsLength)
|
||||
comboBox.setSizePolicy(
|
||||
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
comboBox.setEditable(True)
|
||||
comboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
|
||||
comboBox.setObjectName(name)
|
||||
|
@ -641,19 +641,23 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
'corresponding to %s. Valid entries are %s.')) % \
|
||||
(order_names[count], valid))
|
||||
return False
|
||||
verses_not_used = []
|
||||
for count, verse in enumerate(verses):
|
||||
if verse not in order:
|
||||
self.songTabWidget.setCurrentIndex(0)
|
||||
self.verseOrderEdit.setFocus()
|
||||
answer = QtGui.QMessageBox.warning(self,
|
||||
translate('SongsPlugin.EditSongForm', 'Warning'),
|
||||
unicode(translate('SongsPlugin.EditSongForm',
|
||||
'You have not used %s anywhere in the verse '
|
||||
'order. Are you sure you want to save the song '
|
||||
'like this?')) % verse_names[count],
|
||||
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
|
||||
if answer == QtGui.QMessageBox.No:
|
||||
return False
|
||||
if not verse in order:
|
||||
verses_not_used.append(verse)
|
||||
#self.songTabWidget.setCurrentIndex(0)
|
||||
#self.verseOrderEdit.setFocus()
|
||||
#answer = QtGui.QMessageBox.warning(self,
|
||||
# translate('SongsPlugin.EditSongForm', 'Warning'),
|
||||
# unicode(translate('SongsPlugin.EditSongForm',
|
||||
# 'You have not used %s anywhere in the verse '
|
||||
# 'order. Are you sure you want to save the song '
|
||||
# 'like this?')) % verse_names[count],
|
||||
# QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
|
||||
#if answer == QtGui.QMessageBox.No:
|
||||
# return False
|
||||
if len(verses_in_use) < len(verses):
|
||||
self.warningLabel.setVisible(True)
|
||||
item = int(self.songBookComboBox.currentIndex())
|
||||
text = unicode(self.songBookComboBox.currentText())
|
||||
if self.songBookComboBox.findText(text, QtCore.Qt.MatchExactly) < 0:
|
||||
|
Loading…
Reference in New Issue
Block a user