forked from openlp/openlp
validate all verses before showing a message box and list all verses with misplaced tags at once
This commit is contained in:
parent
3896d2845e
commit
684538214c
@ -721,17 +721,27 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||
self.manager.save_object(book)
|
||||
else:
|
||||
return False
|
||||
cnt_errors = 0
|
||||
error_list = ''
|
||||
verse_tag = []
|
||||
verse_num = []
|
||||
for i in range(self.verseListWidget.rowCount()):
|
||||
item = self.verseListWidget.item(i, 0)
|
||||
tags = self.find_tags.findall(item.text())
|
||||
if self._validate_tags(tags) == False:
|
||||
field = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||
verse_tag = VerseType.translated_name(field[0])
|
||||
verse_num = field[1:]
|
||||
verse_tag.append(VerseType.translated_name(field[0]))
|
||||
verse_num.append(field[1:])
|
||||
cnt_errors += 1;
|
||||
if cnt_errors > 0:
|
||||
for i in range(cnt_errors):
|
||||
error_list += '%s %s' % (verse_tag[i], verse_num[i])
|
||||
if i < cnt_errors-1:
|
||||
error_list += ', '
|
||||
critical_error_message_box(
|
||||
message=translate('SongsPlugin.EditSongForm',
|
||||
'There are misplaced tags in %s %s. '
|
||||
'You need to fix this problem first.' % (verse_tag, verse_num)))
|
||||
'There are misplaced formatting tags in the following verses:\n\n%s\n\n'
|
||||
'Please correct these tags before continuing.' % error_list))
|
||||
return False
|
||||
return True
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user