Option for displaying copyright symbol

This commit is contained in:
Samuel Mehrbrodt 2014-07-09 14:33:26 +02:00
parent 8c2a86580f
commit 383f7ef6e2
3 changed files with 24 additions and 2 deletions

View File

@ -36,7 +36,7 @@ from PyQt4 import QtCore, QtGui
from sqlalchemy.sql import or_ from sqlalchemy.sql import or_
from openlp.core.common import Registry, AppLocation, Settings, check_directory_exists, UiStrings, translate from openlp.core.common import Registry, AppLocation, Settings, check_directory_exists, UiStrings, translate
from openlp.core.lib import MediaManagerItem, ItemCapabilities, PluginStatus, ServiceItem, ServiceItemContext, \ from openlp.core.lib import MediaManagerItem, ItemCapabilities, PluginStatus, ServiceItemContext, \
check_item_selected, create_separated_list check_item_selected, create_separated_list
from openlp.core.lib.ui import create_widget_action from openlp.core.lib.ui import create_widget_action
from openlp.plugins.songs.forms.editsongform import EditSongForm from openlp.plugins.songs.forms.editsongform import EditSongForm
@ -126,6 +126,7 @@ class SongMediaItem(MediaManagerItem):
self.update_service_on_edit = Settings().value(self.settings_section + '/update service on edit') self.update_service_on_edit = Settings().value(self.settings_section + '/update service on edit')
self.add_song_from_service = Settings().value(self.settings_section + '/add song from service') self.add_song_from_service = Settings().value(self.settings_section + '/add song from service')
self.display_songbook = Settings().value(self.settings_section + '/display songbook') self.display_songbook = Settings().value(self.settings_section + '/display songbook')
self.display_copyright_symbol = Settings().value(self.settings_section + '/display copyright symbol')
def retranslateUi(self): def retranslateUi(self):
self.search_text_label.setText('%s:' % UiStrings().Search) self.search_text_label.setText('%s:' % UiStrings().Search)
@ -506,6 +507,12 @@ class SongMediaItem(MediaManagerItem):
if authors_translation: if authors_translation:
item.raw_footer.append("%s: %s" % (AuthorType.Types[AuthorType.Translation], item.raw_footer.append("%s: %s" % (AuthorType.Types[AuthorType.Translation],
create_separated_list(authors_translation))) create_separated_list(authors_translation)))
if song.copyright:
if self.display_copyright_symbol:
print("copyright")
item.raw_footer.append("%s %s" % (SongStrings.CopyrightSymbol, song.copyright))
else:
print("no copyright")
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.book:
item.raw_footer.append("%s #%s" % (song.book.name, song.song_number)) item.raw_footer.append("%s #%s" % (song.book.name, song.song_number))

View File

