Apply docstrings feedback

This commit is contained in:
Jon Tibble 2010-06-10 20:45:02 +01:00
parent 7ddaff2843
commit 78114b8063
4 changed files with 28 additions and 10 deletions

View File

@ -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):
"""

View File

@ -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()

View File

@ -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

View File

@ -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