diff --git a/documentation/source/core/index.rst b/documentation/source/core/index.rst index 9e5dd106c..38a98ab97 100644 --- a/documentation/source/core/index.rst +++ b/documentation/source/core/index.rst @@ -8,3 +8,4 @@ lib theme + diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index a45f23f02..254982799 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -2,7 +2,9 @@ # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 """ OpenLP - Open Source Lyrics Projection + Copyright (c) 2008 Raoul Snyman + Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, This program is free software; you can redistribute it and/or modify it under @@ -21,17 +23,51 @@ import types from PyQt4 import QtCore, QtGui def translate(context, text): + """ + A special shortcut method to wrap around the Qt4 translation functions. + This abstracts the translation procedure so that we can change it if at a + later date if necessary, without having to redo the whole of OpenLP. + + ``context`` + The translation context, used to give each string a context or a + namespace. + + ``text`` + The text to put into the translation tables for translation. + """ return QtGui.QApplication.translate(context, text, None, QtGui.QApplication.UnicodeUTF8) def file_to_xml(xmlfile): + """ + Open a file and return the contents of the file. + + ``xmlfile`` + The name of the file. + """ return open(xmlfile).read() def str_to_bool(stringvalue): + """ + Convert a string version of a boolean into a real boolean. + + ``stringvalue`` + The string value to examine and convert to a boolean type. + """ if stringvalue is True or stringvalue is False: return stringvalue return stringvalue.strip().lower() in (u'true', u'yes', u'y') def buildIcon(icon): + """ + Build a QIcon instance from an existing QIcon, a resource location, or a + physical file location. If the icon is a QIcon instance, that icon is + simply returned. If not, it builds a QIcon instance from the resource or + file name. + + ``icon`` + The icon to build. This can be a QIcon, a resource string in the form + ``:/resource/file.png``, or a file location like ``/path/to/file.png``. + """ ButtonIcon = None if type(icon) is QtGui.QIcon: ButtonIcon = icon @@ -71,8 +107,7 @@ from serviceitem import ServiceItem from serviceitem import ServiceType from serviceitem import ServiceItem from toolbar import OpenLPToolbar -from songxmlhandler import SongXMLBuilder -from songxmlhandler import SongXMLParser +from songxmlhandler import SongXMLBuilder, SongXMLParser from themexmlhandler import ThemeXML from renderer import Renderer from rendermanager import RenderManager diff --git a/openlp/core/lib/pluginconfig.py b/openlp/core/lib/pluginconfig.py index 241769751..d37cf96a0 100644 --- a/openlp/core/lib/pluginconfig.py +++ b/openlp/core/lib/pluginconfig.py @@ -2,7 +2,9 @@ # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 """ OpenLP - Open Source Lyrics Projection + Copyright (c) 2008 Raoul Snyman + Portions copyright (c) 2008 -2009 Martin Thompson, Tim Bentley This program is free software; you can redistribute it and/or modify it under @@ -19,6 +21,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA """ import os + from openlp.core.utils import ConfigHelper class PluginConfig(object): diff --git a/openlp/core/lib/pluginmanager.py b/openlp/core/lib/pluginmanager.py index e60b101f7..fe6bc20cf 100644 --- a/openlp/core/lib/pluginmanager.py +++ b/openlp/core/lib/pluginmanager.py @@ -2,7 +2,9 @@ # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 """ OpenLP - Open Source Lyrics Projection + Copyright (c) 2008 Raoul Snyman + Portions copyright (c) 2008 - 2009 Martin Thompson, Tim Bentley, This program is free software; you can redistribute it and/or modify it under diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 7a818b03c..bb3e28e93 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -2,7 +2,9 @@ # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 """ OpenLP - Open Source Lyrics Projection + Copyright (c) 2008 Raoul Snyman + Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley This program is free software; you can redistribute it and/or modify it under diff --git a/openlp/core/lib/rendermanager.py b/openlp/core/lib/rendermanager.py index 34f48050c..14d7b4be0 100644 --- a/openlp/core/lib/rendermanager.py +++ b/openlp/core/lib/rendermanager.py @@ -2,7 +2,9 @@ # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 """ OpenLP - Open Source Lyrics Projection + Copyright (c) 2008 Raoul Snyman + Portions copyright (c) 2008 - 2009Martin Thompson, Tim Bentley This program is free software; you can redistribute it and/or modify it under @@ -42,7 +44,7 @@ class RenderManager(object): Defaults to *0*. The index of the output/display screen. """ global log - log=logging.getLogger(u'RenderManager') + log = logging.getLogger(u'RenderManager') log.info(u'RenderManager Loaded') def __init__(self, theme_manager, screen_list, screen_number=0): diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index eba0372b2..d6da91850 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -2,7 +2,9 @@ # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 """ OpenLP - Open Source Lyrics Projection + Copyright (c) 2008 Raoul Snyman + Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley This program is free software; you can redistribute it and/or modify it under @@ -37,7 +39,7 @@ class ServiceItem(object): compositor. """ global log - log=logging.getLogger(u'ServiceItem') + log = logging.getLogger(u'ServiceItem') log.info(u'Service Item created') def __init__(self, hostplugin=None): diff --git a/openlp/core/lib/settingsmanager.py b/openlp/core/lib/settingsmanager.py index 3bd32a753..5eb3fe75b 100644 --- a/openlp/core/lib/settingsmanager.py +++ b/openlp/core/lib/settingsmanager.py @@ -2,7 +2,9 @@ # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 """ OpenLP - Open Source Lyrics Projection + Copyright (c) 2008 Raoul Snyman + Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley This program is free software; you can redistribute it and/or modify it under @@ -20,8 +22,9 @@ Place, Suite 330, Boston, MA 02111-1307 USA class SettingsManager(object): """ - Class to control the size of the UI components so they size correctly - This class is created by the main window and then calculates the size of individual components + Class to control the size of the UI components so they size correctly. + This class is created by the main window and then calculates the size of + individual components. """ def __init__(self, screen): self.screen = screen[0] diff --git a/openlp/core/lib/settingstab.py b/openlp/core/lib/settingstab.py index 4e59f6468..0a3b6145d 100644 --- a/openlp/core/lib/settingstab.py +++ b/openlp/core/lib/settingstab.py @@ -2,7 +2,9 @@ # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 """ OpenLP - Open Source Lyrics Projection + Copyright (c) 2008 Raoul Snyman + Portions copyright (c) 2008 Martin Thompson, Tim Bentley This program is free software; you can redistribute it and/or modify it under @@ -19,6 +21,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA """ from PyQt4 import QtCore, QtGui + from openlp.core.lib import PluginConfig class SettingsTab(QtGui.QWidget): diff --git a/openlp/core/lib/songxmlhandler.py b/openlp/core/lib/songxmlhandler.py index 9cb0bb4e9..d66b11da9 100644 --- a/openlp/core/lib/songxmlhandler.py +++ b/openlp/core/lib/songxmlhandler.py @@ -2,7 +2,9 @@ # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 """ OpenLP - Open Source Lyrics Projection + Copyright (c) 2008 Raoul Snyman + Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten Tinggaard This program is free software; you can redistribute it and/or modify it under @@ -16,26 +18,25 @@ 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 -from xml.dom.minidom import Document -from xml.etree.ElementTree import ElementTree, XML, dump - - - - - - - - - - """ import logging from xml.dom.minidom import Document from xml.etree.ElementTree import ElementTree, XML, dump -class SongXMLBuilder(): +class SongXMLBuilder(object): """ This class builds the XML used to describe songs. + + The basic XML looks like this:: + + + + + + + + + """ def __init__(self): """ @@ -97,9 +98,21 @@ class SongXMLBuilder(): """ return self.song_xml.toxml(u'utf-8') -class SongXMLParser(): + +class SongXMLParser(object): """ A class to read in and parse a song's XML. + + The basic XML looks like this:: + + + + + + + + + """ global log log = logging.getLogger(u'SongXMLParser') diff --git a/openlp/core/lib/themexmlhandler.py b/openlp/core/lib/themexmlhandler.py index 0ee295e72..3e6ed41de 100644 --- a/openlp/core/lib/themexmlhandler.py +++ b/openlp/core/lib/themexmlhandler.py @@ -2,7 +2,9 @@ # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 """ OpenLP - Open Source Lyrics Projection + Copyright (c) 2008 Raoul Snyman + Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten Tinggaard This program is free software; you can redistribute it and/or modify it under diff --git a/openlp/core/lib/toolbar.py b/openlp/core/lib/toolbar.py index eaab4d37f..c5511236b 100644 --- a/openlp/core/lib/toolbar.py +++ b/openlp/core/lib/toolbar.py @@ -2,7 +2,9 @@ # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 """ OpenLP - Open Source Lyrics Projection + Copyright (c) 2009 Raoul Snyman + Portions copyright (c) 2009 Martin Thompson, Tim Bentley This program is free software; you can redistribute it and/or modify it under diff --git a/openlp/core/lib/xmlrootclass.py b/openlp/core/lib/xmlrootclass.py index 3cd559f62..677a426f0 100644 --- a/openlp/core/lib/xmlrootclass.py +++ b/openlp/core/lib/xmlrootclass.py @@ -2,7 +2,9 @@ # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 """ OpenLP - Open Source Lyrics Projection + Copyright (c) 2008 Raoul Snyman + Portions copyright (c) 2008 Martin Thompson, Tim Bentley, Carsten Tinggaard This program is free software; you can redistribute it and/or modify it under