forked from openlp/openlp
add song book as first slide
This commit is contained in:
parent
351a0d53df
commit
9e0cb247d6
@ -164,7 +164,7 @@ class Song(BaseModel):
|
||||
"""
|
||||
Add a Songbook Entry to the song if it not yet exists
|
||||
|
||||
:param songbook_name: Name of the Songbook.
|
||||
:param songbook: Name of the Songbook.
|
||||
:param entry: Entry in the Songbook (usually a number)
|
||||
"""
|
||||
for songbook_entry in self.songbook_entries:
|
||||
|
@ -577,6 +577,14 @@ class SongMediaItem(MediaManagerItem):
|
||||
service_item.theme = song.theme_name
|
||||
service_item.edit_id = item_id
|
||||
verse_list = SongXML().get_verses(song.lyrics)
|
||||
if Settings().value('songs/add songbook slide') and song.songbook_entries:
|
||||
first_slide = "\n"
|
||||
for songbook_entry in song.songbook_entries:
|
||||
first_slide = first_slide + "{book}/{num}/{pub}\n\n".format(book=songbook_entry.songbook.name,
|
||||
num=songbook_entry.entry,
|
||||
pub=songbook_entry.songbook.publisher)
|
||||
|
||||
service_item.add_from_text(first_slide, "O1")
|
||||
# no verse list or only 1 space (in error)
|
||||
verse_tags_translated = False
|
||||
if VerseType.from_translated_string(str(verse_list[0][0]['type'])) is not None:
|
||||
@ -623,6 +631,9 @@ class SongMediaItem(MediaManagerItem):
|
||||
if song.media_files:
|
||||
service_item.add_capability(ItemCapabilities.HasBackgroundAudio)
|
||||
service_item.background_audio = [m.file_path for m in song.media_files]
|
||||
item.metadata.append("<em>{label}:</em> {media}".
|
||||
format(label=translate('SongsPlugin.MediaItem', 'Media'),
|
||||
media=service_item.background_audio))
|
||||
return True
|
||||
|
||||
def generate_footer(self, item, song):
|
||||
@ -696,7 +707,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
for songbook_entry in song.songbook_entries:
|
||||
item.metadata.append("<em>{label}:</em> {book}/{num}/{pub}".
|
||||
format(label=translate('SongsPlugin.MediaItem', 'Songbook'),
|
||||
book=songbook_entry.songbook.name,
|
||||
book=songbook_entry.songbook.name,
|
||||
num=songbook_entry.entry,
|
||||
pub=songbook_entry.songbook.publisher))
|
||||
if song.topics:
|
||||
|
@ -51,6 +51,9 @@ class SongsTab(SettingsTab):
|
||||
self.add_from_service_check_box = QtWidgets.QCheckBox(self.mode_group_box)
|
||||
self.add_from_service_check_box.setObjectName('add_from_service_check_box')
|
||||
self.mode_layout.addWidget(self.add_from_service_check_box)
|
||||
self.songbook_slide_check_box = QtWidgets.QCheckBox(self.mode_group_box)
|
||||
self.songbook_slide_check_box.setObjectName('songbook_slide_check_box')
|
||||
self.mode_layout.addWidget(self.songbook_slide_check_box)
|
||||
self.display_songbook_check_box = QtWidgets.QCheckBox(self.mode_group_box)
|
||||
self.display_songbook_check_box.setObjectName('songbook_check_box')
|
||||
self.mode_layout.addWidget(self.display_songbook_check_box)
|
||||
@ -95,6 +98,7 @@ class SongsTab(SettingsTab):
|
||||
self.tool_bar_active_check_box.stateChanged.connect(self.on_tool_bar_active_check_box_changed)
|
||||
self.update_on_edit_check_box.stateChanged.connect(self.on_update_on_edit_check_box_changed)
|
||||
self.add_from_service_check_box.stateChanged.connect(self.on_add_from_service_check_box_changed)
|
||||
self.songbook_slide_check_box.stateChanged.connect(self.on_songbook_slide_check_box_changed)
|
||||
self.display_songbook_check_box.stateChanged.connect(self.on_songbook_check_box_changed)
|
||||
self.display_written_by_check_box.stateChanged.connect(self.on_written_by_check_box_changed)
|
||||
self.display_copyright_check_box.stateChanged.connect(self.on_copyright_check_box_changed)
|
||||
@ -111,6 +115,8 @@ class SongsTab(SettingsTab):
|
||||
self.update_on_edit_check_box.setText(translate('SongsPlugin.SongsTab', 'Update service from song edit'))
|
||||
self.add_from_service_check_box.setText(translate('SongsPlugin.SongsTab',
|
||||
'Import missing songs from Service files'))
|
||||
self.songbook_slide_check_box.setText(translate('SongsPlugin.SongsTab',
|
||||
'Add Songbooks as first side'))
|
||||
self.display_songbook_check_box.setText(translate('SongsPlugin.SongsTab', 'Display songbook in footer'))
|
||||
self.display_written_by_check_box.setText(translate(
|
||||
'SongsPlugin.SongsTab', 'Show "Written by:" in footer for unspecified authors'))
|
||||
@ -141,6 +147,9 @@ class SongsTab(SettingsTab):
|
||||
def on_add_from_service_check_box_changed(self, check_state):
|
||||
self.update_load = (check_state == QtCore.Qt.Checked)
|
||||
|
||||
def on_songbook_slide_check_box_changed(self, check_state):
|
||||
self.songbook_slide = (check_state == QtCore.Qt.Checked)
|
||||
|
||||
def on_songbook_check_box_changed(self, check_state):
|
||||
self.display_songbook = (check_state == QtCore.Qt.Checked)
|
||||
|
||||
@ -171,6 +180,7 @@ class SongsTab(SettingsTab):
|
||||
self.tool_bar = settings.value('display songbar')
|
||||
self.update_edit = settings.value('update service on edit')
|
||||
self.update_load = settings.value('add song from service')
|
||||
self.songbook_slide = settings.value('add songbook slide')
|
||||
self.display_songbook = settings.value('display songbook')
|
||||
self.display_written_by = settings.value('display written by')
|
||||
self.display_copyright_symbol = settings.value('display copyright symbol')
|
||||
@ -208,6 +218,7 @@ class SongsTab(SettingsTab):
|
||||
settings.setValue('mainview chords', self.mainview_chords)
|
||||
settings.setValue('disable chords import', self.disable_chords_import)
|
||||
settings.setValue('chord notation', self.chord_notation)
|
||||
settings.setValue('add songbook slide', self.songbook_slide)
|
||||
settings.endGroup()
|
||||
if self.tab_visited:
|
||||
self.settings_form.register_post_process('songs_config_updated')
|
||||
|
@ -61,6 +61,7 @@ __default_settings__ = {
|
||||
'songs/last import type': SongFormat.OpenLyrics,
|
||||
'songs/update service on edit': False,
|
||||
'songs/add song from service': True,
|
||||
'songs/add songbook slide': False,
|
||||
'songs/display songbar': True,
|
||||
'songs/display songbook': False,
|
||||
'songs/display written by': True,
|
||||
|
Loading…
Reference in New Issue
Block a user