- fixes bug #1170435 (We should not warn when verse order is empty)

bzr-revno: 2145
Fixes: https://launchpad.net/bugs/1170435
This commit is contained in:
Andreas Preikschat 2013-06-21 10:54:46 +02:00
commit 1760e68a9f
2 changed files with 12 additions and 5 deletions

View File

@ -283,7 +283,6 @@ class Ui_EditSongDialog(object):
self.bottomLayout.setObjectName(u'bottomLayout') self.bottomLayout.setObjectName(u'bottomLayout')
self.warningLabel = QtGui.QLabel(editSongDialog) self.warningLabel = QtGui.QLabel(editSongDialog)
self.warningLabel.setObjectName(u'warningLabel') self.warningLabel.setObjectName(u'warningLabel')
self.warningLabel.setVisible(False)
self.bottomLayout.addWidget(self.warningLabel) self.bottomLayout.addWidget(self.warningLabel)
self.buttonBox = create_button_box(editSongDialog, u'buttonBox', self.buttonBox = create_button_box(editSongDialog, u'buttonBox',
[u'cancel', u'save']) [u'cancel', u'save'])
@ -355,9 +354,10 @@ 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( self.notAlllVersesUsed = translate('SongsPlugin.EditSongForm', '<strong>Warning:</strong>'
translate('SongsPlugin.EditSongForm', '<strong>Warning:</strong>' ' Not all of the verses are in use.')
' Not all of the verses are in use.')) self.noVerseOrder = translate('SongsPlugin.EditSongForm', '<strong>Warning:</strong>'
' You have not entered a verse order.')
def editSongDialogComboBox(parent, name): def editSongDialogComboBox(parent, name):
""" """

View File

@ -349,6 +349,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason) self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason)
# Hide or show the preview button. # Hide or show the preview button.
self.previewButton.setVisible(preview) self.previewButton.setVisible(preview)
# Check if all verse tags are used.
self.onVerseOrderTextChanged(self.verseOrderEdit.text())
def tagRows(self): def tagRows(self):
""" """
@ -608,7 +610,12 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
for verse in verses: for verse in verses:
if not verse in order: if not verse in order:
verses_not_used.append(verse) verses_not_used.append(verse)
self.warningLabel.setVisible(len(verses_not_used) > 0) label_text = u''
if not self.verseOrderEdit.text():
label_text = self.noVerseOrder
elif verses_not_used:
label_text = self.notAlllVersesUsed
self.warningLabel.setText(label_text)
def __extractVerseOrder(self, verse_order): def __extractVerseOrder(self, verse_order):
order = [] order = []