- fix a bug, which occurs when viewing (preview/live) a song without/with incomplete footer.

- clean up

bzr-revno: 1353
This commit is contained in:
Andreas Preikschat 2011-03-05 13:03:37 +01:00
commit 4b5a1fe5ce
3 changed files with 12 additions and 21 deletions

View File

@ -88,8 +88,8 @@ class ServiceItem(object):
self.audit = u''
self.items = []
self.iconic_representation = None
self.raw_footer = None
self.foot_text = None
self.raw_footer = []
self.foot_text = u''
self.theme = None
self.service_item_type = None
self._raw_frames = []
@ -183,9 +183,8 @@ class ServiceItem(object):
else:
log.error(u'Invalid value renderer :%s' % self.service_item_type)
self.title = clean_tags(self.title)
self.foot_text = None
if self.raw_footer:
self.foot_text = u'<br>'.join(self.raw_footer)
self.foot_text = \
u'<br>'.join([footer for footer in self.raw_footer if footer])
def add_from_image(self, path, title):
"""

View File

@ -636,7 +636,6 @@ class BibleMediaItem(MediaManagerItem):
bible_text = u''
old_item = None
old_chapter = -1
raw_footer = []
raw_slides = []
raw_title = []
for item in items:
@ -657,13 +656,13 @@ class BibleMediaItem(MediaManagerItem):
second_text = self._decodeQtObject(bitem, 'second_text')
verse_text = self.formatVerse(old_chapter, chapter, verse)
footer = u'%s (%s %s %s)' % (book, version, copyright, permissions)
if footer not in raw_footer:
raw_footer.append(footer)
if footer not in service_item.raw_footer:
service_item.raw_footer.append(footer)
if second_bible:
footer = u'%s (%s %s %s)' % (book, second_version,
second_copyright, second_permissions)
if footer not in raw_footer:
raw_footer.append(footer)
if footer not in service_item.raw_footer:
service_item.raw_footer.append(footer)
bible_text = u'%s&nbsp;%s\n\n%s&nbsp;%s' % (verse_text, text,
verse_text, second_text)
raw_slides.append(bible_text.rstrip())
@ -707,11 +706,6 @@ class BibleMediaItem(MediaManagerItem):
service_item.theme = self.settings.bible_theme
for slide in raw_slides:
service_item.add_from_text(slide[:30], slide)
if service_item.raw_footer:
for footer in raw_footer:
service_item.raw_footer.append(footer)
else:
service_item.raw_footer = raw_footer
return True
def formatTitle(self, start_item, old_item):

View File

@ -330,7 +330,6 @@ class SongMediaItem(MediaManagerItem):
def generateSlideData(self, service_item, item=None, xmlVersion=False):
log.debug(u'generateSlideData (%s:%s)' % (service_item, item))
raw_footer = []
item_id = self._getIdOfItemToGenerate(item, self.remoteSong)
service_item.add_capability(ItemCapabilities.AllowsEdit)
service_item.add_capability(ItemCapabilities.AllowsPreview)
@ -392,16 +391,15 @@ class SongMediaItem(MediaManagerItem):
service_item.add_from_text(slide[:30], unicode(slide))
service_item.title = song.title
author_list = [unicode(author.display_name) for author in song.authors]
raw_footer.append(song.title)
raw_footer.append(u', '.join(author_list))
raw_footer.append(song.copyright)
service_item.raw_footer.append(song.title)
service_item.raw_footer.append(u', '.join(author_list))
service_item.raw_footer.append(song.copyright)
if QtCore.QSettings().value(u'general/ccli number',
QtCore.QVariant(u'')).toString():
raw_footer.append(unicode(
service_item.raw_footer.append(unicode(
translate('SongsPlugin.MediaItem', 'CCLI License: ') +
QtCore.QSettings().value(u'general/ccli number',
QtCore.QVariant(u'')).toString()))
service_item.raw_footer = raw_footer
service_item.audit = [
song.title, author_list, song.copyright, unicode(song.ccli_number)
]