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