openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #23316
[Merge] lp:~sam92/openlp/title-slide into lp:openlp
Samuel Mehrbrodt has proposed merging lp:~sam92/openlp/title-slide into lp:openlp.
Requested reviews:
Raoul Snyman (raoul-snyman)
Tim Bentley (trb143)
For more details, see:
https://code.launchpad.net/~sam92/openlp/title-slide/+merge/216615
Add an option for a title slide.
lp:~sam92/openlp/title-slide (revision 2356)
[SUCCESS] http://ci.openlp.org/job/Branch-01-Pull/381/
[SUCCESS] http://ci.openlp.org/job/Branch-02-Functional-Tests/338/
[SUCCESS] http://ci.openlp.org/job/Branch-03-Interface-Tests/285/
[SUCCESS] http://ci.openlp.org/job/Branch-04-Windows_Tests/247/
[SUCCESS] http://ci.openlp.org/job/Branch-05a-Code_Analysis/170/
[SUCCESS] http://ci.openlp.org/job/Branch-05b-Test_Coverage/45/
--
https://code.launchpad.net/~sam92/openlp/title-slide/+merge/216615
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2014-04-14 18:28:04 +0000
+++ openlp/core/lib/serviceitem.py 2014-04-21 17:54:10 +0000
@@ -111,6 +111,8 @@
``CanEditTitle``
The capability to edit the title of the item
+ ``HasTitleSlide``
+ The capability to show a title slide
"""
CanPreview = 1
CanEdit = 2
@@ -129,6 +131,7 @@
HasBackgroundAudio = 15
CanAutoStartForLive = 16
CanEditTitle = 17
+ HasTitleSlide = 18
class ServiceItem(RegistryProperties):
@@ -232,9 +235,16 @@
log.debug('Render called')
self._display_frames = []
self.bg_image_bytes = None
+ self.title = clean_tags(self.title)
if not provides_own_theme_data:
self.renderer.set_item_theme(self.theme)
self.theme_data, self.main, self.footer = self.renderer.pre_render()
+ if self.is_capable(ItemCapabilities.HasTitleSlide):
+ self._display_frames.append({'title': 'Title',
+ 'text': self.title,
+ 'html': self.title,
+ 'verseTag': 'T'
+ })
if self.service_item_type == ServiceItemType.Text:
log.debug('Formatting slides: %s' % self.title)
# Save rendered pages to this dict. In the case that a slide is used twice we can use the pages saved to
@@ -260,7 +270,6 @@
pass
else:
log.error('Invalid value renderer: %s' % self.service_item_type)
- self.title = clean_tags(self.title)
# The footer should never be None, but to be compatible with a few
# nightly builds between 1.9.4 and 1.9.5, we have to correct this to
# avoid tracebacks.
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2014-04-16 04:49:45 +0000
+++ openlp/core/ui/maindisplay.py 2014-04-21 17:54:10 +0000
@@ -44,7 +44,7 @@
from PyQt4.phonon import Phonon
from openlp.core.common import Registry, RegistryProperties, OpenLPMixin, Settings, translate
-from openlp.core.lib import ServiceItem, ImageSource, build_html, expand_tags, image_to_byte
+from openlp.core.lib import ServiceItem, ItemCapabilities, ImageSource, build_html, expand_tags, image_to_byte
from openlp.core.lib.theme import BackgroundType
from openlp.core.lib import ScreenList
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2014-04-14 19:46:02 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2014-04-21 17:54:10 +0000
@@ -125,6 +125,7 @@
self.search_as_you_type = Settings().value(self.settings_section + '/search as type')
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.display_title_slide = Settings().value(self.settings_section + '/display title slide',)
def retranslateUi(self):
self.search_text_label.setText('%s:' % UiStrings().Search)
@@ -413,6 +414,8 @@
service_item.add_capability(ItemCapabilities.OnLoadUpdate)
service_item.add_capability(ItemCapabilities.AddIfNewItem)
service_item.add_capability(ItemCapabilities.CanSoftBreak)
+ if self.display_title_slide:
+ service_item.add_capability(ItemCapabilities.HasTitleSlide)
song = self.plugin.manager.get_object(Song, item_id)
service_item.theme = song.theme_name
service_item.edit_id = item_id
=== modified file 'openlp/plugins/songs/lib/songstab.py'
--- openlp/plugins/songs/lib/songstab.py 2014-03-08 19:58:58 +0000
+++ openlp/plugins/songs/lib/songstab.py 2014-04-21 17:54:10 +0000
@@ -59,6 +59,9 @@
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.title_slide_check_box = QtGui.QCheckBox(self.mode_group_box)
+ self.title_slide_check_box.setObjectName('title_slide_check_box')
+ self.mode_layout.addWidget(self.title_slide_check_box)
self.left_layout.addWidget(self.mode_group_box)
self.left_layout.addStretch()
self.right_layout.addStretch()
@@ -66,6 +69,7 @@
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.title_slide_check_box.stateChanged.connect(self.on_title_slide_check_box_changed)
def retranslateUi(self):
self.mode_group_box.setTitle(translate('SongsPlugin.SongsTab', 'Songs Mode'))
@@ -75,6 +79,7 @@
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.title_slide_check_box.setText(translate('SongsPlugin.SongsTab', 'Add a title slide'))
def on_search_as_type_check_box_changed(self, check_state):
self.song_search = (check_state == QtCore.Qt.Checked)
@@ -88,6 +93,9 @@
def on_add_from_service_check_box_changed(self, check_state):
self.update_load = (check_state == QtCore.Qt.Checked)
+ def on_title_slide_check_box_changed(self, check_state):
+ self.title_slide = (check_state == QtCore.Qt.Checked)
+
def load(self):
settings = Settings()
settings.beginGroup(self.settings_section)
@@ -95,6 +103,7 @@
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.title_slide = settings.value('display title slide')
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)
@@ -108,6 +117,7 @@
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 title slide', self.title_slide)
settings.endGroup()
if self.tab_visited:
self.settings_form.register_post_process('songs_config_updated')
=== modified file 'openlp/plugins/songs/songsplugin.py'
--- openlp/plugins/songs/songsplugin.py 2014-04-12 20:19:22 +0000
+++ openlp/plugins/songs/songsplugin.py 2014-04-21 17:54:10 +0000
@@ -62,6 +62,7 @@
'songs/update service on edit': False,
'songs/search as type': False,
'songs/add song from service': True,
+ 'songs/display title slide': False,
'songs/display songbar': True,
'songs/last directory import': '',
'songs/last directory export': '',
=== added file 'tests/functional/openlp_plugins/songs/test_songproimport.py'
--- tests/functional/openlp_plugins/songs/test_songproimport.py 1970-01-01 00:00:00 +0000
+++ tests/functional/openlp_plugins/songs/test_songproimport.py 2014-04-21 17:54:10 +0000
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
+
+###############################################################################
+# OpenLP - Open Source Lyrics Projection #
+# --------------------------------------------------------------------------- #
+# Copyright (c) 2008-2014 Raoul Snyman #
+# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
+# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
+# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
+# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
+# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
+# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
+# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
+# --------------------------------------------------------------------------- #
+# This program is free software; you can redistribute it and/or modify it #
+# under the terms of the GNU General Public License as published by the Free #
+# Software Foundation; version 2 of the License. #
+# #
+# This program is distributed in the hope that it will be useful, but WITHOUT #
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
+# more details. #
+# #
+# You should have received a copy of the GNU General Public License along #
+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
+###############################################################################
+"""
+This module contains tests for the SongPro song importer.
+"""
+
+from unittest import TestCase
+
+from tests.functional import MagicMock, patch
+from openlp.plugins.songs.lib.songproimport import SongProImport
+from openlp.plugins.songs.lib.songimport import SongImport
+
+
+class TestSongProImport(TestCase):
+ """
+ Test the functions in the :mod:`songproimport` module.
+ """
+ def create_importer_test(self):
+ """
+ Test creating an instance of the SongPro file importer
+ """
+ # GIVEN: A mocked out SongImport class, and a mocked out "manager"
+ with patch('openlp.plugins.songs.lib.songbeamerimport.SongImport'):
+ mocked_manager = MagicMock()
+
+ # WHEN: An importer object is created
+ importer = SongProImport(mocked_manager, filenames=[])
+
+ # THEN: The importer should be an instance of SongImport
+ self.assertIsInstance(importer, SongImport)
Follow ups