This commit is contained in:
Tim Bentley 2014-08-21 18:05:47 +01:00
commit 63fab9b4be
37 changed files with 1363 additions and 122 deletions

View File

@ -286,6 +286,7 @@ class Settings(QtCore.QSettings):
'themes/last directory export': '', 'themes/last directory export': '',
'themes/last directory import': '', 'themes/last directory import': '',
'themes/theme level': ThemeLevel.Song, 'themes/theme level': ThemeLevel.Song,
'themes/wrap footer': False,
'user interface/live panel': True, 'user interface/live panel': True,
'user interface/live splitter geometry': QtCore.QByteArray(), 'user interface/live splitter geometry': QtCore.QByteArray(),
'user interface/lock panel': False, 'user interface/lock panel': False,

View File

@ -96,9 +96,10 @@ def upgrade_db(url, upgrade):
mapper(Metadata, metadata_table) mapper(Metadata, metadata_table)
version_meta = session.query(Metadata).get('version') version_meta = session.query(Metadata).get('version')
if version_meta is None: if version_meta is None:
version_meta = Metadata.populate(key='version', value='0') # Tables have just been created - fill the version field with the most recent version
version = upgrade.__version__
version_meta = Metadata.populate(key='version', value=version)
session.add(version_meta) session.add(version_meta)
version = 0
else: else:
version = int(version_meta.value) version = int(version_meta.value)
if version > upgrade.__version__: if version > upgrade.__version__:

View File

@ -398,6 +398,7 @@ import logging
from PyQt4 import QtWebKit from PyQt4 import QtWebKit
from openlp.core.common import Settings
from openlp.core.lib.theme import BackgroundType, BackgroundGradientType, VerticalType, HorizontalType from openlp.core.lib.theme import BackgroundType, BackgroundGradientType, VerticalType, HorizontalType
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -750,12 +751,13 @@ def build_footer_css(item, height):
font-size: %spt; font-size: %spt;
color: %s; color: %s;
text-align: left; text-align: left;
white-space: nowrap; white-space: %s;
""" """
theme = item.theme_data theme = item.theme_data
if not theme or not item.footer: if not theme or not item.footer:
return '' return ''
bottom = height - int(item.footer.y()) - int(item.footer.height()) bottom = height - int(item.footer.y()) - int(item.footer.height())
whitespace = 'normal' if Settings().value('themes/wrap footer') else 'nowrap'
lyrics_html = style % (item.footer.x(), bottom, item.footer.width(), lyrics_html = style % (item.footer.x(), bottom, item.footer.width(),
theme.font_footer_name, theme.font_footer_size, theme.font_footer_color) theme.font_footer_name, theme.font_footer_size, theme.font_footer_color, whitespace)
return lyrics_html return lyrics_html

View File

@ -1103,7 +1103,7 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
Moves the cursor selection up the window. Called by the up arrow. Moves the cursor selection up the window. Called by the up arrow.
""" """
item = self.service_manager_list.currentItem() item = self.service_manager_list.currentItem()
item_before = self.service_manager_list.item_above(item) item_before = self.service_manager_list.itemAbove(item)
if item_before is None: if item_before is None:
return return
self.service_manager_list.setCurrentItem(item_before) self.service_manager_list.setCurrentItem(item_before)

View File

@ -96,6 +96,8 @@ class DisplayController(QtGui.QWidget):
""" """
This is the generic function to send signal for control widgets, created from within other plugins This is the generic function to send signal for control widgets, created from within other plugins
This function is needed to catch the current controller This function is needed to catch the current controller
:param args: Arguments to send to the plugins
""" """
sender = self.sender().objectName() if self.sender().objectName() else self.sender().text() sender = self.sender().objectName() if self.sender().objectName() else self.sender().text()
controller = self controller = self
@ -143,11 +145,19 @@ class SlideController(DisplayController, RegistryProperties):
self.panel_layout = QtGui.QVBoxLayout(self.panel) self.panel_layout = QtGui.QVBoxLayout(self.panel)
self.panel_layout.setSpacing(0) self.panel_layout.setSpacing(0)
self.panel_layout.setMargin(0) self.panel_layout.setMargin(0)
# Type label for the top of the slide controller # Type label at the top of the slide controller
self.type_label = QtGui.QLabel(self.panel) self.type_label = QtGui.QLabel(self.panel)
self.type_label.setStyleSheet('font-weight: bold; font-size: 12pt;') self.type_label.setStyleSheet('font-weight: bold; font-size: 12pt;')
self.type_label.setAlignment(QtCore.Qt.AlignCenter) self.type_label.setAlignment(QtCore.Qt.AlignCenter)
if self.is_live:
self.type_label.setText(UiStrings().Live)
else:
self.type_label.setText(UiStrings().Preview)
self.panel_layout.addWidget(self.type_label) self.panel_layout.addWidget(self.type_label)
# Info label for the title of the current item, at the top of the slide controller
self.info_label = QtGui.QLabel(self.panel)
self.info_label.setAlignment(QtCore.Qt.AlignCenter)
self.panel_layout.addWidget(self.info_label)
# Splitter # Splitter
self.splitter = QtGui.QSplitter(self.panel) self.splitter = QtGui.QSplitter(self.panel)
self.splitter.setOrientation(QtCore.Qt.Vertical) self.splitter.setOrientation(QtCore.Qt.Vertical)
@ -402,12 +412,17 @@ class SlideController(DisplayController, RegistryProperties):
""" """
try: try:
from openlp.plugins.songs.lib import VerseType from openlp.plugins.songs.lib import VerseType
SONGS_PLUGIN_AVAILABLE = True is_songs_plugin_available = True
except ImportError: except ImportError:
SONGS_PLUGIN_AVAILABLE = False class VerseType(object):
"""
This empty class is mostly just to satisfy Python, PEP8 and PyCharm
"""
pass
is_songs_plugin_available = False
sender_name = self.sender().objectName() sender_name = self.sender().objectName()
verse_type = sender_name[15:] if sender_name[:15] == 'shortcutAction_' else '' verse_type = sender_name[15:] if sender_name[:15] == 'shortcutAction_' else ''
if SONGS_PLUGIN_AVAILABLE: if is_songs_plugin_available:
if verse_type == 'V': if verse_type == 'V':
self.current_shortcut = VerseType.translated_tags[VerseType.Verse] self.current_shortcut = VerseType.translated_tags[VerseType.Verse]
elif verse_type == 'C': elif verse_type == 'C':
@ -777,6 +792,7 @@ class SlideController(DisplayController, RegistryProperties):
if service_item.is_command(): if service_item.is_command():
Registry().execute( Registry().execute(
'%s_start' % service_item.name.lower(), [self.service_item, self.is_live, self.hide_mode(), slide_no]) '%s_start' % service_item.name.lower(), [self.service_item, self.is_live, self.hide_mode(), slide_no])
self.info_label.setText(self.service_item.title)
self.slide_list = {} self.slide_list = {}
if self.is_live: if self.is_live:
self.song_menu.menu().clear() self.song_menu.menu().clear()

View File

