Display multiple songbooks in the footer

This commit is contained in:
Samuel Mehrbrodt 2016-01-04 13:48:47 +01:00
parent c7d7d16921
commit a106245d8b
3 changed files with 10 additions and 5 deletions

View File

@ -414,6 +414,7 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties):
self.authors_list_view.clear() self.authors_list_view.clear()
self.topics_list_view.clear() self.topics_list_view.clear()
self.songbooks_list_view.clear() self.songbooks_list_view.clear()
self.songbook_entry_edit.clear()
self.audio_list_widget.clear() self.audio_list_widget.clear()
self.title_edit.setFocus() self.title_edit.setFocus()
self.load_authors() self.load_authors()
@ -687,7 +688,7 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties):
self.add_songbookentry_to_list(songbook.id, songbook.name, self.songbook_entry_edit.text()) self.add_songbookentry_to_list(songbook.id, songbook.name, self.songbook_entry_edit.text())
self.load_songbooks() self.load_songbooks()
self.songbooks_combo_box.setCurrentIndex(0) self.songbooks_combo_box.setCurrentIndex(0)
self.songbook_entry_edit.setText("") self.songbook_entry_edit.clear()
else: else:
return return
elif item > 0: elif item > 0:
@ -699,7 +700,7 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties):
else: else:
self.add_songbookentry_to_list(songbook.id, songbook.name, self.songbook_entry_edit.text()) self.add_songbookentry_to_list(songbook.id, songbook.name, self.songbook_entry_edit.text())
self.songbooks_combo_box.setCurrentIndex(0) self.songbooks_combo_box.setCurrentIndex(0)
self.songbook_entry_edit.setText("") self.songbook_entry_edit.clear()
else: else:
QtWidgets.QMessageBox.warning( QtWidgets.QMessageBox.warning(
self, UiStrings().NISs, self, UiStrings().NISs,

View File

@ -181,6 +181,9 @@ class SongBookEntry(BaseModel):
""" """
SongBookEntry model SongBookEntry model
""" """
def __repr__(self):
return SongBookEntry.get_display_name(self.songbook.name, self.entry)
@staticmethod @staticmethod
def get_display_name(songbook_name, entry): def get_display_name(songbook_name, entry):
if entry: if entry:

View File

@ -37,7 +37,7 @@ from openlp.plugins.songs.forms.songmaintenanceform import SongMaintenanceForm
from openlp.plugins.songs.forms.songimportform import SongImportForm from openlp.plugins.songs.forms.songimportform import SongImportForm
from openlp.plugins.songs.forms.songexportform import SongExportForm from openlp.plugins.songs.forms.songexportform import SongExportForm
from openlp.plugins.songs.lib import VerseType, clean_string, delete_song from openlp.plugins.songs.lib import VerseType, clean_string, delete_song
from openlp.plugins.songs.lib.db import Author, AuthorType, Song, Book, MediaFile from openlp.plugins.songs.lib.db import Author, AuthorType, Song, Book, MediaFile, SongBookEntry
from openlp.plugins.songs.lib.ui import SongStrings from openlp.plugins.songs.lib.ui import SongStrings
from openlp.plugins.songs.lib.openlyricsxml import OpenLyrics, SongXML from openlp.plugins.songs.lib.openlyricsxml import OpenLyrics, SongXML
@ -523,8 +523,9 @@ class SongMediaItem(MediaManagerItem):
item.raw_footer.append("%s %s" % (SongStrings.CopyrightSymbol, song.copyright)) item.raw_footer.append("%s %s" % (SongStrings.CopyrightSymbol, song.copyright))
else: else:
item.raw_footer.append(song.copyright) item.raw_footer.append(song.copyright)
if self.display_songbook and song.book: if self.display_songbook and song.songbookentries:
item.raw_footer.append("%s #%s" % (song.book.name, song.song_number)) songbooks = [str(songbookentry) for songbookentry in song.songbookentries]
item.raw_footer.append(", ".join(songbooks))
if Settings().value('core/ccli number'): if Settings().value('core/ccli number'):
item.raw_footer.append(translate('SongsPlugin.MediaItem', item.raw_footer.append(translate('SongsPlugin.MediaItem',
'CCLI License: ') + Settings().value('core/ccli number')) 'CCLI License: ') + Settings().value('core/ccli number'))