Clean ups (missing lines, white spaces, etc.)

bzr-revno: 1337
This commit is contained in:
Andreas Preikschat 2011-02-26 00:05:34 +02:00 committed by Raoul Snyman
commit 149059aef5
25 changed files with 68 additions and 73 deletions

View File

@ -91,6 +91,7 @@ class BaseModel(object):
instance.__setattr__(key, kwargs[key])
return instance
class Manager(object):
"""
Provide generic object persistence management

View File

@ -91,6 +91,7 @@ class ThemeLevel(object):
Service = 2
Song = 3
class BackgroundType(object):
"""
Type enumeration for backgrounds.
@ -123,6 +124,7 @@ class BackgroundType(object):
elif type_string == u'image':
return BackgroundType.Image
class BackgroundGradientType(object):
"""
Type enumeration for background gradients.
@ -200,6 +202,7 @@ INTEGER_LIST = [u'size', u'line_adjustment', u'x', u'height', u'y',
u'width', u'shadow_size', u'outline_size', u'horizontal_align',
u'vertical_align', u'wrap_style']
class ThemeXML(object):
"""
A class to encapsulate the Theme XML.

View File

@ -213,6 +213,7 @@ class Controller(object):
def poll(self):
self.doc.poll_slidenumber(self.is_live)
class MessageListener(object):
"""
This is the Presentation listener who acts on events from the slide

View File

@ -129,6 +129,7 @@ class FieldDescEntry:
self.type = type
self.size = size
class EasyWorshipSongImport(SongImport):
"""
The :class:`EasyWorshipSongImport` class provides OpenLP with the

View File

@ -133,6 +133,7 @@ class FoilPresenterImport(SongImport):
log.exception(u'XML syntax error in file %s' % file_path)
return True
class FoilPresenter(object):
"""
This class represents the converter for Foilpresenter XML from a song.
@ -259,7 +260,6 @@ class FoilPresenter(object):
copyright = None
if copyright:
strings = []
author_temp = []
if copyright.find(u'Copyright') != -1:
temp = copyright.partition(u'Copyright')
copyright = temp[0]
@ -305,7 +305,7 @@ class FoilPresenter(object):
while i != 1:
if copyright.find(u'<marker>') != -1:
temp = copyright.partition(u'<marker>')
if (temp[0].strip() != u'') & (x > 0):
if temp[0].strip() and x > 0:
strings.append(temp[0])
copyright = temp[2]
x += 1
@ -330,12 +330,12 @@ class FoilPresenter(object):
author = author.strip()
if re.search(
u'\w+\.?\s+\w{3,}\s+[a|u]nd\s|\w+\.?\s+\w{3,}\s+&\s',
author, re.U) != None:
author, re.U):
temp = re.split(u'\s[a|u]nd\s|\s&\s', author)
for tempx in temp:
tempx = tempx.strip()
authors.append(tempx)
elif (len(author) > 2):
elif len(author) > 2:
authors.append(author)
for display_name in authors:
author = self.manager.get_object_filtered(Author,

View File

@ -53,6 +53,7 @@ class SongSearch(object):
Authors = 4
Themes = 5
class SongMediaItem(MediaManagerItem):
"""
This is the custom media manager item for Songs.
@ -218,13 +219,9 @@ class SongMediaItem(MediaManagerItem):
self.listView.clear()
searchresults.sort(cmp=self.collateSongTitles)
for song in searchresults:
author_list = u''
for author in song.authors:
if author_list != u'':
author_list = author_list + u', '
author_list = author_list + author.display_name
author_list = [author.display_name for author in song.authors]
song_title = unicode(song.title)
song_detail = u'%s (%s)' % (song_title, author_list)
song_detail = u'%s (%s)' % (song_title, u', '.join(author_list))
song_name = QtGui.QListWidgetItem(song_detail)
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
self.listView.addItem(song_name)
@ -334,9 +331,6 @@ class SongMediaItem(MediaManagerItem):
def generateSlideData(self, service_item, item=None, xmlVersion=False):
log.debug(u'generateSlideData (%s:%s)' % (service_item, item))
raw_footer = []
author_list = u''
author_audit = []
ccli = u''
item_id = self._getIdOfItemToGenerate(item, self.remoteSong)
service_item.add_capability(ItemCapabilities.AllowsEdit)
service_item.add_capability(ItemCapabilities.AllowsPreview)
@ -397,13 +391,9 @@ class SongMediaItem(MediaManagerItem):
for slide in verses:
service_item.add_from_text(slide[:30], unicode(slide))
service_item.title = song.title
for author in song.authors:
if len(author_list) > 1:
author_list = author_list + u', '
author_list = author_list + unicode(author.display_name)
author_audit.append(unicode(author.display_name))
author_list = [unicode(author.display_name) for author in song.authors]
raw_footer.append(song.title)
raw_footer.append(author_list)
raw_footer.append(u', '.join(author_list))
raw_footer.append(song.copyright)
if QtCore.QSettings().value(u'general/ccli number',
QtCore.QVariant(u'')).toString():
@ -413,10 +403,10 @@ class SongMediaItem(MediaManagerItem):
QtCore.QVariant(u'')).toString()))
service_item.raw_footer = raw_footer
service_item.audit = [
song.title, author_audit, song.copyright, unicode(song.ccli_number)
song.title, author_list, song.copyright, unicode(song.ccli_number)
]
service_item.data_string = {u'title': song.search_title,
u'authors': author_list}
u'authors': u', '.join(author_list)}
service_item.xml_version = self.openLyrics.song_to_xml(song)
return True

View File

@ -36,7 +36,6 @@ from openlp.plugins.songs.lib.songimport import SongImport
log = logging.getLogger(__name__)
#TODO: Use lxml for parsing and make sure we use methods of "SongImport" .
class OpenSongImport(SongImport):
"""
Import songs exported from OpenSong