diff --git a/openlp/plugins/plugin.txt b/documentation/plugin.txt
similarity index 100%
rename from openlp/plugins/plugin.txt
rename to documentation/plugin.txt
diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py
index 84525352e..38bcd127c 100644
--- a/openlp/core/lib/__init__.py
+++ b/openlp/core/lib/__init__.py
@@ -172,7 +172,7 @@ from mediamanageritem import MediaManagerItem
from xmlrootclass import XmlRootClass
from serviceitem import ServiceItem
from serviceitem import ServiceItemType
-from serviceitem import ServiceItem
+from serviceitem import ItemCapabilities
from toolbar import OpenLPToolbar
from dockwidget import OpenLPDockWidget
from songxmlhandler import SongXMLBuilder, SongXMLParser
diff --git a/openlp/core/lib/eventreceiver.py b/openlp/core/lib/eventreceiver.py
index 45eeb5145..5b79fc40a 100644
--- a/openlp/core/lib/eventreceiver.py
+++ b/openlp/core/lib/eventreceiver.py
@@ -109,6 +109,12 @@ class EventReceiver(QtCore.QObject):
``presentation types``
Informs all components of the presentation types supported.
+ ``blank_check``
+ Check to see if th eblank display message is required
+
+ ``version_check``
+ Version has changed so pop up window.
+
"""
def __init__(self):
"""
diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py
index 5dc14e50e..81d9a5b03 100644
--- a/openlp/core/lib/mediamanageritem.py
+++ b/openlp/core/lib/mediamanageritem.py
@@ -419,7 +419,7 @@ class MediaManagerItem(QtGui.QWidget):
QtGui.QMessageBox.information(self,
self.trUtf8('No Service Item Selected'),
self.trUtf8('You must select a existing service item to add to.'))
- elif self.title == service_item.name:
+ elif self.title.lower() == service_item.name.lower():
self.generateSlideData(service_item)
self.parent.service_manager.addServiceItem(service_item)
else:
diff --git a/openlp/core/lib/rendermanager.py b/openlp/core/lib/rendermanager.py
index 9a621979b..e811529db 100644
--- a/openlp/core/lib/rendermanager.py
+++ b/openlp/core/lib/rendermanager.py
@@ -49,7 +49,7 @@ class RenderManager(object):
"""
log.info(u'RenderManager Loaded')
- def __init__(self, theme_manager, screens, screen_number=0):
+ def __init__(self, theme_manager, screens):
"""
Initialise the render manager.
"""
@@ -57,7 +57,6 @@ class RenderManager(object):
self.screens = screens
self.theme_manager = theme_manager
self.renderer = Renderer()
- self.screens.set_current_display(screen_number)
self.calculate_default(self.screens.current[u'size'])
self.theme = u''
self.service_theme = u''
@@ -65,12 +64,9 @@ class RenderManager(object):
self.override_background = None
self.themedata = None
- def update_display(self, screen_number):
+ def update_display(self):
"""
Updates the render manager's information about the current screen.
-
- ``screen_number``
- The updated index of the output/display screen.
"""
log.debug(u'Update Display')
self.calculate_default(self.screens.current[u'size'])
diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py
index d86597b40..7bb58af2b 100644
--- a/openlp/core/lib/serviceitem.py
+++ b/openlp/core/lib/serviceitem.py
@@ -42,6 +42,13 @@ class ServiceItemType(object):
Image = 2
Command = 3
+class ItemCapabilities(object):
+ AllowsPreview = 1
+ AllowsEdit = 2
+ AllowsMaintain = 3
+ RequiresMedia = 4
+
+
class ServiceItem(object):
"""
The service item is a base class for the plugins to use to interact with
@@ -67,14 +74,18 @@ class ServiceItem(object):
self.raw_footer = None
self.theme = None
self.service_item_type = None
- self.edit_enabled = False
- self.maintain_allowed = False
self._raw_frames = []
self._display_frames = []
self._uuid = unicode(uuid.uuid1())
- self.auto_preview_allowed = False
self.notes = u''
self.from_plugin = False
+ self.capabilities = []
+
+ def add_capability(self, capability):
+ self.capabilities.append(capability)
+
+ def is_capable(self, capability):
+ return capability in self.capabilities
def addIcon(self, icon):
"""
@@ -207,10 +218,8 @@ class ServiceItem(object):
u'type':self.service_item_type,
u'audit':self.audit,
u'notes':self.notes,
- u'preview':self.auto_preview_allowed,
- u'edit':self.edit_enabled,
- u'maintain':self.maintain_allowed,
- u'from_plugin':self.from_plugin
+ u'from_plugin':self.from_plugin,
+ u'capabilities':self.capabilities
}
service_data = []
if self.service_item_type == ServiceItemType.Text:
@@ -244,11 +253,9 @@ class ServiceItem(object):
self.addIcon(header[u'icon'])
self.raw_footer = header[u'footer']
self.audit = header[u'audit']
- self.auto_preview_allowed = header[u'preview']
self.notes = header[u'notes']
- self.edit_enabled = header[u'edit']
- self.maintain_allowed = header[u'maintain']
self.from_plugin = header[u'from_plugin']
+ self.capabilities = header[u'capabilities']
if self.service_item_type == ServiceItemType.Text:
for slide in serviceitem[u'serviceitem'][u'data']:
self._raw_frames.append(slide)
@@ -284,11 +291,8 @@ class ServiceItem(object):
"""
return self._uuid != other._uuid
- def is_song(self):
- return self.name.lower() == u'songs'
-
def is_media(self):
- return self.name.lower() == u'media'
+ return ItemCapabilities.RequiresMedia in self.capabilities
def is_command(self):
return self.service_item_type == ServiceItemType.Command
diff --git a/openlp/core/lib/settingstab.py b/openlp/core/lib/settingstab.py
index d22d72750..930ce6bc8 100644
--- a/openlp/core/lib/settingstab.py
+++ b/openlp/core/lib/settingstab.py
@@ -54,6 +54,7 @@ class SettingsTab(QtGui.QWidget):
self.config = PluginConfig(title)
else:
self.config = PluginConfig(section)
+ self.preLoad()
self.load()
def setupUi(self):
@@ -62,6 +63,12 @@ class SettingsTab(QtGui.QWidget):
"""
pass
+ def preLoad(self):
+ """
+ Setup the tab's interface.
+ """
+ pass
+
def retranslateUi(self):
"""
Setup the interface translation strings.
diff --git a/openlp/core/test/data_for_tests/render_theme.xml b/openlp/core/test/data_for_tests/render_theme.xml
deleted file mode 100644
index 63dfddc02..000000000
--- a/openlp/core/test/data_for_tests/render_theme.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
- openlp.org Packaged Theme
- 0
- clWhite
-
-
- Tahoma
- $00007F
- 53
- pixels
- 0
- $000000
- 0
- $000000
- 0
- 0
- 1
-
diff --git a/openlp/core/test/data_for_tests/snowbig.jpg b/openlp/core/test/data_for_tests/snowbig.jpg
deleted file mode 100644
index f1d041927..000000000
Binary files a/openlp/core/test/data_for_tests/snowbig.jpg and /dev/null differ
diff --git a/openlp/core/test/data_for_tests/snowsmall.jpg b/openlp/core/test/data_for_tests/snowsmall.jpg
deleted file mode 100644
index 3fd506415..000000000
Binary files a/openlp/core/test/data_for_tests/snowsmall.jpg and /dev/null differ
diff --git a/openlp/core/test/data_for_tests/sunset1.jpg b/openlp/core/test/data_for_tests/sunset1.jpg
deleted file mode 100644
index 75e819c6e..000000000
Binary files a/openlp/core/test/data_for_tests/sunset1.jpg and /dev/null differ
diff --git a/openlp/core/test/data_for_tests/treesbig.jpg b/openlp/core/test/data_for_tests/treesbig.jpg
deleted file mode 100644
index 9454b3a68..000000000
Binary files a/openlp/core/test/data_for_tests/treesbig.jpg and /dev/null differ
diff --git a/openlp/core/test/data_for_tests/treessmall.jpg b/openlp/core/test/data_for_tests/treessmall.jpg
deleted file mode 100644
index d52ec6e80..000000000
Binary files a/openlp/core/test/data_for_tests/treessmall.jpg and /dev/null differ
diff --git a/openlp/core/test/golden_bitmaps/test_bg_shrink_x.bmp b/openlp/core/test/golden_bitmaps/test_bg_shrink_x.bmp
deleted file mode 100644
index c7261c100..000000000
Binary files a/openlp/core/test/golden_bitmaps/test_bg_shrink_x.bmp and /dev/null differ
diff --git a/openlp/core/test/golden_bitmaps/test_bg_shrink_y.bmp b/openlp/core/test/golden_bitmaps/test_bg_shrink_y.bmp
deleted file mode 100644
index 91adf0188..000000000
Binary files a/openlp/core/test/golden_bitmaps/test_bg_shrink_y.bmp and /dev/null differ
diff --git a/openlp/core/test/golden_bitmaps/test_bg_stretch_x.bmp b/openlp/core/test/golden_bitmaps/test_bg_stretch_x.bmp
deleted file mode 100644
index 9741a266b..000000000
Binary files a/openlp/core/test/golden_bitmaps/test_bg_stretch_x.bmp and /dev/null differ
diff --git a/openlp/core/test/golden_bitmaps/test_bg_stretch_y.bmp b/openlp/core/test/golden_bitmaps/test_bg_stretch_y.bmp
deleted file mode 100644
index a05a930d8..000000000
Binary files a/openlp/core/test/golden_bitmaps/test_bg_stretch_y.bmp and /dev/null differ
diff --git a/openlp/core/test/golden_bitmaps/test_gradient_h.bmp b/openlp/core/test/golden_bitmaps/test_gradient_h.bmp
deleted file mode 100644
index f968fe8b7..000000000
Binary files a/openlp/core/test/golden_bitmaps/test_gradient_h.bmp and /dev/null differ
diff --git a/openlp/core/test/golden_bitmaps/test_gradient_v.bmp b/openlp/core/test/golden_bitmaps/test_gradient_v.bmp
deleted file mode 100644
index 1b9b434e3..000000000
Binary files a/openlp/core/test/golden_bitmaps/test_gradient_v.bmp and /dev/null differ
diff --git a/openlp/core/test/golden_bitmaps/test_theme_basic.bmp b/openlp/core/test/golden_bitmaps/test_theme_basic.bmp
deleted file mode 100644
index b156ac762..000000000
Binary files a/openlp/core/test/golden_bitmaps/test_theme_basic.bmp and /dev/null differ
diff --git a/openlp/core/test/golden_bitmaps/test_theme_font.bmp b/openlp/core/test/golden_bitmaps/test_theme_font.bmp
deleted file mode 100644
index c0f6f3aa5..000000000
Binary files a/openlp/core/test/golden_bitmaps/test_theme_font.bmp and /dev/null differ
diff --git a/openlp/core/test/golden_bitmaps/test_theme_horizontal_align_centre.bmp b/openlp/core/test/golden_bitmaps/test_theme_horizontal_align_centre.bmp
deleted file mode 100644
index 2c10be95e..000000000
Binary files a/openlp/core/test/golden_bitmaps/test_theme_horizontal_align_centre.bmp and /dev/null differ
diff --git a/openlp/core/test/golden_bitmaps/test_theme_horizontal_align_left.bmp b/openlp/core/test/golden_bitmaps/test_theme_horizontal_align_left.bmp
deleted file mode 100644
index c7245748e..000000000
Binary files a/openlp/core/test/golden_bitmaps/test_theme_horizontal_align_left.bmp and /dev/null differ
diff --git a/openlp/core/test/golden_bitmaps/test_theme_horizontal_align_left_lyric.bmp b/openlp/core/test/golden_bitmaps/test_theme_horizontal_align_left_lyric.bmp
deleted file mode 100644
index 8e3fc877a..000000000
Binary files a/openlp/core/test/golden_bitmaps/test_theme_horizontal_align_left_lyric.bmp and /dev/null differ
diff --git a/openlp/core/test/golden_bitmaps/test_theme_horizontal_align_right.bmp b/openlp/core/test/golden_bitmaps/test_theme_horizontal_align_right.bmp
deleted file mode 100644
index 7d404a85e..000000000
Binary files a/openlp/core/test/golden_bitmaps/test_theme_horizontal_align_right.bmp and /dev/null differ
diff --git a/openlp/core/test/golden_bitmaps/test_theme_shadow_outline.bmp b/openlp/core/test/golden_bitmaps/test_theme_shadow_outline.bmp
deleted file mode 100644
index daa1e07dd..000000000
Binary files a/openlp/core/test/golden_bitmaps/test_theme_shadow_outline.bmp and /dev/null differ
diff --git a/openlp/core/test/golden_bitmaps/test_theme_vertical_align_bot.bmp b/openlp/core/test/golden_bitmaps/test_theme_vertical_align_bot.bmp
deleted file mode 100644
index d43698b9f..000000000
Binary files a/openlp/core/test/golden_bitmaps/test_theme_vertical_align_bot.bmp and /dev/null differ
diff --git a/openlp/core/test/golden_bitmaps/test_theme_vertical_align_cen.bmp b/openlp/core/test/golden_bitmaps/test_theme_vertical_align_cen.bmp
deleted file mode 100644
index be19a7288..000000000
Binary files a/openlp/core/test/golden_bitmaps/test_theme_vertical_align_cen.bmp and /dev/null differ
diff --git a/openlp/core/test/golden_bitmaps/test_theme_vertical_align_top.bmp b/openlp/core/test/golden_bitmaps/test_theme_vertical_align_top.bmp
deleted file mode 100644
index c7245748e..000000000
Binary files a/openlp/core/test/golden_bitmaps/test_theme_vertical_align_top.bmp and /dev/null differ
diff --git a/openlp/core/test/test_mediamanageritem.py b/openlp/core/test/test_mediamanageritem.py
deleted file mode 100644
index a80bcdb64..000000000
--- a/openlp/core/test/test_mediamanageritem.py
+++ /dev/null
@@ -1,110 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2010 Raoul Snyman #
-# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
-# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
-# Thompson, Jon Tibble, Carsten Tinggaard #
-# --------------------------------------------------------------------------- #
-# 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 #
-###############################################################################
-
-import logging
-import os
-import sys
-
-from PyQt4 import QtCore, QtGui
-
-from openlp.core.lib import MediaManagerItem
-
-logging.basicConfig(level=logging.DEBUG,
- format='%(asctime)s %(name)-30s %(levelname)-8s %(message)s',
- datefmt='%m-%d %H:%M',
- filename='plugins.log',
- filemode='w')
-
-console=logging.StreamHandler()
-# set a format which is simpler for console use
-formatter = logging.Formatter(u'%(name)24s: %(levelname)-8s %(message)s')
-# tell the handler to use this format
-console.setFormatter(formatter)
-logging.getLogger(u'').addHandler(console)
-log = logging.getLogger(u'')
-logging.info(u'Logging started')
-mypath = os.path.split(os.path.abspath(__file__))[0]
-sys.path.insert(0,(os.path.join(mypath, '..' ,'..', '..')))
-
-class TestMediaManager:
- def setup_class(self):
- self.app = QtGui.QApplication([])
- logging.info (u'App is ' + unicode(self.app))
- self.main_window = QtGui.QMainWindow()
- self.main_window.resize(200, 600)
- self.MediaManagerDock = QtGui.QDockWidget(self.main_window)
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
- QtGui.QSizePolicy.Expanding)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(
- self.MediaManagerDock.sizePolicy().hasHeightForWidth())
- self.MediaManagerDock.setSizePolicy(sizePolicy)
- icon = QtGui.QIcon()
- icon.addPixmap(QtGui.QPixmap(u':/system/system_mediamanager.png'),
- QtGui.QIcon.Normal, QtGui.QIcon.Off)
- self.MediaManagerDock.setWindowIcon(icon)
- self.MediaManagerDock.setFloating(False)
- self.MediaManagerContents = QtGui.QWidget()
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
- QtGui.QSizePolicy.Expanding)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(
- self.MediaManagerContents.sizePolicy().hasHeightForWidth())
- self.MediaManagerContents.setSizePolicy(sizePolicy)
- self.MediaManagerLayout = QtGui.QHBoxLayout(self.MediaManagerContents)
- self.MediaManagerLayout.setContentsMargins(0, 2, 0, 0)
- self.MediaToolBox = QtGui.QToolBox(self.MediaManagerContents)
- self.MediaManagerDock.setWidget(self.MediaManagerContents)
- self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(1),
- self.MediaManagerDock)
- self.MediaManagerLayout.addWidget(self.MediaToolBox)
- def test1(self):
- log=logging.getLogger(u'test1')
- log.info(u'Start')
- i1=MediaManagerItem(self.MediaToolBox)
- i2=MediaManagerItem(self.MediaToolBox)
- log.info(u'i1'+unicode(i1))
- log.info(u'i2'+unicode(i2))
- i1.addToolbar()
- i1.addToolbarButton(u'Test1', u'Test1', None)
- i2.addToolbar()
- i2.addToolbarButton(u'Test2', u'Test2', None)
- self.MediaToolBox.setItemText(
- self.MediaToolBox.indexOf(i1), self.trUtf8('Item1'))
- self.MediaToolBox.setItemText(
- self.MediaToolBox.indexOf(i2), self.trUtf8('Item2'))
- log.info(u'Show window')
- self.main_window.show()
- log.info(u'End')
- return 1
-
-if __name__ == "__main__":
- t=TestMediaManager()
- t.setup_class()
- t.test1()
- log.info(u'exec')
- sys.exit(t.app.exec_())
diff --git a/openlp/core/test/test_plugin_manager.py b/openlp/core/test/test_plugin_manager.py
deleted file mode 100644
index c927fce9b..000000000
--- a/openlp/core/test/test_plugin_manager.py
+++ /dev/null
@@ -1,74 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2010 Raoul Snyman #
-# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
-# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
-# Thompson, Jon Tibble, Carsten Tinggaard #
-# --------------------------------------------------------------------------- #
-# 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 #
-###############################################################################
-
-import logging
-import os
-import sys
-
-from openlp.core.lib.pluginmanager import PluginManager
-
-logging.basicConfig(level=logging.DEBUG,
- format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
- datefmt='%m-%d %H:%M',
- filename='plugins.log',
- filemode='w')
-
-console=logging.StreamHandler()
-# set a format which is simpler for console use
-formatter = logging.Formatter(u'%(name)-12s: %(levelname)-8s %(message)s')
-# tell the handler to use this format
-console.setFormatter(formatter)
-logging.getLogger(u'').addHandler(console)
-log = logging.getLogger(u'')
-logging.info(u'Logging started')
-mypath = os.path.split(os.path.abspath(__file__))[0]
-sys.path.insert(0,(os.path.join(mypath, '..' ,'..', '..')))
-
-# test the plugin manager with some plugins in the test_plugins directory
-class TestPluginManager:
- def test_init(self):
- self.p = PluginManager(u'./testplugins')
- p = self.p
- p.find_plugins(u'./testplugins', None, None)
- assert(len(p.plugins) == 2)
- # get list of the names of the plugins
- names = [plugin.name for plugin in p.plugins]
- # see which ones we've got
- assert(u'testplugin1' in names)
- assert(u'testplugin2' in names)
- # and not got - it's too deep in the hierarchy!
- assert(u'testplugin3' not in names)
- # test that the weighting is done right
- assert(p.plugins[0].name == "testplugin2")
- assert(p.plugins[1].name == "testplugin1")
-
-if __name__ == "__main__":
- log.debug(u'Starting')
- t = TestPluginManager()
- t.test_init()
- log.debug(u'List of plugins found:')
- for plugin in t.p.plugins:
- log.debug(u'Plugin %s, name=%s (version=%d)' %(unicode(plugin),
- plugin.name, plugin.version))
diff --git a/openlp/core/test/test_render.py b/openlp/core/test/test_render.py
deleted file mode 100644
index 92f79cf37..000000000
--- a/openlp/core/test/test_render.py
+++ /dev/null
@@ -1,241 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2010 Raoul Snyman #
-# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
-# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
-# Thompson, Jon Tibble, Carsten Tinggaard #
-# --------------------------------------------------------------------------- #
-# 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 #
-###############################################################################
-
-import sys
-import os
-import os.path
-
-from PyQt4 import QtGui, QtCore
-
-from openlp.core.theme import Theme
-from openlp.core.lib import Renderer
-
-mypath = os.path.split(os.path.abspath(__file__))[0]
-sys.path.insert(0, (os.path.join(mypath, '..', '..', '..')))
-
-# from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66062
-def whoami(depth=1):
- return sys._getframe(depth).f_code.co_name
-
-class TstFrame:
- # {{{ init
-
- def __init__(self, size):
- """Create the DemoPanel."""
- self.width = size.width();
- self.height = size.height();
- # create something to be painted into
- self._Buffer = QtGui.QPixmap(self.width, self.height)
- def GetPixmap(self):
- return self._Buffer
-
- # }}}
-
-class TestRender_base:
- def __init__(self):
- if not os.path.exists(u'test_results'):
- os.mkdir(u'test_results')
- self.app = None
- def write_to_file(self, pixmap, name):
- im=pixmap.toImage()
- testpathname = os.path.join(u'test_results', name+'.bmp')
- if os.path.exists(testpathname):
- os.unlink(testpathname)
- im.save(testpathname, 'bmp')
- return im
- # xxx quitting the app still leaves it hanging aroudn so we die
- # when trying to start another one. Not quitting doesn't help
- # though This means that the py.test runs both test modules in
- # sequence and the second one tries to create another application
- # which gives us errors :(
-
- def setup_class(self):
- print "class setup", self
- try:
- if self.app is None:
- pass
- except AttributeError: # didn't have one
- print "No app"
- self.app = None
-
- print "Test app (should be None)"
- if self.app is None:
- print "App is None"
- self.app = QtGui.QApplication([])
- else:
- print "class setup, app is", app
-# self.app = QtGui.QApplication([])
-
- def teardown_class(self):
- print "class quit", self, self.app
- self.app.quit()
-
- def setup_method(self, method):
- print "SSsetup", method
- if not hasattr(self, 'app'):
- self.app = None
- try: # see if we already have an app for some reason.
- # have to try and so something, cant just test against None
- print "app", self.app, ";;;"
- print self.app.quit()
- print "quitted"
- except RuntimeError: # not valid app, create one
- print "Runtime error"
- except AttributeError: # didn't have one
- print "Attribute error"
-# print "App", self.app
-# self.app = QtGui.QApplication([])
- print "Application created and sorted"
- self.size = QtCore.QSize(800,600)
- frame = TstFrame(size = self.size)
- self.frame = frame
- self.paintdest = frame.GetPixmap()
- self.renderer = Renderer()
- self.renderer.set_paint_dest(self.paintdest)
- self.expected_answer = "Don't know yet"
- self.answer = None
- print "--------------- Setup Done -------------"
-
- def teardown_method(self, method):
- self.write_to_file(self.frame.GetPixmap(), 'test_render')
-
-class TestRender(TestRender_base):
- def __init__(self):
- TestRender_base.__init__(self)
-
- def setup_method(self, method):
- TestRender_base.setup_method(self, method)
- self.renderer.set_debug(1)
- themefile = os.path.abspath(u'data_for_tests/render_theme.xml')
- self.renderer.set_theme(Theme(themefile)) # set default theme
- self.renderer._render_background()
- self.renderer.set_text_rectangle(QtCore.QRect(
- 0,0, self.size.width()-1, self.size.height()-1))
- self.msg = None
-
- def test_easy(self):
- answer = self.renderer._render_single_line(
- u'Test line', tlcorner = (0,100))
- assert(answer == (219,163))
-
- def test_longer(self):
- answer = self.renderer._render_single_line(
- u'Test line with more words than fit on one line',
- tlcorner = (10,10))
- assert(answer == (753,136))
-
- def test_even_longer(self):
- answer = self.renderer._render_single_line(
- u'Test line with more words than fit on either one or two lines',
- tlcorner = (10,10))
- assert(answer == (753,199))
- def test_lines(self):
- lines = []
- lines.append(u'Line One')
- lines.append(u'Line Two')
- lines.append(u'Line Three and should be long enough to wrap')
- lines.append(u'Line Four and should be long enough to wrap also')
- answer = self.renderer._render_lines(lines)
- assert(answer == QtCore.QRect(0,0,741,378))
-
- def test_set_words_openlp(self):
- words="""
-Verse 1: Line 1
-Line 2
-
-Verse 2: Line 1
-Line 2
-
-Verse 3: Line 1
-Line 2
-Line 3"""
- expected_answer = ["Verse 1: Line 1\nLine 2","Verse 2: Line 1\nLine 2","Verse 3: Line 1\nLine 2\nLine 3"]
- answer = self.renderer.set_words_openlp(words)
- assert(answer == expected_answer)
-
- def test_render_screens(self):
- words="""
-Verse 1: Line 1
-Line 2
-
-Verse 2: Line 1
-Line 2
-
-Verse 3: Line 1
-Line 2
-Line 3"""
- verses = self.renderer.set_words_openlp(words)
- expected_answer = ["Verse 1: Line 1\nLine 2","Verse 2: Line 1\nLine 2","Verse 3: Line 1\nLine 2\nLine 3"]
- assert(verses == expected_answer)
-
- expected_answer = [QtCore.QRect(0,0,397,126), QtCore.QRect(0,0,397,126),
- QtCore.QRect(0,0,397,189)]
- for v in range(len(verses)):
- answer=self.renderer.render_screen(v)
-# print v, answer.x(), answer.y(), answer.width(), answer.height()
- assert(answer == expected_answer[v])
-
- def split_test(self, number, answer, expected_answers):
- lines=[]
- print "Split test", number, answer
- for i in range(number):
- extra=""
- if i == 51: # make an extra long line on line 51 to test wrapping
- extra = "Some more words to make it wrap around don't you know until it wraps so many times we don't know what to do"
- lines.append(u'Line %d %s' % (i, extra))
- result = self.renderer.split_set_of_lines(lines)
- print "results---------------__", result
- for i in range(len(result)):
- self.setup_method(None)
- answer = self.renderer._render_lines(result[i])
- print answer
- self.write_to_file(self.frame.GetPixmap(), "split_test_%03d"% i)
- print number, i, answer.x(), answer.y(), answer.width(), \
- answer.height()
- e = expected_answers[i]
- assert(answer == QtCore.QRect(e[0],e[1],e[2],e[3]))
-
-
- def test_splits(self):
- print "Test splits"
- self.split_test(100, 11, [(0,0,180,567), (0,0,214,567), (0,0,214,567),
- (0,0,214,567), (0,0,214,567), (0,0,214,378), (0,0,759,567),
- (0,0,214,567), (0,0,214,567), (0,0,214,567), (0,0,214,567),
- (0,0,214,567), (0,0,214,567)])
- self.split_test(30, 4, [ (0,0,180,441), (0,0,214,441), (0,0,214,441),
- (0,0,214,441)])
- self.split_test(20, 3, [(0,0,180,378), (0,0,214,378), (0,0,214,378)])
- self.split_test(12, 2, [(0,0,180,378), (0,0,214,378)])
- self.split_test(4, 1, [(0,0,180,252)])
- self.split_test(6, 1, [(0,0,180,378)])
- self.split_test(8, 1, [(0,0,180,504)])
-
-if __name__ == "__main__":
- t = TestRender()
- t.setup_class()
- t.setup_method(None)
- t.test_easy()
- t.test_splits()
- t.teardown_method(None)
diff --git a/openlp/core/test/test_render_theme.py b/openlp/core/test/test_render_theme.py
deleted file mode 100644
index 2b5d1a2b5..000000000
--- a/openlp/core/test/test_render_theme.py
+++ /dev/null
@@ -1,319 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2010 Raoul Snyman #
-# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
-# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
-# Thompson, Jon Tibble, Carsten Tinggaard #
-# --------------------------------------------------------------------------- #
-# 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 #
-###############################################################################
-
-import sys
-import os
-
-from PyQt4 import QtGui, QtCore
-
-from openlp.core.theme import Theme
-from test_render import TestRender_base, whoami
-
-pypath = os.path.split(os.path.abspath(__file__))[0]
-sys.path.insert(0, (os.path.join(mypath, '..', '..', '..')))
-
-def compare_images(goldenim, testim, threshold=0.01):
- # easy test first
- if goldenim == testim:
- return 1
- # how close are they? Calculated the sum of absolute differences in
- # each channel of each pixel and divide by the number of pixels in the image
- # if this sum is < threshold, the images are deemed to be "close enough"
- sad = 0;
- for x in range(goldenim.width()):
- for y in range(goldenim.height()):
- p1=goldenim.pixel(x,y)
- p2=testim.pixel(x,y)
- sad += abs((p1&0xFF)-(p2&0xFF))
- sad += abs((p1>>8&0xFF)-(p2>>8&0xFF))
- sad += abs((p1>>16&0xFF)-(p2>>16&0xFF))
- sad /= float(goldenim.width()*goldenim.height())
- if (sad < threshold):
- return 1
- return 0
-
-class TestRenderTheme(TestRender_base):
- # {{{ Basics
-
- def __init__(self):
- TestRender_base.__init__(self)
-
- def setup_method(self, method):
- TestRender_base.setup_method(self, method)
- print "Theme setup", method
-# print "setup theme"
- self.renderer.set_theme(Theme(u'blank_theme.xml')) # set "blank" theme
- self.renderer.set_text_rectangle(QtCore.QRect(0,0, self.size.width(),
- self.size.height()))
- words = """How sweet the name of Jesus sounds
-In a believer's ear!
-It soothes his sorrows, heals his wounds,
-And drives away his fear.
-"""
- verses = self.renderer.set_words_openlp(words)
-# usually the same
- self.expected_answer = QtCore.QRect(0, 0, 559, 342)
- self.msg = None
- self.bmpname = "Not set a bitmap yet"
- print "------------- setup done --------------"
-
- def teardown_method(self, method):
- print "============ teardown =============", method, self.bmpname
- if self.bmpname is not None:
- assert (self.compare_DC_to_file(self.bmpname))
- if self.expected_answer is not None: # result=None => Nothing to check
- assert self.expected_answer == self.answer
- print "============ teardown done ========="
-
- def compare_DC_to_file(self, name):
- """writes DC out to a bitmap file and then compares it with a golden
- one returns True if OK, False if not (so you can assert on it)
-
- """
- print "--- compare DC to file --- ", name
- p = self.frame.GetPixmap()
- im = self.write_to_file(p, name)
- print "Compare"
- goldenfilename=os.path.join(u'golden_bitmaps",name+".bmp')
- if os.path.exists(goldenfilename):
- goldenim = QtGui.QImage(goldenfilename)
- else:
- print "File", goldenfilename, "not found"
- return False
- if (compare_images(goldenim, im)):
- print name, "Images match"
- return True
- else:
- print name, goldenfilename, "Images don't match"
- return False
-
- def test_theme_basic(self):
- self.answer = self.renderer.render_screen(0)
- self.bmpname = whoami()
- print self.renderer._theme.FontProportion
- print self.answer, self.expected_answer, \
- self.answer == self.expected_answer
-# self.msg=self.bmpname
-
- # }}}
-
- # {{{ Gradients
- def test_gradient_h(self):
- # normally we wouldn't hack with these directly!
- self.renderer._theme.BackgroundType = 1
- self.renderer._theme.BackgroundParameter1 = QtGui.QColor(255,0,0)
- self.renderer._theme.BackgroundParameter2 = QtGui.QColor(255,255,0)
- self.renderer._theme.BackgroundParameter3 = 1
- self.answer = self.renderer.render_screen(0)
- self.bmpname = whoami()
-
- def test_gradient_v(self):
- # normally we wouldn't hack with these directly!
- self.renderer._theme.BackgroundType = 1
- self.renderer._theme.BackgroundParameter1 = QtGui.QColor(255,0,0)
- self.renderer._theme.BackgroundParameter2 = QtGui.QColor(255,255,0)
- self.renderer._theme.BackgroundParameter3 = 0
- self.answer = self.renderer.render_screen(0)
- self.bmpname = whoami()
- # }}}
-
- # {{{ backgrounds
- def test_bg_stretch_y(self):
- t = Theme(u'blank_theme.xml')
- t.BackgroundType = 2
- t.BackgroundParameter1 = os.path.join(u'data_for_tests',
- 'snowsmall.jpg')
- t.BackgroundParameter2 = QtGui.QColor(0,0,64)
- t.BackgroundParameter3 = 0
- t.Name = "stretch y"
- self.renderer.set_theme(t)
- print "render"
- self.answer = self.renderer.render_screen(0)
- print "whoami"
- self.bmpname = whoami()
- print "fone"
-
- def test_bg_shrink_y(self):
- t = Theme(u'blank_theme.xml')
- t.BackgroundType = 2
- t.BackgroundParameter1 = os.path.join(u'data_for_tests', 'snowbig.jpg')
- t.BackgroundParameter2 = QtGui.QColor(0,0,64)
- t.BackgroundParameter3 = 0
- t.Name = "shrink y"
- self.renderer.set_theme(t)
- self.answer = self.renderer.render_screen(0)
- self.bmpname = whoami()
-
- def test_bg_stretch_x(self):
- t = Theme(u'blank_theme.xml')
- t.BackgroundType = 2
- t.BackgroundParameter1 = os.path.join(u'data_for_tests',
- 'treessmall.jpg')
- t.BackgroundParameter2 = QtGui.QColor(0,0,64)
- t.BackgroundParameter3 = 0
- t.VerticalAlign = 2
- t.Name = "stretch x"
- self.renderer.set_theme(t)
- self.answer = self.renderer.render_screen(0)
- self.expected_answer = QtCore.QRect(0, 129, 559, 342)
- self.bmpname = whoami()
-
- def test_bg_shrink_x(self):
- t = Theme(u'blank_theme.xml')
- t.BackgroundType = 2
- t.BackgroundParameter1 = os.path.join(u'data_for_tests',
- 'treesbig.jpg')
- t.BackgroundParameter2 = QtGui.QColor(0,0,64)
- t.BackgroundParameter3 = 0
- t.VerticalAlign = 2
- t.Name = "shrink x"
- self.renderer.set_theme(t)
- self.expected_answer = QtCore.QRect(0, 129, 559, 342)
- self.answer = self.renderer.render_screen(0)
- self.bmpname = whoami()
- # }}}
-
- # {{{ Vertical alignment
- def test_theme_vertical_align_top(self):
- t = Theme(u'blank_theme.xml')
- t.BackgroundType = 0
- t.BackgroundParameter1 = QtGui.QColor(0,0,64)
- t.VerticalAlign = 0
- t.Name = "valign top"
- self.renderer.set_theme(t)
- self.answer = self.renderer.render_screen(0)
- self.bmpname = whoami()
-
- def test_theme_vertical_align_bot(self):
- t = Theme(u'blank_theme.xml')
- t.BackgroundType = 0
- t.BackgroundParameter1 = QtGui.QColor(0,0,64)
- t.VerticalAlign = 1
- t.Name = "valign bot"
- self.renderer.set_theme(t)
- self.answer = self.renderer.render_screen(0)
- self.expected_answer = QtCore.QRect(0, 257, 559, 342)
- self.bmpname = whoami()
-
- def test_theme_vertical_align_cen(self):
- t = Theme(u'blank_theme.xml')
- t.BackgroundType = 0
- t.BackgroundParameter1 = QtGui.QColor(0,0,64)
- t.VerticalAlign = 2
- t.Name = "valign cen"
- self.renderer.set_theme(t)
- self.answer = self.renderer.render_screen(0)
- self.expected_answer = QtCore.QRect(0, 129, 559, 342)
- self.bmpname = whoami()
- # }}}
-
- # {{{ Horzontal alignment
- def test_theme_horizontal_align_left(self):
- t = Theme(u'blank_theme.xml')
- t.BackgroundType = 0
- t.BackgroundParameter1 = QtGui.QColor(0,0,64)
- t.VerticalAlign = 0
- t.HorizontalAlign = 0
- t.Name = "halign left"
- self.renderer.set_theme(t)
- self.answer = self.renderer.render_screen(0)
- self.bmpname = whoami()
-
- def test_theme_horizontal_align_right(self):
- t = Theme(u'blank_theme.xml')
- t.BackgroundType = 0
- t.BackgroundParameter1 = QtGui.QColor(0,0,64)
- t.VerticalAlign = 0
- t.HorizontalAlign = 1
- t.Name = "halign right"
- self.renderer.set_theme(t)
- self.expected_answer = QtCore.QRect(0, 0, 800, 342)
- self.answer = self.renderer.render_screen(0)
- self.bmpname = whoami()
-
- def test_theme_horizontal_align_centre(self):
- t = Theme(u'blank_theme.xml')
- t.BackgroundType = 0
- t.BackgroundParameter1 = QtGui.QColor(0,0,64)
- t.VerticalAlign = 0
- t.HorizontalAlign = 2
- t.Name = "halign centre"
- self.renderer.set_theme(t)
- self.answer = self.renderer.render_screen(0)
- self.expected_answer = QtCore.QRect(0, 0, 679, 342)
- self.bmpname = whoami()
-
- def test_theme_horizontal_align_left_lyric(self):
- t = Theme(u'blank_theme.xml')
- t.BackgroundType = 0
- t.BackgroundParameter1 = QtGui.QColor(0,0,64)
- t.VerticalAlign = 0
- t.HorizontalAlign = 0
- t.WrapStyle = 1
- t.Name = "halign left lyric"
- self.renderer.set_theme(t)
- self.answer = self.renderer.render_screen(0)
- self.expected_answer = QtCore.QRect(0, 0, 778, 342)
- self.bmpname = whoami()
- # }}}
-
- # {{{ Shadows and outlines
- def test_theme_shadow_outline(self):
- t = Theme(u'blank_theme.xml')
-
- t.BackgroundType = 0
- t.BackgroundParameter1 = QtGui.QColor(0,0,0);
- t.Name="shadow/outline"
- t.Shadow = 1
- t.Outline = 1
- t.ShadowColor = QtGui.QColor(64,128,0)
- t.OutlineColor = QtGui.QColor(128,0,0)
- self.renderer.set_debug(1)
- self.renderer.set_theme(t)
- self.answer = self.renderer.render_screen(0)
- hoffset = self.renderer._shadow_offset+2*(self.renderer._outline_offset)
- voffset = hoffset * (len(self.renderer.words[0])+1)
-
- self.expected_answer = QtCore.QRect(0, 0, 559+hoffset, 342+voffset)
- self.bmpname = whoami()
- # }}}
-
- def test_theme_font(self):
- t = Theme(u'blank_theme.xml')
- t.BackgroundType = 0
- t.BackgroundParameter1 = QtGui.QColor(0,0,64)
- t.Name = "font"
- t.FontName = "Times New Roman"
- self.renderer.set_theme(t)
- self.answer = self.renderer.render_screen(0)
- self.expected_answer = QtCore.QRect(0, 0, 499, 336)
- self.bmpname=whoami()
-
-if __name__ == "__main__":
- test_render_theme = TestRenderTheme()
- test_render_theme.setup_class()
- test_render_theme.setup_method(None)
- test_render_theme.test_bg_stretch_y()
- test_render_theme.teardown_method(None)
diff --git a/openlp/core/test/testplugins/deeper/__init__.py b/openlp/core/test/testplugins/deeper/__init__.py
deleted file mode 100644
index 8b1378917..000000000
--- a/openlp/core/test/testplugins/deeper/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/openlp/core/test/testplugins/deeper/toodeep/__init__.py b/openlp/core/test/testplugins/deeper/toodeep/__init__.py
deleted file mode 100644
index 8b1378917..000000000
--- a/openlp/core/test/testplugins/deeper/toodeep/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/openlp/core/test/testplugins/deeper/toodeep/plugin3toodeep.py b/openlp/core/test/testplugins/deeper/toodeep/plugin3toodeep.py
deleted file mode 100644
index 9746dbdd2..000000000
--- a/openlp/core/test/testplugins/deeper/toodeep/plugin3toodeep.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from openlp.core.lib import Plugin
-import logging
-
-class testplugin3toodeep(Plugin):
- name="testplugin3"
- version=0
- global log
- log=logging.getLogger(u'testplugin1')
- log.info(u'Started')
- weight=10
- def __init__(self):
- pass
-
\ No newline at end of file
diff --git a/openlp/core/test/testplugins/testplugin1.py b/openlp/core/test/testplugins/testplugin1.py
deleted file mode 100644
index 01ae468e6..000000000
--- a/openlp/core/test/testplugins/testplugin1.py
+++ /dev/null
@@ -1,13 +0,0 @@
-from openlp.core.lib import Plugin
-import logging
-
-class testplugin1(Plugin):
- name="testplugin1"
- version=0
- global log
- log=logging.getLogger(u'testplugin1')
- log.info(u'Started')
- weight=10
- def __init__(self):
- pass
-
\ No newline at end of file
diff --git a/openlp/core/test/testplugins/testplugin2/__init__.py b/openlp/core/test/testplugins/testplugin2/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/openlp/core/test/testplugins/testplugin2/testplugin2.py b/openlp/core/test/testplugins/testplugin2/testplugin2.py
deleted file mode 100644
index c1687d2d9..000000000
--- a/openlp/core/test/testplugins/testplugin2/testplugin2.py
+++ /dev/null
@@ -1,8 +0,0 @@
-from openlp.core.lib import Plugin
-
-class testplugin2(Plugin):
- name="testplugin2"
- version=1
- weight=1
- def __init__(self):
- pass
diff --git a/openlp/core/theme/test/test_theme.py b/openlp/core/theme/test/test_theme.py
deleted file mode 100644
index 2e8c2b500..000000000
--- a/openlp/core/theme/test/test_theme.py
+++ /dev/null
@@ -1,82 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2010 Raoul Snyman #
-# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
-# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
-# Thompson, Jon Tibble, Carsten Tinggaard #
-# --------------------------------------------------------------------------- #
-# 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 #
-###############################################################################
-
-import os
-import os.path
-import sys
-
-from PyQt4 import QtGui
-
-from openlp.core.theme import Theme
-
-mypath = os.path.split(os.path.abspath(__file__))[0]
-sys.path.insert(0, (os.path.join(mypath, '..', '..', '..', '..')))
-
-print sys.path
-
-def test_read_theme():
- dir = os.path.split(__file__)[0]
- # test we can read a theme
- theme = Theme(os.path.join(dir, 'test_theme.xml'))
- print theme
- assert(theme.BackgroundParameter1 == 'sunset1.jpg')
- assert(theme.BackgroundParameter2 is None)
- assert(theme.BackgroundParameter3 is None)
- assert(theme.BackgroundType == 2)
- assert(theme.FontColor == QtGui.QColor(255,255,255))
- assert(theme.FontName == 'Tahoma')
- assert(theme.FontProportion == 16)
- assert(theme.FontUnits == 'pixels')
- assert(theme.HorizontalAlign == 2)
- assert(theme.Name == 'openlp.org Packaged Theme')
- assert(theme.Outline == -1)
- assert(theme.OutlineColor == QtGui.QColor(255,0,0))
- assert(theme.Shadow == -1)
- assert(theme.ShadowColor == QtGui.QColor(0,0,1))
- assert(theme.VerticalAlign == 0)
-
-def test_theme():
- # test we create a "blank" theme correctly
- theme = Theme()
- print theme
- assert(theme.BackgroundParameter1 == QtGui.QColor(0,0,0))
- assert(theme.BackgroundParameter2 is None)
- assert(theme.BackgroundParameter3 is None)
- assert(theme.BackgroundType == 0)
- assert(theme.FontColor == QtGui.QColor(255,255,255))
- assert(theme.FontName == 'Arial')
- assert(theme.FontProportion == 30)
- assert(theme.HorizontalAlign == 0)
- assert(theme.FontUnits == 'pixels')
- assert(theme.Name == 'BlankStyle')
- assert(theme.Outline == 0)
- assert(theme.Shadow == 0)
- assert(theme.VerticalAlign == 0)
-
- print "Tests passed"
-
-if __name__ == "__main__":
- test_read_theme()
- test_theme()
diff --git a/openlp/core/theme/test/test_theme.xml b/openlp/core/theme/test/test_theme.xml
deleted file mode 100644
index 79bc2107f..000000000
--- a/openlp/core/theme/test/test_theme.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
- openlp.org Packaged Theme
- 2
- sunset1.jpg
-
-
- Tahoma
- clWhite
- 16
- pixels
- -1
- $00000001
- -1
- clRed
- 2
- 0
-
diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py
index c6a544430..ec20650cf 100644
--- a/openlp/core/ui/generaltab.py
+++ b/openlp/core/ui/generaltab.py
@@ -25,16 +25,29 @@
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import SettingsTab, str_to_bool
+from openlp.core.lib import SettingsTab, str_to_bool, Receiver
class GeneralTab(SettingsTab):
"""
GeneralTab is the general settings tab in the settings dialog.
"""
- def __init__(self, screen_list):
- self.screen_list = screen_list
+ def __init__(self, screens):
+ self.screens = screens
SettingsTab.__init__(self, u'General')
+ def preLoad(self):
+ """
+ Set up the display screen and set correct screen
+ values.
+ If not set before default to last screen.
+ """
+ self.MonitorNumber = int(self.config.get_config(u'monitor',
+ self.screens.monitor_number))
+ self.screens.set_current_display(self.MonitorNumber)
+ self.screens.monitor_number = self.MonitorNumber
+ self.DisplayOnMonitor = str_to_bool(self.config.get_config(u'display on monitor', u'True'))
+ self.screens.display = self.DisplayOnMonitor
+
def setupUi(self):
self.setObjectName(u'GeneralTab')
self.tabTitleVisible = self.trUtf8('General')
@@ -60,6 +73,10 @@ class GeneralTab(SettingsTab):
self.MonitorComboBox = QtGui.QComboBox(self.MonitorGroupBox)
self.MonitorComboBox.setObjectName(u'MonitorComboBox')
self.MonitorLayout.addWidget(self.MonitorComboBox)
+ self.MonitorLayout.addWidget(self.MonitorComboBox)
+ self.DisplayOnMonitorCheck = QtGui.QCheckBox(self.MonitorGroupBox)
+ self.DisplayOnMonitorCheck.setObjectName(u'MonitorComboBox')
+ self.MonitorLayout.addWidget(self.DisplayOnMonitorCheck)
self.GeneralLeftLayout.addWidget(self.MonitorGroupBox)
self.StartupGroupBox = QtGui.QGroupBox(self.GeneralLeftWidget)
self.StartupGroupBox.setObjectName(u'StartupGroupBox')
@@ -133,6 +150,8 @@ class GeneralTab(SettingsTab):
self.GeneralLayout.addWidget(self.GeneralRightWidget)
QtCore.QObject.connect(self.MonitorComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onMonitorComboBoxChanged)
+ QtCore.QObject.connect(self.DisplayOnMonitorCheck,
+ QtCore.SIGNAL(u'stateChanged(int)'), self.onDisplayOnMonitorCheckChanged)
QtCore.QObject.connect(self.WarningCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), self.onWarningCheckBoxChanged)
QtCore.QObject.connect(self.AutoOpenCheckBox,
@@ -153,6 +172,7 @@ class GeneralTab(SettingsTab):
def retranslateUi(self):
self.MonitorGroupBox.setTitle(self.trUtf8('Monitors'))
self.MonitorLabel.setText(self.trUtf8('Select monitor for output display:'))
+ self.DisplayOnMonitorCheck.setText(self.trUtf8('Display if in single screen'))
self.StartupGroupBox.setTitle(self.trUtf8('Application Startup'))
self.WarningCheckBox.setText(self.trUtf8('Show blank screen warning'))
self.AutoOpenCheckBox.setText(self.trUtf8('Automatically open the last service'))
@@ -168,6 +188,9 @@ class GeneralTab(SettingsTab):
def onMonitorComboBoxChanged(self):
self.MonitorNumber = self.MonitorComboBox.currentIndex()
+ def onDisplayOnMonitorCheckChanged(self, value):
+ self.DisplayOnMonitor = (value == QtCore.Qt.Checked)
+
def onAutoOpenCheckBoxChanged(self, value):
self.AutoOpen = (value == QtCore.Qt.Checked)
@@ -193,13 +216,12 @@ class GeneralTab(SettingsTab):
self.Password = self.PasswordEdit.displayText()
def load(self):
- for screen in self.screen_list.screen_list:
+ for screen in self.screens.screen_list:
screen_name = u'%s %d' % (self.trUtf8('Screen'), screen[u'number'] + 1)
if screen[u'primary']:
screen_name = u'%s (%s)' % (screen_name, self.trUtf8('primary'))
self.MonitorComboBox.addItem(screen_name)
# Get the configs
- self.MonitorNumber = int(self.config.get_config(u'monitor', u'0'))
self.Warning = str_to_bool(self.config.get_config(u'blank warning', u'False'))
self.AutoOpen = str_to_bool(self.config.get_config(u'auto open', u'False'))
self.ShowSplash = str_to_bool(self.config.get_config(u'show splash', u'True'))
@@ -211,6 +233,7 @@ class GeneralTab(SettingsTab):
self.SaveCheckServiceCheckBox.setChecked(self.PromptSaveService)
# Set a few things up
self.MonitorComboBox.setCurrentIndex(self.MonitorNumber)
+ self.DisplayOnMonitorCheck.setChecked(self.DisplayOnMonitor)
self.WarningCheckBox.setChecked(self.Warning)
self.AutoOpenCheckBox.setChecked(self.AutoOpen)
self.ShowSplashCheckBox.setChecked(self.ShowSplash)
@@ -221,6 +244,7 @@ class GeneralTab(SettingsTab):
def save(self):
self.config.set_config(u'monitor', self.MonitorNumber)
+ self.config.set_config(u'display on monitor', self.DisplayOnMonitor)
self.config.set_config(u'blank warning', self.Warning)
self.config.set_config(u'auto open', self.AutoOpen)
self.config.set_config(u'show splash', self.ShowSplash)
@@ -229,3 +253,9 @@ class GeneralTab(SettingsTab):
self.config.set_config(u'ccli number', self.CCLINumber)
self.config.set_config(u'songselect username', self.Username)
self.config.set_config(u'songselect password', self.Password)
+ self.screens.display = self.DisplayOnMonitor
+ #Monitor Number has changed.
+ if self.screens.monitor_number != self.MonitorNumber:
+ self.screens.monitor_number = self.MonitorNumber
+ self.screens.set_current_display(self.MonitorNumber)
+ Receiver.send_message(u'screen_changed')
diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py
index eaf1ed78f..5c2394ab2 100644
--- a/openlp/core/ui/maindisplay.py
+++ b/openlp/core/ui/maindisplay.py
@@ -130,13 +130,15 @@ class MainDisplay(DisplayWidget):
QtCore.SIGNAL(u'media_pause'), self.onMediaPause)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'media_stop'), self.onMediaStop)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'update_config'), self.setup)
- def setup(self, screenNumber):
+ def setup(self):
"""
Sets up the screen on a particular screen.
- @param (integer) screen This is the screen number.
"""
- log.debug(u'Setup %s for %s ' %(self.screens, screenNumber))
+ log.debug(u'Setup %s for %s ' %(self.screens,
+ self.screens.monitor_number))
self.setVisible(False)
self.screen = self.screens.current
#Sort out screen locations and sizes
@@ -183,7 +185,6 @@ class MainDisplay(DisplayWidget):
else:
self.setVisible(False)
self.primary = True
- Receiver.send_message(u'screen_changed')
def resetDisplay(self):
Receiver.send_message(u'stop_display_loop')
@@ -247,7 +248,7 @@ class MainDisplay(DisplayWidget):
else:
self.display_text.setPixmap(QtGui.QPixmap.fromImage(frame))
self.display_frame = frame
- if not self.isVisible():
+ if not self.isVisible() and self.screens.display:
self.setVisible(True)
self.showFullScreen()
else:
@@ -320,4 +321,4 @@ class MainDisplay(DisplayWidget):
self.video.setVisible(False)
self.display_text.show()
self.display_image.show()
- self.blankDisplay(False, False)
\ No newline at end of file
+ self.blankDisplay(False, False)
diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py
index 13d880407..23dbccabe 100644
--- a/openlp/core/ui/mainwindow.py
+++ b/openlp/core/ui/mainwindow.py
@@ -496,6 +496,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.SIGNAL(u'version_check'), self.versionCheck)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'blank_check'), self.blankCheck)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'screen_changed'), self.screenChanged)
QtCore.QObject.connect(self.FileNewItem,
QtCore.SIGNAL(u'triggered()'),
self.ServiceManagerContents.onNewService)
@@ -512,7 +514,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
#RenderManager needs to call ThemeManager and
#ThemeManager needs to call RenderManager
self.RenderManager = RenderManager(self.ThemeManagerContents,
- self.screens, self.getMonitorNumber())
+ self.screens)
#Define the media Dock Manager
self.mediaDockManager = MediaDockManager(self.MediaToolBox)
log.info(u'Load Plugins')
@@ -563,24 +565,13 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
- def getMonitorNumber(self):
- """
- Set up the default behaviour of the monitor configuration in
- here. Currently it is set to default to monitor 0 if the saved
- monitor number does not exist.
- """
- screen_number = int(self.generalConfig.get_config(u'monitor', 0))
- if not self.screens.screen_exists(screen_number):
- screen_number = 0
- return screen_number
-
def show(self):
"""
Show the main form, as well as the display form
"""
self.showMaximized()
- screen_number = self.getMonitorNumber()
- self.mainDisplay.setup(screen_number)
+ #screen_number = self.getMonitorNumber()
+ self.mainDisplay.setup()
if self.mainDisplay.isVisible():
self.mainDisplay.setFocus()
self.activateWindow()
@@ -598,7 +589,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtGui.QMessageBox.Ok)
def versionThread(self):
- #app_version = self.applicationVersion[u'full']
vT = VersionThread(self, self.applicationVersion, self.generalConfig)
vT.start()
@@ -621,13 +611,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
Show the Settings dialog
"""
self.settingsForm.exec_()
- updated_display = self.getMonitorNumber()
- if updated_display != self.screens.current_display:
- self.screens.set_current_display(updated_display)
- self.RenderManager.update_display(updated_display)
- self.mainDisplay.setup(updated_display)
- #Trigger after changes have been made
- Receiver.send_message(u'config_updated')
+
+ def screenChanged(self):
+ self.RenderManager.update_display()
+ self.mainDisplay.setup()
self.activateWindow()
def closeEvent(self, event):
diff --git a/openlp/core/ui/screen.py b/openlp/core/ui/screen.py
index baf7e0d5e..32cc5ba50 100644
--- a/openlp/core/ui/screen.py
+++ b/openlp/core/ui/screen.py
@@ -37,14 +37,17 @@ class ScreenList(object):
self.preview = None
self.current = None
self.screen_list = []
- self.count = 0
+ self.display_count = 0
+ #actual display number
self.current_display = 0
+ #save config display number
+ self.monitor_number = 0
def add_screen(self, screen):
if screen[u'primary']:
self.current = screen
self.screen_list.append(screen)
- self.count += 1
+ self.display_count += 1
def screen_exists(self, number):
for screen in self.screen_list:
@@ -53,21 +56,15 @@ class ScreenList(object):
return False
def set_current_display(self, number):
- if number + 1 > self.count:
+ """
+ Set up the current screen dimensions
+ """
+ if number + 1 > self.display_count:
self.current = self.screen_list[0]
self.current_display = 0
else:
self.current = self.screen_list[number]
self.preview = self.current
self.current_display = number
- if self.count == 1:
+ if self.display_count == 1:
self.preview = self.screen_list[0]
-
-# if self.screen[u'number'] != screenNumber:
-# # We will most probably never actually hit this bit, but just in
-# # case the index in the list doesn't match the screen number, we
-# # search for it.
-# for scrn in self.screens:
-# if scrn[u'number'] == screenNumber:
-# self.screen = scrn
-# break
diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py
index 4565a9527..d7acbdf4f 100644
--- a/openlp/core/ui/servicemanager.py
+++ b/openlp/core/ui/servicemanager.py
@@ -33,7 +33,7 @@ log = logging.getLogger(__name__)
from PyQt4 import QtCore, QtGui
from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, \
- contextMenuAction, Receiver, str_to_bool, build_icon
+ contextMenuAction, Receiver, str_to_bool, build_icon, ItemCapabilities
from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm
class ServiceManagerList(QtGui.QTreeWidget):
@@ -233,9 +233,9 @@ class ServiceManager(QtGui.QWidget):
self.editAction.setVisible(False)
self.maintainAction.setVisible(False)
self.notesAction.setVisible(False)
- if serviceItem[u'service_item'].edit_enabled:
+ if serviceItem[u'service_item'].is_capable(ItemCapabilities.AllowsEdit):
self.editAction.setVisible(True)
- if serviceItem[u'service_item'].maintain_allowed:
+ if serviceItem[u'service_item'].is_capable(ItemCapabilities.AllowsMaintain):
self.maintainAction.setVisible(True)
if item.parent() is None:
self.notesAction.setVisible(True)
@@ -713,7 +713,7 @@ class ServiceManager(QtGui.QWidget):
get_config(u'auto preview', u'False')):
item += 1
if self.serviceItems and item < len(self.serviceItems) and \
- self.serviceItems[item][u'service_item'].auto_preview_allowed:
+ serviceItem[u'service_item'].is_capable(ItemCapabilities.AllowsPreview):
self.parent.PreviewController.addServiceManagerItem(
self.serviceItems[item][u'service_item'], 0)
@@ -722,7 +722,8 @@ class ServiceManager(QtGui.QWidget):
Posts a remote edit message to a plugin to allow item to be edited.
"""
item, count = self.findServiceItem()
- if self.serviceItems[item][u'service_item'].edit_enabled:
+ if self.serviceItems[item][u'service_item'].\
+ is_capable(ItemCapabilities.AllowsEdit):
self.remoteEditTriggered = True
Receiver.send_message(u'%s_edit' %
self.serviceItems[item][u'service_item'].name, u'L:%s' %
diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py
index 4d59b850f..c86525a54 100644
--- a/openlp/core/ui/settingsform.py
+++ b/openlp/core/ui/settingsform.py
@@ -34,11 +34,11 @@ log = logging.getLogger(__name__)
class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
- def __init__(self, screen_list, mainWindow, parent=None):
+ def __init__(self, screens, mainWindow, parent=None):
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
# General tab
- self.GeneralTab = GeneralTab(screen_list)
+ self.GeneralTab = GeneralTab(screens)
self.addTab(u'General', self.GeneralTab)
# Themes tab
self.ThemesTab = ThemesTab(mainWindow)
diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py
index c802219b5..35f520c9e 100644
--- a/openlp/core/ui/slidecontroller.py
+++ b/openlp/core/ui/slidecontroller.py
@@ -30,6 +30,8 @@ import os
from PyQt4 import QtCore, QtGui
from PyQt4.phonon import Phonon
+from openlp.core.lib import ItemCapabilities
+
class HideMode(object):
"""
This is basically an enumeration class which specifies the mode of a Bible.
@@ -375,8 +377,7 @@ class SlideController(QtGui.QWidget):
self.Toolbar.makeWidgetsInvisible(self.image_list)
if item.is_text():
self.Toolbar.makeWidgetsInvisible(self.image_list)
- if item.is_song() and \
- str_to_bool(self.songsconfig.get_config(u'show songbar', True)) \
+ if str_to_bool(self.songsconfig.get_config(u'show songbar', True)) \
and len(self.slideList) > 0:
self.Toolbar.makeWidgetsVisible([u'Song Menu'])
elif item.is_image():
@@ -395,7 +396,7 @@ class SlideController(QtGui.QWidget):
self.Toolbar.setVisible(True)
self.Mediabar.setVisible(False)
self.Toolbar.makeWidgetsInvisible(self.song_edit_list)
- if item.edit_enabled and item.from_plugin:
+ if item.is_capable(ItemCapabilities.AllowsEdit) and item.from_plugin:
self.Toolbar.makeWidgetsVisible(self.song_edit_list)
elif item.is_media():
self.Toolbar.setVisible(False)
@@ -494,15 +495,18 @@ class SlideController(QtGui.QWidget):
bits = frame[u'verseTag'].split(u':')
tag = None
#If verse handle verse number else tag only
- if bits[0] == self.trUtf8('Verse'):
- tag = u'%s%s' % (bits[0][0], bits[1][0:] )
- row = bits[1][0:]
+ if bits[0] == self.trUtf8('Verse') or \
+ bits[0] == self.trUtf8('Chorus'):
+ tag = u'%s\n%s' % (bits[0][0], bits[1][0:] )
+ tag1 = u'%s%s' % (bits[0][0], bits[1][0:] )
+ row = tag
else:
tag = bits[0]
+ tag1 = tag
row = bits[0][0:1]
- if tag not in self.slideList:
- self.slideList[tag] = framenumber
- self.SongMenu.menu().addAction(self.trUtf8(u'%s'%tag),
+ if tag1 not in self.slideList:
+ self.slideList[tag1] = framenumber
+ self.SongMenu.menu().addAction(self.trUtf8(u'%s'%tag1),
self.onSongBarHandler)
else:
row += 1
@@ -519,6 +523,7 @@ class SlideController(QtGui.QWidget):
slide_height = width * self.parent.RenderManager.screen_ratio
row += 1
rowitem.setText(unicode(row))
+ rowitem.setTextAlignment(QtCore.Qt.AlignVCenter)
self.PreviewListWidget.setItem(framenumber, 0, rowitem)
self.PreviewListWidget.setItem(framenumber, 1, item)
if slide_height != 0:
@@ -759,7 +764,7 @@ class SlideController(QtGui.QWidget):
else:
self.mediaObject.stop()
self.mediaObject.clearQueue()
- file = os.path.join(item.service_item_path, item.get_frame_title())
+ file = os.path.join(item.get_frame_path(), item.get_frame_title())
self.mediaObject.setCurrentSource(Phonon.MediaSource(file))
self.onMediaPlay()
diff --git a/openlp/core/ui/test/test_service_manager.py b/openlp/core/ui/test/test_service_manager.py
deleted file mode 100644
index 3755e459c..000000000
--- a/openlp/core/ui/test/test_service_manager.py
+++ /dev/null
@@ -1,160 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2010 Raoul Snyman #
-# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
-# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
-# Thompson, Jon Tibble, Carsten Tinggaard #
-# --------------------------------------------------------------------------- #
-# 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 #
-###############################################################################
-
-import sys
-import os
-import os.path
-import logging
-
-from PyQt4 import QtGui
-
-from openlp.core.ui import ServiceManager
-from openlp.plugins.images.lib import ImageServiceItem
-
-mypath = os.path.split(os.path.abspath(__file__))[0]
-sys.path.insert(0, (os.path.join(mypath, '..', '..', '..', '..')))
-
-logging.basicConfig(filename='test_service_manager.log', level=logging.INFO,
- filemode='w')
-
-# # from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66062
-# def whoami(depth=1):
-# return sys._getframe(depth).f_code.co_name
-global app
-global log
-log = logging.getLogger(u'TestServiceManager')
-
-class TestServiceManager_base:
- def __init__(self):
- pass
-
- def setup_class(self):
- log.info( "class setup" + unicode(self))
- try:
- if app is None:
- app = QtGui.QApplication([])
- except UnboundLocalError:
- app = QtGui.QApplication([])
-
- def teardown_class(self):
- pass
-
- def setup_method(self, method):
- log.info(u'Setup method:' + unicode(method))
- self.expected_answer = "Don't know yet"
- self.answer = None
- self.s = ServiceManager(None)
- log.info(u'--------------- Setup Done -------------')
-
- def teardown_method(self, method):
- self.s = None
-
- def select_row(self, row):
- # now select the line we just added
- # first get the index
- i = QModelIndex(self.s.service_data.index(0,0))
- # make a selection of it
- self.sm = QItemSelectionModel(self.s.service_data)
- self.sm.select(i, QItemSelectionModel.ClearAndSelect)
- log.info(unicode(self.sm.selectedIndexes()))
- self.s.TreeView.setSelectionModel(self.sm)
- log.info(u'Selected indexes = ' + unicode(
- self.s.TreeView.selectedIndexes()))
-
- def test_easy(self):
- log.info(u'test_easy')
- item = ImageServiceItem(None)
- item.add(u'test.gif')
- self.s.addServiceItem(item)
- answer = self.s.service_as_text()
- log.info(u'Answer = ' + unicode(answer))
- lines = answer.split(u'\n')
- log.info(u'lines = ' + unicode(lines))
- assert lines[0].startswith(u'# 1:
return False
service_item.title = unicode(self.trUtf8('Media'))
+ service_item.add_capability(ItemCapabilities.RequiresMedia)
for item in items:
bitem = self.ListView.item(item.row())
filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py
index 6e9bbfaed..1b4097b6c 100644
--- a/openlp/plugins/presentations/lib/mediaitem.py
+++ b/openlp/plugins/presentations/lib/mediaitem.py
@@ -152,7 +152,6 @@ class PresentationMediaItem(MediaManagerItem):
service_item.title = unicode(self.DisplayTypeComboBox.currentText())
service_item.shortname = unicode(self.DisplayTypeComboBox.currentText())
shortname = service_item.shortname
-
for item in items:
bitem = self.ListView.item(item.row())
filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
diff --git a/openlp/plugins/red-x.png b/openlp/plugins/red-x.png
deleted file mode 100644
index c23f2ac9f..000000000
Binary files a/openlp/plugins/red-x.png and /dev/null differ
diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py
index a369e46a1..b2b1b14c4 100644
--- a/openlp/plugins/songs/forms/editsongform.py
+++ b/openlp/plugins/songs/forms/editsongform.py
@@ -411,16 +411,18 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.SongTabWidget.setCurrentIndex(2)
self.AuthorsListView.setFocus()
#split the verse list by space and mark lower case for testing
- taglist = unicode(self.trUtf8(' bcitped'))
+ taglist = unicode(self.trUtf8(' bitped'))
for verse in unicode(self.VerseOrderEdit.text()).lower().split(u' '):
if len(verse) > 1:
- if verse[0:1] == u'%s' % self.trUtf8('v') and verse[1:].isdigit():
+ if (verse[0:1] == u'%s' % self.trUtf8('v') or
+ verse[0:1] == u'%s' % self.trUtf8('c')) \
+ and verse[1:].isdigit():
pass
else:
self.SongTabWidget.setCurrentIndex(0)
self.VerseOrderEdit.setFocus()
return False, \
- self.trUtf8('Invalid verse entry - vX')
+ self.trUtf8('Invalid verse entry - Vx or Cx')
else:
if taglist.find(verse) > -1:
pass
@@ -429,7 +431,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.VerseOrderEdit.setFocus()
return False, \
self.trUtf8(\
- 'Invalid verse entry - values must be Numeric, I,B,C,T,P,E,O')
+ 'Invalid verse entry, values must be I,B,T,P,E,O,Vx,Cx')
return True, u''
def onTitleEditItemLostFocus(self):
diff --git a/openlp/plugins/songs/forms/editverseform.py b/openlp/plugins/songs/forms/editverseform.py
index 2666c146e..326946bc4 100644
--- a/openlp/plugins/songs/forms/editverseform.py
+++ b/openlp/plugins/songs/forms/editverseform.py
@@ -59,46 +59,43 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
def onAddIntro(self):
self.startNewLine()
- self.VerseTextEdit.insertPlainText(u'---[%s:1]---\n'
- % self.trUtf8('Intro'))
+ self.VerseTextEdit.insertPlainText(u'---[Intro:1]---\n')
self.VerseTextEdit.setFocus()
def onAddEnding(self):
self.startNewLine()
- self.VerseTextEdit.insertPlainText(u'---[%s:1]---\n'
- % self.trUtf8('Ending'))
+ self.VerseTextEdit.insertPlainText(u'---[Ending:1]---\n')
self.VerseTextEdit.setFocus()
def onAddOther(self):
self.startNewLine()
- self.VerseTextEdit.insertPlainText(u'---[%s:1]---\n'
- % self.trUtf8('Other'))
+ self.VerseTextEdit.insertPlainText(u'---[Other:1]---\n')
self.VerseTextEdit.setFocus()
def onAddPreChorus(self):
self.startNewLine()
- self.VerseTextEdit.insertPlainText(u'---[%s:1]---\n'
- % self.trUtf8('Pre-Chorus'))
+ self.VerseTextEdit.insertPlainText(u'---[Pre-Chorus:1]---\n')
self.VerseTextEdit.setFocus()
def onAddBridge(self):
self.startNewLine()
- self.VerseTextEdit.insertPlainText(u'---[%s:1]---\n'
- % self.trUtf8('Bridge'))
+ self.VerseTextEdit.insertPlainText(u'---[Bridge:1]---\n')
self.VerseTextEdit.setFocus()
def onAddChorus(self):
self.startNewLine()
- self.VerseTextEdit.insertPlainText(u'---[%s:1]---\n'
- % self.trUtf8('Chorus'))
+ count = self.VerseTextEdit.toPlainText().\
+ count(u'---[Chorus')
+ self.VerseTextEdit.insertPlainText(u'---[Chorus:%s]---\n'
+ % unicode(count + 1))
self.VerseTextEdit.setFocus()
def onAddVerse(self):
self.startNewLine()
count = self.VerseTextEdit.toPlainText().\
- count(u'---[%s' % self.trUtf8('Verse'))
- self.VerseTextEdit.insertPlainText(u'---[%s:%s]---\n'
- % (self.trUtf8('Verse'), count + 1))
+ count(u'---[Verse')
+ self.VerseTextEdit.insertPlainText(u'---[Verse:%s]---\n'
+ % unicode(count + 1))
self.VerseTextEdit.setFocus()
def setVerse(self, text, verseCount=0, single=False, tag=u'Verse:1'):
@@ -155,7 +152,8 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
return text
def onVerseComboChanged(self, id):
- if unicode(self.VerseListComboBox.currentText()) == self.trUtf8('Verse'):
+ if unicode(self.VerseListComboBox.currentText()) == self.trUtf8('Verse') or \
+ unicode(self.VerseListComboBox.currentText()) == self.trUtf8('Chrous'):
self.SubVerseListComboBox.setEnabled(True)
else:
self.SubVerseListComboBox.setEnabled(False)
diff --git a/openlp/plugins/songs/lib/manager.py b/openlp/plugins/songs/lib/manager.py
index 0dfed09b6..dcb49bfcd 100644
--- a/openlp/plugins/songs/lib/manager.py
+++ b/openlp/plugins/songs/lib/manager.py
@@ -111,16 +111,12 @@ class SongManager():
return False
def delete_song(self, songid):
- print songid
song = self.get_song(songid)
- print song.title
try:
self.session.delete(song)
self.session.commit()
- print "ok"
return True
except:
- print "error"
self.session.rollback()
log.exception(u'Could not delete song from song database')
return False
diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py
index 1ce69f407..4ca4eb697 100644
--- a/openlp/plugins/songs/lib/mediaitem.py
+++ b/openlp/plugins/songs/lib/mediaitem.py
@@ -28,7 +28,7 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, SongXMLParser, \
- BaseListWithDnD, Receiver, str_to_bool
+ BaseListWithDnD, Receiver, str_to_bool, ItemCapabilities
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm
log = logging.getLogger(__name__)
@@ -301,10 +301,10 @@ class SongMediaItem(MediaManagerItem):
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
else:
item_id = self.remoteSong
- service_item.auto_preview_allowed = True
+ service_item.add_capability(ItemCapabilities.AllowsEdit)
+ service_item.add_capability(ItemCapabilities.AllowsPreview)
song = self.parent.songmanager.get_song(item_id)
service_item.theme = song.theme_name
- service_item.edit_enabled = True
service_item.editId = item_id
if song.lyrics.startswith(u'
-
- Amazing Grace
- John Newton
- 1982 Jubilate Hymns Limited
-
-
-
-
- 1037882
- God: Attributes
-
-
-
-
- [V1]
-. D D7 G D Bm E A A7
- Amazing grace how sweet the sound that saved a wretch like me;
-. D D7 G D Bm A G D
- I once was lost but now I'm found, was blind but now I see.
-
-[V2]
-. D D7 G D Bm E A A7
- Twas grace that taught my heart to fear, and grace my fears relieved;
-. D D7 G D Bm A G D
- How precious did that grace appear the hour I first believed!
-
-[V3]
-. D D7 G D Bm E A A7
- Through many dangers, toils, and snares I have already come;
-. D D7 G D Bm A G D
- 'Tis grace that brought me safe thus far and grace will lead me home.
-
-[V4]
-. D D7 G D Bm E A A7
- When we've been there ten thousand years bright shining as the sun;
-. D D7 G D Bm A G D
- We've no less days to sing God's praise than when we'd first begun!
\ No newline at end of file
diff --git a/openlp/plugins/songs/test/data_opensong/På en fjern ensom høj b/openlp/plugins/songs/test/data_opensong/På en fjern ensom høj
deleted file mode 100644
index 6023414ca..000000000
--- a/openlp/plugins/songs/test/data_opensong/På en fjern ensom høj
+++ /dev/null
@@ -1,56 +0,0 @@
-På en fjern ensom høj[V1]
- På en fjern ensom høj,
- Jesu kors dyrest stod,
- symbolet på smerte og skam.
- O, jeg elsker det kors,
- hvor Guds søn gjorde bod,
- da forbandelsen blev lagt på ham.
-
-[C1]
- Jeg vil elske det urgamle kors,
- i det kraft er der sejer og sang.
- Lad mig favne det hellige kors,
- det med kronen ombyttes engang.
-
-[V2]
- O, det urgamle kors,
- med sin hvile og fred,
- tilhyllet i verdens foragt.
- Se, det hellige lam,
- som på Golgatha stred,
- og til jorden Guds nåde har bragt.
-
-[C2]
- Jeg vil elske det urgamle kors,
- i det kraft er der sejer og sang.
- Lad mig favne det hellige kors,
- det med kronen ombyttes engang.
-
-[V3]
- I det urgamle kors,
- i hans blod farvet rødt,
- en underfuld skønhed jeg ser.
- Ja, det var på det kors,
- at han selv blev forstødt,
- nu skal aldrig for dommen jeg mer.
-
-[C3]
- Jeg vil elske det urgamle kors,
- i det kraft er der sejer og sang.
- Lad mig favne det hellige kors,
- det med kronen ombyttes engang.
-
-[V4]
- For det urgamle kors,
- står mit hjerte i brand,
- min plads jeg nu har ved dets fod.
- Til han kalder en dag,
- mig til himmelens land,
- og til hvilen hos Faderen god.
-
-[C4]
- Jeg vil elske det urgamle kors,
- i det kraft er der sejer og sang.
- Lad mig favne det hellige kors,
- det med kronen ombyttes engang.
-V1 C1 V2 C2 V3 C3 V4 C4
\ No newline at end of file
diff --git a/openlp/plugins/songs/test/data_opensong/The Solid Rock b/openlp/plugins/songs/test/data_opensong/The Solid Rock
deleted file mode 100644
index bb1eecc97..000000000
--- a/openlp/plugins/songs/test/data_opensong/The Solid Rock
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
- The Solid Rock
- Edward Mote and John B. Dykes
- Public Domain
- V1 C V2 C V3 C V4 C
- 101740
- Christ: Victory
- Fruit: Peace/Comfort
- [V]
-. E B A B E
-1My hope is built on nothing less than Jesus' blood and righteousness;
-2When darkness veils His lovely face, I rest on His un___changing grace.
-3His oath, His cove_____nant, His blood|support me in the whelming flood;
-4When He shall come with trumpet sound, O may I then in Him be found;
-. E B A B E
-1I dare not trust the sweetest frame, but wholly lean on Jesus' name.
-2In every high and stormy gale, my anchor holds within the veil.
-3When all around my soul gives way, He then is all my hope and stay.
-4Dressed in His righteous___ness alone, fault___less to stand be_fore the throne.
-
-[C]
-. E A
- On Christ, the solid rock I stand;
-. E B
- All other ground is sinking sand,
-. A B E
- All other ground is sinking sand.
\ No newline at end of file
diff --git a/openlp/plugins/songs/test/data_text/CCLI example.txt b/openlp/plugins/songs/test/data_text/CCLI example.txt
deleted file mode 100644
index 6a5c23222..000000000
--- a/openlp/plugins/songs/test/data_text/CCLI example.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-Song Title Here
-
-
-Chorus 1
-Lyrics
-Lyrics
-Lyrics
-Lyrics
-
-
-Verse 1
-Lyrics
-Lyrics
-Lyrics
-
-
-Verse 2
-Lyrics
-Lyrics
-Lyrics
-
-
-Misc 1
-(BRIDGE)
-Lyrics
-Lyrics
-Lyrics
-Lyrics
-
-
-
-CCLI Song No. 1234567
-© 1996 Publisher Info
-Author/artist name
-For use solely in accordance with the SongSelect Advanced Terms of Agreement. All rights Reserved.
-CCLI License No. 1234567
\ No newline at end of file
diff --git a/openlp/plugins/songs/test/data_text/PÃ¥EnFjern.txt b/openlp/plugins/songs/test/data_text/PÃ¥EnFjern.txt
deleted file mode 100644
index 34a6da1ce..000000000
--- a/openlp/plugins/songs/test/data_text/PÃ¥EnFjern.txt
+++ /dev/null
@@ -1,61 +0,0 @@
-På en fjern ensom høj
-
-Verse 1
-På en fjern ensom høj,
-Jesu kors dyrest stod,
-symbolet på smerte og skam.
-O, jeg elsker det kors,
-hvor Guds søn gjorde bod,
-da forbandelsen blev lagt på ham.
-
-Chorus 1
-Jeg vil elske det urgamle kors,
-i det kraft er der sejer og sang.
-Lad mig favne det hellige kors,
-det med kronen ombyttes engang.
-
-Verse 2
-O, det urgamle kors,
-med sin hvile og fred,
-tilhyllet i verdens foragt.
-Se, det hellige lam,
-som på Golgatha stred,
-og til jorden Guds nåde har bragt.
-
-Chorus 2
-Jeg vil elske det urgamle kors,
-i det kraft er der sejer og sang.
-Lad mig favne det hellige kors,
-det med kronen ombyttes engang.
-
-Verse 3
-I det urgamle kors,
-i hans blod farvet rødt,
-en underfuld skønhed jeg ser.
-Ja, det var på det kors,
-at han selv blev forstødt,
-nu skal aldrig for dommen jeg mer.
-
-Chorus 3
-Jeg vil elske det urgamle kors,
-i det kraft er der sejer og sang.
-Lad mig favne det hellige kors,
-det med kronen ombyttes engang.
-
-Verse 4
-For det urgamle kors,
-står mit hjerte i brand,
-min plads jeg nu har ved dets fod.
-Til han kalder en dag,
-mig til himmelens land,
-og til hvilen hos Faderen god.
-
-Chorus 4
-Jeg vil elske det urgamle kors,
-i det kraft er der sejer og sang.
-Lad mig favne det hellige kors,
-det med kronen ombyttes engang.
-
-CCLI Song No.
-©
-Georg Bennard
diff --git a/openlp/plugins/songs/test/data_xml/amazing1.xml b/openlp/plugins/songs/test/data_xml/amazing1.xml
deleted file mode 100644
index 9cc7e1b97..000000000
--- a/openlp/plugins/songs/test/data_xml/amazing1.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-Amazing Grace
-
-
-Amazing grace how sweet the sound that saved a wretch like me;
-I once was lost but now I'm found, was blind but now I see.
-
-
-Twas grace that taught my heart to fear, and grace my fears relieved;
-How precious did that grace appear the hour I first believed!
-
-
-Through many dangers, toils, and snares I have already come;
-'Tis grace that brought me safe thus far and grace will lead me home.
-
-
-When we've been there ten thousand years bright shining as the sun;
-We've no less days to sing God's praise than when we'd first begun!
-
-
-
\ No newline at end of file
diff --git a/openlp/plugins/songs/test/data_xml/amazing2.xml b/openlp/plugins/songs/test/data_xml/amazing2.xml
deleted file mode 100644
index 8ea0666ef..000000000
--- a/openlp/plugins/songs/test/data_xml/amazing2.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-Amazing Grace
-
-
-Amazing grace how sweet the sound that saved a wretch like me;
-I once was lost but now I'm found, was blind but now I see.
-
-
-Twas grace that taught my heart to fear, and grace my fears relieved;
-How precious did that grace appear the hour I first believed!
-
-
-Through many dangers, toils, and snares I have already come;
-'Tis grace that brought me safe thus far and grace will lead me home.
-
-
-When we've been there ten thousand years bright shining as the sun;
-We've no less days to sing God's praise than when we'd first begun!
-
-
-
\ No newline at end of file
diff --git a/openlp/plugins/songs/test/data_xml/danish1.xml b/openlp/plugins/songs/test/data_xml/danish1.xml
deleted file mode 100644
index ec53ac150..000000000
--- a/openlp/plugins/songs/test/data_xml/danish1.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-På en fjern ensom høj
-
-
-På en fjern ensom høj,
-Jesu kors dyrest stod,
-symbolet på smerte og skam.
-O, jeg elsker det kors,
-hvor Guds søn gjorde bod,
-da forbandelsen blev lagt på ham.
-
-
-Jeg vil elske det urgamle kors,
-i det kraft er der sejer og sang.
-Lad mig favne det hellige kors,
-det med kronen ombyttes engang.
-
-
-O, det urgamle kors,
-med sin hvile og fred,
-tilhyllet i verdens foragt.
-Se, det hellige lam,
-som på Golgatha stred,
-og til jorden Guds nåde har bragt.
-
-
-Jeg vil elske det urgamle kors,
-i det kraft er der sejer og sang.
-Lad mig favne det hellige kors,
-det med kronen ombyttes engang.
-
-
-I det urgamle kors,
-i hans blod farvet rødt,
-en underfuld skønhed jeg ser.
-Ja, det var på det kors,
-at han selv blev forstødt,
-nu skal aldrig for dommen jeg mer.
-
-
-Jeg vil elske det urgamle kors,
-i det kraft er der sejer og sang.
-Lad mig favne det hellige kors,
-det med kronen ombyttes engang.
-
-
-For det urgamle kors,
-står mit hjerte i brand,
-min plads jeg nu har ved dets fod.
-Til han kalder en dag,
-mig til himmelens land,
-og til hvilen hos Faderen god.
-
-
-Jeg vil elske det urgamle kors,
-i det kraft er der sejer og sang.
-Lad mig favne det hellige kors,
-det med kronen ombyttes engang.
-
-
-
diff --git a/openlp/plugins/songs/test/data_xml/danish2.xml b/openlp/plugins/songs/test/data_xml/danish2.xml
deleted file mode 100644
index e7edb5bf5..000000000
--- a/openlp/plugins/songs/test/data_xml/danish2.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-På en fjern ensom høj
-
-
-På en fjern ensom høj,
-Jesu kors dyrest stod,
-symbolet på smerte og skam.
-O, jeg elsker det kors,
-hvor Guds søn gjorde bod,
-da forbandelsen blev lagt på ham.
-
-
-Jeg vil elske det urgamle kors,
-i det kraft er der sejer og sang.
-Lad mig favne det hellige kors,
-det med kronen ombyttes engang.
-
-
-O, det urgamle kors,
-med sin hvile og fred,
-tilhyllet i verdens foragt.
-Se, det hellige lam,
-som på Golgatha stred,
-og til jorden Guds nåde har bragt.
-
-
-Jeg vil elske det urgamle kors,
-i det kraft er der sejer og sang.
-Lad mig favne det hellige kors,
-det med kronen ombyttes engang.
-
-
-I det urgamle kors,
-i hans blod farvet rødt,
-en underfuld skønhed jeg ser.
-Ja, det var på det kors,
-at han selv blev forstødt,
-nu skal aldrig for dommen jeg mer.
-
-
-Jeg vil elske det urgamle kors,
-i det kraft er der sejer og sang.
-Lad mig favne det hellige kors,
-det med kronen ombyttes engang.
-
-
-For det urgamle kors,
-står mit hjerte i brand,
-min plads jeg nu har ved dets fod.
-Til han kalder en dag,
-mig til himmelens land,
-og til hvilen hos Faderen god.
-
-
-Jeg vil elske det urgamle kors,
-i det kraft er der sejer og sang.
-Lad mig favne det hellige kors,
-det med kronen ombyttes engang.
-
-
-
diff --git a/openlp/plugins/songs/test/data_xml/format1.xml b/openlp/plugins/songs/test/data_xml/format1.xml
deleted file mode 100644
index f80ea8704..000000000
--- a/openlp/plugins/songs/test/data_xml/format1.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-Amazing Grace
-
-
-Amazing grace how sweet the sound that saved a wretch like me;
-I once was lost but now I'm found, was blind but now I see.
-
-
-Twas grace that taught my heart to fear, and grace my fears relieved;
-How precious did that grace appear the hour I first believed!
-
-
-Through many dangers, toils, and snares I have already come;
-'Tis grace that brought me safe thus far and grace will lead me home.
-
-
-When we've been there ten thousand years bright shining as the sun;
-We've no less days to sing God's praise than when we'd first begun!
-
-
-
\ No newline at end of file
diff --git a/openlp/plugins/songs/test/data_xml/sample1.xml b/openlp/plugins/songs/test/data_xml/sample1.xml
deleted file mode 100644
index 11a8576ad..000000000
--- a/openlp/plugins/songs/test/data_xml/sample1.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
- Amazing Grace
-
- name of verse specific theme
- any text
-
- Amazing grace, how ...
-
-
- A b c
- D e f
-
- ...
-
-
- any text
- ...
-
-
-
- Erstaunliche Anmut
-
- Erstaunliche Anmut, wie
- ...
-
-
- ...
-
-
-
diff --git a/openlp/plugins/songs/test/test_song_basic.py b/openlp/plugins/songs/test/test_song_basic.py
deleted file mode 100644
index 2cbfdd8ff..000000000
--- a/openlp/plugins/songs/test/test_song_basic.py
+++ /dev/null
@@ -1,182 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2010 Raoul Snyman #
-# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
-# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
-# Thompson, Jon Tibble, Carsten Tinggaard #
-# --------------------------------------------------------------------------- #
-# 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 #
-###############################################################################
-
-import py.test
-import os
-import sys
-
-__ThisDir__ = os.path.dirname(__file__)
-if "" == __ThisDir__ :
- __ThisDir__ = os.path.abspath(u'.')
-
-sys.path.append(os.path.abspath(u'%s/../../../..'%__ThisDir__))
-
-from openlp.plugins.songs.lib.songxml import *
-
-class Test_Basic(object):
- """Class for first initialization check
- set-get functions
- """
-
- def test_Creation(self):
- """Init: Create as empty"""
- s = Song()
- assert(True)
-
- def test_Title1(self):
- """Set an empty title - raises an exception"""
- s = Song()
- py.test.raises(SongTitleError, s.set_title, '')
-
- def test_Title2(self):
- """Set a normal title"""
- s = Song()
- t = "A normal title"
- s.set_title(t)
- assert(s.get_title() == t)
- assert(s.get_search_title() == t)
-
- def test_Title3(self):
- """Set a titel with punctuation 1"""
- s = Song()
- t1 = "Hey! Come on, ya programmers*"
- t2 = "Hey Come on ya programmers"
- s.set_title(t1)
- assert(s.get_title() == t1)
- assert(s.get_search_title() == t2)
-
- def test_Title4(self):
- """Set a titel with punctuation 2"""
- s = Song()
- t1 = "??#Hey! Come on, ya programmers*"
- t2 = "Hey Come on ya programmers"
- s.set_title(t1)
- assert(s.get_title() == t1)
- assert(s.get_search_title() == t2)
-
- def test_Title5(self):
- """
- Set a title
- Where searchable title becomes empty raises an exception
- """
- s = Song()
- py.test.raises(SongTitleError, s.set_title, ',*')
-
- def test_Copyright(self):
- """Set a copyright string"""
- s = Song()
- assert(s.get_copyright() == '')
- s.set_copyright(u'A B Car')
- assert(s.get_copyright() == 'A B Car')
-
- def test_SongCclino(self):
- """Set a SongCcliNo"""
- s = Song()
- assert(s.get_song_cclino() == '')
- s.set_song_cclino(12345)
- assert(s.get_song_cclino() == '12345')
-
- def test_SongBook(self):
- """Set a songbook value"""
- s = Song()
- assert(s.get_song_book() == '')
- s.set_song_book(u'Hymns')
- assert(s.get_song_book() == u'Hymns')
-
- def test_SongNumber(self):
- """Set a song number"""
- s = Song()
- assert(s.get_song_number() == '')
- s.set_song_number(278)
- assert(s.get_song_number() == '278')
-
- def test_Theme(self):
- """Set a theme name"""
- s = Song()
- assert(s.get_theme() == '')
- s.set_theme(u'Red')
- assert(s.get_theme() == 'Red')
-
- def test_VerseOrder(self):
- """Set a verse order"""
- s = Song()
- assert(s.get_verse_order() == '')
- s.set_verse_order(u'V1 C V2')
- assert(s.get_verse_order() == 'V1 C V2')
-
- def test_Comments(self):
- """Set a comment"""
- s = Song()
- assert(s.get_comments() == '')
- s.set_comments(u'a comment')
- assert(s.get_comments() == 'a comment')
-
- def test_AuthorList(self):
- """Set author lists"""
- s = Song()
- assert(s.get_author_list(True) == '')
- assert(s.get_author_list(False) == [])
- t1 = "John Newton"
- s.set_author_list(t1)
- assert(s.get_author_list(True) == t1)
- assert(s.get_author_list(False) == [t1])
- s.set_author_list(u' Peter Done , John Newton')
- assert(s.get_author_list(True)== 'Peter Done, John Newton')
- assert(s.get_author_list(False) == ["Peter Done", u'John Newton'])
- s.set_author_list(None)
- assert(s.get_author_list(True) == '')
- assert(s.get_author_list(False) == [])
- s.set_author_list(u'')
- assert(s.get_author_list(True) == '')
- assert(s.get_author_list(False) == [""])
- s.set_author_list([])
- assert(s.get_author_list(True) == '')
- assert(s.get_author_list(False) == [""])
-
- def test_CategoryArray(self):
- """Set categories"""
- s = Song()
- assert(s.get_category_array(True) == '')
- assert(s.get_category_array(False) == [])
- t1 = "Gospel"
- s.set_category_array(t1)
- assert(s.get_category_array(True) == t1)
- assert(s.get_category_array(False) == [t1])
- s.set_category_array(u' Gospel, Hymns ')
- assert(s.get_category_array(True) == 'Gospel, Hymns')
- assert(s.get_category_array(False) == ["Gospel", u'Hymns'])
- s.set_category_array(None)
- assert(s.get_category_array(True) == '')
- assert(s.get_category_array(False) == [])
- s.set_category_array(u'')
- assert(s.get_category_array(True) == '')
- assert(s.get_category_array(False) == [""])
- s.set_category_array([])
- assert(s.get_category_array(True) == '')
- assert(s.get_category_array(False) == [""])
-
-if '__main__' == __name__:
- r = Test_Basic()
- r.test_asString()
diff --git a/openlp/plugins/songs/test/test_song_opensong.py b/openlp/plugins/songs/test/test_song_opensong.py
deleted file mode 100644
index d0c716d7d..000000000
--- a/openlp/plugins/songs/test/test_song_opensong.py
+++ /dev/null
@@ -1,192 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2010 Raoul Snyman #
-# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
-# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
-# Thompson, Jon Tibble, Carsten Tinggaard #
-# --------------------------------------------------------------------------- #
-# 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 #
-###############################################################################
-
-import os
-import sys
-
-__ThisDir__ = os.path.dirname(__file__)
-if "" == __ThisDir__ :
- __ThisDir__ = os.path.abspath(u'.')
-
-sys.path.append(os.path.abspath(u'%s/../../../..'%__ThisDir__))
-
-from openlp.plugins.songs.lib.songxml import *
-
-
-_sample1 = \
-'''
-
-
-
-
-
-
-
- [V1]
-. chord line 1
- verse 1 line 1
-. chord line 2
- verse 1 line 2
-
-[V2]
- verse 2 line 1
- verse 2 line 2
-
-[V3]
- verse 3 line 1
- verse 3 line 2
-
-[C]
-. chorus chord line 1
- chorus line 1
-. chorus chord line 2
- chorus line 2
-
-'''
-
-_sample2 = \
-'''
-
-
-
-
-
-
-
- [V]
-1verse 1 line 1
-2verse 2 line 1
-3verse 3 line 1
-1verse 1 line 2
-2verse 2 line 2
-3verse 3 line 2
-
-[C]
- chorus line 1
- chorus line 2
-
-'''
-
-_sample3 = \
-'''
-
-
-
-
-
-
-
- [V]
-1verse 1 line 1
-2verse 2 line 1
-3verse 3 line 1
-1verse 1 line 2
-2verse 2 line 2
-3verse 3 line 2
-
-[C]
- chorus line 1
- chorus line 2
-
-[P]
- pre-chorus line 1
- pre-chorus line 2
- pre-chorus line 3
-
-[B]
- bridge line 1
- bridge line 2
-
-
-'''
-
-class Test_OpenSong(object):
- """Test cases for converting from OpenSong xml format to Song"""
-
- def test_sample1(self):
- """OpenSong: handwritten sample1"""
- s = Song()
- s.from_opensong_buffer(_sample1)
- l = s.get_lyrics()
- assert(len(l) == (4*3+3))
- assert(s.get_number_of_slides() == 4)
-
- def test_sample2(self):
- """OpenSong: handwritten sample2 - with verses and chorus"""
- s = Song()
- s.from_opensong_buffer(_sample2)
- l = s.get_lyrics()
- assert(len(l) == (4*3+3))
- assert(s.get_number_of_slides() == 4)
-
- def test_sample3(self):
- """OpenSong: handwritten sample3 - with verses, chorus, bridge and pre-chorus"""
- s = Song()
- s.from_opensong_buffer(_sample3)
- l = s.get_lyrics()
- assert(len(l) == (4*3+4+5+4))
- assert(s.get_number_of_slides() == 6)
-
- def test_file1(self):
- """OpenSong: parse Amazing Grace"""
- global __ThisDir__
- s = Song()
- s.from_opensong_file(u'%s/data_opensong/Amazing Grace'%(__ThisDir__))
- assert(s.get_title() == 'Amazing Grace')
- assert(s.get_copyright() == '1982 Jubilate Hymns Limited')
- assert(s.get_song_cclino() == '1037882')
- assert(s.get_category_array(True) == 'God: Attributes')
- assert(s.get_author_list(True) == 'John Newton')
- assert(s.get_verse_order() == '')
- assert(s.get_number_of_slides() == 4)
-
- def test_file2(self):
- """OpenSong: parse The Solid Rock"""
- s = Song()
- s.from_opensong_file(u'%s/data_opensong/The Solid Rock'%(__ThisDir__))
- assert(s.get_title() == 'The Solid Rock')
- assert(s.get_copyright() == 'Public Domain')
- assert(s.get_song_cclino() == '101740')
- assert(s.get_category_array(True) == 'Christ: Victory, Fruit: Peace/Comfort')
- assert(s.get_author_list(True) == 'Edward Mote, John B. Dykes')
- assert(s.get_verse_order() == 'V1 C V2 C V3 C V4 C')
- assert(s.get_number_of_slides() == 5)
-
- def test_file3(self):
- """OpenSong: parse 'På en fjern ensom høj' (danish)"""
- #FIXME: problem with XML convert and danish characters
- s = Song()
- s.from_opensong_file(u'%s/data_opensong/På en fjern ensom høj'%(__ThisDir__))
- assert(s.get_title() == u'På en fjern ensom høj')
- assert(s.get_copyright() == '')
- assert(s.get_song_cclino() == '')
- assert(s.get_category_array(True) == '')
- assert(s.get_author_list(True) == '')
- assert(s.get_verse_order() == 'V1 C1 V2 C2 V3 C3 V4 C4')
- assert(s.get_number_of_slides() == 8)
-
-if '__main__' == __name__:
- r = Test_OpenSong()
- r.test_file3()
diff --git a/openlp/plugins/songs/test/test_song_text.py b/openlp/plugins/songs/test/test_song_text.py
deleted file mode 100644
index 810428233..000000000
--- a/openlp/plugins/songs/test/test_song_text.py
+++ /dev/null
@@ -1,66 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2010 Raoul Snyman #
-# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
-# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
-# Thompson, Jon Tibble, Carsten Tinggaard #
-# --------------------------------------------------------------------------- #
-# 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 #
-###############################################################################
-
-import os
-import sys
-
-__ThisDir__ = os.path.dirname(__file__)
-if "" == __ThisDir__ :
- __ThisDir__ = os.path.abspath(u'.')
-
-sys.path.append(os.path.abspath(u'%s/../../../..'%__ThisDir__))
-
-from openlp.plugins.songs.lib.songxml import *
-
-class Test_Text(object):
- """Test cases for converting from text format to Song"""
-
- def test_file1(self):
- """OpenSong: parse CCLI example"""
- global __ThisDir__
- s = Song()
- s.from_ccli_text_file(u'%s/data_text/CCLI example.txt'%(__ThisDir__))
- assert(s.get_title() == 'Song Title Here')
- assert(s.get_author_list(True) == 'Author, artist name')
- assert(s.get_copyright() == '1996 Publisher Info')
- assert(s.get_song_cclino() == '1234567')
- assert(s.get_number_of_slides() == 4)
-
- def test_file2(self):
- """OpenSong: parse PÃ¥EnFjern (danish)"""
- global __ThisDir__
- s = Song()
- s.from_ccli_text_file(u'%s/data_text/PÃ¥EnFjern.txt'%(__ThisDir__))
- assert(s.get_title() == 'På en fjern ensom høj')
- assert(s.get_author_list(True) == 'Georg Bennard')
- assert(s.get_copyright() == '')
- assert(s.get_song_cclino() == '')
- assert(s.get_number_of_slides() == 8)
-
-if '__main__' == __name__:
- # for local debugging
- r = Test_Text()
- r.test_file1()
- r.test_file2()
diff --git a/openlp/plugins/songs/test/test_song_verse.py b/openlp/plugins/songs/test/test_song_verse.py
deleted file mode 100644
index 7467bbb1b..000000000
--- a/openlp/plugins/songs/test/test_song_verse.py
+++ /dev/null
@@ -1,156 +0,0 @@
-# -*- coding: utf-8 -*-
-# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
-
-###############################################################################
-# OpenLP - Open Source Lyrics Projection #
-# --------------------------------------------------------------------------- #
-# Copyright (c) 2008-2010 Raoul Snyman #
-# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
-# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
-# Thompson, Jon Tibble, Carsten Tinggaard #
-# --------------------------------------------------------------------------- #
-# 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 #
-###############################################################################
-
-import os
-import sys
-
-__ThisDir__ = os.path.dirname(__file__)
-if "" == __ThisDir__ :
- __ThisDir__ = os.path.abspath(u'.')
-
-sys.path.append(os.path.abspath(u'%s/../../../..'%__ThisDir__))
-
-from openlp.plugins.songs.lib.songxml import *
-
-class Test_Verse(object):
- """Class for testing verses for preview and review"""
-
- def stdSong(self):
- """Definition of a standard song"""
- s = Song()
- self.title = "A song"
- self.author = "John Newton"
- self.copyright = "Peter Hamil"
- self.ccli = "123456"
- s.set_lyrics(["# verse","a single line"])
- s.set_title(self.title)
- s.set_copyright(self.copyright)
- s.set_author_list(self.author)
- s.set_song_cclino(self.ccli)
- return s
-
- def check_allfields(self, r, isblank = 0):
- #[theme, title, author, cpright, ccli, lyrics]
- if isblank == 1 :
- assert(r[1] == '')
- else :
- assert(r[1] == self.title)
- if isblank == 2 :
- assert(r[2] == '')
- else :
- assert(r[2] == self.author)
- if isblank == 3 :
- assert(r[3] == '')
- else :
- assert(r[3] == self.copyright)
- if isblank == 4 :
- assert(r[4] == '')
- else :
- assert(r[4] == self.ccli)
-
-
- def test_title_show_noshow(self):
- """Test the show title flag"""
- s = self.stdSong()
- r = s.get_render_slide(1)
- self.check_allfields(r)
- s.set_show_title(False)
- r = s.get_render_slide(1)
- self.check_allfields(r, 1)
- s.set_show_title(True)
- r = s.get_render_slide(1)
- self.check_allfields(r)
-
- def test_author_show_noshow(self):
- """Test the show author flag"""
- s = self.stdSong()
- r = s.get_render_slide(1)
- self.check_allfields(r)
- s.set_show_author_list(False)
- r = s.get_render_slide(1)
- self.check_allfields(r, 2)
- s.set_show_author_list(True)
- r = s.get_render_slide(1)
- self.check_allfields(r)
-
- def test_copyright_show_noshow(self):
- """Test the show copyright flag"""
- s = self.stdSong()
- r = s.get_render_slide(1)
- self.check_allfields(r)
- s.set_show_copyright(False)
- r = s.get_render_slide(1)
- self.check_allfields(r, 3)
- s.set_show_copyright(True)
- r = s.get_render_slide(1)
- self.check_allfields(r)
-
- def test_ccli_show_noshow(self):
- """Test the show copyright flag"""
- s = self.stdSong()
- r = s.get_render_slide(1)
- self.check_allfields(r)
- s.set_show_song_cclino(False)
- r = s.get_render_slide(1)
- self.check_allfields(r, 4)
- s.set_show_song_cclino(True)
- r = s.get_render_slide(1)
- self.check_allfields(r)
-
- def test_verse1(self):
- """Test an empty verse list"""
- s = Song()
- s.set_lyrics([])
- assert(s.get_number_of_slides() == 0)
-
- def test_verse2(self):
- """Test a list with an empty string"""
- s = Song()
- s.set_lyrics([""])
- assert(s.get_number_of_slides() == 0)
-
- def test_verse3a(self):
- """Test a one liner song"""
- s = Song()
- s.set_lyrics(["Single verse"])
- assert(s.get_number_of_slides() == 1)
-
- def test_verse3b(self):
- """Test a one liner song"""
- s = Song()
- s.set_lyrics(["", u'Single verse'])
- assert(s.get_number_of_slides() == 1)
-
- def test_verse3c(self):
- """Test a one liner song"""
- s = Song()
- s.set_lyrics(["", u'Single verse', u'', u''])
- assert(s.get_number_of_slides() == 1)
-
- def test_verse3d(self):
- """Test a one liner song"""
- s = Song()
- s.set_lyrics(["", u'# Verse', u'', u''])
- assert(s.get_number_of_slides() == 1)