forked from openlp/openlp
Songs being edited must have an Author
Songs being edited must have text in a verse bzr-revno: 1153 Fixes: https://launchpad.net/bugs/691952
This commit is contained in:
commit
9c9b949874
@ -547,14 +547,11 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
if self.AuthorsListView.count() == 0:
|
||||
self.SongTabWidget.setCurrentIndex(1)
|
||||
self.AuthorsListView.setFocus()
|
||||
answer = QtGui.QMessageBox.warning(self,
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate('SongsPlugin.EditSongForm', 'Warning'),
|
||||
translate('SongsPlugin.EditSongForm',
|
||||
'You have not added any authors for this song. Do you '
|
||||
'want to add an author now?'),
|
||||
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
|
||||
if answer == QtGui.QMessageBox.Yes:
|
||||
return False
|
||||
'You need to have an author for this song.'))
|
||||
return False
|
||||
if self.song.verse_order:
|
||||
order = []
|
||||
order_names = self.song.verse_order.split()
|
||||
|
@ -29,7 +29,7 @@ import logging
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.plugins.songs.lib import VerseType
|
||||
from openlp.plugins.songs.lib import VerseType, translate
|
||||
|
||||
from editversedialog import Ui_EditVerseDialog
|
||||
|
||||
@ -131,6 +131,7 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
||||
|
||||
def setVerse(self, text, single=False,
|
||||
tag=u'%s:1' % VerseType.to_string(VerseType.Verse)):
|
||||
self.hasSingleVerse = single
|
||||
if single:
|
||||
verse_type, verse_number = tag.split(u':')
|
||||
verse_type_index = VerseType.from_string(verse_type)
|
||||
@ -159,3 +160,16 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
||||
text = u'---[%s:1]---\n%s' % (VerseType.to_string(VerseType.Verse),
|
||||
text)
|
||||
return text
|
||||
|
||||
def accept(self):
|
||||
if self.hasSingleVerse:
|
||||
value = unicode(self.getVerse()[0])
|
||||
else:
|
||||
value = self.getVerse()[0].split(u'\n')[1]
|
||||
if len(value) == 0:
|
||||
QtGui.QMessageBox.critical(self,
|
||||
translate('SongsPlugin.EditSongForm', 'Error'),
|
||||
translate('SongsPlugin.EditSongForm',
|
||||
'You need to type some text in to the verse.'))
|
||||
return False
|
||||
QtGui.QDialog.accept(self)
|
||||
|
Loading…
Reference in New Issue
Block a user