@ -384,16 +384,8 @@ class ThemeManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ThemeManager, R
self.application.set_busy_cursor() self.application.set_busy_cursor()
if path: if path:
Settings().setValue(self.settings_section + '/last directory export', path) Settings().setValue(self.settings_section + '/last directory export', path)
theme_path = os.path.join(path, theme + '.otz')
theme_zip = None
try: try:
theme_zip = zipfile.ZipFile(theme_path, 'w') self._export_theme(path, theme)
source = os.path.join(self.path, theme)
for files in os.walk(source):
for name in files[2]:
theme_zip.write(
os.path.join(source, name).encode('utf-8'), os.path.join(theme, name).encode('utf-8')
)
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self,
translate('OpenLP.ThemeManager', 'Theme Exported'), translate('OpenLP.ThemeManager', 'Theme Exported'),
translate('OpenLP.ThemeManager', translate('OpenLP.ThemeManager',
@ -403,11 +395,29 @@ class ThemeManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ThemeManager, R
critical_error_message_box(translate('OpenLP.ThemeManager', 'Theme Export Failed'), critical_error_message_box(translate('OpenLP.ThemeManager', 'Theme Export Failed'),
translate('OpenLP.ThemeManager', translate('OpenLP.ThemeManager',
'Your theme could not be exported due to an error.')) 'Your theme could not be exported due to an error.'))
finally:
if theme_zip:
theme_zip.close()
self.application.set_normal_cursor() self.application.set_normal_cursor()
def _export_theme(self, path, theme):
"""
Create the zipfile with the theme contents.
:param path: Location where the zip file will be placed
:param theme: The name of the theme to be exported
"""
theme_path = os.path.join(path, theme + '.otz')
try:
theme_zip = zipfile.ZipFile(theme_path, 'w')
source = os.path.join(self.path, theme)
for files in os.walk(source):
for name in files[2]:
theme_zip.write(os.path.join(source, name), os.path.join(theme, name))
except (IOError, OSError):
if theme_zip:
theme_zip.close()
shutil.rmtree(theme_path, True)
raise
else:
theme_zip.close()
def on_import_theme(self, field=None): def on_import_theme(self, field=None):
""" """
Opens a file dialog to select the theme file(s) to import before attempting to extract OpenLP themes from Opens a file dialog to select the theme file(s) to import before attempting to extract OpenLP themes from

View File

@ -69,6 +69,14 @@ class ThemesTab(SettingsTab):
self.default_list_view.setObjectName('default_list_view') self.default_list_view.setObjectName('default_list_view')
self.global_group_box_layout.addWidget(self.default_list_view) self.global_group_box_layout.addWidget(self.default_list_view)
self.left_layout.addWidget(self.global_group_box) self.left_layout.addWidget(self.global_group_box)
self.universal_group_box = QtGui.QGroupBox(self.left_column)
self.universal_group_box.setObjectName('universal_group_box')
self.universal_group_box_layout = QtGui.QVBoxLayout(self.universal_group_box)
self.universal_group_box_layout.setObjectName('universal_group_box_layout')
self.wrap_footer_check_box = QtGui.QCheckBox(self.universal_group_box)
self.wrap_footer_check_box.setObjectName('wrap_footer_check_box')
self.universal_group_box_layout.addWidget(self.wrap_footer_check_box)
self.left_layout.addWidget(self.universal_group_box)
self.left_layout.addStretch() self.left_layout.addStretch()
self.level_group_box = QtGui.QGroupBox(self.right_column) self.level_group_box = QtGui.QGroupBox(self.right_column)
self.level_group_box.setObjectName('level_group_box') self.level_group_box.setObjectName('level_group_box')
@ -112,6 +120,8 @@ class ThemesTab(SettingsTab):
""" """
self.tab_title_visible = UiStrings().Themes self.tab_title_visible = UiStrings().Themes
self.global_group_box.setTitle(translate('OpenLP.ThemesTab', 'Global Theme')) self.global_group_box.setTitle(translate('OpenLP.ThemesTab', 'Global Theme'))
self.universal_group_box.setTitle(translate('OpenLP.ThemesTab', 'Universal Settings'))
self.wrap_footer_check_box.setText(translate('OpenLP.ThemesTab', '&Wrap footer text'))
self.level_group_box.setTitle(translate('OpenLP.ThemesTab', 'Theme Level')) self.level_group_box.setTitle(translate('OpenLP.ThemesTab', 'Theme Level'))
self.song_level_radio_button.setText(translate('OpenLP.ThemesTab', 'S&ong Level')) self.song_level_radio_button.setText(translate('OpenLP.ThemesTab', 'S&ong Level'))
self.song_level_label.setText( self.song_level_label.setText(
@ -136,6 +146,7 @@ class ThemesTab(SettingsTab):
settings.beginGroup(self.settings_section) settings.beginGroup(self.settings_section)
self.theme_level = settings.value('theme level') self.theme_level = settings.value('theme level')
self.global_theme = settings.value('global theme') self.global_theme = settings.value('global theme')
self.wrap_footer_check_box.setChecked(settings.value('wrap footer'))
settings.endGroup() settings.endGroup()
if self.theme_level == ThemeLevel.Global: if self.theme_level == ThemeLevel.Global:
self.global_level_radio_button.setChecked(True) self.global_level_radio_button.setChecked(True)
@ -152,6 +163,7 @@ class ThemesTab(SettingsTab):
settings.beginGroup(self.settings_section) settings.beginGroup(self.settings_section)
settings.setValue('theme level', self.theme_level) settings.setValue('theme level', self.theme_level)
settings.setValue('global theme', self.global_theme) settings.setValue('global theme', self.global_theme)
settings.setValue('wrap footer', self.wrap_footer_check_box.isChecked())
settings.endGroup() settings.endGroup()
self.renderer.set_theme_level(self.theme_level) self.renderer.set_theme_level(self.theme_level)
if self.tab_visited: if self.tab_visited:

View File

@ -138,6 +138,9 @@ class Ui_EditSongDialog(object):
self.author_remove_layout = QtGui.QHBoxLayout() self.author_remove_layout = QtGui.QHBoxLayout()
self.author_remove_layout.setObjectName('author_remove_layout') self.author_remove_layout.setObjectName('author_remove_layout')
self.author_remove_layout.addStretch() self.author_remove_layout.addStretch()
self.author_edit_button = QtGui.QPushButton(self.authors_group_box)
self.author_edit_button.setObjectName('author_edit_button')
self.author_remove_layout.addWidget(self.author_edit_button)
self.author_remove_button = QtGui.QPushButton(self.authors_group_box) self.author_remove_button = QtGui.QPushButton(self.authors_group_box)
self.author_remove_button.setObjectName('author_remove_button') self.author_remove_button.setObjectName('author_remove_button')
self.author_remove_layout.addWidget(self.author_remove_button) self.author_remove_layout.addWidget(self.author_remove_button)
@ -305,6 +308,7 @@ class Ui_EditSongDialog(object):
translate('SongsPlugin.EditSongForm', 'Title && Lyrics')) translate('SongsPlugin.EditSongForm', 'Title && Lyrics'))
self.authors_group_box.setTitle(SongStrings.Authors) self.authors_group_box.setTitle(SongStrings.Authors)
self.author_add_button.setText(translate('SongsPlugin.EditSongForm', '&Add to Song')) self.author_add_button.setText(translate('SongsPlugin.EditSongForm', '&Add to Song'))
self.author_edit_button.setText(translate('SongsPlugin.EditSongForm', '&Edit Author Type'))
self.author_remove_button.setText(translate('SongsPlugin.EditSongForm', '&Remove')) self.author_remove_button.setText(translate('SongsPlugin.EditSongForm', '&Remove'))
self.maintenance_button.setText(translate('SongsPlugin.EditSongForm', '&Manage Authors, Topics, Song Books')) self.maintenance_button.setText(translate('SongsPlugin.EditSongForm', '&Manage Authors, Topics, Song Books'))
self.topics_group_box.setTitle(SongStrings.Topic) self.topics_group_box.setTitle(SongStrings.Topic)

View File

@ -70,6 +70,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog, RegistryProperties):
self.setupUi(self) self.setupUi(self)
# Connecting signals and slots # Connecting signals and slots
self.author_add_button.clicked.connect(self.on_author_add_button_clicked) self.author_add_button.clicked.connect(self.on_author_add_button_clicked)
self.author_edit_button.clicked.connect(self.on_author_edit_button_clicked)
self.author_remove_button.clicked.connect(self.on_author_remove_button_clicked) self.author_remove_button.clicked.connect(self.on_author_remove_button_clicked)
self.authors_list_view.itemClicked.connect(self.on_authors_list_view_clicked) self.authors_list_view.itemClicked.connect(self.on_authors_list_view_clicked)
self.topic_add_button.clicked.connect(self.on_topic_add_button_clicked) self.topic_add_button.clicked.connect(self.on_topic_add_button_clicked)
@ -334,6 +335,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog, RegistryProperties):
""" """
self.verse_edit_button.setEnabled(False) self.verse_edit_button.setEnabled(False)
self.verse_delete_button.setEnabled(False) self.verse_delete_button.setEnabled(False)
self.author_edit_button.setEnabled(False)
self.author_remove_button.setEnabled(False) self.author_remove_button.setEnabled(False)
self.topic_remove_button.setEnabled(False) self.topic_remove_button.setEnabled(False)
@ -354,12 +356,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog, RegistryProperties):
# Types # Types
self.author_types_combo_box.clear() self.author_types_combo_box.clear()
self.author_types_combo_box.addItem('')
# Don't iterate over the dictionary to give them this specific order # Don't iterate over the dictionary to give them this specific order
self.author_types_combo_box.addItem(AuthorType.Types[AuthorType.Words], AuthorType.Words) for author_type in AuthorType.SortedTypes:
self.author_types_combo_box.addItem(AuthorType.Types[AuthorType.Music], AuthorType.Music) self.author_types_combo_box.addItem(AuthorType.Types[author_type], author_type)
self.author_types_combo_box.addItem(AuthorType.Types[AuthorType.WordsAndMusic], AuthorType.WordsAndMusic)
self.author_types_combo_box.addItem(AuthorType.Types[AuthorType.Translation], AuthorType.Translation)
def load_topics(self): def load_topics(self):
""" """
@ -596,9 +595,32 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog, RegistryProperties):
""" """
Run a set of actions when an author in the list is selected (mainly enable the delete button). Run a set of actions when an author in the list is selected (mainly enable the delete button).
""" """
if self.authors_list_view.count() > 1: count = self.authors_list_view.count()
if count > 0:
self.author_edit_button.setEnabled(True)
if count > 1:
# There must be at least one author
self.author_remove_button.setEnabled(True) self.author_remove_button.setEnabled(True)
def on_author_edit_button_clicked(self):
"""
Show a dialog to change the type of an author when the edit button is clicked
"""
self.author_edit_button.setEnabled(False)
item = self.authors_list_view.currentItem()
author_id, author_type = item.data(QtCore.Qt.UserRole)
choice, ok = QtGui.QInputDialog.getItem(self, translate('SongsPlugin.EditSongForm', 'Edit Author Type'),
translate('SongsPlugin.EditSongForm', 'Choose type for this author'),
AuthorType.TranslatedTypes,
current=AuthorType.SortedTypes.index(author_type),
editable=False)
if not ok:
return
author = self.manager.get_object(Author, author_id)
author_type = AuthorType.from_translated_text(choice)
item.setData(QtCore.Qt.UserRole, (author_id, author_type))
item.setText(author.get_display_name(author_type))
def on_author_remove_button_clicked(self): def on_author_remove_button_clicked(self):
""" """
Remove the author from the list when the delete button is clicked. Remove the author from the list when the delete button is clicked.

View File

@ -374,7 +374,7 @@ def clean_song(manager, song):
:param manager: The song database manager object. :param manager: The song database manager object.
:param song: The song object. :param song: The song object.
""" """
from .xml import SongXML from .openlyricsxml import SongXML
if song.title: if song.title:
song.title = clean_title(song.title) song.title = clean_title(song.title)

View File

@ -69,17 +69,42 @@ class AuthorType(object):
The 'words+music' type is not an official type, but is provided for convenience. The 'words+music' type is not an official type, but is provided for convenience.
""" """
NoType = ''
Words = 'words' Words = 'words'
Music = 'music' Music = 'music'
WordsAndMusic = 'words+music' WordsAndMusic = 'words+music'
Translation = 'translation' Translation = 'translation'
Types = { Types = {
NoType: '',
Words: translate('SongsPlugin.AuthorType', 'Words', 'Author who wrote the lyrics of a song'), Words: translate('SongsPlugin.AuthorType', 'Words', 'Author who wrote the lyrics of a song'),
Music: translate('SongsPlugin.AuthorType', 'Music', 'Author who wrote the music of a song'), Music: translate('SongsPlugin.AuthorType', 'Music', 'Author who wrote the music of a song'),
WordsAndMusic: translate('SongsPlugin.AuthorType', 'Words and Music', WordsAndMusic: translate('SongsPlugin.AuthorType', 'Words and Music',
'Author who wrote both lyrics and music of a song'), 'Author who wrote both lyrics and music of a song'),
Translation: translate('SongsPlugin.AuthorType', 'Translation', 'Author who translated the song') Translation: translate('SongsPlugin.AuthorType', 'Translation', 'Author who translated the song')
} }
SortedTypes = [
NoType,
Words,
Music,
WordsAndMusic
]
TranslatedTypes = [
Types[NoType],
Types[Words],
Types[Music],
Types[WordsAndMusic]
]
@staticmethod
def from_translated_text(translated_type):
"""
Get the AuthorType from a translated string.
:param translated_type: Translated Author type.
"""
for key, value in AuthorType.Types.items():
if value == translated_type:
return key
return AuthorType.NoType
class Book(BaseModel): class Book(BaseModel):

View File