@ -31,6 +31,7 @@ from PyQt4 import QtCore, QtGui
from openlp.core.common import Settings, translate from openlp.core.common import Settings, translate
from openlp.core.lib import SettingsTab from openlp.core.lib import SettingsTab
from openlp.plugins.songs.lib.ui import SongStrings
class SongsTab(SettingsTab): class SongsTab(SettingsTab):
@ -62,6 +63,9 @@ class SongsTab(SettingsTab):
self.display_songbook_check_box = QtGui.QCheckBox(self.mode_group_box) self.display_songbook_check_box = QtGui.QCheckBox(self.mode_group_box)
self.display_songbook_check_box.setObjectName('songbook_check_box') self.display_songbook_check_box.setObjectName('songbook_check_box')
self.mode_layout.addWidget(self.display_songbook_check_box) self.mode_layout.addWidget(self.display_songbook_check_box)
self.display_copyright_check_box = QtGui.QCheckBox(self.mode_group_box)
self.display_copyright_check_box.setObjectName('copyright_check_box')
self.mode_layout.addWidget(self.display_copyright_check_box)
self.left_layout.addWidget(self.mode_group_box) self.left_layout.addWidget(self.mode_group_box)
self.left_layout.addStretch() self.left_layout.addStretch()
self.right_layout.addStretch() self.right_layout.addStretch()
@ -70,6 +74,7 @@ class SongsTab(SettingsTab):
self.update_on_edit_check_box.stateChanged.connect(self.on_update_on_edit_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.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) self.display_songbook_check_box.stateChanged.connect(self.on_songbook_check_box_changed)
self.display_copyright_check_box.stateChanged.connect(self.on_copyright_check_box_changed)
def retranslateUi(self): def retranslateUi(self):
self.mode_group_box.setTitle(translate('SongsPlugin.SongsTab', 'Songs Mode')) self.mode_group_box.setTitle(translate('SongsPlugin.SongsTab', 'Songs Mode'))
@ -80,6 +85,9 @@ class SongsTab(SettingsTab):
self.add_from_service_check_box.setText(translate('SongsPlugin.SongsTab', self.add_from_service_check_box.setText(translate('SongsPlugin.SongsTab',
'Import missing songs from service files')) 'Import missing songs from service files'))
self.display_songbook_check_box.setText(translate('SongsPlugin.SongsTab', 'Display songbook in footer')) self.display_songbook_check_box.setText(translate('SongsPlugin.SongsTab', 'Display songbook in footer'))
self.display_copyright_check_box.setText(translate('SongsPlugin.SongsTab',
'Display "%s" symbol before copyright info' %
SongStrings.CopyrightSymbol))
def on_search_as_type_check_box_changed(self, check_state): def on_search_as_type_check_box_changed(self, check_state):
self.song_search = (check_state == QtCore.Qt.Checked) self.song_search = (check_state == QtCore.Qt.Checked)
@ -96,6 +104,9 @@ class SongsTab(SettingsTab):
def on_songbook_check_box_changed(self, check_state): def on_songbook_check_box_changed(self, check_state):
self.display_songbook = (check_state == QtCore.Qt.Checked) self.display_songbook = (check_state == QtCore.Qt.Checked)
def on_copyright_check_box_changed(self, check_state):
self.display_copyright_symbol = (check_state == QtCore.Qt.Checked)
def load(self): def load(self):
settings = Settings() settings = Settings()
settings.beginGroup(self.settings_section) settings.beginGroup(self.settings_section)
@ -104,11 +115,13 @@ class SongsTab(SettingsTab):
self.update_edit = settings.value('update service on edit') self.update_edit = settings.value('update service on edit')
self.update_load = settings.value('add song from service') self.update_load = settings.value('add song from service')
self.display_songbook = settings.value('display songbook') self.display_songbook = settings.value('display songbook')
self.display_copyright_symbol = settings.value('display copyright symbol')
self.search_as_type_check_box.setChecked(self.song_search) self.search_as_type_check_box.setChecked(self.song_search)
self.tool_bar_active_check_box.setChecked(self.tool_bar) self.tool_bar_active_check_box.setChecked(self.tool_bar)
self.update_on_edit_check_box.setChecked(self.update_edit) self.update_on_edit_check_box.setChecked(self.update_edit)
self.add_from_service_check_box.setChecked(self.update_load) self.add_from_service_check_box.setChecked(self.update_load)
self.display_songbook_check_box.setChecked(self.display_songbook) self.display_songbook_check_box.setChecked(self.display_songbook)
self.display_copyright_check_box.setChecked(self.display_copyright_symbol)
settings.endGroup() settings.endGroup()
def save(self): def save(self):
@ -119,6 +132,7 @@ class SongsTab(SettingsTab):
settings.setValue('update service on edit', self.update_edit) settings.setValue('update service on edit', self.update_edit)
settings.setValue('add song from service', self.update_load) settings.setValue('add song from service', self.update_load)
settings.setValue('display songbook', self.display_songbook) settings.setValue('display songbook', self.display_songbook)
settings.setValue('display copyright symbol', self.display_copyright_symbol)
settings.endGroup() settings.endGroup()
if self.tab_visited: if self.tab_visited:
self.settings_form.register_post_process('songs_config_updated') self.settings_form.register_post_process('songs_config_updated')

View File

@ -64,6 +64,7 @@ __default_settings__ = {
'songs/add song from service': True, 'songs/add song from service': True,
'songs/display songbar': True, 'songs/display songbar': True,
'songs/display songbook': False, 'songs/display songbook': False,
'songs/display copyright symbol': False,
'songs/last directory import': '', 'songs/last directory import': '',
'songs/last directory export': '', 'songs/last directory export': '',
'songs/songselect username': '', 'songs/songselect username': '',