forked from openlp/openlp
Add an option to display the songbook in the footer
This commit is contained in:
parent
b7aee018e5
commit
e0d813db3f
@ -36,8 +36,8 @@ from PyQt4 import QtCore, QtGui
|
||||
from sqlalchemy.sql import or_
|
||||
|
||||
from openlp.core.common import Registry, AppLocation, Settings, check_directory_exists, UiStrings, translate
|
||||
from openlp.core.lib import MediaManagerItem, ItemCapabilities, PluginStatus, ServiceItemContext, check_item_selected, \
|
||||
create_separated_list
|
||||
from openlp.core.lib import MediaManagerItem, ItemCapabilities, PluginStatus, ServiceItem, ServiceItemContext, \
|
||||
check_item_selected, create_separated_list
|
||||
from openlp.core.lib.ui import create_widget_action
|
||||
from openlp.plugins.songs.forms.editsongform import EditSongForm
|
||||
from openlp.plugins.songs.forms.songmaintenanceform import SongMaintenanceForm
|
||||
@ -460,7 +460,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
service_item.background_audio = [m.file_name for m in song.media_files]
|
||||
return True
|
||||
|
||||
def generate_footer(self, item, song):
|
||||
def generate_footer(self, item: ServiceItem, song: Song):
|
||||
"""
|
||||
Generates the song footer based on a song and adds details to a service item.
|
||||
|
||||
@ -506,6 +506,8 @@ class SongMediaItem(MediaManagerItem):
|
||||
item.raw_footer.append("%s: %s" % (AuthorType.Types[AuthorType.Translation],
|
||||
create_separated_list(authors_translation)))
|
||||
item.raw_footer.append(song.copyright)
|
||||
if Settings().value('songs/display songbook') and song.book:
|
||||
item.raw_footer.append("%s #%s" % (song.book.name, song.song_number))
|
||||
if Settings().value('core/ccli number'):
|
||||
item.raw_footer.append(translate('SongsPlugin.MediaItem',
|
||||
'CCLI License: ') + Settings().value('core/ccli number'))
|
||||
|
@ -59,6 +59,9 @@ class SongsTab(SettingsTab):
|
||||
self.add_from_service_check_box = QtGui.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.display_songbook_check_box = QtGui.QCheckBox(self.mode_group_box)
|
||||
self.display_songbook_check_box.setObjectName('songbook_check_box')
|
||||
self.mode_layout.addWidget(self.display_songbook_check_box)
|
||||
self.left_layout.addWidget(self.mode_group_box)
|
||||
self.left_layout.addStretch()
|
||||
self.right_layout.addStretch()
|
||||
@ -66,6 +69,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.display_songbook_check_box.stateChanged.connect(self.on_songbook_check_box_changed)
|
||||
|
||||
def retranslateUi(self):
|
||||
self.mode_group_box.setTitle(translate('SongsPlugin.SongsTab', 'Songs Mode'))
|
||||
@ -75,6 +79,7 @@ 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.display_songbook_check_box.setText(translate('SongsPlugin.SongsTab', 'Display songbook in footer'))
|
||||
|
||||
def on_search_as_type_check_box_changed(self, check_state):
|
||||
self.song_search = (check_state == QtCore.Qt.Checked)
|
||||
@ -88,6 +93,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_check_box_changed(self, check_state):
|
||||
self.display_songbook = (check_state == QtCore.Qt.Checked)
|
||||
|
||||
def load(self):
|
||||
settings = Settings()
|
||||
settings.beginGroup(self.settings_section)
|
||||
@ -95,10 +103,12 @@ 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.display_songbook = settings.value('display songbook')
|
||||
self.search_as_type_check_box.setChecked(self.song_search)
|
||||
self.tool_bar_active_check_box.setChecked(self.tool_bar)
|
||||
self.update_on_edit_check_box.setChecked(self.update_edit)
|
||||
self.add_from_service_check_box.setChecked(self.update_load)
|
||||
self.display_songbook_check_box.setChecked(self.display_songbook)
|
||||
settings.endGroup()
|
||||
|
||||
def save(self):
|
||||
@ -108,6 +118,7 @@ class SongsTab(SettingsTab):
|
||||
settings.setValue('display songbar', self.tool_bar)
|
||||
settings.setValue('update service on edit', self.update_edit)
|
||||
settings.setValue('add song from service', self.update_load)
|
||||
settings.setValue('display songbook', self.display_songbook)
|
||||
settings.endGroup()
|
||||
if self.tab_visited:
|
||||
self.settings_form.register_post_process('songs_config_updated')
|
||||
|
@ -63,6 +63,7 @@ __default_settings__ = {
|
||||
'songs/search as type': False,
|
||||
'songs/add song from service': True,
|
||||
'songs/display songbar': True,
|
||||
'songs/display songbook': False,
|
||||
'songs/last directory import': '',
|
||||
'songs/last directory export': '',
|
||||
'songs/songselect username': '',
|
||||
|
Loading…
Reference in New Issue
Block a user