@ -51,12 +51,12 @@ from .importers.foilpresenter import FoilPresenterImport
from .importers.zionworx import ZionWorxImport from .importers.zionworx import ZionWorxImport
from .importers.propresenter import ProPresenterImport from .importers.propresenter import ProPresenterImport
from .importers.worshipassistant import WorshipAssistantImport from .importers.worshipassistant import WorshipAssistantImport
# Imports that might fail from .importers.powerpraise import PowerPraiseImport
from .importers.presentationmanager import PresentationManagerImport
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
# Imports that might fail
try: try:
from .importers.songsoffellowship import SongsOfFellowshipImport from .importers.songsoffellowship import SongsOfFellowshipImport
HAS_SOF = True HAS_SOF = True
@ -160,17 +160,19 @@ class SongFormat(object):
FoilPresenter = 8 FoilPresenter = 8
MediaShout = 9 MediaShout = 9
OpenSong = 10 OpenSong = 10
PowerSong = 11 PowerPraise = 11
ProPresenter = 12 PowerSong = 12
SongBeamer = 13 PresentationManager = 13
SongPro = 14 ProPresenter = 14
SongShowPlus = 15 SongBeamer = 15
SongsOfFellowship = 16 SongPro = 16
SundayPlus = 17 SongShowPlus = 17
WordsOfWorship = 18 SongsOfFellowship = 18
WorshipAssistant = 19 SundayPlus = 19
WorshipCenterPro = 20 WordsOfWorship = 20
ZionWorx = 21 WorshipAssistant = 21
WorshipCenterPro = 22
ZionWorx = 23
# Set optional attribute defaults # Set optional attribute defaults
__defaults__ = { __defaults__ = {
@ -266,6 +268,12 @@ class SongFormat(object):
'name': WizardStrings.OS, 'name': WizardStrings.OS,
'prefix': 'openSong' 'prefix': 'openSong'
}, },
PowerPraise: {
'class': PowerPraiseImport,
'name': 'PowerPraise',
'prefix': 'powerPraise',
'filter': '%s (*.ppl)' % translate('SongsPlugin.ImportWizardForm', 'PowerPraise Song Files')
},
PowerSong: { PowerSong: {
'class': PowerSongImport, 'class': PowerSongImport,
'name': 'PowerSong 1.0', 'name': 'PowerSong 1.0',
@ -274,6 +282,12 @@ class SongFormat(object):
'invalidSourceMsg': translate('SongsPlugin.ImportWizardForm', 'You need to specify a valid PowerSong 1.0 ' 'invalidSourceMsg': translate('SongsPlugin.ImportWizardForm', 'You need to specify a valid PowerSong 1.0 '
'database folder.') 'database folder.')
}, },
PresentationManager: {
'class': PresentationManagerImport,
'name': 'PresentationManager',
'prefix': 'presentationManager',
'filter': '%s (*.sng)' % translate('SongsPlugin.ImportWizardForm', 'PresentationManager Song Files')
},
ProPresenter: { ProPresenter: {
'class': ProPresenterImport, 'class': ProPresenterImport,
'name': 'ProPresenter', 'name': 'ProPresenter',
@ -374,7 +388,9 @@ class SongFormat(object):
SongFormat.FoilPresenter, SongFormat.FoilPresenter,
SongFormat.MediaShout, SongFormat.MediaShout,
SongFormat.OpenSong, SongFormat.OpenSong,
SongFormat.PowerPraise,
SongFormat.PowerSong, SongFormat.PowerSong,
SongFormat.PresentationManager,
SongFormat.ProPresenter, SongFormat.ProPresenter,
SongFormat.SongBeamer, SongFormat.SongBeamer,
SongFormat.SongPro, SongFormat.SongPro,

View File

@ -0,0 +1,91 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2013 Raoul Snyman #
# Portions copyright (c) 2008-2013 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 #
###############################################################################
"""
The :mod:`powerpraiseimport` module provides the functionality for importing
Powerpraise song files into the current database.
"""
import os
from lxml import objectify
from openlp.core.ui.wizard import WizardStrings
from .songimport import SongImport
class PowerPraiseImport(SongImport):
"""
The :class:`PowerpraiseImport` class provides OpenLP with the
ability to import Powerpraise song files.
"""
def do_import(self):
self.import_wizard.progress_bar.setMaximum(len(self.import_source))
for file_path in self.import_source:
if self.stop_import_flag:
return
self.import_wizard.increment_progress_bar(WizardStrings.ImportingType % os.path.basename(file_path))
root = objectify.parse(open(file_path, 'rb')).getroot()
self.process_song(root)
def process_song(self, root):
self.set_defaults()
self.title = str(root.general.title)
verse_order_list = []
verse_count = {}
for item in root.order.item:
verse_order_list.append(str(item))
for part in root.songtext.part:
original_verse_def = part.get('caption')
# There are some predefined verse defitions in PowerPraise, try to parse these
if original_verse_def.startswith("Strophe") or original_verse_def.startswith("Teil"):
verse_def = 'v'
elif original_verse_def.startswith("Refrain"):
verse_def = 'c'
elif original_verse_def.startswith("Bridge"):
verse_def = 'b'
elif original_verse_def.startswith("Schluss"):
verse_def = 'e'
else:
verse_def = 'o'
verse_count[verse_def] = verse_count.get(verse_def, 0) + 1
verse_def = '%s%d' % (verse_def, verse_count[verse_def])
verse_text = []
for slide in part.slide:
if not hasattr(slide, 'line'):
continue # No content
for line in slide.line:
verse_text.append(str(line))
self.add_verse('\n'.join(verse_text), verse_def)
# Update verse name in verse order list
for i in range(len(verse_order_list)):
if verse_order_list[i].lower() == original_verse_def.lower():
verse_order_list[i] = verse_def
self.verse_order_list = verse_order_list
if not self.finish():
self.log_error(self.import_source)

View File

@ -0,0 +1,93 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2013 Raoul Snyman #
# Portions copyright (c) 2008-2013 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 #
###############################################################################
"""
The :mod:`presentationmanager` module provides the functionality for importing
Presentationmanager song files into the current database.
"""
import os
from lxml import objectify
from openlp.core.ui.wizard import WizardStrings
from .songimport import SongImport
class PresentationManagerImport(SongImport):
"""
The :class:`PresentationManagerImport` class provides OpenLP with the
ability to import Presentationmanager song files.
"""
def do_import(self):
self.import_wizard.progress_bar.setMaximum(len(self.import_source))
for file_path in self.import_source:
if self.stop_import_flag:
return
self.import_wizard.increment_progress_bar(WizardStrings.ImportingType % os.path.basename(file_path))
root = objectify.parse(open(file_path, 'rb')).getroot()
self.process_song(root)
def process_song(self, root):
self.set_defaults()
self.title = str(root.attributes.title)
self.add_author(str(root.attributes.author))
self.copyright = str(root.attributes.copyright)
self.ccli_number = str(root.attributes.ccli_number)
self.comments = str(root.attributes.comments)
verse_order_list = []
verse_count = {}
duplicates = []
for verse in root.verses.verse:
original_verse_def = verse.get('id')
# Presentation Manager stores duplicate verses instead of a verse order.
# We need to create the verse order from that.
is_duplicate = False
if original_verse_def in duplicates:
is_duplicate = True
else:
duplicates.append(original_verse_def)
if original_verse_def.startswith("Verse"):
verse_def = 'v'
elif original_verse_def.startswith("Chorus") or original_verse_def.startswith("Refrain"):
verse_def = 'c'
elif original_verse_def.startswith("Bridge"):
verse_def = 'b'
elif original_verse_def.startswith("End"):
verse_def = 'e'
else:
verse_def = 'o'
if not is_duplicate: # Only increment verse number if no duplicate
verse_count[verse_def] = verse_count.get(verse_def, 0) + 1
verse_def = '%s%d' % (verse_def, verse_count[verse_def])
if not is_duplicate: # Only add verse if no duplicate
self.add_verse(str(verse).strip(), verse_def)
verse_order_list.append(verse_def)
self.verse_order_list = verse_order_list
if not self.finish():
self.log_error(self.import_source)

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,7 +507,11 @@ 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)))
item.raw_footer.append(song.copyright) if song.copyright:
if self.display_copyright_symbol:
item.raw_footer.append("%s %s" % (SongStrings.CopyrightSymbol, song.copyright))
else:
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))
if Settings().value('core/ccli number'): if Settings().value('core/ccli 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

@ -33,7 +33,6 @@ backend for the Songs plugin
import logging import logging
from sqlalchemy import Column, ForeignKey, types from sqlalchemy import Column, ForeignKey, types
from sqlalchemy.exc import OperationalError
from sqlalchemy.sql.expression import func, false, null, text from sqlalchemy.sql.expression import func, false, null, text
from openlp.core.lib.db import get_upgrade_op from openlp.core.lib.db import get_upgrade_op
@ -57,16 +56,13 @@ def upgrade_1(session, metadata):
:param session: :param session:
:param metadata: :param metadata:
""" """
try: op = get_upgrade_op(session)
op = get_upgrade_op(session) op.drop_table('media_files_songs')
op.drop_table('media_files_songs') op.add_column('media_files', Column('song_id', types.Integer(), server_default=null()))
op.add_column('media_files', Column('song_id', types.Integer(), server_default=null())) op.add_column('media_files', Column('weight', types.Integer(), server_default=text('0')))
op.add_column('media_files', Column('weight', types.Integer(), server_default=text('0'))) if metadata.bind.url.get_dialect().name != 'sqlite':
if metadata.bind.url.get_dialect().name != 'sqlite': # SQLite doesn't support ALTER TABLE ADD CONSTRAINT
# SQLite doesn't support ALTER TABLE ADD CONSTRAINT op.create_foreign_key('fk_media_files_song_id', 'media_files', 'songs', ['song_id', 'id'])
op.create_foreign_key('fk_media_files_song_id', 'media_files', 'songs', ['song_id', 'id'])
except OperationalError:
log.info('Upgrade 1 has already been run')
def upgrade_2(session, metadata): def upgrade_2(session, metadata):
@ -75,12 +71,9 @@ def upgrade_2(session, metadata):
This upgrade adds a create_date and last_modified date to the songs table This upgrade adds a create_date and last_modified date to the songs table
""" """
try: op = get_upgrade_op(session)
op = get_upgrade_op(session) op.add_column('songs', Column('create_date', types.DateTime(), default=func.now()))
op.add_column('songs', Column('create_date', types.DateTime(), default=func.now())) op.add_column('songs', Column('last_modified', types.DateTime(), default=func.now()))
op.add_column('songs', Column('last_modified', types.DateTime(), default=func.now()))
except OperationalError:
log.info('Upgrade 2 has already been run')
def upgrade_3(session, metadata): def upgrade_3(session, metadata):
@ -89,14 +82,11 @@ def upgrade_3(session, metadata):
This upgrade adds a temporary song flag to the songs table This upgrade adds a temporary song flag to the songs table
""" """
try: op = get_upgrade_op(session)
op = get_upgrade_op(session) if metadata.bind.url.get_dialect().name == 'sqlite':
if metadata.bind.url.get_dialect().name == 'sqlite': op.add_column('songs', Column('temporary', types.Boolean(create_constraint=False), server_default=false()))
op.add_column('songs', Column('temporary', types.Boolean(create_constraint=False), server_default=false())) else:
else: op.add_column('songs', Column('temporary', types.Boolean(), server_default=false()))
op.add_column('songs', Column('temporary', types.Boolean(), server_default=false()))
except OperationalError:
log.info('Upgrade 3 has already been run')
def upgrade_4(session, metadata): def upgrade_4(session, metadata):
@ -105,17 +95,14 @@ def upgrade_4(session, metadata):
This upgrade adds a column for author type to the authors_songs table This upgrade adds a column for author type to the authors_songs table
""" """
try: # Since SQLite doesn't support changing the primary key of a table, we need to recreate the table
# Since SQLite doesn't support changing the primary key of a table, we need to recreate the table # and copy the old values
# and copy the old values op = get_upgrade_op(session)
op = get_upgrade_op(session) op.create_table('authors_songs_tmp',
op.create_table('authors_songs_tmp', Column('author_id', types.Integer(), ForeignKey('authors.id'), primary_key=True),
Column('author_id', types.Integer(), ForeignKey('authors.id'), primary_key=True), Column('song_id', types.Integer(), ForeignKey('songs.id'), primary_key=True),
Column('song_id', types.Integer(), ForeignKey('songs.id'), primary_key=True), Column('author_type', types.String(), primary_key=True,
Column('author_type', types.String(), primary_key=True, nullable=False, server_default=text('""')))
nullable=False, server_default=text('""'))) op.execute('INSERT INTO authors_songs_tmp SELECT author_id, song_id, "" FROM authors_songs')
op.execute('INSERT INTO authors_songs_tmp SELECT author_id, song_id, "" FROM authors_songs') op.drop_table('authors_songs')
op.drop_table('authors_songs') op.rename_table('authors_songs_tmp', 'authors_songs')
op.rename_table('authors_songs_tmp', 'authors_songs')
except OperationalError:
log.info('Upgrade 4 has already been run')

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': '',

View File

@ -32,7 +32,6 @@ backend for the SongsUsage plugin
""" """
import logging import logging
from sqlalchemy.exc import OperationalError
from sqlalchemy import Column, types from sqlalchemy import Column, types
from openlp.core.lib.db import get_upgrade_op from openlp.core.lib.db import get_upgrade_op
@ -50,9 +49,6 @@ def upgrade_1(session, metadata):
:param session: SQLAlchemy Session object :param session: SQLAlchemy Session object
:param metadata: SQLAlchemy MetaData object :param metadata: SQLAlchemy MetaData object
""" """
try: op = get_upgrade_op(session)
op = get_upgrade_op(session) op.add_column('songusage_data', Column('plugin_name', types.Unicode(20), server_default=''))
op.add_column('songusage_data', Column('plugin_name', types.Unicode(20), server_default='')) op.add_column('songusage_data', Column('source', types.Unicode(10), server_default=''))
op.add_column('songusage_data', Column('source', types.Unicode(10), server_default=''))
except OperationalError:
log.info('Upgrade 1 has already taken place')

View File

@ -62,11 +62,12 @@ class OpenLPJobs(object):
Branch_Pull = 'Branch-01-Pull' Branch_Pull = 'Branch-01-Pull'
Branch_Functional = 'Branch-02-Functional-Tests' Branch_Functional = 'Branch-02-Functional-Tests'
Branch_Interface = 'Branch-03-Interface-Tests' Branch_Interface = 'Branch-03-Interface-Tests'
Branch_Windows = 'Branch-04-Windows_Tests' Branch_Windows_Functional = 'Branch-04a-Windows_Functional_Tests'
Branch_Windows_Interface = 'Branch-04b-Windows_Interface_Tests'
Branch_PEP = 'Branch-05a-Code_Analysis' Branch_PEP = 'Branch-05a-Code_Analysis'
Branch_Coverage = 'Branch-05b-Test_Coverage' Branch_Coverage = 'Branch-05b-Test_Coverage'
Jobs = [Branch_Pull, Branch_Functional, Branch_Interface, Branch_Windows, Branch_PEP, Branch_Coverage] Jobs = [Branch_Pull, Branch_Functional, Branch_Interface, Branch_Windows_Functional, Branch_Windows_Interface, Branch_PEP, Branch_Coverage]
class Colour(object): class Colour(object):
@ -115,7 +116,9 @@ class JenkinsTrigger(object):
print(' Local repository: %s (revision %s)' % (self.repo_name, revno)) print(' Local repository: %s (revision %s)' % (self.repo_name, revno))
for job in OpenLPJobs.Jobs: for job in OpenLPJobs.Jobs:
self.__print_build_info(job) if not self.__print_build_info(job):
print('Stopping after failure')
break
def open_browser(self): def open_browser(self):
""" """
@ -132,6 +135,7 @@ class JenkinsTrigger(object):
:param job_name: The name of the job we want the information from. For example *Branch-01-Pull*. Use the class :param job_name: The name of the job we want the information from. For example *Branch-01-Pull*. Use the class
variables from the :class:`OpenLPJobs` class. variables from the :class:`OpenLPJobs` class.
""" """
is_success = False
job = self.jenkins_instance.job(job_name) job = self.jenkins_instance.job(job_name)
while job.info['inQueue']: while job.info['inQueue']:
time.sleep(1) time.sleep(1)
@ -140,11 +144,13 @@ class JenkinsTrigger(object):
if build.info['result'] == 'SUCCESS': if build.info['result'] == 'SUCCESS':
# Make 'SUCCESS' green. # Make 'SUCCESS' green.
result_string = '%s%s%s' % (Colour.GREEN_START, build.info['result'], Colour.GREEN_END) result_string = '%s%s%s' % (Colour.GREEN_START, build.info['result'], Colour.GREEN_END)
is_success = True
else: else:
# Make 'FAILURE' red. # Make 'FAILURE' red.
result_string = '%s%s%s' % (Colour.RED_START, build.info['result'], Colour.RED_END) result_string = '%s%s%s' % (Colour.RED_START, build.info['result'], Colour.RED_END)
url = build.info['url'] url = build.info['url']
print('[%s] %s' % (result_string, url)) print('[%s] %s' % (result_string, url))
return is_success
def get_repo_name(branch_type='l'): def get_repo_name(branch_type='l'):

View File

@ -6,11 +6,12 @@ from unittest import TestCase
from PyQt4 import QtCore from PyQt4 import QtCore
from openlp.core.common import Settings
from openlp.core.lib.htmlbuilder import build_html, build_background_css, build_lyrics_css, build_lyrics_outline_css, \ from openlp.core.lib.htmlbuilder import build_html, build_background_css, build_lyrics_css, build_lyrics_outline_css, \
build_lyrics_format_css, build_footer_css build_lyrics_format_css, build_footer_css
from openlp.core.lib.theme import HorizontalType, VerticalType from openlp.core.lib.theme import HorizontalType, VerticalType
from tests.functional import MagicMock, patch from tests.functional import MagicMock, patch
from tests.helpers.testmixin import TestMixin
HTML = """ HTML = """
<!DOCTYPE html> <!DOCTYPE html>
@ -184,7 +185,7 @@ LYRICS_OUTLINE_CSS = ' -webkit-text-stroke: 0.125em #000000; -webkit-text-fill-c
LYRICS_FORMAT_CSS = ' word-wrap: break-word; text-align: justify; vertical-align: bottom; ' + \ LYRICS_FORMAT_CSS = ' word-wrap: break-word; text-align: justify; vertical-align: bottom; ' + \
'font-family: Arial; font-size: 40pt; color: #FFFFFF; line-height: 108%; margin: 0;padding: 0; ' + \ 'font-family: Arial; font-size: 40pt; color: #FFFFFF; line-height: 108%; margin: 0;padding: 0; ' + \
'padding-bottom: 0.5em; padding-left: 2px; width: 1580px; height: 810px; font-style:italic; font-weight:bold; ' 'padding-bottom: 0.5em; padding-left: 2px; width: 1580px; height: 810px; font-style:italic; font-weight:bold; '
FOOTER_CSS = """ FOOTER_CSS_BASE = """
left: 10px; left: 10px;
bottom: 0px; bottom: 0px;
width: 1260px; width: 1260px;
@ -192,11 +193,28 @@ FOOTER_CSS = """
font-size: 12pt; font-size: 12pt;
color: #FFFFFF; color: #FFFFFF;
text-align: left; text-align: left;
white-space: nowrap; white-space: %s;
""" """
FOOTER_CSS = FOOTER_CSS_BASE % ('nowrap')
FOOTER_CSS_WRAP = FOOTER_CSS_BASE % ('normal')
class Htmbuilder(TestCase): class Htmbuilder(TestCase, TestMixin):
"""
Test the functions in the Htmlbuilder module
"""
def setUp(self):
"""
Create the UI
"""
self.build_settings()
def tearDown(self):
"""
Delete all the C++ objects at the end so that we don't have a segfault
"""
self.destroy_settings()
def build_html_test(self): def build_html_test(self):
""" """
Test the build_html() function Test the build_html() function
@ -225,7 +243,7 @@ class Htmbuilder(TestCase):
html = build_html(item, screen, is_live, background, plugins=plugins) html = build_html(item, screen, is_live, background, plugins=plugins)
# THEN: The returned html should match. # THEN: The returned html should match.
assert html == HTML self.assertEqual(html, HTML, 'The returned html should match')
def build_background_css_radial_test(self): def build_background_css_radial_test(self):
""" """
@ -241,7 +259,7 @@ class Htmbuilder(TestCase):
css = build_background_css(item, width) css = build_background_css(item, width)
# THEN: The returned css should match. # THEN: The returned css should match.
assert BACKGROUND_CSS_RADIAL == css, 'The background css should be equal.' self.assertEqual(BACKGROUND_CSS_RADIAL, css, 'The background css should be equal.')
def build_lyrics_css_test(self): def build_lyrics_css_test(self):
""" """
@ -262,7 +280,7 @@ class Htmbuilder(TestCase):
css = build_lyrics_css(item) css = build_lyrics_css(item)
# THEN: The css should be equal. # THEN: The css should be equal.
assert LYRICS_CSS == css, 'The lyrics css should be equal.' self.assertEqual(LYRICS_CSS, css, 'The lyrics css should be equal.')
def build_lyrics_outline_css_test(self): def build_lyrics_outline_css_test(self):
""" """
@ -279,7 +297,7 @@ class Htmbuilder(TestCase):
css = build_lyrics_outline_css(theme_data) css = build_lyrics_outline_css(theme_data)
# THEN: The css should be equal. # THEN: The css should be equal.
assert LYRICS_OUTLINE_CSS == css, 'The outline css should be equal.' self.assertEqual(LYRICS_OUTLINE_CSS, css, 'The outline css should be equal.')
def build_lyrics_format_css_test(self): def build_lyrics_format_css_test(self):
""" """
@ -302,7 +320,7 @@ class Htmbuilder(TestCase):
css = build_lyrics_format_css(theme_data, width, height) css = build_lyrics_format_css(theme_data, width, height)
# THEN: They should be equal. # THEN: They should be equal.
assert LYRICS_FORMAT_CSS == css, 'The lyrics format css should be equal.' self.assertEqual(LYRICS_FORMAT_CSS, css, 'The lyrics format css should be equal.')
def build_footer_css_test(self): def build_footer_css_test(self):
""" """
@ -316,8 +334,27 @@ class Htmbuilder(TestCase):
item.theme_data.font_footer_color = '#FFFFFF' item.theme_data.font_footer_color = '#FFFFFF'
height = 1024 height = 1024
# WHEN: create the css. # WHEN: create the css with default settings.
css = build_footer_css(item, height) css = build_footer_css(item, height)
# THEN: THE css should be the same. # THEN: THE css should be the same.
assert FOOTER_CSS == css, 'The footer strings should be equal.' self.assertEqual(FOOTER_CSS, css, 'The footer strings should be equal.')
def build_footer_css_wrap_test(self):
"""
Test the build_footer_css() function
"""
# GIVEN: Create a theme.
item = MagicMock()
item.footer = QtCore.QRect(10, 921, 1260, 103)
item.theme_data.font_footer_name = 'Arial'
item.theme_data.font_footer_size = 12
item.theme_data.font_footer_color = '#FFFFFF'
height = 1024
# WHEN: Settings say that footer should wrap
Settings().setValue('themes/wrap footer', True)
css = build_footer_css(item, height)
# THEN: Footer should wrap
self.assertEqual(FOOTER_CSS_WRAP, css, 'The footer strings should be equal.')

View File

@ -30,10 +30,13 @@
Package to test the openlp.core.ui.slidecontroller package. Package to test the openlp.core.ui.slidecontroller package.
""" """
from unittest import TestCase from unittest import TestCase
from openlp.core import Registry
from openlp.core.lib import ServiceItemAction
from openlp.core.ui import SlideController from openlp.core.ui import SlideController
from openlp.core.ui.slidecontroller import WIDE_MENU, NON_TEXT_MENU
from tests.interfaces import MagicMock from tests.interfaces import MagicMock, patch
class TestSlideController(TestCase): class TestSlideController(TestCase):
@ -42,37 +45,512 @@ class TestSlideController(TestCase):
""" """
Test the initial slide controller state . Test the initial slide controller state .
""" """
# GIVEN: A new slideController instance. # GIVEN: A new SlideController instance.
slide_controller = SlideController(None) slide_controller = SlideController(None)
# WHEN: the default controller is built. # WHEN: the default controller is built.
# THEN: The controller should not be a live controller. # THEN: The controller should not be a live controller.
self.assertEqual(slide_controller.is_live, False, 'The base slide controller should not be a live controller') self.assertEqual(slide_controller.is_live, False, 'The base slide controller should not be a live controller')
def toggle_blank_test(self): def text_service_item_blank_test(self):
""" """
Test the setting of the display blank icons by display type. Test that loading a text-based service item into the slide controller sets the correct blank menu
""" """
# GIVEN: A new slideController instance. # GIVEN: A new SlideController instance.
slide_controller = SlideController(None) slide_controller = SlideController(None)
service_item = MagicMock() service_item = MagicMock()
toolbar = MagicMock() toolbar = MagicMock()
toolbar.set_widget_visible = self.dummy_widget_visible toolbar.set_widget_visible = MagicMock()
slide_controller.toolbar = toolbar slide_controller.toolbar = toolbar
slide_controller.service_item = service_item slide_controller.service_item = service_item
# WHEN a text based service item is used # WHEN: a text based service item is used
slide_controller.service_item.is_text = MagicMock(return_value=True) slide_controller.service_item.is_text = MagicMock(return_value=True)
slide_controller.set_blank_menu() slide_controller.set_blank_menu()
# THEN: then call set up the toolbar to blank the display screen. # THEN: the call to set the visible items on the toolbar should be correct
self.assertEqual(len(self.test_widget), 3, 'There should be three icons to display on the screen') toolbar.set_widget_visible.assert_called_with(WIDE_MENU, True)
def non_text_service_item_blank_test(self):
"""
Test that loading a non-text service item into the slide controller sets the correct blank menu
"""
# GIVEN: A new SlideController instance.
slide_controller = SlideController(None)
service_item = MagicMock()
toolbar = MagicMock()
toolbar.set_widget_visible = MagicMock()
slide_controller.toolbar = toolbar
slide_controller.service_item = service_item
# WHEN a non text based service item is used # WHEN a non text based service item is used
slide_controller.service_item.is_text = MagicMock(return_value=False) slide_controller.service_item.is_text = MagicMock(return_value=False)
slide_controller.set_blank_menu() slide_controller.set_blank_menu()
# THEN: then call set up the toolbar to blank the display screen. # THEN: then call set up the toolbar to blank the display screen.
self.assertEqual(len(self.test_widget), 2, 'There should be only two icons to display on the screen') toolbar.set_widget_visible.assert_called_with(NON_TEXT_MENU, True)
def dummy_widget_visible(self, widget, visible=True): def receive_spin_delay_test(self):
self.test_widget = widget """
Test that the spin box is updated accordingly after a call to receive_spin_delay()
"""
with patch('openlp.core.ui.slidecontroller.Settings') as MockedSettings:
# GIVEN: A new SlideController instance.
mocked_value = MagicMock(return_value=1)
MockedSettings.return_value = MagicMock(value=mocked_value)
mocked_delay_spin_box = MagicMock()
slide_controller = SlideController(None)
slide_controller.delay_spin_box = mocked_delay_spin_box
# WHEN: The receive_spin_delay() method is called
slide_controller.receive_spin_delay()
# THEN: The Settings()value() and delay_spin_box.setValue() methods should have been called correctly
mocked_value.assert_called_with('core/loop delay')
mocked_delay_spin_box.setValue.assert_called_with(1)
def toggle_display_blank_test(self):
"""
Check that the toggle_display('blank') method calls the on_blank_display() method
"""
# GIVEN: A new SlideController instance.
mocked_on_blank_display = MagicMock()
mocked_on_theme_display = MagicMock()
mocked_on_hide_display = MagicMock()
slide_controller = SlideController(None)
slide_controller.on_blank_display = mocked_on_blank_display
slide_controller.on_theme_display = mocked_on_theme_display
slide_controller.on_hide_display = mocked_on_hide_display
# WHEN: toggle_display() is called with an argument of "blank"
slide_controller.toggle_display('blank')
# THEN: Only on_blank_display() should have been called with an argument of True
mocked_on_blank_display.assert_called_once_with(True)
self.assertEqual(0, mocked_on_theme_display.call_count, 'on_theme_display should not have been called')
self.assertEqual(0, mocked_on_hide_display.call_count, 'on_hide_display should not have been called')
def toggle_display_hide_test(self):
"""
Check that the toggle_display('hide') method calls the on_blank_display() method
"""
# GIVEN: A new SlideController instance.
mocked_on_blank_display = MagicMock()
mocked_on_theme_display = MagicMock()
mocked_on_hide_display = MagicMock()
slide_controller = SlideController(None)
slide_controller.on_blank_display = mocked_on_blank_display
slide_controller.on_theme_display = mocked_on_theme_display
slide_controller.on_hide_display = mocked_on_hide_display
# WHEN: toggle_display() is called with an argument of "hide"
slide_controller.toggle_display('hide')
# THEN: Only on_blank_display() should have been called with an argument of True
mocked_on_blank_display.assert_called_once_with(True)
self.assertEqual(0, mocked_on_theme_display.call_count, 'on_theme_display should not have been called')
self.assertEqual(0, mocked_on_hide_display.call_count, 'on_hide_display should not have been called')
def toggle_display_theme_test(self):
"""
Check that the toggle_display('theme') method calls the on_theme_display() method
"""
# GIVEN: A new SlideController instance.
mocked_on_blank_display = MagicMock()
mocked_on_theme_display = MagicMock()
mocked_on_hide_display = MagicMock()
slide_controller = SlideController(None)
slide_controller.on_blank_display = mocked_on_blank_display
slide_controller.on_theme_display = mocked_on_theme_display
slide_controller.on_hide_display = mocked_on_hide_display
# WHEN: toggle_display() is called with an argument of "theme"
slide_controller.toggle_display('theme')
# THEN: Only on_theme_display() should have been called with an argument of True
mocked_on_theme_display.assert_called_once_with(True)
self.assertEqual(0, mocked_on_blank_display.call_count, 'on_blank_display should not have been called')
self.assertEqual(0, mocked_on_hide_display.call_count, 'on_hide_display should not have been called')
def toggle_display_desktop_test(self):
"""
Check that the toggle_display('desktop') method calls the on_hide_display() method
"""
# GIVEN: A new SlideController instance.
mocked_on_blank_display = MagicMock()
mocked_on_theme_display = MagicMock()
mocked_on_hide_display = MagicMock()
slide_controller = SlideController(None)
slide_controller.on_blank_display = mocked_on_blank_display
slide_controller.on_theme_display = mocked_on_theme_display
slide_controller.on_hide_display = mocked_on_hide_display
# WHEN: toggle_display() is called with an argument of "desktop"
slide_controller.toggle_display('desktop')
# THEN: Only on_hide_display() should have been called with an argument of True
mocked_on_hide_display.assert_called_once_with(True)
self.assertEqual(0, mocked_on_blank_display.call_count, 'on_blank_display should not have been called')
self.assertEqual(0, mocked_on_theme_display.call_count, 'on_theme_display should not have been called')
def toggle_display_show_test(self):
"""
Check that the toggle_display('show') method calls all the on_X_display() methods
"""
# GIVEN: A new SlideController instance.
mocked_on_blank_display = MagicMock()
mocked_on_theme_display = MagicMock()
mocked_on_hide_display = MagicMock()
slide_controller = SlideController(None)
slide_controller.on_blank_display = mocked_on_blank_display
slide_controller.on_theme_display = mocked_on_theme_display
slide_controller.on_hide_display = mocked_on_hide_display
# WHEN: toggle_display() is called with an argument of "show"
slide_controller.toggle_display('show')
# THEN: All the on_X_display() methods should have been called with an argument of False
mocked_on_blank_display.assert_called_once_with(False)
mocked_on_theme_display.assert_called_once_with(False)
mocked_on_hide_display.assert_called_once_with(False)
def live_escape_test(self):
"""
Test that when the live_escape() method is called, the display is set to invisible and any media is stopped
"""
# GIVEN: A new SlideController instance and mocked out display and media_controller
mocked_display = MagicMock()
mocked_media_controller = MagicMock()
Registry.create()
Registry().register('media_controller', mocked_media_controller)
slide_controller = SlideController(None)
slide_controller.display = mocked_display
# WHEN: live_escape() is called
slide_controller.live_escape()
# THEN: the display should be set to invisible and the media controller stopped
mocked_display.setVisible.assert_called_once_with(False)
mocked_media_controller.media_stop.assert_called_once_with(slide_controller)
def service_previous_test(self):
"""
Check that calling the service_previous() method adds the previous key to the queue and processes the queue
"""
# GIVEN: A new SlideController instance.
mocked_keypress_queue = MagicMock()
mocked_process_queue = MagicMock()
slide_controller = SlideController(None)
slide_controller.keypress_queue = mocked_keypress_queue
slide_controller._process_queue = mocked_process_queue
# WHEN: The service_previous() method is called
slide_controller.service_previous()
# THEN: The keypress is added to the queue and the queue is processed
mocked_keypress_queue.append.assert_called_once_with(ServiceItemAction.Previous)
mocked_process_queue.assert_called_once_with()
def service_next_test(self):
"""
Check that calling the service_next() method adds the next key to the queue and processes the queue
"""
# GIVEN: A new SlideController instance and mocked out methods
mocked_keypress_queue = MagicMock()
mocked_process_queue = MagicMock()
slide_controller = SlideController(None)
slide_controller.keypress_queue = mocked_keypress_queue
slide_controller._process_queue = mocked_process_queue
# WHEN: The service_next() method is called
slide_controller.service_next()
# THEN: The keypress is added to the queue and the queue is processed
mocked_keypress_queue.append.assert_called_once_with(ServiceItemAction.Next)
mocked_process_queue.assert_called_once_with()
def update_slide_limits_test(self):
"""
Test that calling the update_slide_limits() method updates the slide limits
"""
# GIVEN: A mocked out Settings object, a new SlideController and a mocked out main_window
with patch('openlp.core.ui.slidecontroller.Settings') as MockedSettings:
mocked_value = MagicMock(return_value=10)
MockedSettings.return_value = MagicMock(value=mocked_value)
mocked_main_window = MagicMock(advanced_settings_section='advanced')
Registry.create()
Registry().register('main_window', mocked_main_window)
slide_controller = SlideController(None)
# WHEN: update_slide_limits() is called
slide_controller.update_slide_limits()
# THEN: The value of slide_limits should be 10
mocked_value.assert_called_once_with('advanced/slide limits')
self.assertEqual(10, slide_controller.slide_limits, 'Slide limits should have been updated to 10')
def enable_tool_bar_live_test(self):
"""
Check that when enable_tool_bar on a live slide controller is called, enable_live_tool_bar is called
"""
# GIVEN: Mocked out enable methods and a real slide controller which is set to live
mocked_enable_live_tool_bar = MagicMock()
mocked_enable_preview_tool_bar = MagicMock()
slide_controller = SlideController(None)
slide_controller.is_live = True
slide_controller.enable_live_tool_bar = mocked_enable_live_tool_bar
slide_controller.enable_preview_tool_bar = mocked_enable_preview_tool_bar
mocked_service_item = MagicMock()
# WHEN: enable_tool_bar() is called
slide_controller.enable_tool_bar(mocked_service_item)
# THEN: The enable_live_tool_bar() method is called, not enable_preview_tool_bar()
mocked_enable_live_tool_bar.assert_called_once_with(mocked_service_item)
self.assertEqual(0, mocked_enable_preview_tool_bar.call_count, 'The preview method should not have been called')
def enable_tool_bar_preview_test(self):
"""
Check that when enable_tool_bar on a preview slide controller is called, enable_preview_tool_bar is called
"""
# GIVEN: Mocked out enable methods and a real slide controller which is set to live
mocked_enable_live_tool_bar = MagicMock()
mocked_enable_preview_tool_bar = MagicMock()
slide_controller = SlideController(None)
slide_controller.is_live = False
slide_controller.enable_live_tool_bar = mocked_enable_live_tool_bar
slide_controller.enable_preview_tool_bar = mocked_enable_preview_tool_bar
mocked_service_item = MagicMock()
# WHEN: enable_tool_bar() is called
slide_controller.enable_tool_bar(mocked_service_item)
# THEN: The enable_preview_tool_bar() method is called, not enable_live_tool_bar()
mocked_enable_preview_tool_bar.assert_called_once_with(mocked_service_item)
self.assertEqual(0, mocked_enable_live_tool_bar.call_count, 'The live method should not have been called')
def refresh_service_item_text_test(self):
"""
Test that the refresh_service_item() method refreshes a text service item
"""
# GIVEN: A mock service item and a fresh slide controller
mocked_service_item = MagicMock()
mocked_service_item.is_text.return_value = True
mocked_service_item.is_image.return_value = False
mocked_process_item = MagicMock()
slide_controller = SlideController(None)
slide_controller.service_item = mocked_service_item
slide_controller._process_item = mocked_process_item
slide_controller.selected_row = 5
# WHEN: The refresh_service_item method() is called
slide_controller.refresh_service_item()
# THEN: The item should be re-processed
mocked_service_item.is_text.assert_called_once_with()
self.assertEqual(0, mocked_service_item.is_image.call_count, 'is_image should not have been called')
mocked_service_item.render.assert_called_once_with()
mocked_process_item.assert_called_once_with(mocked_service_item, 5)
def refresh_service_item_image_test(self):
"""
Test that the refresh_service_item() method refreshes a image service item
"""
# GIVEN: A mock service item and a fresh slide controller
mocked_service_item = MagicMock()
mocked_service_item.is_text.return_value = False
mocked_service_item.is_image.return_value = True
mocked_process_item = MagicMock()
slide_controller = SlideController(None)
slide_controller.service_item = mocked_service_item
slide_controller._process_item = mocked_process_item
slide_controller.selected_row = 5
# WHEN: The refresh_service_item method() is called
slide_controller.refresh_service_item()
# THEN: The item should be re-processed
mocked_service_item.is_text.assert_called_once_with()
mocked_service_item.is_image.assert_called_once_with()
mocked_service_item.render.assert_called_once_with()
mocked_process_item.assert_called_once_with(mocked_service_item, 5)
def refresh_service_item_not_image_or_text_test(self):
"""
Test that the refresh_service_item() method does not refresh a service item if it's neither text or an image
"""
# GIVEN: A mock service item and a fresh slide controller
mocked_service_item = MagicMock()
mocked_service_item.is_text.return_value = False
mocked_service_item.is_image.return_value = False
mocked_process_item = MagicMock()
slide_controller = SlideController(None)
slide_controller.service_item = mocked_service_item
slide_controller._process_item = mocked_process_item
slide_controller.selected_row = 5
# WHEN: The refresh_service_item method() is called
slide_controller.refresh_service_item()
# THEN: The item should be re-processed
mocked_service_item.is_text.assert_called_once_with()
mocked_service_item.is_image.assert_called_once_with()
self.assertEqual(0, mocked_service_item.render.call_count, 'The render() method should not have been called')
self.assertEqual(0, mocked_process_item.call_count,
'The mocked_process_item() method should not have been called')
def add_service_item_with_song_edit_test(self):
"""
Test the add_service_item() method when song_edit is True
"""
# GIVEN: A slide controller and a new item to add
mocked_item = MagicMock()
mocked_process_item = MagicMock()
slide_controller = SlideController(None)
slide_controller._process_item = mocked_process_item
slide_controller.song_edit = True
slide_controller.selected_row = 2
# WHEN: The item is added to the service
slide_controller.add_service_item(mocked_item)
# THEN: The item is processed, the slide number is correct, and the song is not editable (or something)
mocked_item.render.assert_called_once_with()
self.assertFalse(slide_controller.song_edit, 'song_edit should be False')
mocked_process_item.assert_called_once_with(mocked_item, 2)
def add_service_item_without_song_edit_test(self):
"""
Test the add_service_item() method when song_edit is False
"""
# GIVEN: A slide controller and a new item to add
mocked_item = MagicMock()
mocked_process_item = MagicMock()
slide_controller = SlideController(None)
slide_controller._process_item = mocked_process_item
slide_controller.song_edit = False
slide_controller.selected_row = 2
# WHEN: The item is added to the service
slide_controller.add_service_item(mocked_item)
# THEN: The item is processed, the slide number is correct, and the song is not editable (or something)
mocked_item.render.assert_called_once_with()
self.assertFalse(slide_controller.song_edit, 'song_edit should be False')
mocked_process_item.assert_called_once_with(mocked_item, 0)
def replace_service_manager_item_different_items_test(self):
"""
Test that when the service items are not the same, nothing happens
"""
# GIVEN: A slide controller and a new item to add
mocked_item = MagicMock()
mocked_preview_widget = MagicMock()
mocked_process_item = MagicMock()
slide_controller = SlideController(None)
slide_controller.preview_widget = mocked_preview_widget
slide_controller._process_item = mocked_process_item
slide_controller.service_item = None
# WHEN: The service item is replaced
slide_controller.replace_service_manager_item(mocked_item)
# THEN: The service item should not be processed
self.assertEqual(0, mocked_process_item.call_count, 'The _process_item() method should not have been called')
self.assertEqual(0, mocked_preview_widget.current_slide_number.call_count,
'The preview_widgetcurrent_slide_number.() method should not have been called')
def replace_service_manager_item_same_item_test(self):
"""
Test that when the service item is the same, the service item is reprocessed
"""
# GIVEN: A slide controller and a new item to add
mocked_item = MagicMock()
mocked_preview_widget = MagicMock()
mocked_preview_widget.current_slide_number.return_value = 7
mocked_process_item = MagicMock()
slide_controller = SlideController(None)
slide_controller.preview_widget = mocked_preview_widget
slide_controller._process_item = mocked_process_item
slide_controller.service_item = mocked_item
# WHEN: The service item is replaced
slide_controller.replace_service_manager_item(mocked_item)
# THEN: The service item should not be processed
mocked_preview_widget.current_slide_number.assert_called_with()
mocked_process_item.assert_called_once_with(mocked_item, 7)
def on_slide_selected_index_no_service_item_test(self):
"""
Test that when there is no service item, the on_slide_selected_index() method returns immediately
"""
# GIVEN: A mocked service item and a slide controller without a service item
mocked_item = MagicMock()
slide_controller = SlideController(None)
slide_controller.service_item = None
# WHEN: The method is called
slide_controller.on_slide_selected_index([10])
# THEN: It should have exited early
self.assertEqual(0, mocked_item.is_command.call_count, 'The service item should have not been called')
def on_slide_selected_index_service_item_command_test(self):
"""
Test that when there is a command service item, the command is executed
"""
# GIVEN: A mocked service item and a slide controller with a service item
mocked_item = MagicMock()
mocked_item.is_command.return_value = True
mocked_item.name = 'Mocked Item'
mocked_update_preview = MagicMock()
mocked_preview_widget = MagicMock()
mocked_slide_selected = MagicMock()
with patch.object(Registry, 'execute') as mocked_execute:
Registry.create()
slide_controller = SlideController(None)
slide_controller.service_item = mocked_item
slide_controller.update_preview = mocked_update_preview
slide_controller.preview_widget = mocked_preview_widget
slide_controller.slide_selected = mocked_slide_selected
slide_controller.is_live = True
# WHEN: The method is called
slide_controller.on_slide_selected_index([9])
# THEN: It should have sent a notification
mocked_item.is_command.assert_called_once_with()
mocked_execute.assert_called_once_with('mocked item_slide', [mocked_item, True, 9])
mocked_update_preview.assert_called_once_with()
self.assertEqual(0, mocked_preview_widget.change_slide.call_count, 'Change slide should not have been called')
self.assertEqual(0, mocked_slide_selected.call_count, 'slide_selected should not have been called')
def on_slide_selected_index_service_item_not_command_test(self):
"""
Test that when there is a service item but it's not a command, the preview widget is updated
"""
# GIVEN: A mocked service item and a slide controller with a service item
mocked_item = MagicMock()
mocked_item.is_command.return_value = False
mocked_item.name = 'Mocked Item'
mocked_update_preview = MagicMock()
mocked_preview_widget = MagicMock()
mocked_slide_selected = MagicMock()
with patch.object(Registry, 'execute') as mocked_execute:
Registry.create()
slide_controller = SlideController(None)
slide_controller.service_item = mocked_item
slide_controller.update_preview = mocked_update_preview
slide_controller.preview_widget = mocked_preview_widget
slide_controller.slide_selected = mocked_slide_selected
# WHEN: The method is called
slide_controller.on_slide_selected_index([7])
# THEN: It should have sent a notification
mocked_item.is_command.assert_called_once_with()
self.assertEqual(0, mocked_execute.call_count, 'Execute should not have been called')
self.assertEqual(0, mocked_update_preview.call_count, 'Update preview should not have been called')
mocked_preview_widget.change_slide.assert_called_once_with(7)
mocked_slide_selected.assert_called_once_with()

View File

@ -0,0 +1,62 @@
# -*- 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 #
###############################################################################
"""
Package to test the openlp.core.ui.thememanager package.
"""
import zipfile
import os
from unittest import TestCase
from tests.interfaces import MagicMock
from openlp.core.ui import ThemeManager
RESOURCES_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'resources', 'themes'))
class TestThemeManager(TestCase):
def export_theme_test(self):
"""
Test exporting a theme .
"""
# GIVEN: A new ThemeManager instance.
theme_manager = ThemeManager()
theme_manager.path = RESOURCES_PATH
zipfile.ZipFile.__init__ = MagicMock()
zipfile.ZipFile.__init__.return_value = None
zipfile.ZipFile.write = MagicMock()
# WHEN: The theme is exported
theme_manager._export_theme('/some/path', 'Default')
# THEN: The zipfile should be created at the given path
zipfile.ZipFile.__init__.assert_called_with('/some/path/Default.otz', 'w')
zipfile.ZipFile.write.assert_called_with(os.path.join(RESOURCES_PATH, 'Default', 'Default.xml'),
'Default/Default.xml')

View File

@ -112,3 +112,44 @@ class TestDB(TestCase):
# THEN: It should have been removed and the other author should still be there # THEN: It should have been removed and the other author should still be there
self.assertEqual(1, len(song.authors_songs)) self.assertEqual(1, len(song.authors_songs))
self.assertEqual(None, song.authors_songs[0].author_type) self.assertEqual(None, song.authors_songs[0].author_type)
def test_get_author_type_from_translated_text(self):
"""
Test getting an author type from translated text
"""
# GIVEN: A string with an author type
author_type_name = AuthorType.Types[AuthorType.Words]
# WHEN: We call the method
author_type = AuthorType.from_translated_text(author_type_name)
# THEN: The type should be correct
self.assertEqual(author_type, AuthorType.Words)
def test_author_get_display_name(self):
"""
Test that the display name of an author is correct
"""
# GIVEN: An author
author = Author()
author.display_name = "John Doe"
# WHEN: We call the get_display_name() function
display_name = author.get_display_name()
# THEN: It should return only the name
self.assertEqual("John Doe", display_name)
def test_author_get_display_name_with_type(self):
"""
Test that the display name of an author with a type is correct
"""
# GIVEN: An author
author = Author()
author.display_name = "John Doe"
# WHEN: We call the get_display_name() function
display_name = author.get_display_name(AuthorType.Words)
# THEN: It should return the name with the type in brackets
self.assertEqual("John Doe (Words)", display_name)

View File

@ -28,6 +28,7 @@ class TestMediaItem(TestCase, TestMixin):
patch('openlp.plugins.songs.forms.editsongform.EditSongForm.__init__'): patch('openlp.plugins.songs.forms.editsongform.EditSongForm.__init__'):
self.media_item = SongMediaItem(None, MagicMock()) self.media_item = SongMediaItem(None, MagicMock())
self.media_item.display_songbook = False self.media_item.display_songbook = False
self.media_item.display_copyright_symbol = False
self.get_application() self.get_application()
self.build_settings() self.build_settings()
QtCore.QLocale.setDefault(QtCore.QLocale('en_GB')) QtCore.QLocale.setDefault(QtCore.QLocale('en_GB'))
@ -154,6 +155,39 @@ class TestMediaItem(TestCase, TestMixin):
# THEN: The songbook should be in the footer # THEN: The songbook should be in the footer
self.assertEqual(service_item.raw_footer, ['My Song', 'My copyright', 'My songbook #12']) self.assertEqual(service_item.raw_footer, ['My Song', 'My copyright', 'My songbook #12'])
def build_song_footer_copyright_enabled_test(self):
"""
Test building song footer with displaying the copyright symbol
"""
# GIVEN: A Song and a Service Item; displaying the copyright symbol is enabled
self.media_item.display_copyright_symbol = True
mock_song = MagicMock()
mock_song.title = 'My Song'
mock_song.copyright = 'My copyright'
service_item = ServiceItem(None)
# WHEN: I generate the Footer with default settings
self.media_item.generate_footer(service_item, mock_song)
# THEN: The copyright symbol should be in the footer
self.assertEqual(service_item.raw_footer, ['My Song', '© My copyright'])
def build_song_footer_copyright_disabled_test(self):
"""
Test building song footer without displaying the copyright symbol
"""
# GIVEN: A Song and a Service Item; displaying the copyright symbol should be disabled by default
mock_song = MagicMock()
mock_song.title = 'My Song'
mock_song.copyright = 'My copyright'
service_item = ServiceItem(None)
# WHEN: I generate the Footer with default settings
self.media_item.generate_footer(service_item, mock_song)
# THEN: The copyright symbol should not be in the footer
self.assertEqual(service_item.raw_footer, ['My Song', 'My copyright'])
def authors_match_test(self): def authors_match_test(self):
""" """
Test the author matching when importing a song from a service Test the author matching when importing a song from a service

View File

@ -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-2013 Raoul Snyman #
# Portions copyright (c) 2008-2013 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 #
###############################################################################
"""
The :mod:`powerpraiseimport` module provides the functionality for importing
ProPresenter song files into the current installation database.
"""
import os
from tests.helpers.songfileimport import SongImportTestHelper
TEST_PATH = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'powerpraisesongs'))
class TestPowerPraiseFileImport(SongImportTestHelper):
def __init__(self, *args, **kwargs):
self.importer_class_name = 'PowerPraiseImport'
self.importer_module_name = 'powerpraise'
super(TestPowerPraiseFileImport, self).__init__(*args, **kwargs)
def test_song_import(self):
"""
Test that loading a PowerPraise file works correctly
"""
self.file_import([os.path.join(TEST_PATH, 'Näher, mein Gott zu Dir.ppl')],
self.load_external_result_data(os.path.join(TEST_PATH, 'Näher, mein Gott zu Dir.json')))
self.file_import([os.path.join(TEST_PATH, 'You are so faithful.ppl')],
self.load_external_result_data(os.path.join(TEST_PATH, 'You are so faithful.json')))

View File

@ -0,0 +1,53 @@
# -*- 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 PresentationManager song importer.
"""
import os
from tests.helpers.songfileimport import SongImportTestHelper
TEST_PATH = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'presentationmanagersongs'))
class TestSongShowPlusFileImport(SongImportTestHelper):
def __init__(self, *args, **kwargs):
self.importer_class_name = 'PresentationManagerImport'
self.importer_module_name = 'presentationmanager'
super(TestSongShowPlusFileImport, self).__init__(*args, **kwargs)
def test_song_import(self):
"""
Test that loading a PresentationManager file works correctly
"""
self.file_import([os.path.join(TEST_PATH, 'Great Is Thy Faithfulness.sng')],
self.load_external_result_data(os.path.join(TEST_PATH, 'Great Is Thy Faithfulness.json')))

