openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #06423
[Merge] lp:~googol-hush/openlp/trivial2 into lp:openlp
Andreas Preikschat has proposed merging lp:~googol-hush/openlp/trivial2 into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~googol-hush/openlp/trivial2/+merge/50520
- added a new Songbeamer property
- replaced try
- enumeration fix
--
https://code.launchpad.net/~googol-hush/openlp/trivial2/+merge/50520
Your team OpenLP Core is requested to review the proposed merge of lp:~googol-hush/openlp/trivial2 into lp:openlp.
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2011-02-18 16:37:41 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2011-02-20 18:38:45 +0000
@@ -254,9 +254,9 @@
"""
if self.searchAsYouType:
search_length = 1
- if self.searchTextEdit.currentSearchType() == 1:
+ if self.searchTextEdit.currentSearchType() == SongSearch.Entire:
search_length = 3
- elif self.searchTextEdit.currentSearchType() == 3:
+ elif self.searchTextEdit.currentSearchType() == SongSearch.Lyrics:
search_length = 7
if len(text) > search_length:
self.onSearchTextButtonClick()
=== modified file 'openlp/plugins/songs/lib/songbeamerimport.py'
--- openlp/plugins/songs/lib/songbeamerimport.py 2011-02-18 17:34:43 +0000
+++ openlp/plugins/songs/lib/songbeamerimport.py 2011-02-20 18:38:45 +0000
@@ -245,6 +245,8 @@
self.song_number = u''
elif tag_val[0] == u'#Speed':
pass
+ elif tag_val[0] == u'Tempo':
+ pass
elif tag_val[0] == u'#TextAlign':
pass
elif tag_val[0] == u'#Title':
=== modified file 'openlp/plugins/songs/lib/xml.py'
--- openlp/plugins/songs/lib/xml.py 2011-02-18 16:37:41 +0000
+++ openlp/plugins/songs/lib/xml.py 2011-02-20 18:38:45 +0000
@@ -299,9 +299,9 @@
# Remove chords from xml.
xml = re.compile(u'<chord name=".*?"/>').sub(u'', xml)
song_xml = objectify.fromstring(xml)
- try:
+ if hasattr(song_xml, u'properties'):
properties = song_xml.properties
- except AttributeError:
+ else:
return None
song = Song()
self._process_copyright(properties, song)
@@ -369,13 +369,11 @@
The song object.
"""
authors = []
- try:
+ if hasattr(properties, u'authors'):
for author in properties.authors.author:
display_name = self._text(author)
if display_name:
authors.append(display_name)
- except AttributeError:
- pass
if not authors:
authors.append(SongStrings.AuthorUnknownUnT)
for display_name in authors:
@@ -399,10 +397,8 @@
``song``
The song object.
"""
- try:
+ if hasattr(properties, u'ccliNo'):
song.ccli_number = self._text(properties.ccliNo)
- except AttributeError:
- song.ccli_number = u''
def _process_comments(self, properties, song):
"""
@@ -414,15 +410,13 @@
``song``
The song object.
"""
- try:
- comments_list = []
+ if hasattr(properties, u'comments'):
+ comments_list = []
for comment in properties.comments.comment:
commenttext = self._text(comment)
if commenttext:
comments_list.append(commenttext)
song.comments = u'\n'.join(comments_list)
- except AttributeError:
- song.comments = u''
def _process_copyright(self, properties, song):
"""
@@ -434,10 +428,8 @@
``song``
The song object.
"""
- try:
+ if hasattr(properties, u'copyright'):
song.copyright = self._text(properties.copyright)
- except AttributeError:
- song.copyright = u''
def _process_lyrics(self, properties, lyrics, song):
"""
@@ -478,9 +470,9 @@
song.search_lyrics = search_text.lower()
song.lyrics = unicode(sxml.extract_xml(), u'utf-8')
# Process verse order
- try:
+ if hasattr(properties, u'verseOrder'):
song.verse_order = self._text(properties.verseOrder)
- except AttributeError:
+ else:
# We have to process the temp_verse_order, as the verseOrder
# property is not present.
previous_type = u''
@@ -511,7 +503,7 @@
"""
song.song_book_id = 0
song.song_number = u''
- try:
+ if hasattr(properties, u'songbooks'):
for songbook in properties.songbooks.songbook:
bookname = self._get(songbook, u'name')
if bookname:
@@ -522,15 +514,10 @@
book = Book.populate(name=bookname, publisher=u'')
self.manager.save_object(book)
song.song_book_id = book.id
- try:
- if self._get(songbook, u'entry'):
- song.song_number = self._get(songbook, u'entry')
- except AttributeError:
- pass
+ if hasattr(songbook, u'entry'):
+ song.song_number = self._get(songbook, u'entry')
# We only support one song book, so take the first one.
break
- except AttributeError:
- pass
def _process_titles(self, properties, song):
"""
@@ -563,7 +550,7 @@
``song``
The song object.
"""
- try:
+ if hasattr(properties, u'themes'):
for topictext in properties.themes.theme:
topictext = self._text(topictext)
if topictext:
@@ -574,8 +561,6 @@
topic = Topic.populate(name=topictext)
self.manager.save_object(topic)
song.topics.append(topic)
- except AttributeError:
- pass
def _dump_xml(self, xml):
"""
Follow ups