Verse tagging verses must be in format of vX

This commit is contained in:
Tim Bentley 2009-12-04 18:52:44 +00:00
parent 1b6ad5814b
commit 547074d29a
2 changed files with 19 additions and 9 deletions

View File

@ -401,14 +401,24 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
if self.AuthorsListView.count() == 0: if self.AuthorsListView.count() == 0:
self.SongTabWidget.setCurrentIndex(2) self.SongTabWidget.setCurrentIndex(2)
self.AuthorsListView.setFocus() self.AuthorsListView.setFocus()
for verse in unicode(self.VerseOrderEdit.text()): for verse in unicode(self.VerseOrderEdit.text()).split(u' '):
if verse.isdigit() or u' BCITPEO'.find(verse.upper()) > -1: if len(verse) == 2:
if verse[0:1] == u'v' and verse[1:].isdigit():
pass pass
else: else:
self.SongTabWidget.setCurrentIndex(0) self.SongTabWidget.setCurrentIndex(0)
self.VerseOrderEdit.setFocus() self.VerseOrderEdit.setFocus()
return False, \ return False, \
self.trUtf8('Invalid verse entry - values must be Numeric, I,B,C,T,P,E,O') self.trUtf8('Invalid verse entry - vX')
else:
if u' BCITPEO'.find(verse.upper()) > -1:
pass
else:
self.SongTabWidget.setCurrentIndex(0)
self.VerseOrderEdit.setFocus()
return False, \
self.trUtf8(\
'Invalid verse entry - values must be Numeric, I,B,C,T,P,E,O')
return True, u'' return True, u''
def onTitleEditItemLostFocus(self): def onTitleEditItemLostFocus(self):

View File

@ -297,11 +297,11 @@ class SongMediaItem(MediaManagerItem):
for verse in verseList: for verse in verseList:
service_item.add_from_text(verse[1][:30], unicode(verse[1])) service_item.add_from_text(verse[1][:30], unicode(verse[1]))
else: else:
for order in service_item.verse_order: for order in service_item.verse_order.split(u' '):
for verse in verseList: for verse in verseList:
if verse[1]: if verse[1]:
if verse[0][u'type'] == "Verse" and \ if verse[0][u'type'] == "Verse" and \
verse[0][u'label'][0] == order[0]: verse[0][u'label'][0] == order[1:]:
verseTag = u'%s:%s' % \ verseTag = u'%s:%s' % \
(verse[0][u'type'], verse[0][u'label']) (verse[0][u'type'], verse[0][u'label'])
service_item.add_from_text\ service_item.add_from_text\