View File

@ -48,7 +48,7 @@ class TestProPresenterFileImport(SongImportTestHelper):
def test_song_import(self): def test_song_import(self):
""" """
Test that loading an ProPresenter file works correctly Test that loading a ProPresenter file works correctly
""" """
self.file_import([os.path.join(TEST_PATH, 'Amazing Grace.pro4')], self.file_import([os.path.join(TEST_PATH, 'Amazing Grace.pro4')],
self.load_external_result_data(os.path.join(TEST_PATH, 'Amazing Grace.json'))) self.load_external_result_data(os.path.join(TEST_PATH, 'Amazing Grace.json')))

View File

@ -31,10 +31,13 @@ The :mod:`songfileimporthelper` modules provides a helper class and methods to e
song files from third party applications. song files from third party applications.
""" """
import json import json
import logging
from unittest import TestCase from unittest import TestCase
from tests.functional import patch, MagicMock, call from tests.functional import patch, MagicMock, call
log = logging.getLogger(__name__)
class SongImportTestHelper(TestCase): class SongImportTestHelper(TestCase):
""" """
@ -108,9 +111,21 @@ class SongImportTestHelper(TestCase):
topics = self._get_data(result_data, 'topics') topics = self._get_data(result_data, 'topics')
verse_order_list = self._get_data(result_data, 'verse_order_list') verse_order_list = self._get_data(result_data, 'verse_order_list')
# THEN: do_import should return none, the song data should be as expected, and finish should have been # THEN: do_import should return none, the song data should be as expected, and finish should have been called.
# called.
self.assertIsNone(importer.do_import(), 'do_import should return None when it has completed') self.assertIsNone(importer.do_import(), 'do_import should return None when it has completed')
# Debug information - will be displayed when the test fails
log.debug("Title imported: %s" % importer.title)
log.debug("Verses imported: %s" % self.mocked_add_verse.mock_calls)
log.debug("Verse order imported: %s" % importer.verse_order_list)
log.debug("Authors imported: %s" % self.mocked_add_author.mock_calls)
log.debug("CCLI No. imported: %s" % importer.ccli_number)
log.debug("Comments imported: %s" % importer.comments)
log.debug("Songbook imported: %s" % importer.song_book_name)
log.debug("Song number imported: %s" % importer.song_number)
log.debug("Song copyright imported: %s" % importer.song_number)
log.debug("Topics imported: %s" % importer.topics)
self.assertEqual(importer.title, title, 'title for %s should be "%s"' % (source_file_name, title)) self.assertEqual(importer.title, title, 'title for %s should be "%s"' % (source_file_name, title))
for author in author_calls: for author in author_calls:
self.mocked_add_author.assert_any_call(author) self.mocked_add_author.assert_any_call(author)

