Fix up song verse expansion to handle no verse order

Fix bug in slide controller when no slide and button is pressed
This commit is contained in:
Tim Bentley 2009-11-30 18:22:43 +00:00
parent 939909fdd8
commit 6380cc5126
2 changed files with 20 additions and 19 deletions

View File

@ -556,7 +556,7 @@ class SlideController(QtGui.QWidget):
"""
Go to the next slide.
"""
if self.serviceItem.is_command():
if self.serviceItem and self.serviceItem.is_command():
Receiver.send_message(u'%s_next'% self.serviceItem.name.lower())
self.updatePreview()
else:
@ -570,7 +570,7 @@ class SlideController(QtGui.QWidget):
"""
Go to the previous slide.
"""
if self.serviceItem.is_command():
if self.serviceItem and self.serviceItem.is_command():
Receiver.send_message(
u'%s_previous'% self.serviceItem.name.lower())
self.updatePreview()
@ -585,7 +585,7 @@ class SlideController(QtGui.QWidget):
"""
Go to the last slide.
"""
if self.serviceItem.is_command():
if self.serviceItem and self.serviceItem.is_command():
Receiver.send_message(u'%s_last'% self.serviceItem.name.lower())
self.updatePreview()
else:

View File

@ -293,20 +293,21 @@ class SongMediaItem(MediaManagerItem):
if song.lyrics.startswith(u'<?xml version='):
songXML = SongXMLParser(song.lyrics)
verseList = songXML.get_verses()
if service_item.verse_order is None or service_item.verse_order == u'':
for verse in verseList:
service_item.add_from_text(verse[1][:30], unicode(verse[1]))
else:
for order in service_item.verse_order:
for verse in verseList:
if verse[1]:
#Check for verses and expand all verses
if order.isdigit():
if verse[0][u'type'] == "Verse" and \
verse[0][u'label'].find(order) > -1:
verse[0][u'label'][0] == order[0]:
verseTag = u'%s:%s' % \
(verse[0][u'type'], verse[0][u'label'])
service_item.add_from_text\
(verse[1][:30], verse[1], verseTag)
else:
if verse[0][u'type'].find(order) > -1:
if verse[0][u'type'][0] == order[0]:
verseTag = u'%s:%s' % \
(verse[0][u'type'], verse[0][u'label'])
service_item.add_from_text\