From 830e3d6624c717cf140e013206c65c096c874ccf Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Tue, 1 Apr 2014 23:07:49 +0200 Subject: [PATCH] PEP8 --- openlp/plugins/songs/lib/db.py | 6 +++++- openlp/plugins/songs/lib/mediaitem.py | 17 ++++++++++------- openlp/plugins/songs/lib/ui.py | 2 +- openlp/plugins/songs/lib/upgrade.py | 1 + 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/openlp/plugins/songs/lib/db.py b/openlp/plugins/songs/lib/db.py index f597fc2d2..59592a7e0 100644 --- a/openlp/plugins/songs/lib/db.py +++ b/openlp/plugins/songs/lib/db.py @@ -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 '' % (str(self.id), self.name, self.publisher) + class MediaFile(BaseModel): """ MediaFile model diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index ceb7848d6..71c5fea9c 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -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'): diff --git a/openlp/plugins/songs/lib/ui.py b/openlp/plugins/songs/lib/ui.py index 4f60bec1f..193b70608 100644 --- a/openlp/plugins/songs/lib/ui.py +++ b/openlp/plugins/songs/lib/ui.py @@ -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') diff --git a/openlp/plugins/songs/lib/upgrade.py b/openlp/plugins/songs/lib/upgrade.py index d0123feaa..96cd65051 100644 --- a/openlp/plugins/songs/lib/upgrade.py +++ b/openlp/plugins/songs/lib/upgrade.py @@ -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.