View File

@ -0,0 +1,18 @@
{
"title": "Näher, mein Gott, zu Dir",
"verse_order_list": ["v1", "v2", "v3"],
"verses": [
[
"Näher, mein Gott, zu Dir,\nsei meine Bitt'!\nNäher, o Herr, zu Dir\nmit jedem Schritt.\nNur an dem Herzen Dein\nkann ich geborgen sein;\ndeshalb die Bitte mein:\nNäher zu Dir!",
"v1"
],
[
"Näher, mein Gott, zu Dir!\nEin jeder Tag\nsoll es neu zeigen mir,\nwas er vermag:\nWie seiner Gnade Macht,\nErlösung hat gebracht,\nin uns're Sündennacht.\nNäher zu Dir!",
"v2"
],
[
"Näher, mein Gott, zu Dir!\nDich bet' ich an.\nWie vieles hast an mir,\nDu doch getan!\nVon Banden frei und los,\nruh' ich in Deinem Schoss.\nJa, Deine Gnad' ist gross!\nNäher zu Dir!",
"v3"
]
]
}

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<ppl version="3.0"><general><title>Näher, mein Gott, zu Dir</title><category>Anbetung</category><language>Deutsch</language></general><songtext><part caption="Teil 1"><slide mainsize="42" backgroundnr="0"><line>Näher, mein Gott, zu Dir,</line><line>sei meine Bitt'!</line><line>Näher, o Herr, zu Dir</line><line>mit jedem Schritt.</line></slide><slide mainsize="44" backgroundnr="0"><line>Nur an dem Herzen Dein</line><line>kann ich geborgen sein;</line><line>deshalb die Bitte mein:</line><line>Näher zu Dir!</line></slide></part><part caption="Teil 2"><slide mainsize="42" backgroundnr="0"><line>Näher, mein Gott, zu Dir!</line><line>Ein jeder Tag</line><line>soll es neu zeigen mir,</line><line>was er vermag:</line></slide><slide mainsize="42" backgroundnr="0"><line>Wie seiner Gnade Macht,</line><line>Erlösung hat gebracht,</line><line>in uns're Sündennacht.</line><line>Näher zu Dir!</line></slide></part><part caption="Teil 3"><slide mainsize="42" backgroundnr="0"><line>Näher, mein Gott, zu Dir!</line><line>Dich bet' ich an.</line><line>Wie vieles hast an mir,</line><line>Du doch getan!</line></slide><slide mainsize="42" backgroundnr="0"><line>Von Banden frei und los,</line><line>ruh' ich in Deinem Schoss.</line><line>Ja, Deine Gnad' ist gross!</line><line>Näher zu Dir!</line></slide></part></songtext><order><item>Teil 1</item><item>Teil 2</item><item>Teil 3</item></order><information><copyright><position>lastslide</position><text><line>Text und Musik: Lowell Mason, 1792-1872</line></text></copyright><source><position>firstslide</position><text><line>grünes Buch 339</line></text></source></information><formatting><font><maintext><name>Times New Roman</name><size>44</size><bold>true</bold><italic>true</italic><color>16777215</color><outline>30</outline><shadow>15</shadow></maintext><translationtext><name>Times New Roman</name><size>20</size><bold>false</bold><italic>false</italic><color>16777215</color><outline>30</outline><shadow>20</shadow></translationtext><copyrighttext><name>Times New Roman</name><size>14</size><bold>false</bold><italic>false</italic><color>16777215</color><outline>30</outline><shadow>20</shadow></copyrighttext><sourcetext><name>Times New Roman</name><size>30</size><bold>false</bold><italic>false</italic><color>16777215</color><outline>30</outline><shadow>20</shadow></sourcetext><outline><enabled>false</enabled><color>0</color></outline><shadow><enabled>true</enabled><color>0</color><direction>125</direction></shadow></font><background><file>Blumen\Blume 3.jpg</file></background><linespacing><main>30</main><translation>20</translation></linespacing><textorientation><horizontal>left</horizontal><vertical>center</vertical><transpos>inline</transpos></textorientation><borders><mainleft>50</mainleft><maintop>40</maintop><mainright>60</mainright><mainbottom>70</mainbottom><copyrightbottom>30</copyrightbottom><sourcetop>20</sourcetop><sourceright>40</sourceright></borders></formatting></ppl>

