Merge lp:~raoul-snyman/openlp/docstrings into lp:openlp

Proposed by Raoul Snyman
Status: Merged
Merged at revision: not available
Proposed branch: lp:~raoul-snyman/openlp/docstrings
Merge into: lp:openlp
Diff against target: None lines
To merge this branch: bzr merge lp:~raoul-snyman/openlp/docstrings
Reviewer Review Type Date Requested Status
Tim Bentley Approve
Review via email: mp+8371@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

First of a few merges to update the docstrings in our code, and do some general code style cleanups.

Revision history for this message
Tim Bentley (trb143) wrote :

Go for it

review: Approve
lp:~raoul-snyman/openlp/docstrings updated
486. By Raoul Snyman

Put the settings tab back in after accidentally removing it... silly me!

487. By Raoul Snyman

Merged docstrings changes.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cnvdb.py'
2--- cnvdb.py 2009-07-06 16:34:13 +0000
3+++ cnvdb.py 2009-07-08 06:55:08 +0000
4@@ -21,27 +21,35 @@
5 import codecs
6 import sys
7
8-
9-class Convert():
10- def __init__(self):
11- pass
12-
13- def process(self, inname, outname):
14- infile = codecs.open(inname, 'r', encoding='iso-8859-1')
15- writefile = codecs.open(outname, 'w', encoding='utf-8')
16- for line in infile:
17- #replace the quotes with quotes
18- line = line.replace(u'\'\'', u'\'')
19- writefile.write(line)
20- infile.close()
21- writefile.close()
22+def convert_file(self, inname, outname):
23+ """
24+ Convert a file from another encoding into UTF-8.
25+
26+ ``inname``
27+ The name of the file to be opened and converted.
28+
29+ ``outname``
30+ The output file name.
31+ """
32+ infile = codecs.open(inname, 'r', encoding='iso-8859-1')
33+ writefile = codecs.open(outname, 'w', encoding='utf-8')
34+ for line in infile:
35+ #replace the quotes with quotes
36+ line = line.replace(u'\'\'', u'\'')
37+ writefile.write(line)
38+ infile.close()
39+ writefile.close()
40
41 if __name__ == '__main__':
42+ """
43+ Run the conversion script.
44+ """
45 if len(sys.argv) < 2:
46 print 'No action specified.'
47 sys.exit()
48- print u'Uncode conversion '
49- print u'Input file = ', sys.argv[1:]
50- print u'Output file = ', sys.argv[2:]
51- mig = Convert()
52- mig.process(sys.argv[1:],sys.argv[2:])
53+ print 'Uncode conversion:'
54+ print 'Input file = ', sys.argv[1]
55+ print 'Output file = ', sys.argv[2]
56+ print 'Converting...'
57+ convert_file(sys.argv[1], sys.argv[2])
58+ print 'Done.'
59
60=== modified file 'demo.py'
61--- demo.py 2009-06-16 18:21:24 +0000
62+++ demo.py 2009-07-08 06:55:08 +0000
63@@ -16,12 +16,14 @@
64 Place, Suite 330, Boston, MA 02111-1307 USA
65 """
66
67-from openlp.core import Renderer
68-from openlp.theme import Theme
69 import sys
70 import time
71
72 from PyQt4 import QtGui, QtCore
73+
74+from openlp.core import Renderer
75+from openlp.theme import Theme
76+
77 words="""How sweet the name of Jesus sounds
78 In a believer's ear!
79 It soothes his sorrows, heals his wounds,
80@@ -29,53 +31,74 @@
81 """
82
83 class TstFrame(QtGui.QMainWindow):
84- """ We simply derive a new class of QMainWindow"""
85-
86- # {{{ init
87+ """
88+ We simply derive a new class of QMainWindow
89+ """
90
91 def __init__(self, *args, **kwargs):
92- """Create the DemoPanel."""
93+ """
94+ Create the DemoPanel.
95+ """
96 QtGui.QMainWindow.__init__(self)
97- self.resize(1024,768)
98- self.size=(1024,768)
99-
100- self.v=0
101- self._font=QtGui.QFont(u'Decorative', 32)
102- self.framecount=0
103+ self.resize(1024, 768)
104+ self.size = (1024, 768)
105+ self.v = 0
106+ self._font = QtGui.QFont(u'Decorative', 32)
107+ self.framecount = 0
108 self.totaltime = 0
109- self.dir=1
110- self.y=1
111-# self.startTimer(10)
112- self.frame=QtGui.QFrame()
113+ self.dir = 1
114+ self.y = 1
115+ self.frame = QtGui.QFrame()
116 self.setCentralWidget(self.frame)
117- self.r=Renderer()
118+ self.r = Renderer()
119 self.r.set_theme(Theme(u'demo_theme.xml'))
120-
121 self.r.set_text_rectangle(self.frame.frameRect())
122 self.r.set_paint_dest(self)
123 self.r.set_words_openlp(words)
124+
125 def timerEvent(self, event):
126+ """
127+ Update the form on a timer event.
128+
129+ ``event``
130+ The event which triggered this update.
131+ """
132 self.update()
133+
134 def paintEvent(self, event):
135+ """
136+ Repaint the canvas.
137+
138+ ``event``
139+ The event which triggered this repaint.
140+ """
141 self.r.set_text_rectangle(self.frame.frameRect())
142 self.r.scale_bg_image()
143- t1=time.clock()
144+ t1 = time.clock()
145 self.r.render_screen(0)
146 t2 = time.clock()
147- deltat=t2-t1
148+ deltat = t2 - t1
149 self.totaltime += deltat
150- self.framecount+=1
151+ self.framecount += 1
152 print "Timing result: %5.3ffps" %(self.framecount/float(self.totaltime))
153
154- # }}}
155
156-class Demo:
157+class Demo(object):
158+ """
159+ The demo application itself.
160+ """
161 def __init__(self):
162+ """
163+ Construct the application.
164+ """
165 app = QtGui.QApplication(sys.argv)
166- main=TstFrame()
167+ main = TstFrame()
168 main.show()
169 sys.exit(app.exec_())
170
171
172 if __name__=="__main__":
173- t=Demo()
174+ """
175+ Run the demo.
176+ """
177+ t = Demo()
178
179=== modified file 'openlp.pyw'
180--- openlp.pyw 2009-06-21 07:30:15 +0000
181+++ openlp.pyw 2009-07-08 06:55:08 +0000
182@@ -23,22 +23,29 @@
183 import logging
184
185 from PyQt4 import QtCore, QtGui
186+
187 from openlp.core.lib import Receiver
188+from openlp.core.resources import *
189+from openlp.core.ui import MainWindow, SplashScreen
190
191 logging.basicConfig(level=logging.DEBUG,
192 format=u'%(asctime)s:%(msecs)3d %(name)-15s %(levelname)-8s %(message)s',
193 datefmt=u'%m-%d %H:%M:%S', filename=u'openlp.log', filemode=u'w')
194
195-from openlp.core.resources import *
196-from openlp.core.ui import MainWindow, SplashScreen
197-
198 class OpenLP(QtGui.QApplication):
199+ """
200+ The core application class. This class inherits from Qt's QApplication
201+ class in order to provide the core of the application.
202+ """
203 global log
204 log = logging.getLogger(u'OpenLP Application')
205 log.info(u'Application Loaded')
206
207 def run(self):
208- #set the default string encoding
209+ """
210+ Run the OpenLP application.
211+ """
212+ #set the default string encoding
213 try:
214 sys.setappdefaultencoding(u'utf-8')
215 except:
216@@ -68,5 +75,8 @@
217 sys.exit(app.exec_())
218
219 if __name__ == u'__main__':
220+ """
221+ Instantiate and run the application.
222+ """
223 app = OpenLP(sys.argv)
224 app.run()
225
226=== modified file 'openlp/core/__init__.py'
227--- openlp/core/__init__.py 2009-05-21 05:15:51 +0000
228+++ openlp/core/__init__.py 2009-07-08 06:55:08 +0000
229@@ -17,6 +17,7 @@
230 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
231 Place, Suite 330, Boston, MA 02111-1307 USA
232 """
233+
234 from settingsmanager import SettingsManager
235 from openlp.core.lib.pluginmanager import PluginManager
236
237
238=== modified file 'openlp/core/lib/themexmlhandler.py'
239--- openlp/core/lib/themexmlhandler.py 2009-06-24 05:17:41 +0000
240+++ openlp/core/lib/themexmlhandler.py 2009-07-08 06:55:08 +0000
241@@ -19,10 +19,12 @@
242
243 For XML Schema see wiki.openlp.org
244 """
245-import os, os.path
246+import os
247+
248+from xml.dom.minidom import Document
249+from xml.etree.ElementTree import ElementTree, XML, dump
250+
251 from openlp.core.lib import str_to_bool
252-from xml.dom.minidom import Document
253-from xml.etree.ElementTree import ElementTree, XML, dump
254
255 blankthemexml=\
256 '''<?xml version="1.0" encoding="iso-8859-1"?>
257@@ -62,26 +64,38 @@
258 </theme>
259 '''
260
261-class ThemeXML():
262+class ThemeXML(object):
263+ """
264+ A class to encapsulate the Theme XML.
265+ """
266 def __init__(self):
267+ """
268+ Initialise the theme object.
269+ """
270 # Create the minidom document
271 self.theme_xml = Document()
272
273 def extend_image_filename(self, path):
274 """
275 Add the path name to the image name so the background can be rendered.
276+
277+ ``path``
278+ The path name to be added.
279 """
280- if self.background_filename is not None:
281- self.background_filename = os.path.join(path, self.theme_name, self.background_filename)
282+ if self.background_filename is not None and path is not None:
283+ self.background_filename = os.path.join(path, self.theme_name,
284+ self.background_filename)
285
286 def new_document(self, name):
287+ """
288+ Create a new theme XML document.
289+ """
290 self.theme = self.theme_xml.createElement(u'theme')
291 self.theme_xml.appendChild(self.theme)
292 self.theme.setAttribute(u'version', u'1.0')
293-
294 self.name = self.theme_xml.createElement(u'name')
295- ctn = self.theme_xml.createTextNode(name)
296- self.name.appendChild(ctn)
297+ text_node = self.theme_xml.createTextNode(name)
298+ self.name.appendChild(text_node)
299 self.theme.appendChild(self.name)
300
301 def add_background_transparent(self):
302@@ -95,23 +109,33 @@
303 def add_background_solid(self, bkcolor):
304 """
305 Add a Solid background.
306+
307+ ``bkcolor``
308+ The color of the background.
309 """
310 background = self.theme_xml.createElement(u'background')
311 background.setAttribute(u'mode', u'opaque')
312 background.setAttribute(u'type', u'solid')
313 self.theme.appendChild(background)
314-
315 self.child_element(background, u'color', bkcolor)
316
317 def add_background_gradient(self, startcolor, endcolor, direction):
318 """
319 Add a gradient background.
320+
321+ ``startcolor``
322+ The gradient's starting colour.
323+
324+ ``endcolor``
325+ The gradient's ending colour.
326+
327+ ``direction``
328+ The direction of the gradient.
329 """
330 background = self.theme_xml.createElement(u'background')
331 background.setAttribute(u'mode', u'opaque')
332 background.setAttribute(u'type', u'gradient')
333 self.theme.appendChild(background)
334-
335 # Create startColor element
336 self.child_element(background, u'startColor', startcolor)
337 # Create endColor element
338@@ -122,39 +146,63 @@
339 def add_background_image(self, filename):
340 """
341 Add a image background.
342+
343+ ``filename``
344+ The file name of the image.
345 """
346 background = self.theme_xml.createElement(u'background')
347 background.setAttribute(u'mode', u'opaque')
348 background.setAttribute(u'type', u'image')
349 self.theme.appendChild(background)
350-
351 #Create Filename element
352 self.child_element(background, u'filename', filename)
353
354- def add_font(self, name, color, proportion, override, fonttype=u'main', xpos=0, ypos=0 ,width=0, height=0):
355+ def add_font(self, name, color, proportion, override, fonttype=u'main',
356+ xpos=0, ypos=0, width=0, height=0):
357 """
358 Add a Font.
359+
360+ ``name``
361+ The name of the font.
362+
363+ ``color``
364+ The colour of the font.
365+
366+ ``proportion``
367+ The size of the font.
368+
369+ ``override``
370+ Whether or not to override the default positioning of the theme.
371+
372+ ``fonttype``
373+ The type of font, ``main`` or ``footer``. Defaults to ``main``.
374+
375+ ``xpos``
376+ The X position of the text block.
377+
378+ ``ypos``
379+ The Y position of the text block.
380+
381+ ``width``
382+ The width of the text block.
383+
384+ ``height``
385+ The height of the text block.
386 """
387 background = self.theme_xml.createElement(u'font')
388 background.setAttribute(u'type',fonttype)
389 self.theme.appendChild(background)
390-
391 #Create Font name element
392 self.child_element(background, u'name', name)
393-
394 #Create Font color element
395 self.child_element(background, u'color', color)
396-
397- #Create Proportion name element
398- self.child_element(background, u'proportion', proportion)
399-
400- #Create Proportion name element
401- self.child_element(background, u'proportion', proportion)
402-
403+ #Create Proportion name element
404+ self.child_element(background, u'proportion', proportion)
405+ #Create Proportion name element
406+ self.child_element(background, u'proportion', proportion)
407 #Create Location element
408 element = self.theme_xml.createElement(u'location')
409 element.setAttribute(u'override',override)
410-
411 if override == u'True':
412 element.setAttribute(u'x', xpos)
413 element.setAttribute(u'y', ypos)
414@@ -162,79 +210,120 @@
415 element.setAttribute(u'height', height)
416 background.appendChild(element)
417
418- def add_display(self, shadow, shadowColor, outline, outlineColor, horizontal, vertical, wrap):
419+ def add_display(self, shadow, shadow_color, outline, outline_color,
420+ horizontal, vertical, wrap):
421 """
422 Add a Display options.
423+
424+ ``shadow``
425+ Whether or not to show a shadow.
426+
427+ ``shadow_color``
428+ The colour of the shadow.
429+
430+ ``outline``
431+ Whether or not to show an outline.
432+
433+ ``outline_color``
434+ The colour of the outline.
435+
436+ ``horizontal``
437+ The horizontal alignment of the text.
438+
439+ ``vertical``
440+ The vertical alignment of the text.
441+
442+ ``wrap``
443+ Wrap style.
444 """
445 background = self.theme_xml.createElement(u'display')
446 self.theme.appendChild(background)
447-
448- tagElement = self.theme_xml.createElement(u'shadow')
449-
450- tagElement.setAttribute(u'color',shadowColor)
451- tagValue = self.theme_xml.createTextNode(shadow)
452- tagElement.appendChild(tagValue)
453- background.appendChild(tagElement)
454-
455- tagElement = self.theme_xml.createElement(u'outline')
456- tagElement.setAttribute(u'color',outlineColor)
457- tagValue = self.theme_xml.createTextNode(outline)
458- tagElement.appendChild(tagValue)
459- background.appendChild(tagElement)
460-
461- tagElement = self.theme_xml.createElement(u'horizontalAlign')
462- tagValue = self.theme_xml.createTextNode(horizontal)
463- tagElement.appendChild(tagValue)
464- background.appendChild(tagElement)
465-
466- tagElement = self.theme_xml.createElement(u'verticalAlign')
467- tagValue = self.theme_xml.createTextNode(vertical)
468- tagElement.appendChild(tagValue)
469- background.appendChild(tagElement)
470-
471- tagElement = self.theme_xml.createElement(u'wrapStyle')
472- tagValue = self.theme_xml.createTextNode(wrap)
473- tagElement.appendChild(tagValue)
474- background.appendChild(tagElement)
475+ # Shadow
476+ element = self.theme_xml.createElement(u'shadow')
477+ element.setAttribute(u'color', shadow_color)
478+ value = self.theme_xml.createTextNode(shadow)
479+ element.appendChild(value)
480+ background.appendChild(element)
481+ # Outline
482+ element = self.theme_xml.createElement(u'outline')
483+ element.setAttribute(u'color', outline_color)
484+ value = self.theme_xml.createTextNode(outline)
485+ element.appendChild(value)
486+ background.appendChild(element)
487+ # Horizontal alignment
488+ element = self.theme_xml.createElement(u'horizontalAlign')
489+ value = self.theme_xml.createTextNode(horizontal)
490+ element.appendChild(value)
491+ background.appendChild(element)
492+ # Vertical alignment
493+ element = self.theme_xml.createElement(u'verticalAlign')
494+ value = self.theme_xml.createTextNode(vertical)
495+ element.appendChild(value)
496+ background.appendChild(element)
497+ # Wrap style
498+ element = self.theme_xml.createElement(u'wrapStyle')
499+ value = self.theme_xml.createTextNode(wrap)
500+ element.appendChild(value)
501+ background.appendChild(element)
502
503 def child_element(self, element, tag, value):
504+ """
505+ Generic child element creator.
506+ """
507 child = self.theme_xml.createElement(tag)
508 child.appendChild(self.theme_xml.createTextNode(value))
509 element.appendChild(child)
510 return child
511
512 def dump_xml(self):
513+ """
514+ Dump the XML to file.
515+ """
516 # Debugging aid to see what we have
517 print self.theme_xml.toprettyxml(indent=u' ')
518
519 def extract_xml(self):
520+ """
521+ Pull out the XML string.
522+ """
523 # Print our newly created XML
524 return self.theme_xml.toxml()
525
526 def parse(self, xml):
527- self.baseParseXml()
528+ """
529+ Read in an XML string and parse it.
530+
531+ ``xml``
532+ The XML string to parse.
533+ """
534+ self.base_parse_xml()
535 self.parse_xml(xml)
536 self.theme_filename_extended = False
537
538- def baseParseXml(self):
539+ def base_parse_xml(self):
540+ """
541+ Pull in the blank theme XML as a starting point.
542+ """
543 self.parse_xml(blankthemexml)
544
545 def parse_xml(self, xml):
546+ """
547+ Parse an XML string.
548+
549+ ``xml``
550+ The XML string to parse.
551+ """
552 theme_xml = ElementTree(element=XML(xml))
553 iter = theme_xml.getiterator()
554 master = u''
555 for element in iter:
556- #print element.tag, element.text
557 if len(element.getchildren()) > 0:
558 master = element.tag + u'_'
559 if len(element.attrib) > 0:
560- #print "D", element.tag , element.attrib
561 for e in element.attrib.iteritems():
562- #print "A", master, e[0], e[1]
563 if master == u'font_' and e[0] == u'type':
564 master += e[1] + u'_'
565 elif master == u'display_' and (element.tag == u'shadow' or element.tag == u'outline'):
566- #print "b", master, element.tag, element.text, e[0], e[1]
567 et = str_to_bool(element.text)
568 setattr(self, master + element.tag , et)
569 setattr(self, master + element.tag + u'_'+ e[0], e[1])
570@@ -245,12 +334,14 @@
571 e1 = str_to_bool(e[1])
572 setattr(self, field, e1)
573 else:
574- #print "c", element.tag, element.text
575 if element.tag is not None:
576 field = master + element.tag
577 setattr(self, field, element.text)
578
579 def __str__(self):
580+ """
581+ Return a string representation of this object.
582+ """
583 s = u''
584 for k in dir(self):
585 if k[0:1] != u'_':
586
587=== modified file 'openlp/core/lib/toolbar.py'
588--- openlp/core/lib/toolbar.py 2009-06-29 05:07:32 +0000
589+++ openlp/core/lib/toolbar.py 2009-07-08 06:55:08 +0000
590@@ -1,4 +1,3 @@
591-
592 # -*- coding: utf-8 -*-
593 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
594 """
595@@ -19,15 +18,19 @@
596 Place, Suite 330, Boston, MA 02111-1307 USA
597 """
598 import types
599+import logging
600
601 from PyQt4 import QtCore, QtGui
602-import logging
603
604 class OpenLPToolbar(QtGui.QToolBar):
605 """
606- Lots of toolbars around the place, so it makes sense to have a common way to manage them
607+ Lots of toolbars around the place, so it makes sense to have a common way
608+ to manage them. This is the base toolbar class.
609 """
610 def __init__(self, parent):
611+ """
612+ Initialise the toolbar.
613+ """
614 QtGui.QToolBar.__init__(self, None)
615 # useful to be able to reuse button icons...
616 self.icons = {}
617@@ -37,6 +40,23 @@
618 def addToolbarButton(self, title, icon, tooltip=None, slot=None, objectname=None):
619 """
620 A method to help developers easily add a button to the toolbar.
621+
622+ ``title``
623+ The title of the button.
624+
625+ ``icon``
626+ The icon of the button. This can be an instance of QIcon, or a
627+ string cotaining either the absolute path to the image, or an
628+ internal resource path starting with ':/'.
629+
630+ ``tooltip``
631+ A hint or tooltip for this button.
632+
633+ ``slot``
634+ The method to run when this button is clicked.
635+
636+ ``objectname``
637+ The name of the object, as used in `<button>.setObjectName()`.
638 """
639 ButtonIcon = None
640 if type(icon) is QtGui.QIcon:
641@@ -58,6 +78,13 @@
642 self.icons[title] = ButtonIcon
643
644 def getIconFromTitle(self, title):
645+ """
646+ Search through the list of icons for an icon with a particular title,
647+ and return that icon.
648+
649+ ``title``
650+ The title of the icon to search for.
651+ """
652 if self.icons.has_key(title):
653 return self.icons[title]
654 else:
655
656=== modified file 'openlp/core/lib/xmlrootclass.py'
657--- openlp/core/lib/xmlrootclass.py 2009-05-20 20:17:20 +0000
658+++ openlp/core/lib/xmlrootclass.py 2009-07-08 06:55:08 +0000
659@@ -22,81 +22,80 @@
660 import sys
661 import os
662 from types import StringType, NoneType, UnicodeType
663-sys.path.append(os.path.abspath(u'./../..'))
664
665 from xml.etree.ElementTree import ElementTree, XML
666
667+sys.path.append(os.path.abspath(os.path.join('.', '..', '..')))
668
669 class XmlRootClass(object):
670- """Root class for themes, songs etc
671-
672- provides interface for parsing xml files into object attributes
673-
674- if you overload this class and provide a function called
675- post_tag_hook, it will be called thusly for each tag,value pair:
676-
677- (element.tag, val) = self.post_tag_hook(element.tag, val)
678- """
679- def _setFromXml(self, xml, rootTag):
680- """Set song properties from given xml content
681-
682- xml (string) -- formatted as xml tags and values
683- rootTag -- main tag of the xml
684+ """
685+ Root class for themes, songs etc
686+
687+ This class provides interface for parsing xml files into object attributes.
688+
689+ If you overload this class and provide a function called `post_tag_hook`,
690+ it will be called thusly for each `tag, value` pair::
691+
692+ (element.tag, val) = self.post_tag_hook(element.tag, val)
693+ """
694+ def _setFromXml(self, xml, root_tag):
695+ """
696+ Set song properties from given xml content.
697+
698+ ``xml``
699+ Formatted xml tags and values.
700+ ``root_tag``
701+ The root tag of the xml.
702 """
703 root = ElementTree(element=XML(xml))
704 iter = root.getiterator()
705 for element in iter:
706- if element.tag != rootTag:
707- t = element.text
708- #print element.tag, t, type(t)
709- if type(t) == NoneType:
710- # easy!
711- val=t
712- elif type(t) == UnicodeType :
713- val=t
714- elif type(t) == StringType:
715- # strings need special handling to sort the colours out
716- #print "str",
717- if t[0] == '$':
718- # might be a hex number
719- #print "hex",
720+ if element.tag != root_tag:
721+ text = element.text
722+ if type(text) is NoneType:
723+ val = text
724+ elif type(text) is UnicodeType :
725+ val = text
726+ elif type(text) is StringType:
727+ # Strings need special handling to sort the colours out
728+ if text[0] == '$':
729+ # This might be a hex number, let's try to convert it.
730 try:
731- val = int(t[1:], 16)
732+ val = int(text[1:], 16)
733 except ValueError:
734- # nope
735- #print "nope",
736 pass
737 else:
738- #print "last chance",
739+ # Let's just see if it's a integer.
740 try:
741- val=int(t)
742- #print "int",
743+ val = int(text)
744 except ValueError:
745- #print "give up",
746- val=t
747+ # Ok, it seems to be a string.
748+ val = text
749 if hasattr(self, u'post_tag_hook'):
750 (element.tag, val) = self.post_tag_hook(element.tag, val)
751 setattr(self, element.tag, val)
752- pass
753
754 def __str__(self):
755- """Return string with all public attributes
756+ """
757+ Return string with all public attributes
758
759 The string is formatted with one attribute per line
760 If the string is split on newline then the length of the
761 list is equal to the number of attributes
762 """
763- l = []
764- for k in dir(self):
765- if not k.startswith(u'_'):
766- l.append(u'%30s : %s' %(k,getattr(self,k)))
767- return u'\n'.join(l)
768+ attributes = []
769+ for attrib in dir(self):
770+ if not attrib.startswith(u'_'):
771+ attributes.append(u'%30s : %s' % (attrib, getattr(self, attrib)))
772+ return u'\n'.join(attributes)
773
774 def _get_as_string(self):
775- """Return one string with all public attributes"""
776- s=""
777- for k in dir(self):
778- if not k.startswith(u'_'):
779- s+= u'_%s_' %(getattr(self,k))
780- return s
781+ """
782+ Return one string with all public attributes
783+ """
784+ result = u''
785+ for attrib in dir(self):
786+ if not attrib.startswith(u'_'):
787+ result += u'_%s_' % getattr(self, attrib)
788+ return result
789
790
791=== modified file 'openlp/core/settingsmanager.py'
792--- openlp/core/settingsmanager.py 2008-11-29 05:36:16 +0000
793+++ openlp/core/settingsmanager.py 2009-07-08 06:55:08 +0000
794@@ -19,5 +19,7 @@
795 """
796
797 class SettingsManager(object):
798- def __init__(self):
799- pass
800+ """
801+ A base settings manager class.
802+ """
803+ pass
804
805=== modified file 'openlpcnv.pyw'
806--- openlpcnv.pyw 2009-06-23 16:25:40 +0000
807+++ openlpcnv.pyw 2009-07-08 06:55:08 +0000
808@@ -1,4 +1,23 @@
809 #!/usr/bin/env python
810+# -*- coding: utf-8 -*-
811+# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
812+"""
813+OpenLP - Open Source Lyrics Projection
814+Copyright (c) 2008 Raoul Snyman
815+Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley,
816+
817+This program is free software; you can redistribute it and/or modify it under
818+the terms of the GNU General Public License as published by the Free Software
819+Foundation; version 2 of the License.
820+
821+This program is distributed in the hope that it will be useful, but WITHOUT ANY
822+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
823+PARTICULAR PURPOSE. See the GNU General Public License for more details.
824+
825+You should have received a copy of the GNU General Public License along with
826+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
827+Place, Suite 330, Boston, MA 02111-1307 USA
828+"""
829
830 import os
831 import sys
832@@ -17,20 +36,30 @@
833 filename='openlp-migration.log',
834 filemode='w')
835
836-class Migration():
837+class Migration(object):
838+ """
839+ A class to take care of the migration process.
840+ """
841 def __init__(self):
842 """
843+ Initialise the process.
844 """
845 self.display = Display()
846 self.stime = time.strftime(u'%Y-%m-%d-%H%M%S', time.localtime())
847 self.display.output(u'OpenLp v1.9.0 Migration Utility Started')
848
849 def process(self):
850+ """
851+ Perform the conversion.
852+ """
853 #MigrateFiles(self.display).process()
854 MigrateSongs(self.display).process()
855 #MigrateBibles(self.display).process()
856
857 def move_log_file(self):
858+ """
859+ Move the log file to a new location.
860+ """
861 fname = 'openlp-migration.log'
862 c = os.path.splitext(fname)
863 b = (c[0]+'-'+ unicode(self.stime) + c[1])