openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #24383
[Merge] lp:~martin-woodhart/openlp/show-hide-song-footer into lp:openlp
Marty Woodhart has proposed merging lp:~martin-woodhart/openlp/show-hide-song-footer into lp:openlp.
Requested reviews:
Tim Bentley (trb143)
For more details, see:
https://code.launchpad.net/~martin-woodhart/openlp/show-hide-song-footer/+merge/238838
Add ability to specify when the footer text in a song is to be shown. Eg. Show Footer only on First slide and hide it on every other.
Settings confined to Song plugin - located under Edit Song --> Theme, Copyrights & Comments tab --> Song Footer.
--
https://code.launchpad.net/~martin-woodhart/openlp/show-hide-song-footer/+merge/238838
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/common/__init__.py'
--- openlp/core/common/__init__.py 2014-08-27 23:18:06 +0000
+++ openlp/core/common/__init__.py 2014-10-19 22:05:44 +0000
@@ -120,6 +120,16 @@
Next = 3
+class SlideFooter(object):
+ """
+ Provides an enumeration for when to show the footer text during the songs
+ """
+ All = 0
+ First = 1
+ Last = 2
+ FirstAndLast = 3
+
+
def de_hump(name):
"""
Change any Camel Case string to python string
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2014-09-23 21:45:42 +0000
+++ openlp/core/lib/serviceitem.py 2014-10-19 22:05:44 +0000
@@ -39,7 +39,7 @@
from PyQt4 import QtGui
-from openlp.core.common import RegistryProperties, Settings, translate, AppLocation
+from openlp.core.common import RegistryProperties, Settings, translate, AppLocation, SlideFooter
from openlp.core.lib import ImageSource, build_icon, clean_tags, expand_tags, create_thumb
log = logging.getLogger(__name__)
@@ -202,6 +202,7 @@
self.timed_slide_interval = 0
self.will_auto_start = False
self.has_original_files = True
+ self.slide_footer = SlideFooter.All
self._new_item()
def _new_item(self):
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2014-08-27 23:18:06 +0000
+++ openlp/core/ui/maindisplay.py 2014-10-19 22:05:44 +0000
@@ -326,7 +326,7 @@
# clear the cache
self.override = {}
- def preview(self):
+ def preview(self, hide_slide):
"""
Generates a preview of the image displayed.
"""
@@ -337,6 +337,12 @@
# Wait for the fade to finish before geting the preview.
# Important otherwise preview will have incorrect text if at all!
if self.service_item.theme_data and self.service_item.theme_data.display_slide_transition:
+ if hide_slide:
+ if self.service_item.foot_text:
+ self.footer("")
+ else:
+ if self.service_item.foot_text:
+ self.footer(self.service_item.foot_text)
while not self.frame.evaluateJavaScript('show_text_completed()'):
self.application.process_events()
# Wait for the webview to update before getting the preview.
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2014-07-15 18:52:59 +0000
+++ openlp/core/ui/slidecontroller.py 2014-10-19 22:05:44 +0000
@@ -36,7 +36,7 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.common import Registry, RegistryProperties, Settings, SlideLimits, UiStrings, translate, \
+from openlp.core.common import Registry, RegistryProperties, Settings, SlideLimits, UiStrings, translate, SlideFooter, \
RegistryMixin, OpenLPMixin
from openlp.core.lib import OpenLPToolbar, ItemCapabilities, ServiceItem, ImageSource, ServiceItemAction, \
ScreenList, build_icon, build_html
@@ -1069,10 +1069,38 @@
QtCore.QTimer.singleShot(0.5, self.grab_maindisplay)
QtCore.QTimer.singleShot(2.5, self.grab_maindisplay)
else:
- self.slide_image = self.display.preview()
+ hide_footer = self.check_to_hide_footer(self.service_item.slide_footer,
+ self.preview_widget.current_slide_number() + 1,
+ self.preview_widget.slide_count())
+ self.slide_image = self.display.preview(hide_footer)
self.slide_preview.setPixmap(self.slide_image)
self.slide_count += 1
+ def check_to_hide_footer(self, slide_footer, current_slide, slide_count):
+ """
+ Determines if the current slide should hide the text in the footer
+ """
+ hide_footer = False
+ if current_slide == 1:
+ # If it's on the first slide only hide the footer when the 'Show footer on
+ # last slide' setting is on
+ if slide_footer == SlideFooter.Last:
+ hide_footer = True
+ elif current_slide == slide_count:
+ # If it's on the last slide only hide the footer when the 'Show footer on
+ # first slide' setting is on
+ if slide_footer == SlideFooter.First:
+ hide_footer = True
+ else:
+ # If it's on any of the middle slides only hide the footer if the 'Show footer on all
+ # slides' setting is not on (ie. when setting is either First, Last or First + Last)
+ if (slide_footer != SlideFooter.All) & \
+ ((slide_footer == SlideFooter.First) |
+ (slide_footer == SlideFooter.Last) |
+ (slide_footer == SlideFooter.FirstAndLast)):
+ hide_footer = True
+ return hide_footer
+
def grab_maindisplay(self):
"""
Creates an image of the current screen and updates the preview frame.
=== modified file 'openlp/plugins/songs/forms/editsongdialog.py'
--- openlp/plugins/songs/forms/editsongdialog.py 2014-07-14 16:25:59 +0000
+++ openlp/plugins/songs/forms/editsongdialog.py 2014-10-19 22:05:44 +0000
@@ -29,7 +29,7 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.common import UiStrings, translate
+from openlp.core.common import UiStrings, translate, SlideFooter
from openlp.core.lib import build_icon
from openlp.core.lib.ui import create_button_box, create_button
from openlp.core.ui import SingleColumnTableWidget
@@ -239,8 +239,18 @@
self.ccli_layout.addWidget(self.ccli_number_edit)
self.rights_layout.addLayout(self.ccli_layout)
self.theme_left_layout.addWidget(self.rights_group_box)
+ # footer tab
+ self.footer_group_box = QtGui.QGroupBox(self.theme_tab)
+ self.footer_group_box.setObjectName('footer_group_box')
+ self.footer_layout = QtGui.QHBoxLayout(self.footer_group_box)
+ self.footer_layout.setObjectName('footer_layout')
+ self.footer_combo_box = create_combo_box(self.footer_group_box, 'footer_combo_box')
+ self.footer_combo_box.addItems(['', '', '', ''])
+ self.footer_layout.addWidget(self.footer_combo_box)
+ self.theme_left_layout.addWidget(self.footer_group_box)
self.theme_left_layout.addStretch()
self.theme_tab_layout.addLayout(self.theme_left_layout)
+ # comments tab
self.comments_group_box = QtGui.QGroupBox(self.theme_tab)
self.comments_group_box.setObjectName('comments_group_box')
self.comments_layout = QtGui.QVBoxLayout(self.comments_group_box)
@@ -324,6 +334,17 @@
self.rights_group_box.setTitle(translate('SongsPlugin.EditSongForm', 'Copyright Information'))
self.copyright_insert_button.setText(SongStrings.CopyrightSymbol)
self.ccli_label.setText(UiStrings().CCLINumberLabel)
+
+ self.footer_group_box.setTitle(translate('SongsPlugin.EditSongForm', 'Show Footer'))
+
+ self.footer_combo_box.setItemText(SlideFooter.All, translate('SongsPlugin.EditSongForm', 'All Slides'))
+ self.footer_combo_box.setItemText(SlideFooter.First,
+ translate('SongsPlugin.EditSongForm', 'First Slide Only'))
+ self.footer_combo_box.setItemText(SlideFooter.Last,
+ translate('SongsPlugin.EditSongForm', 'Last Slide Only'))
+ self.footer_combo_box.setItemText(SlideFooter.FirstAndLast,
+ translate('SongsPlugin.EditSongForm', 'First and Last Slide'))
+
self.comments_group_box.setTitle(translate('SongsPlugin.EditSongForm', 'Comments'))
self.song_tab_widget.setTabText(self.song_tab_widget.indexOf(self.theme_tab),
translate('SongsPlugin.EditSongForm', 'Theme, Copyright Info && Comments'))
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py 2014-07-14 16:25:59 +0000
+++ openlp/plugins/songs/forms/editsongform.py 2014-10-19 22:05:44 +0000
@@ -38,7 +38,7 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.common import Registry, RegistryProperties, AppLocation, UiStrings, check_directory_exists, translate
+from openlp.core.common import Registry, RegistryProperties, AppLocation, UiStrings, check_directory_exists, translate, SlideFooter
from openlp.core.lib import FileDialog, PluginStatus, MediaType, create_separated_list
from openlp.core.lib.ui import set_case_insensitive_completer, critical_error_message_box, find_and_set_in_combo_box
from openlp.plugins.songs.lib import VerseType, clean_song
@@ -456,6 +456,17 @@
self.theme_combo_box.setEditText('')
self.theme_combo_box.setCurrentIndex(0)
self.copyright_edit.setText(self.song.copyright if self.song.copyright else '')
+ if self.song.footer:
+ if self.song.footer == SlideFooter.All:
+ self.footer_combo_box.setCurrentIndex(SlideFooter.All)
+ elif self.song.footer == SlideFooter.First:
+ self.footer_combo_box.setCurrentIndex(SlideFooter.First)
+ elif self.song.footer == SlideFooter.Last:
+ self.footer_combo_box.setCurrentIndex(SlideFooter.Last)
+ elif self.song.footer == SlideFooter.FirstAndLast:
+ self.footer_combo_box.setCurrentIndex(SlideFooter.FirstAndLast)
+ else:
+ self.footer_combo_box.setCurrentIndex(0)
self.comments_edit.setPlainText(self.song.comments if self.song.comments else '')
self.ccli_number_edit.setText(self.song.ccli_number if self.song.ccli_number else '')
self.song_book_number_edit.setText(self.song.song_number if self.song.song_number else '')
@@ -965,6 +976,7 @@
self.song.search_lyrics = ''
self.song.verse_order = ''
self.song.comments = self.comments_edit.toPlainText()
+ self.song.footer = self.footer_combo_box.currentIndex()
order_text = self.verse_order_edit.text()
order = []
for item in order_text.split():
=== modified file 'openlp/plugins/songs/lib/db.py'
--- openlp/plugins/songs/lib/db.py 2014-09-14 13:35:55 +0000
+++ openlp/plugins/songs/lib/db.py 2014-10-19 22:05:44 +0000
@@ -238,6 +238,7 @@
* theme_name
* search_title
* search_lyrics
+ * footer
**songs_topics Table**
This is a bridging table between the *songs* and *topics* tables, which
@@ -302,7 +303,8 @@
Column('search_lyrics', types.UnicodeText, nullable=False),
Column('create_date', types.DateTime(), default=func.now()),
Column('last_modified', types.DateTime(), default=func.now(), onupdate=func.now()),
- Column('temporary', types.Boolean(), default=False)
+ Column('temporary', types.Boolean(), default=False),
+ Column('footer', types.Integer(), default=0)
)
# Definition of the "topics" table
=== modified file 'openlp/plugins/songs/lib/importers/openlp.py'
--- openlp/plugins/songs/lib/importers/openlp.py 2014-07-04 09:35:10 +0000
+++ openlp/plugins/songs/lib/importers/openlp.py 2014-10-19 22:05:44 +0000
@@ -177,6 +177,7 @@
new_song.lyrics = song.lyrics
new_song.verse_order = song.verse_order
new_song.copyright = song.copyright
+ new_song.footer = song.footer
new_song.comments = song.comments
new_song.theme_name = song.theme_name
new_song.ccli_number = song.ccli_number
=== modified file 'openlp/plugins/songs/lib/importers/songimport.py'
--- openlp/plugins/songs/lib/importers/songimport.py 2014-08-18 19:04:46 +0000
+++ openlp/plugins/songs/lib/importers/songimport.py 2014-10-19 22:05:44 +0000
@@ -34,7 +34,7 @@
from PyQt4 import QtCore
-from openlp.core.common import Registry, AppLocation, check_directory_exists, translate
+from openlp.core.common import Registry, AppLocation, check_directory_exists, translate, SlideFooter
from openlp.core.ui.wizard import WizardStrings
from openlp.plugins.songs.lib import clean_song, VerseType
from openlp.plugins.songs.lib.db import Song, Author, Topic, Book, MediaFile
@@ -344,6 +344,7 @@
song.search_lyrics = ''
song.verse_order = ''
song.song_number = self.song_number
+ song.footer = SlideFooter.All
verses_changed_to_other = {}
sxml = SongXML()
other_count = 1
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2014-07-09 12:45:54 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2014-10-19 22:05:44 +0000
@@ -417,6 +417,7 @@
song = self.plugin.manager.get_object(Song, item_id)
service_item.theme = song.theme_name
service_item.edit_id = item_id
+ service_item.slide_footer = song.footer
verse_list = SongXML().get_verses(song.lyrics)
# no verse list or only 1 space (in error)
verse_tags_translated = False
=== modified file 'openlp/plugins/songs/lib/openlyricsxml.py'
--- openlp/plugins/songs/lib/openlyricsxml.py 2014-07-03 16:54:51 +0000
+++ openlp/plugins/songs/lib/openlyricsxml.py 2014-10-19 22:05:44 +0000
@@ -68,7 +68,7 @@
from lxml import etree, objectify
-from openlp.core.common import translate
+from openlp.core.common import translate, SlideFooter
from openlp.core.lib import FormattingTags
from openlp.plugins.songs.lib import VerseType, clean_song
from openlp.plugins.songs.lib.db import Author, AuthorType, Book, Song, Topic
@@ -397,6 +397,7 @@
song.search_lyrics = ''
song.verse_order = ''
song.search_title = ''
+ song.footer = SlideFooter.All
song.temporary = parse_and_temporary_save
self._process_copyright(properties, song)
self._process_cclinumber(properties, song)
=== modified file 'openlp/plugins/songs/lib/upgrade.py'
--- openlp/plugins/songs/lib/upgrade.py 2014-07-17 21:04:58 +0000
+++ openlp/plugins/songs/lib/upgrade.py 2014-10-19 22:05:44 +0000
@@ -38,7 +38,7 @@
from openlp.core.lib.db import get_upgrade_op
log = logging.getLogger(__name__)
-__version__ = 4
+__version__ = 5
def upgrade_1(session, metadata):
@@ -106,3 +106,14 @@
op.execute('INSERT INTO authors_songs_tmp SELECT author_id, song_id, "" FROM authors_songs')
op.drop_table('authors_songs')
op.rename_table('authors_songs_tmp', 'authors_songs')
+
+
+def upgrade_5(session, metadata):
+ """
+ Version 5 upgrade.
+
+ This upgrade adds a footer enum to the songs table, indicating when the footer section of the slide should
+ be shown on a song
+ """
+ op = get_upgrade_op(session)
+ op.add_column('songs', Column('footer', types.Integer(), default=0))
Follow ups