Song editing cleaned up

This commit is contained in:
Tim Bentley 2010-06-05 16:46:14 +01:00
parent 61b4850941
commit 7bf8e71acf
2 changed files with 17 additions and 26 deletions

View File

@ -469,27 +469,18 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.SongTabWidget.setCurrentIndex(1) self.SongTabWidget.setCurrentIndex(1)
self.AuthorsListView.setFocus() self.AuthorsListView.setFocus()
#split the verse list by space and mark lower case for testing #split the verse list by space and mark lower case for testing
taglist = unicode(self.trUtf8(' bitped')) taglist = unicode(self.trUtf8(' bitpedvc'))
for verse in unicode(self.VerseOrderEdit.text()).lower().split(u' '): for verse in unicode(self.VerseOrderEdit.text()).lower().split(u' '):
if len(verse) > 1: if len(verse) > 1:
if (verse[0:1] == u'%s' % self.trUtf8('v') or if taglist.find(verse[0:1]) > -1 \
verse[0:1] == u'%s' % self.trUtf8('c')) \
and verse[1:].isdigit(): and verse[1:].isdigit():
pass pass
else:
self.SongTabWidget.setCurrentIndex(0)
self.VerseOrderEdit.setFocus()
return False, \
self.trUtf8('Invalid verse entry - Vx or Cx')
else:
if taglist.find(verse) > -1:
pass
else: else:
self.SongTabWidget.setCurrentIndex(0) self.SongTabWidget.setCurrentIndex(0)
self.VerseOrderEdit.setFocus() self.VerseOrderEdit.setFocus()
return False, \ return False, \
self.trUtf8(\ self.trUtf8(\
'Invalid verse entry, values must be I,B,T,P,E,O,Vx,Cx') 'Invalid verse entry, values must be I,B,T,P,E,O,V,C followed by a number')
return True, u'' return True, u''
def onTitleEditItemLostFocus(self): def onTitleEditItemLostFocus(self):

View File

@ -335,20 +335,20 @@ class SongMediaItem(MediaManagerItem):
break break
for verse in verseList: for verse in verseList:
if verse[1]: if verse[1]:
if verse[0][u'type'] == "Verse" \ # if verse[0][u'type'] == "Verse" \
or verse[0][u'type'] == "Chorus": # or verse[0][u'type'] == "Chorus":
if verse[0][u'label'] == order[1:] and \ if verse[0][u'label'] == order[1:] and \
verse[0][u'type'][0] == order[0]: verse[0][u'type'][0] == order[0]:
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\
(verse[1][:30], verse[1], verseTag) (verse[1][:30], verse[1], verseTag)
else: # else:
if verse[0][u'type'][0] == order[0]: # if verse[0][u'type'][0] == order[0]:
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\
(verse[1][:30], verse[1], verseTag) # (verse[1][:30], verse[1], verseTag)
else: else:
verses = song.lyrics.split(u'\n\n') verses = song.lyrics.split(u'\n\n')
for slide in verses: for slide in verses: