forked from openlp/openlp
PEP8
This commit is contained in:
parent
ad982e9fa3
commit
830e3d6624
@ -48,9 +48,10 @@ class Author(BaseModel):
|
|||||||
"""
|
"""
|
||||||
def get_display_name(self, author_type=None):
|
def get_display_name(self, author_type=None):
|
||||||
if author_type:
|
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
|
return self.display_name
|
||||||
|
|
||||||
|
|
||||||
class AuthorSong(BaseModel):
|
class AuthorSong(BaseModel):
|
||||||
"""
|
"""
|
||||||
Relationship between Authors and Songs (many to many).
|
Relationship between Authors and Songs (many to many).
|
||||||
@ -60,6 +61,7 @@ class AuthorSong(BaseModel):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class AuthorType(object):
|
class AuthorType(object):
|
||||||
"""
|
"""
|
||||||
Enumeration for Author types.
|
Enumeration for Author types.
|
||||||
@ -74,6 +76,7 @@ class AuthorType(object):
|
|||||||
Translation: translate('OpenLP.Ui', 'Translation')
|
Translation: translate('OpenLP.Ui', 'Translation')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class Book(BaseModel):
|
class Book(BaseModel):
|
||||||
"""
|
"""
|
||||||
Book model
|
Book model
|
||||||
@ -81,6 +84,7 @@ class Book(BaseModel):
|
|||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '<Book id="%s" name="%s" publisher="%s" />' % (str(self.id), self.name, self.publisher)
|
return '<Book id="%s" name="%s" publisher="%s" />' % (str(self.id), self.name, self.publisher)
|
||||||
|
|
||||||
|
|
||||||
class MediaFile(BaseModel):
|
class MediaFile(BaseModel):
|
||||||
"""
|
"""
|
||||||
MediaFile model
|
MediaFile model
|
||||||
|
@ -234,8 +234,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
if song.temporary:
|
if song.temporary:
|
||||||
continue
|
continue
|
||||||
author_list = [author.display_name for author in song.authors]
|
author_list = [author.display_name for author in song.authors]
|
||||||
song_detail = '%s (%s)' % (song.title, create_separated_list(author_list)) if author_list\
|
song_detail = '%s (%s)' % (song.title, create_separated_list(author_list)) if author_list else song.title
|
||||||
else '%s'%song.title
|
|
||||||
song_name = QtGui.QListWidgetItem(song_detail)
|
song_name = QtGui.QListWidgetItem(song_detail)
|
||||||
song_name.setData(QtCore.Qt.UserRole, song.id)
|
song_name.setData(QtCore.Qt.UserRole, song.id)
|
||||||
self.list_view.addItem(song_name)
|
self.list_view.addItem(song_name)
|
||||||
@ -489,14 +488,18 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
item.raw_footer = []
|
item.raw_footer = []
|
||||||
item.raw_footer.append(song.title)
|
item.raw_footer.append(song.title)
|
||||||
if authors_none:
|
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:
|
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:
|
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:
|
if authors_translation:
|
||||||
item.raw_footer.append("%s: %s"%(AuthorType.Types[AuthorType.Translation], create_separated_list(authors_translation)))
|
item.raw_footer.append("%s: %s" % (AuthorType.Types[AuthorType.Translation],
|
||||||
if not authors_all: #No authors defined
|
create_separated_list(authors_translation)))
|
||||||
|
if not authors_all: # No authors defined
|
||||||
item.raw_footer.append(SongStrings.AuthorUnknown)
|
item.raw_footer.append(SongStrings.AuthorUnknown)
|
||||||
item.raw_footer.append(song.copyright)
|
item.raw_footer.append(song.copyright)
|
||||||
if Settings().value('core/ccli number'):
|
if Settings().value('core/ccli number'):
|
||||||
|
@ -40,7 +40,7 @@ class SongStrings(object):
|
|||||||
# These strings should need a good reason to be retranslated elsewhere.
|
# These strings should need a good reason to be retranslated elsewhere.
|
||||||
Author = translate('OpenLP.Ui', 'Author', 'Singular')
|
Author = translate('OpenLP.Ui', 'Author', 'Singular')
|
||||||
Authors = translate('OpenLP.Ui', 'Authors', 'Plural')
|
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.')
|
CopyrightSymbol = translate('OpenLP.Ui', '\xa9', 'Copyright symbol.')
|
||||||
SongBook = translate('OpenLP.Ui', 'Song Book', 'Singular')
|
SongBook = translate('OpenLP.Ui', 'Song Book', 'Singular')
|
||||||
SongBooks = translate('OpenLP.Ui', 'Song Books', 'Plural')
|
SongBooks = translate('OpenLP.Ui', 'Song Books', 'Plural')
|
||||||
|
@ -98,6 +98,7 @@ def upgrade_3(session, metadata):
|
|||||||
except OperationalError:
|
except OperationalError:
|
||||||
log.info('Upgrade 3 has already been run')
|
log.info('Upgrade 3 has already been run')
|
||||||
|
|
||||||
|
|
||||||
def upgrade_4(session, metadata):
|
def upgrade_4(session, metadata):
|
||||||
"""
|
"""
|
||||||
Version 4 upgrade.
|
Version 4 upgrade.
|
||||||
|
Loading…
Reference in New Issue
Block a user