openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #23312
[Merge] lp:~sam92/openlp/2.0-bug-1310523 into lp:openlp/2.0
Samuel Mehrbrodt has proposed merging lp:~sam92/openlp/2.0-bug-1310523 into lp:openlp/2.0.
Requested reviews:
Jonathan Corwin (j-corwin)
Related bugs:
Bug #1310523 in OpenLP: "Can't display songs that have more than 26 verses named equally"
https://bugs.launchpad.net/openlp/+bug/1310523
For more details, see:
https://code.launchpad.net/~sam92/openlp/2.0-bug-1310523/+merge/216586
Fix bug 1310523 by not allowing more than 26 equal verse names
--
https://code.launchpad.net/~sam92/openlp/2.0-bug-1310523/+merge/216586
Your team OpenLP Core is subscribed to branch lp:openlp/2.0.
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py 2014-01-14 19:25:18 +0000
+++ openlp/plugins/songs/forms/editsongform.py 2014-04-21 13:42:08 +0000
@@ -723,19 +723,32 @@
return False
cnt_errors = 0
error_list = ''
- verse_tag = []
- verse_num = []
+ verse_tags = []
+ wrong_verse_tags = []
+ wrong_verse_nums = []
for i in range(self.verseListWidget.rowCount()):
item = self.verseListWidget.item(i, 0)
tags = self.find_tags.findall(item.text())
+ verse_tags.append(unicode(item.data(QtCore.Qt.UserRole).toString()))
if self._validate_tags(tags) == False:
field = unicode(item.data(QtCore.Qt.UserRole).toString())
- verse_tag.append(VerseType.translated_name(field[0]))
- verse_num.append(field[1:])
+ wrong_verse_tags.append(VerseType.translated_name(field[0]))
+ wrong_verse_nums.append(field[1:])
cnt_errors += 1;
+ for tag in verse_tags:
+ if verse_tags.count(tag) > 26:
+ # lp#1310523: OpenLyrics allows only a-z variants of one verse:
+ # http://openlyrics.info/dataformat.html#verse-name
+ critical_error_message_box(
+ message=translate('SongsPlugin.EditSongForm',
+ 'You have %(count)s verses named %(name)s %(number)s. '
+ 'You can have at most 26 verses with the same name' %
+ {'count': verse_tags.count(tag), 'name': VerseType.translated_name(tag[0]),
+ 'number': tag[1:]}))
+ return False
if cnt_errors > 0:
for i in range(cnt_errors):
- error_list += '%s %s' % (verse_tag[i], verse_num[i])
+ error_list += '%s %s' % (wrong_verse_tags[i], wrong_verse_nums[i])
if i < cnt_errors-1:
error_list += ', '
critical_error_message_box(
=== modified file 'openlp/plugins/songs/lib/xml.py'
--- openlp/plugins/songs/lib/xml.py 2014-01-14 19:25:18 +0000
+++ openlp/plugins/songs/lib/xml.py 2014-04-21 13:42:08 +0000
@@ -360,9 +360,9 @@
verse_tag = verse[0][u'type'][0].lower()
verse_number = verse[0][u'label']
verse_def = verse_tag + verse_number
+ # Create the letter from the number of duplicates
+ verse[0][u'suffix'] = chr(97 + (verse_tags.count(verse_def) % 26))
verse_tags.append(verse_def)
- # Create the letter from the number of duplicates
- verse[0][u'suffix'] = chr(96 + verse_tags.count(verse_def))
# If the verse tag is a duplicate use the suffix letter
for verse in verse_list:
verse_tag = verse[0][u'type'][0].lower()
References