This commit is contained in:
Samuel Mehrbrodt 2014-04-01 23:07:49 +02:00
parent ad982e9fa3
commit 830e3d6624
4 changed files with 17 additions and 9 deletions

View File

@ -48,9 +48,10 @@ class Author(BaseModel):
"""
def get_display_name(self, author_type=None):
if author_type:
return "%s: %s"%(AuthorType.Types[author_type], self.display_name)
return "%s: %s" % (AuthorType.Types[author_type], self.display_name)
return self.display_name
class AuthorSong(BaseModel):
"""
Relationship between Authors and Songs (many to many).
@ -60,6 +61,7 @@ class AuthorSong(BaseModel):
"""
pass
class AuthorType(object):
"""
Enumeration for Author types.
@ -74,6 +76,7 @@ class AuthorType(object):
Translation: translate('OpenLP.Ui', 'Translation')
}
class Book(BaseModel):
"""
Book model
@ -81,6 +84,7 @@ class Book(BaseModel):
def __repr__(self):
return '<Book id="%s" name="%s" publisher="%s" />' % (str(self.id), self.name, self.publisher)
class MediaFile(BaseModel):
"""
MediaFile model

View File

@ -234,8 +234,7 @@ class SongMediaItem(MediaManagerItem):
if song.temporary:
continue
author_list = [author.display_name for author in song.authors]
song_detail = '%s (%s)' % (song.title, create_separated_list(author_list)) if author_list\
else '%s'%song.title
song_detail = '%s (%s)' % (song.title, create_separated_list(author_list)) if author_list else song.title
song_name = QtGui.QListWidgetItem(song_detail)
song_name.setData(QtCore.Qt.UserRole, song.id)
self.list_view.addItem(song_name)
@ -489,14 +488,18 @@ class SongMediaItem(MediaManagerItem):
item.raw_footer = []
item.raw_footer.append(song.title)
if authors_none:
item.raw_footer.append("%s: %s"%(translate('OpenLP.Ui', 'Written by'), create_separated_list(authors_none)))
item.raw_footer.append("%s: %s" % (translate('OpenLP.Ui', 'Written by'),
create_separated_list(authors_none)))
if authors_words:
item.raw_footer.append("%s: %s"%(AuthorType.Types[AuthorType.Words], create_separated_list(authors_words)))
item.raw_footer.append("%s: %s" % (AuthorType.Types[AuthorType.Words],
create_separated_list(authors_words)))
if authors_music:
item.raw_footer.append("%s: %s"%(AuthorType.Types[AuthorType.Music], create_separated_list(authors_music)))
item.raw_footer.append("%s: %s" % (AuthorType.Types[AuthorType.Music],
create_separated_list(authors_music)))
if authors_translation:
item.raw_footer.append("%s: %s"%(AuthorType.Types[AuthorType.Translation], create_separated_list(authors_translation)))
if not authors_all: #No authors defined
item.raw_footer.append("%s: %s" % (AuthorType.Types[AuthorType.Translation],
create_separated_list(authors_translation)))
if not authors_all: # No authors defined
item.raw_footer.append(SongStrings.AuthorUnknown)
item.raw_footer.append(song.copyright)
if Settings().value('core/ccli number'):

View File

@ -40,7 +40,7 @@ class SongStrings(object):
# These strings should need a good reason to be retranslated elsewhere.
Author = translate('OpenLP.Ui', 'Author', 'Singular')
Authors = translate('OpenLP.Ui', 'Authors', 'Plural')
AuthorUnknown = translate('OpenLP.Ui', 'Author Unknown') #Shown when a song has no author
AuthorUnknown = translate('OpenLP.Ui', 'Author Unknown') # Shown when a song has no author
CopyrightSymbol = translate('OpenLP.Ui', '\xa9', 'Copyright symbol.')
SongBook = translate('OpenLP.Ui', 'Song Book', 'Singular')
SongBooks = translate('OpenLP.Ui', 'Song Books', 'Plural')

View File

@ -98,6 +98,7 @@ def upgrade_3(session, metadata):
except OperationalError:
log.info('Upgrade 3 has already been run')
def upgrade_4(session, metadata):
"""
Version 4 upgrade.