View File

@ -0,0 +1,26 @@
{
"title": "You are so faithful",
"verse_order_list": ["v1", "c1", "v2", "c1", "v3", "c1", "v4"],
"verses": [
[
"You are so faithful\nso faithful, so faithful.\nYou are so faithful\nso faithful, so faithful.",
"v1"
],
[
"That's why I praise you\nin the morning\nThat's why I praise you\nin the noontime.\nThat's why I praise you\nin the evening\nThat's why I praise you\nall the time.",
"c1"
],
[
"You are so loving\nso loving, so loving.\nYou are so loving\nso loving, so loving.",
"v2"
],
[
"You are so caring\nso caring, so caring.\nYou are so caring\nso caring, so caring.",
"v3"
],
[
"You are so mighty\nso mighty, so mighty.\nYou are so mighty\nso mighty, so mighty.",
"v4"
]
]
}

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<ppl version="3.0"><general><title>You are so faithful</title><category>Lobpreis</category><language>Englisch</language></general><songtext><part caption="Strophe 1"><slide mainsize="30" backgroundnr="0"><line>You are so faithful</line><line>so faithful, so faithful.</line><translation>Du bist so treu</translation><translation>so treu, so treu.</translation></slide><slide mainsize="30" backgroundnr="0"><line>You are so faithful</line><line>so faithful, so faithful.</line><translation>Du bist so treu</translation><translation>so treu, so treu.</translation></slide></part><part caption="Refrain"><slide mainsize="30" backgroundnr="0"><line>That's why I praise you</line><line>in the morning</line><line>That's why I praise you</line><line>in the noontime.</line><translation>Deshalb preise ich Dich</translation><translation>am Morgen</translation><translation>Deshalb preise ich Dich</translation><translation>am Mittag.</translation></slide><slide mainsize="30" backgroundnr="0"><line>That's why I praise you</line><line>in the evening</line><line>That's why I praise you</line><line>all the time.</line><translation>Deshalb preise ich Dich</translation><translation>am Abend</translation><translation>Deshalb preise ich Dich</translation><translation>allezeit.</translation></slide></part><part caption="Strophe 2"><slide mainsize="30" backgroundnr="0"><line>You are so loving</line><line>so loving, so loving.</line><translation>Du bist so liebevoll</translation><translation>so liebevoll, so liebevoll.</translation></slide><slide mainsize="30" backgroundnr="0"><line>You are so loving</line><line>so loving, so loving.</line><translation>Du bist so liebevoll</translation><translation>so liebevoll, so liebevoll.</translation></slide></part><part caption="Strophe 3"><slide mainsize="30" backgroundnr="0"><line>You are so caring</line><line>so caring, so caring.</line><translation>Du sorgst so gut</translation><translation>Du kümmerst dich um uns.</translation></slide><slide mainsize="30" backgroundnr="0"><line>You are so caring</line><line>so caring, so caring.</line><translation>Du sorgst so gut</translation><translation>Du kümmerst dich um uns.</translation></slide></part><part caption="Strophe 4"><slide mainsize="30" backgroundnr="0"><line>You are so mighty</line><line>so mighty, so mighty.</line><translation>Du bist so mächtig</translation><translation>so mächtig, so mächtig.</translation></slide><slide mainsize="30" backgroundnr="0"><line>You are so mighty</line><line>so mighty, so mighty.</line><translation>Du bist so mächtig</translation><translation>so mächtig, so mächtig.</translation></slide></part></songtext><order><item>Strophe 1</item><item>Refrain</item><item>Strophe 2</item><item>Refrain</item><item>Strophe 3</item><item>Refrain</item><item>Strophe 4</item></order><information><copyright><position>lastslide</position><text><line>Musik &amp; Copyright unbekannt</line></text></copyright><source><position>firstslide</position><text/></source></information><formatting><font><maintext><name>Tahoma</name><size>30</size><bold>true</bold><italic>false</italic><color>16777215</color><outline>30</outline><shadow>20</shadow></maintext><translationtext><name>Tahoma</name><size>20</size><bold>false</bold><italic>false</italic><color>16777215</color><outline>30</outline><shadow>20</shadow></translationtext><copyrighttext><name>Tahoma</name><size>14</size><bold>false</bold><italic>false</italic><color>16777215</color><outline>30</outline><shadow>20</shadow></copyrighttext><sourcetext><name>Tahoma</name><size>30</size><bold>false</bold><italic>false</italic><color>16777215</color><outline>30</outline><shadow>20</shadow></sourcetext><outline><enabled>true</enabled><color>0</color></outline><shadow><enabled>true</enabled><color>0</color><direction>125</direction></shadow></font><background><file>Blumen\Blume 6.jpg</file></background><linespacing><main>30</main><translation>20</translation></linespacing><textorientation><horizontal>center</horizontal><vertical>center</vertical><transpos>inline</transpos></textorientation><borders><mainleft>50</mainleft><maintop>40</maintop><mainright>60</mainright><mainbottom>70</mainbottom><copyrightbottom>30</copyrightbottom><sourcetop>20</sourcetop><sourceright>40</sourceright></borders></formatting></ppl>

