diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index cfe183db6..dbc7a97da 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -112,7 +112,7 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties): Generically load a set of objects into a cache and a combobox. """ objects = self.manager.get_all_objects(cls) - get_key = lambda object: get_natural_key(object.name) + def get_key(object): return get_natural_key(object.name) objects.sort(key=get_key) combo.clear() combo.addItem('') @@ -347,7 +347,7 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties): Load the authors from the database into the combobox. """ authors = self.manager.get_all_objects(Author) - get_author_key = lambda author: get_natural_key(author.display_name) + def get_author_key(author): return get_natural_key(author.display_name) authors.sort(key=get_author_key) self.authors_combo_box.clear() self.authors_combo_box.addItem('') @@ -386,7 +386,7 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties): self.theme_combo_box.clear() self.theme_combo_box.addItem('') self.themes = theme_list - get_theme_key = lambda theme: get_natural_key(theme) + def get_theme_key(theme): return get_natural_key(theme) self.themes.sort(key=get_theme_key) self.theme_combo_box.addItems(theme_list) set_case_insensitive_completer(self.themes, self.theme_combo_box) diff --git a/openlp/plugins/songs/forms/songexportform.py b/openlp/plugins/songs/forms/songexportform.py index fbf909552..fc4ed16c5 100644 --- a/openlp/plugins/songs/forms/songexportform.py +++ b/openlp/plugins/songs/forms/songexportform.py @@ -213,7 +213,7 @@ class SongExportForm(OpenLPWizard): # Load the list of songs. self.application.set_busy_cursor() songs = self.plugin.manager.get_all_objects(Song) - get_song_key = lambda song: song.sort_key + def get_song_key(song): return song.sort_key songs.sort(key=get_song_key) for song in songs: # No need to export temporary songs. diff --git a/openlp/plugins/songs/forms/songmaintenanceform.py b/openlp/plugins/songs/forms/songmaintenanceform.py index 52c84acbd..e949b77c8 100644 --- a/openlp/plugins/songs/forms/songmaintenanceform.py +++ b/openlp/plugins/songs/forms/songmaintenanceform.py @@ -123,7 +123,7 @@ class SongMaintenanceForm(QtWidgets.QDialog, Ui_SongMaintenanceDialog, RegistryP """ self.authors_list_widget.clear() authors = self.manager.get_all_objects(Author) - get_author_key = lambda author: get_natural_key(author.display_name) + def get_author_key(author): return get_natural_key(author.display_name) authors.sort(key=get_author_key) for author in authors: if author.display_name: @@ -139,7 +139,7 @@ class SongMaintenanceForm(QtWidgets.QDialog, Ui_SongMaintenanceDialog, RegistryP """ self.topics_list_widget.clear() topics = self.manager.get_all_objects(Topic) - get_topic_key = lambda topic: get_natural_key(topic.name) + def get_topic_key(topic): return get_natural_key(topic.name) topics.sort(key=get_topic_key) for topic in topics: topic_name = QtWidgets.QListWidgetItem(topic.name) @@ -152,7 +152,7 @@ class SongMaintenanceForm(QtWidgets.QDialog, Ui_SongMaintenanceDialog, RegistryP """ self.song_books_list_widget.clear() books = self.manager.get_all_objects(Book) - get_book_key = lambda book: get_natural_key(book.name) + def get_book_key(book): return get_natural_key(book.name) books.sort(key=get_book_key) for book in books: book_name = QtWidgets.QListWidgetItem('%s (%s)' % (book.name, book.publisher)) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index c43a23781..30b26ea24 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -261,7 +261,7 @@ class SongMediaItem(MediaManagerItem): log.debug('display results Song') self.save_auto_select_id() self.list_view.clear() - get_song_key = lambda song: song.sort_key + def get_song_key(song): return song.sort_key search_results.sort(key=get_song_key) for song in search_results: # Do not display temporary songs @@ -286,10 +286,10 @@ class SongMediaItem(MediaManagerItem): """ log.debug('display results Author') self.list_view.clear() - get_author_key = lambda author: get_natural_key(author.display_name) + def get_author_key(author): return get_natural_key(author.display_name) search_results.sort(key=get_author_key) for author in search_results: - get_song_key = lambda song: song.sort_key + def get_song_key(song): return song.sort_key author.songs.sort(key=get_song_key) for song in author.songs: # Do not display temporary songs @@ -309,7 +309,8 @@ class SongMediaItem(MediaManagerItem): """ log.debug('display results Book') self.list_view.clear() - get_songbook_key = lambda songbook_entry:(get_natural_key(songbook_entry.songbook.name), get_natural_key(songbook_entry.entry)) + def get_songbook_key(songbook_entry): return (get_natural_key(songbook_entry.songbook.name), + get_natural_key(songbook_entry.entry)) search_results.sort(key=get_songbook_key) for songbook_entry in search_results: # Do not display temporary songs @@ -329,10 +330,10 @@ class SongMediaItem(MediaManagerItem): """ log.debug('display results Topic') self.list_view.clear() - get_topic_key = lambda topic: get_natural_key(topic.name) + def get_topic_key(topic): return get_natural_key(topic.name) search_results.sort(key=get_topic_key) for topic in search_results: - get_song_key = lambda song: song.sort_key + def get_song_key(song): return song.sort_key topic.songs.sort(key=get_song_key) for song in topic.songs: # Do not display temporary songs @@ -352,7 +353,7 @@ class SongMediaItem(MediaManagerItem): """ log.debug('display results Themes') self.list_view.clear() - get_theme_key = lambda song: (get_natural_key(song.theme_name), song.sort_key) + def get_theme_key(song): return (get_natural_key(song.theme_name), song.sort_key) search_results.sort(key=get_theme_key) for song in search_results: # Do not display temporary songs @@ -372,7 +373,7 @@ class SongMediaItem(MediaManagerItem): """ log.debug('display results CCLI number') self.list_view.clear() - get_cclinumber_key = lambda song: (get_natural_key(song.ccli_number), song.sort_key) + def get_cclinumber_key(song): return (get_natural_key(song.ccli_number), song.sort_key) search_results.sort(key=get_cclinumber_key) for song in search_results: # Do not display temporary songs