From 78114b80630f3dc701bc5b40e22862535ebc9cce Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Thu, 10 Jun 2010 20:45:02 +0100 Subject: [PATCH] Apply docstrings feedback --- openlp/core/ui/__init__.py | 3 +++ openlp/core/ui/thememanager.py | 26 ++++++++++++++++++++------ openlp/core/utils/__init__.py | 5 ++++- openlp/plugins/songs/forms/__init__.py | 4 +--- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index 76b84503e..e104a2ec6 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -22,6 +22,9 @@ # with this program; if not, write to the Free Software Foundation, Inc., 59 # # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### +""" +The :mod:`ui` module provides the core user interface for OpenLP +""" class HideMode(object): """ diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index b5322d0ec..1d60d264f 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -168,8 +168,6 @@ class ThemeManager(QtGui.QWidget): def onAddTheme(self): """ - Add a new theme - Loads a new theme with the default settings and then launches the theme editing form for the user to make their customisations. """ @@ -180,8 +178,6 @@ class ThemeManager(QtGui.QWidget): def onEditTheme(self): """ - Edit a theme - Loads the settings for the theme that is to be edited and launches the theme editing form so the user can make their changes. """ @@ -286,8 +282,6 @@ class ThemeManager(QtGui.QWidget): def onImportTheme(self): """ - Import a theme - Opens a file dialog to select the theme file(s) to import before attempting to extract OpenLP themes from those files. This process will load both OpenLP version 1 and version 2 themes. @@ -565,11 +559,20 @@ class ThemeManager(QtGui.QWidget): return frame def getPreviewImage(self, theme): + """ + Return an image representing the look of the theme + + ``theme`` + The theme to return the image for + """ log.debug(u'getPreviewImage %s ', theme) image = os.path.join(self.path, theme + u'.png') return image def baseTheme(self): + """ + Provide a base theme with sensible defaults + """ log.debug(u'base theme created') newtheme = ThemeXML() newtheme.new_document(unicode(translate(u'ThemeManager', u'New Theme'))) @@ -583,6 +586,12 @@ class ThemeManager(QtGui.QWidget): return newtheme.extract_xml() def createThemeFromXml(self, theme_xml, path): + """ + Return a theme object using information parsed from XML + + ``theme_xml`` + The XML data to load into the theme + """ theme = ThemeXML() theme.parse(theme_xml) self.cleanTheme(theme) @@ -590,6 +599,11 @@ class ThemeManager(QtGui.QWidget): return theme def cleanTheme(self, theme): + """ + Clean a theme loaded from an XML file by removing stray whitespace and + making sure parameters are the correct type for the theme object + attributes + """ theme.background_color = theme.background_color.strip() theme.background_direction = theme.background_direction.strip() theme.background_endColor = theme.background_endColor.strip() diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 8cbf7657a..512e15f06 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -22,13 +22,16 @@ # with this program; if not, write to the Free Software Foundation, Inc., 59 # # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### +""" +The :mod:`utils` module provides the utility libraries for OpenLP +""" import os import sys import logging import urllib2 -from datetime import datetime +from datetime import datetime from PyQt4 import QtCore import openlp diff --git a/openlp/plugins/songs/forms/__init__.py b/openlp/plugins/songs/forms/__init__.py index 84e75c202..a96e092c4 100644 --- a/openlp/plugins/songs/forms/__init__.py +++ b/openlp/plugins/songs/forms/__init__.py @@ -27,9 +27,7 @@ from openlp.core.lib import translate class VerseType(object): """ - Provide a type definition for verses - - VerseType provides the type definition for the tags that may be associated + VerseType provides an enumeration for the tags that may be associated with verses in songs. """ Verse = 0