View File

@ -0,0 +1,25 @@
{
"title": "Great Is Thy Faithfulness",
"authors": [
"Thomas O. Chisholm (1866-1960)"
],
"verse_order_list": ["v1", "c1", "v2", "c1", "v3", "c1"],
"verses": [
[
"\"Great is Thy faithfulness\", O God my Father.\nThere is no shadow of turning with Thee;\nThou changest not, Thy compassions they fail not,\nAs Thou hast been Thou forever shall be.",
"v1"
],
[
"Great is Thy faithfulness!\nGreat is Thy faithfulness!\nMorning by morning new mercies I see!\nAll I have needed Thy hand hath provided -\n\"Great is Thy faithfulness\", Lord, unto me!",
"c1"
],
[
"Summer and winter, and springtime and harvest,\nSun, moon, and stars in their courses above,\nJoin with all nature in manifold witness,\nTo Thy great faithfulness, mercy and love.",
"v2"
],
[
"Pardon for sin and a peace that endureth,\nThine own dear presence to cheer and to guide,\nStrength for today and bright hope for tomorrow,\nBlessings all mine, with ten thousand beside!",
"v3"
]
]
}

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<song xmlns="creativelifestyles/song">
<attributes>
<title>Great Is Thy Faithfulness</title>
<author>Thomas O. Chisholm (1866-1960)</author>
<copyright></copyright>
<ccli_number></ccli_number>
<comments></comments>
</attributes>
<verses>
<verse id="Verse 1">
"Great is Thy faithfulness", O God my Father.
There is no shadow of turning with Thee;
Thou changest not, Thy compassions they fail not,
As Thou hast been Thou forever shall be.
</verse>
<verse id="Chorus">
Great is Thy faithfulness!
Great is Thy faithfulness!
Morning by morning new mercies I see!
All I have needed Thy hand hath provided -
"Great is Thy faithfulness", Lord, unto me!
</verse>
<verse id="Verse 2">
Summer and winter, and springtime and harvest,
Sun, moon, and stars in their courses above,
Join with all nature in manifold witness,
To Thy great faithfulness, mercy and love.
</verse>
<verse id="Chorus">
Great is Thy faithfulness!
Great is Thy faithfulness!
Morning by morning new mercies I see!
All I have needed Thy hand hath provided -
"Great is Thy faithfulness", Lord, unto me!
</verse>
<verse id="Verse 3">
Pardon for sin and a peace that endureth,
Thine own dear presence to cheer and to guide,
Strength for today and bright hope for tomorrow,
Blessings all mine, with ten thousand beside!
</verse>
<verse id="Chorus">
Great is Thy faithfulness!
Great is Thy faithfulness!
Morning by morning new mercies I see!
All I have needed Thy hand hath provided -
"Great is Thy faithfulness", Lord, unto me!
</verse>
</verses>
</song>

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<theme version="2.0">
<name>Default</name>
<background type="solid">
<color>#000000</color>
</background>
<font type="main">
<name>Arial</name>
<color>#FFFFFF</color>
<size>40</size>
<bold>False</bold>
<italics>False</italics>
<line_adjustment>0</line_adjustment>
<location height="690" override="False" width="1004" x="10" y="10"/>
<shadow shadowColor="#000000" shadowSize="5">True</shadow>
<outline outlineColor="#000000" outlineSize="2">False</outline>
</font>
<font type="footer">
<name>Arial</name>
<color>#FFFFFF</color>
<size>12</size>
<bold>False</bold>
<italics>False</italics>
<line_adjustment>0</line_adjustment>
<location height="78" override="False" width="1004" x="10" y="690"/>
<shadow shadowColor="#000000" shadowSize="5">True</shadow>
<outline outlineColor="#000000" outlineSize="2">False</outline>
</font>
<display>
<horizontalAlign>0</horizontalAlign>
<verticalAlign>0</verticalAlign>
<slideTransition>False</slideTransition>
</display>
</theme>

