text clean ups

This commit is contained in:
Tim Bentley 2018-01-19 21:31:36 +00:00
parent 4fa63439f4
commit 0ce0231a5f
2 changed files with 20 additions and 10 deletions

View File

@ -384,7 +384,7 @@ class BibleMediaItem(MediaManagerItem):
This initialises the given bible, which means that its book names and their chapter numbers is added to the
combo boxes on the 'Select' Tab. This is not of any importance of the 'Search' Tab.
:param last_book_id: The "book reference id" of the book which is chosen at the moment. (int)
:param last_book: The "book reference id" of the book which is chosen at the moment. (int)
:return: None
"""
log.debug('initialise_advanced_bible {bible}, {ref}'.format(bible=self.bible, ref=last_book))
@ -1005,14 +1005,17 @@ class BibleMediaItem(MediaManagerItem):
}[self.settings.display_style]
return '{{su}}{bracket[0]}{verse_text}{bracket[1]}{{/su}} '.format(verse_text=verse_text, bracket=bracket)
def search(self, string, showError):
def search(self, string, show_error=True):
"""
Search for some Bible verses (by reference).
:param string: search string
:param show_error: do we show the error
:return: the results of the search
"""
if self.bible is None:
return []
reference = self.plugin.manager.parse_ref(self.bible.name, string)
search_results = self.plugin.manager.get_verses(self.bible.name, reference, showError)
search_results = self.plugin.manager.get_verses(self.bible.name, reference, show_error)
if search_results:
verse_text = ' '.join([verse.text for verse in search_results])
return [[string, verse_text]]

View File

@ -321,9 +321,12 @@ class SongMediaItem(MediaManagerItem):
:param search_results: A tuple containing (songbook entry, book name, song title, song id)
:return: None
"""
def get_songbook_key(result):
"""Get the key to sort by"""
return (get_natural_key(result[1]), get_natural_key(result[0]), get_natural_key(result[2]))
def get_songbook_key(text_array):
"""
Get the key to sort by
:param text_array: the result text to be processed.
"""
return get_natural_key(text_array[1]), get_natural_key(text_array[0]), get_natural_key(text_array[2])
log.debug('display results Book')
self.list_view.clear()
@ -373,7 +376,7 @@ class SongMediaItem(MediaManagerItem):
"""
def get_theme_key(song):
"""Get the key to sort by"""
return (get_natural_key(song.theme_name), song.sort_key)
return get_natural_key(song.theme_name), song.sort_key
log.debug('display results Themes')
self.list_view.clear()
@ -396,7 +399,7 @@ class SongMediaItem(MediaManagerItem):
"""
def get_cclinumber_key(song):
"""Get the key to sort by"""
return (get_natural_key(song.ccli_number), song.sort_key)
return get_natural_key(song.ccli_number), song.sort_key
log.debug('display results CCLI number')
self.list_view.clear()
@ -460,6 +463,8 @@ class SongMediaItem(MediaManagerItem):
"""
Called by ServiceManager or SlideController by event passing the Song Id in the payload along with an indicator
to say which type of display is required.
:param song_id: the id of the song
:param preview: show we preview after the update
"""
log.debug('on_remote_edit for song {song}'.format(song=song_id))
song_id = int(song_id)
@ -721,7 +726,8 @@ class SongMediaItem(MediaManagerItem):
self.generate_footer(item, song)
return item
def _authors_match(self, song, authors):
@staticmethod
def _authors_match(song, authors):
"""
Checks whether authors from a song in the database match the authors of the song to be imported.
@ -738,11 +744,12 @@ class SongMediaItem(MediaManagerItem):
# List must be empty at the end
return not author_list
def search(self, string, show_error):
def search(self, string, show_error=True):
"""
Search for some songs
:param string: The string to show
:param show_error: Is this an error?
:return: the results of the search
"""
search_results = self.search_entire(string)
return [[song.id, song.title, song.alternate_title] for song in search_results]