View File

@ -30,7 +30,7 @@
Package to test for proper bzr tags. Package to test for proper bzr tags.
""" """
import os import os
import re
from unittest import TestCase from unittest import TestCase
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
@ -52,6 +52,10 @@ TAGS = [
['2.0', '2118'], ['2.0', '2118'],
['2.1.0', '2119'] ['2.1.0', '2119']
] ]
# Depending on the repository, we sometimes have the 2.0.x tags in the repo too. They come up with a revision number of
# "?", which I suspect is due to the fact that we're using shared repositories. This regular expression matches all
# 2.0.x tags.
TAG_SEARCH = re.compile('2\.0\.\d')
class TestBzrTags(TestCase): class TestBzrTags(TestCase):
@ -65,8 +69,9 @@ class TestBzrTags(TestCase):
# WHEN getting the branches tags # WHEN getting the branches tags
bzr = Popen(('bzr', 'tags', '--directory=' + path), stdout=PIPE) bzr = Popen(('bzr', 'tags', '--directory=' + path), stdout=PIPE)
stdout = bzr.communicate()[0] std_out = bzr.communicate()[0]
tags = [line.decode('utf-8').split() for line in stdout.splitlines()] tags = [line.decode('utf-8').split() for line in std_out.splitlines()]
tags = [t_r for t_r in tags if t_r[1] != '?' or not (t_r[1] == '?' and TAG_SEARCH.search(t_r[0]))]
# THEN the tags should match the accepted tags # THEN the tags should match the accepted tags
self.assertEqual(TAGS, tags, 'List of tags should match') self.assertEqual(TAGS, tags, 'List of tags should match')