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+11278@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Some more docstrings!

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

Approved

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

Merged lp:~raoul-snyman/openlp/docstrings into trunk.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'documentation/source/conf.py'
2--- documentation/source/conf.py 2009-07-10 15:45:17 +0000
3+++ documentation/source/conf.py 2009-09-03 21:41:34 +0000
4@@ -47,7 +47,7 @@
5 # The short X.Y version.
6 version = '2.0'
7 # The full version, including alpha/beta/rc tags.
8-release = '1.9.0'
9+release = '2.0.pre'
10
11 # The language for content autogenerated by Sphinx. Refer to documentation
12 # for a list of supported languages.
13@@ -96,7 +96,14 @@
14 # Theme options are theme-specific and customize the look and feel of a theme
15 # further. For a list of options available for each theme, see the
16 # documentation.
17-#html_theme_options = {}
18+html_theme_options = {
19+ 'sidebarbgcolor': '#3a60a9',
20+ 'relbarbgcolor': '#203b6f',
21+ 'footerbgcolor': '#26437c',
22+ 'headtextcolor': '#203b6f',
23+ 'linkcolor': '#26437c',
24+ 'sidebarlinkcolor': '#ceceff'
25+}
26
27 # Add any paths that contain custom themes here, relative to this directory.
28 #html_theme_path = []
29
30=== modified file 'documentation/source/core/index.rst'
31--- documentation/source/core/index.rst 2009-07-10 15:45:17 +0000
32+++ documentation/source/core/index.rst 2009-09-06 18:59:21 +0000
33@@ -3,42 +3,9 @@
34 :mod:`core` Module
35 ==================
36
37-.. automodule:: openlp.core
38- :members:
39-
40-:mod:`lib` Module
41------------------
42-
43-.. automodule:: openlp.core.lib
44- :members:
45-
46-:mod:`baselistwithdnd` Submodule
47-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
48-
49-.. automodule:: openlp.core.lib.baselistwithdnd
50- :members:
51-
52-:mod:`event` Submodule
53-^^^^^^^^^^^^^^^^^^^^^^
54-
55-.. automodule:: openlp.core.lib.event
56- :members:
57-
58-:mod:`eventmanager` Submodule
59-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
60-
61-.. automodule:: openlp.core.lib.eventmanager
62- :members:
63-
64-:mod:`eventreceiver` Submodule
65-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66-
67-.. automodule:: openlp.core.lib.eventreceiver
68- :members:
69-
70-:mod:`theme` Submodule
71-----------------------
72-
73-.. automodule:: openlp.core.theme
74- :members:
75+.. toctree::
76+ :maxdepth: 2
77+
78+ lib
79+ theme
80
81
82=== added file 'documentation/source/core/lib.rst'
83--- documentation/source/core/lib.rst 1970-01-01 00:00:00 +0000
84+++ documentation/source/core/lib.rst 2009-09-06 18:59:21 +0000
85@@ -0,0 +1,110 @@
86+.. _core-lib:
87+
88+:mod:`lib` Module
89+=================
90+
91+Module Members
92+--------------
93+
94+.. automodule:: openlp.core.lib
95+ :members:
96+
97+Module Classes
98+--------------
99+
100+:mod:`BaseListWithDnD`
101+^^^^^^^^^^^^^^^^^^^^^^
102+
103+.. autoclass:: openlp.core.lib.baselistwithdnd.BaseListWithDnD
104+ :members:
105+
106+:mod:`EventReceiver`
107+^^^^^^^^^^^^^^^^^^^^
108+
109+.. autoclass:: openlp.core.lib.eventreceiver.EventReceiver
110+ :members:
111+
112+:mod:`ListWithPreviews`
113+^^^^^^^^^^^^^^^^^^^^^^^
114+
115+.. autoclass:: openlp.core.lib.listwithpreviews.ListWithPreviews
116+ :members:
117+
118+:mod:`MediaManagerItem`
119+^^^^^^^^^^^^^^^^^^^^^^^
120+
121+.. autoclass:: openlp.core.lib.mediamanageritem.MediaManagerItem
122+ :members:
123+
124+:mod:`Plugin`
125+^^^^^^^^^^^^^
126+
127+.. autoclass:: openlp.core.lib.plugin.Plugin
128+ :members:
129+
130+:mod:`PluginConfig`
131+^^^^^^^^^^^^^^^^^^^
132+
133+.. autoclass:: openlp.core.lib.pluginconfig.PluginConfig
134+ :members:
135+
136+:mod:`PluginManager`
137+^^^^^^^^^^^^^^^^^^^^
138+
139+.. autoclass:: openlp.core.lib.pluginmanager.PluginManager
140+ :members:
141+
142+:mod:`Renderer`
143+^^^^^^^^^^^^^^^
144+
145+.. autoclass:: openlp.core.lib.renderer.Renderer
146+ :members:
147+
148+:mod:`RenderManager`
149+^^^^^^^^^^^^^^^^^^^^
150+
151+.. autoclass:: openlp.core.lib.rendermanager.RenderManager
152+ :members:
153+
154+:mod:`ServiceItem`
155+^^^^^^^^^^^^^^^^^^
156+
157+.. autoclass:: openlp.core.lib.serviceitem.ServiceItem
158+ :members:
159+
160+:mod:`SettingsTab`
161+^^^^^^^^^^^^^^^^^^
162+
163+.. autoclass:: openlp.core.lib.settingstab.SettingsTab
164+ :members:
165+
166+:mod:`SongXMLBuilder`
167+^^^^^^^^^^^^^^^^^^^^^
168+
169+.. autoclass:: openlp.core.lib.songxmlhandler.SongXMLBuilder
170+ :members:
171+
172+:mod:`SongXMLParser`
173+^^^^^^^^^^^^^^^^^^^^
174+
175+.. autoclass:: openlp.core.lib.songxmlhandler.SongXMLParser
176+ :members:
177+
178+:mod:`ThemeXML`
179+^^^^^^^^^^^^^^^
180+
181+.. autoclass:: openlp.core.lib.themexmlhandler.ThemeXML
182+ :members:
183+
184+:mod:`OpenLPToolbar`
185+^^^^^^^^^^^^^^^^^^^^
186+
187+.. autoclass:: openlp.core.lib.toolbar.OpenLPToolbar
188+ :members:
189+
190+:mod:`XmlRootClass`
191+^^^^^^^^^^^^^^^^^^^
192+
193+.. autoclass:: openlp.core.lib.xmlrootclass.XmlRootClass
194+ :members:
195+
196
197=== added file 'documentation/source/core/theme.rst'
198--- documentation/source/core/theme.rst 1970-01-01 00:00:00 +0000
199+++ documentation/source/core/theme.rst 2009-09-03 21:41:34 +0000
200@@ -0,0 +1,8 @@
201+.. _core-theme:
202+
203+:mod:`theme` Module
204+===================
205+
206+.. automodule:: openlp.core.theme
207+ :members:
208+
209
210=== modified file 'documentation/source/index.rst'
211--- documentation/source/index.rst 2009-07-10 15:45:17 +0000
212+++ documentation/source/index.rst 2009-09-03 21:41:34 +0000
213@@ -3,8 +3,12 @@
214 You can adapt this file completely to your liking, but it should at least
215 contain the root `toctree` directive.
216
217-Welcome to OpenLP's documentation!
218-==================================
219+Welcome
220+=======
221+
222+Welcome to the OpenLP 2.0 API Documentation! In here you will find all
223+information relating to OpenLP's core classes, core plugins, and anything else
224+deemed necessary or interesting by the developers.
225
226 Contents:
227
228
229=== modified file 'documentation/source/plugins/index.rst'
230--- documentation/source/plugins/index.rst 2009-07-10 15:45:17 +0000
231+++ documentation/source/plugins/index.rst 2009-09-02 20:42:57 +0000
232@@ -6,11 +6,10 @@
233 .. automodule:: openlp.plugins
234 :members:
235
236-:mod:`songs` Plugin
237--------------------
238+.. toctree::
239+ :maxdepth: 2
240
241-.. automodule:: openlp.plugins.songs
242- :members:
243+ songs
244
245 :mod:`bibles` Plugin
246 --------------------
247
248=== added file 'documentation/source/plugins/songs.rst'
249--- documentation/source/plugins/songs.rst 1970-01-01 00:00:00 +0000
250+++ documentation/source/plugins/songs.rst 2009-09-03 21:41:34 +0000
251@@ -0,0 +1,46 @@
252+.. _plugins-songs:
253+
254+:mod:`songs` Plugin
255+===================
256+
257+.. automodule:: openlp.plugins.songs
258+ :members:
259+
260+:mod:`SongsPlugin` Class
261+------------------------
262+
263+.. autoclass:: openlp.plugins.songs.songsplugin.SongsPlugin
264+ :members:
265+
266+:mod:`forms` Submodule
267+----------------------
268+
269+.. automodule:: openlp.plugins.songs.forms
270+ :members:
271+
272+:mod:`AuthorsForm`
273+^^^^^^^^^^^^^^^^^^
274+
275+.. autoclass:: openlp.plugins.songs.forms.authorsdialog.Ui_AuthorsDialog
276+ :members:
277+
278+.. autoclass:: openlp.plugins.songs.forms.authorsform.AuthorsForm
279+ :members:
280+
281+:mod:`EditSongForm`
282+^^^^^^^^^^^^^^^^^^^
283+
284+.. autoclass:: openlp.plugins.songs.forms.editsongdialog.Ui_EditSongDialog
285+ :members:
286+
287+.. autoclass:: openlp.plugins.songs.forms.editsongform.EditSongForm
288+ :members:
289+
290+:mod:`EditVerseForm`
291+^^^^^^^^^^^^^^^^^^^^
292+
293+.. autoclass:: openlp.plugins.songs.forms.editversedialog.Ui_EditVerseDialog
294+ :members:
295+
296+.. autoclass:: openlp.plugins.songs.forms.editverseform.EditVerseForm
297+ :members:
298
299=== modified file 'openlp.pyw'
300--- openlp.pyw 2009-09-01 05:17:32 +0000
301+++ openlp.pyw 2009-09-02 20:42:57 +0000
302@@ -3,7 +3,9 @@
303 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
304 """
305 OpenLP - Open Source Lyrics Projection
306+
307 Copyright (c) 2008 Raoul Snyman
308+
309 Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley,
310
311 This program is free software; you can redistribute it and/or modify it under
312@@ -29,15 +31,7 @@
313 from openlp.core.resources import *
314 from openlp.core.ui import MainWindow, SplashScreen
315
316-filename=u'openlp.log'
317 log = logging.getLogger()
318-log.setLevel(logging.INFO)
319-
320-logfile = logging.handlers.RotatingFileHandler(filename ,maxBytes=200000, backupCount=5)
321-logfile.setLevel(logging.DEBUG)
322-logfile.setFormatter(logging.Formatter(u'%(asctime)s %(name)-15s %(levelname)-8s %(message)s'))
323-
324-log.addHandler(logfile)
325
326 class OpenLP(QtGui.QApplication):
327 """
328@@ -78,22 +72,40 @@
329 self.mainWindow.show()
330 # now kill the splashscreen
331 self.splash.finish(self.mainWindow)
332- sys.exit(app.exec_())
333+ sys.exit(self.exec_())
334+
335
336 def main():
337- usage = "usage: %prog [options] arg1 arg2"
338+ """
339+ The main function which parses command line options and then runs
340+ the PyQt4 Application.
341+ """
342+ # Set up command line options.
343+ usage = u'Usage: %prog [options] [qt-options]'
344 parser = OptionParser(usage=usage)
345- parser.add_option("-d", "--debug",dest="debug",action="store_true",
346- help="Switch on Debugging ")
347+ parser.add_option("-d", "--debug", dest="debug",
348+ action="store_true", help="set logging to DEBUG level")
349+ # Set up logging
350+ filename = u'openlp.log'
351+ logfile = logging.handlers.RotatingFileHandler(
352+ filename, maxBytes=200000, backupCount=5)
353+ logfile.setFormatter(
354+ logging.Formatter(u'%(asctime)s %(name)-15s %(levelname)-8s %(message)s'))
355+ log.addHandler(logfile)
356+ # Parse command line options and deal with them.
357 (options, args) = parser.parse_args()
358 if options.debug is not None:
359 log.setLevel(logging.DEBUG)
360+ else:
361+ log.setLevel(logging.INFO)
362+ # Now create and actually run the application.
363+ app = OpenLP(sys.argv)
364+ app.run()
365+
366 if __name__ == u'__main__':
367 """
368 Instantiate and run the application.
369 """
370+ #import cProfile
371+ #cProfile.run("main()", "profile.out")
372 main()
373- app = OpenLP(sys.argv)
374- #import cProfile
375- #cProfile.run("app.run()", "profile.out")
376- app.run()
377
378=== modified file 'openlp/__init__.py'
379--- openlp/__init__.py 2009-05-21 05:15:51 +0000
380+++ openlp/__init__.py 2009-09-02 20:42:57 +0000
381@@ -1,6 +1,8 @@
382 """
383 OpenLP - Open Source Lyrics Projection
384+
385 Copyright (c) 2008 Raoul Snyman
386+
387 Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley
388
389 This program is free software; you can redistribute it and/or modify it under
390
391=== modified file 'openlp/core/__init__.py'
392--- openlp/core/__init__.py 2009-07-09 05:15:26 +0000
393+++ openlp/core/__init__.py 2009-09-02 20:42:57 +0000
394@@ -2,7 +2,9 @@
395 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
396 """
397 OpenLP - Open Source Lyrics Projection
398+
399 Copyright (c) 2008 Raoul Snyman
400+
401 Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley
402
403 This program is free software; you can redistribute it and/or modify it under
404
405=== modified file 'openlp/core/lib/__init__.py'
406--- openlp/core/lib/__init__.py 2009-09-05 01:22:05 +0000
407+++ openlp/core/lib/__init__.py 2009-09-06 18:59:21 +0000
408@@ -2,7 +2,9 @@
409 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
410 """
411 OpenLP - Open Source Lyrics Projection
412+
413 Copyright (c) 2008 Raoul Snyman
414+
415 Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley,
416
417 This program is free software; you can redistribute it and/or modify it under
418@@ -21,17 +23,51 @@
419 from PyQt4 import QtCore, QtGui
420
421 def translate(context, text):
422+ """
423+ A special shortcut method to wrap around the Qt4 translation functions.
424+ This abstracts the translation procedure so that we can change it if at a
425+ later date if necessary, without having to redo the whole of OpenLP.
426+
427+ ``context``
428+ The translation context, used to give each string a context or a
429+ namespace.
430+
431+ ``text``
432+ The text to put into the translation tables for translation.
433+ """
434 return QtGui.QApplication.translate(context, text, None, QtGui.QApplication.UnicodeUTF8)
435
436 def file_to_xml(xmlfile):
437+ """
438+ Open a file and return the contents of the file.
439+
440+ ``xmlfile``
441+ The name of the file.
442+ """
443 return open(xmlfile).read()
444
445 def str_to_bool(stringvalue):
446+ """
447+ Convert a string version of a boolean into a real boolean.
448+
449+ ``stringvalue``
450+ The string value to examine and convert to a boolean type.
451+ """
452 if stringvalue is True or stringvalue is False:
453 return stringvalue
454 return stringvalue.strip().lower() in (u'true', u'yes', u'y')
455
456 def buildIcon(icon):
457+ """
458+ Build a QIcon instance from an existing QIcon, a resource location, or a
459+ physical file location. If the icon is a QIcon instance, that icon is
460+ simply returned. If not, it builds a QIcon instance from the resource or
461+ file name.
462+
463+ ``icon``
464+ The icon to build. This can be a QIcon, a resource string in the form
465+ ``:/resource/file.png``, or a file location like ``/path/to/file.png``.
466+ """
467 ButtonIcon = None
468 if type(icon) is QtGui.QIcon:
469 ButtonIcon = icon
470@@ -59,6 +95,7 @@
471 action.setSeparator(True)
472 return action
473
474+from eventreceiver import Receiver
475 from settingsmanager import SettingsManager
476 from pluginconfig import PluginConfig
477 from plugin import Plugin
478@@ -67,12 +104,10 @@
479 from mediamanageritem import MediaManagerItem
480 from xmlrootclass import XmlRootClass
481 from serviceitem import ServiceItem
482-from eventreceiver import Receiver
483 from serviceitem import ServiceType
484 from serviceitem import ServiceItem
485 from toolbar import OpenLPToolbar
486-from songxmlhandler import SongXMLBuilder
487-from songxmlhandler import SongXMLParser
488+from songxmlhandler import SongXMLBuilder, SongXMLParser
489 from themexmlhandler import ThemeXML
490 from renderer import Renderer
491 from rendermanager import RenderManager
492
493=== modified file 'openlp/core/lib/eventreceiver.py'
494--- openlp/core/lib/eventreceiver.py 2009-09-05 19:58:02 +0000
495+++ openlp/core/lib/eventreceiver.py 2009-09-06 18:47:48 +0000
496@@ -24,8 +24,9 @@
497
498 class EventReceiver(QtCore.QObject):
499 """
500- Class to allow events to be passed from different parts of the system.
501- This is a private class and should not be used directly but via the Receiver class
502+ Class to allow events to be passed from different parts of the
503+ system. This is a private class and should not be used directly
504+ but rather via the Receiver class.
505
506 ``stop_import``
507 Stops the Bible Import
508@@ -36,13 +37,13 @@
509 ``process_events``
510 Requests the Application to flush the events queue
511
512- ``{plugin}_add_service_item ``
513+ ``{plugin}_add_service_item``
514 ask the plugin to push the selected items to the service item
515
516- ``update_themes ``
517+ ``update_themes``
518 send out message with new themes
519
520- ``update_global_theme ``
521+ ``update_global_theme``
522 Tell the components we have a new global theme
523
524 ``load_song_list``
525@@ -78,31 +79,57 @@
526 log = logging.getLogger(u'EventReceiver')
527
528 def __init__(self):
529+ """
530+ Initialise the event receiver, calling the parent constructor.
531+ """
532 QtCore.QObject.__init__(self)
533
534 def send_message(self, event, msg=None):
535- log.debug(u'Event %s passed with payload %s' % (event, msg))
536+ """
537+ Emit a Qt signal.
538+
539+ ``event``
540+ The event to that was sent.
541+
542+ ``msg``
543+ Defaults to *None*. The message to send with the event.
544+ """
545 self.emit(QtCore.SIGNAL(event), msg)
546
547+
548 class Receiver():
549 """
550- Class to allow events to be passed from different parts of the system.
551- This is a static wrapper around the EventReceiver class.
552- As there is only one instance of it in the systems the QT signal/slot architecture
553- can send messages across the system
554-
555- ``Send message``
556- Receiver().send_message(u'<<Message ID>>', data)
557-
558- ``Receive Message``
559- QtCore.QObject.connect(Receiver().get_receiver(),QtCore.SIGNAL(u'<<Message ID>>'),<<ACTION>>)
560+ Class to allow events to be passed from different parts of the
561+ system. This is a static wrapper around the ``EventReceiver``
562+ class. As there is only one instance of it in the system the QT
563+ signal/slot architecture can send messages across the system.
564+
565+ To send a message:
566+ ``Receiver().send_message(u'<<Message ID>>', data)``
567+
568+ To receive a Message
569+ ``QtCore.QObject.connect(Receiver().get_receiver(), QtCore.SIGNAL(u'<<Message ID>>'), <<ACTION>>)``
570 """
571 eventreceiver = EventReceiver()
572
573 @staticmethod
574 def send_message(event, msg=None):
575+ """
576+ Sends a message to the messaging system.
577+
578+ ``event``
579+ The event to send.
580+
581+ ``msg``
582+ Defaults to *None*. The message to send with the event.
583+ """
584 Receiver.eventreceiver.send_message(event, msg)
585
586 @staticmethod
587 def get_receiver():
588+ """
589+ Get the global ``eventreceiver`` instance.
590+ """
591 return Receiver.eventreceiver
592+
593+
594
595=== modified file 'openlp/core/lib/mediamanageritem.py'
596--- openlp/core/lib/mediamanageritem.py 2009-08-31 21:53:35 +0000
597+++ openlp/core/lib/mediamanageritem.py 2009-09-06 18:59:21 +0000
598@@ -31,28 +31,60 @@
599 MediaManagerItem is a helper widget for plugins.
600
601 None of the following *need* to be used, feel free to override
602- them cmopletely in your plugin's implementation. Alternatively, call them from your
603- plugin before or after you've done etra things that you need to.
604-
605- The plugin will be assigned an icon called u':/media/media_' + 'self.ShortPluginName + u'image.png'
606- which needs to be available in the main resources in order for them to work, you need to have setup
607-
608- self.TranslationContext
609- self.PluginTextShort # eg 'Image' for the image plugin
610- self.ConfigSection - where the items in the media manager are stored
611- this could potentially be self.PluginTextShort.lower()
612-
613- self.OnNewPrompt=u'Select Image(s)'
614- self.OnNewFileMasks=u'Images (*.jpg *jpeg *.gif *.png *.bmp)'
615- assumes that the new action is to load a file. If not, override onnew
616-
617- self.ListViewWithDnD_class - there is a base list class with DnD assigned to it (openlp.core.lib.BaseListWithDnD())
618- each plugin needs to inherit a class from this and pass that *class* (not an instance) to here
619- via the ListViewWithDnD_class member
620-
621- self.PreviewFunction - a function which returns a QImage to represent the item (a preview usually)
622- - no scaling required - that's done later
623- If this fn is not defined, a default will be used (treat the filename as an image)
624+ them cmopletely in your plugin's implementation. Alternatively,
625+ call them from your plugin before or after you've done extra
626+ things that you need to.
627+
628+ **Constructor Parameters**
629+
630+ ``parent``
631+ The parent widget. Usually this will be the *Media Manager*
632+ itself. This needs to be a class descended from ``QWidget``.
633+
634+ ``icon``
635+ Either a ``QIcon``, a resource path, or a file name. This is
636+ the icon which is displayed in the *Media Manager*.
637+
638+ ``title``
639+ The title visible on the item in the *Media Manager*.
640+
641+ **Member Variables**
642+
643+ When creating a descendant class from this class for your plugin,
644+ the following member variables should be set.
645+
646+ ``self.TranslationContext``
647+ This sets the translation context of all the text in the
648+ Media Manager item.
649+
650+ ``self.PluginTextShort``
651+ The shortened name for the plugin, e.g. *'Image'* for the
652+ image plugin.
653+
654+ ``self.ConfigSection``
655+ The section in the configuration where the items in the media
656+ manager are stored. This could potentially be
657+ ``self.PluginTextShort.lower()``.
658+
659+ ``self.OnNewPrompt``
660+ Defaults to *'Select Image(s)'*.
661+
662+ ``self.OnNewFileMasks``
663+ Defaults to *'Images (*.jpg *jpeg *.gif *.png *.bmp)'*. This
664+ assumes that the new action is to load a file. If not, you
665+ need to override the ``OnNew`` method.
666+
667+ ``self.ListViewWithDnD_class``
668+ This must be a **class**, not an object, descended from
669+ ``openlp.core.lib.BaseListWithDnD`` that is not used in any
670+ other part of OpenLP.
671+
672+ ``self.PreviewFunction``
673+ This must be a method which returns a QImage to represent the
674+ item (usually a preview). No scaling is required, that is
675+ performed automatically by OpenLP when necessary. If this
676+ method is not defined, a default will be used (treat the
677+ filename as an image).
678 """
679
680 global log
681@@ -83,12 +115,17 @@
682 self.initialise()
683
684 def retranslateUi(self):
685+ """
686+ This method is called automatically to provide OpenLP with the
687+ opportunity to translate the ``MediaManagerItem`` to another
688+ language.
689+ """
690 pass
691
692 def addToolbar(self):
693 """
694- A method to help developers easily add a toolbar to the media manager
695- item.
696+ A method to help developers easily add a toolbar to the media
697+ manager item.
698 """
699 if self.Toolbar is None:
700 self.Toolbar = OpenLPToolbar(self)
701@@ -97,9 +134,29 @@
702 def addToolbarButton(self, title, tooltip, icon, slot=None, objectname=None):
703 """
704 A method to help developers easily add a button to the toolbar.
705+
706+ ``title``
707+ The title of the button.
708+
709+ ``tooltip``
710+ The tooltip to be displayed when the mouse hovers over the
711+ button.
712+
713+ ``icon``
714+ The icon of the button. This can be an instance of QIcon, or a
715+ string cotaining either the absolute path to the image, or an
716+ internal resource path starting with ':/'.
717+
718+ ``slot``
719+ The method to call when the button is clicked.
720+
721+ ``objectname``
722+ The name of the button.
723 """
724- # NB different order (when I broke this out, I wanted to not break compatability)
725- # but it makes sense for the icon to come before the tooltip (as you have to have an icon, but not neccesarily a tooltip)
726+ # NB different order (when I broke this out, I didn't want to
727+ # break compatability), but it makes sense for the icon to
728+ # come before the tooltip (as you have to have an icon, but
729+ # not neccesarily a tooltip)
730 self.Toolbar.addToolbarButton(title, icon, tooltip, slot, objectname)
731
732 def addToolbarSeparator(self):
733@@ -109,6 +166,11 @@
734 self.Toolbar.addSeparator()
735
736 def setupUi(self):
737+ """
738+ This method sets up the interface on the button. Plugin
739+ developers use this to add and create toolbars, and the rest
740+ of the interface of the media manager item.
741+ """
742 # Add a toolbar
743 self.addToolbar()
744 # Create buttons for the toolbar
745@@ -189,6 +251,11 @@
746 QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onPreviewClick)
747
748 def initialise(self):
749+ """
750+ Implement this method in your descendent media manager item to
751+ do any UI or other initialisation. This method is called
752+ automatically.
753+ """
754 pass
755
756 def addHeaderBar(self):
757
758=== modified file 'openlp/core/lib/plugin.py'
759--- openlp/core/lib/plugin.py 2009-08-26 05:00:19 +0000
760+++ openlp/core/lib/plugin.py 2009-09-06 18:59:21 +0000
761@@ -21,17 +21,13 @@
762 import logging
763 from PyQt4 import QtCore
764
765-from openlp.core.lib import PluginConfig
766-# why does this not work???
767-# from openlp.core.lib import Event, EventType
768-# so I have to do this???
769-from eventreceiver import Receiver
770+from openlp.core.lib import PluginConfig, Receiver
771
772 class Plugin(object):
773 """
774 Base class for openlp plugins to inherit from.
775
776- Basic attributes are:
777+ **Basic Attributes**
778
779 ``name``
780 The name that should appear in the plugins list.
781@@ -49,7 +45,7 @@
782 ``log``
783 A log object used to log debugging messages. This is pre-instantiated.
784
785- Hook functions:
786+ **Hook Functions**
787
788 ``check_pre_conditions()``
789 Provides the Plugin with a handle to check if it can be loaded.
790@@ -201,7 +197,7 @@
791
792 def finalise(self):
793 """
794- Called by the plugin Manager to cleanup things
795+ Called by the plugin Manager to cleanup things.
796 """
797 pass
798
799
800=== modified file 'openlp/core/lib/pluginconfig.py'
801--- openlp/core/lib/pluginconfig.py 2009-09-02 01:44:09 +0000
802+++ openlp/core/lib/pluginconfig.py 2009-09-06 18:59:21 +0000
803@@ -2,7 +2,9 @@
804 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
805 """
806 OpenLP - Open Source Lyrics Projection
807+
808 Copyright (c) 2008 Raoul Snyman
809+
810 Portions copyright (c) 2008 -2009 Martin Thompson, Tim Bentley
811
812 This program is free software; you can redistribute it and/or modify it under
813@@ -19,6 +21,7 @@
814 """
815
816 import os
817+
818 from openlp.core.utils import ConfigHelper
819
820 class PluginConfig(object):
821
822=== modified file 'openlp/core/lib/pluginmanager.py'
823--- openlp/core/lib/pluginmanager.py 2009-09-05 08:52:01 +0000
824+++ openlp/core/lib/pluginmanager.py 2009-09-06 18:59:21 +0000
825@@ -2,7 +2,9 @@
826 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
827 """
828 OpenLP - Open Source Lyrics Projection
829+
830 Copyright (c) 2008 Raoul Snyman
831+
832 Portions copyright (c) 2008 - 2009 Martin Thompson, Tim Bentley,
833
834 This program is free software; you can redistribute it and/or modify it under
835@@ -52,7 +54,8 @@
836
837 def find_plugins(self, dir, plugin_helpers):
838 """
839- Scan the directory dir for objects inheriting from ``openlp.plugin``.
840+ Scan the directory ``dir`` for objects inheriting from the ``Plugin``
841+ class.
842
843 ``dir``
844 The directory to scan.
845
846=== modified file 'openlp/core/lib/renderer.py'
847--- openlp/core/lib/renderer.py 2009-09-03 17:46:46 +0000
848+++ openlp/core/lib/renderer.py 2009-09-06 18:59:21 +0000
849@@ -2,7 +2,9 @@
850 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
851 """
852 OpenLP - Open Source Lyrics Projection
853+
854 Copyright (c) 2008 Raoul Snyman
855+
856 Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley
857
858 This program is free software; you can redistribute it and/or modify it under
859
860=== modified file 'openlp/core/lib/rendermanager.py'
861--- openlp/core/lib/rendermanager.py 2009-09-03 17:46:46 +0000
862+++ openlp/core/lib/rendermanager.py 2009-09-06 18:59:21 +0000
863@@ -2,7 +2,9 @@
864 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
865 """
866 OpenLP - Open Source Lyrics Projection
867+
868 Copyright (c) 2008 Raoul Snyman
869+
870 Portions copyright (c) 2008 - 2009Martin Thompson, Tim Bentley
871
872 This program is free software; you can redistribute it and/or modify it under
873@@ -31,23 +33,23 @@
874 Class to pull all Renderer interactions into one place. The plugins will
875 call helper methods to do the rendering but this class will provide
876 display defense code.
877+
878+ ``theme_manager``
879+ The ThemeManager instance, used to get the current theme details.
880+
881+ ``screen_list``
882+ The list of screens available.
883+
884+ ``screen_number``
885+ Defaults to *0*. The index of the output/display screen.
886 """
887 global log
888- log=logging.getLogger(u'RenderManager')
889+ log = logging.getLogger(u'RenderManager')
890 log.info(u'RenderManager Loaded')
891
892 def __init__(self, theme_manager, screen_list, screen_number=0):
893 """
894 Initialise the render manager.
895-
896- ``theme_manager``
897- The ThemeManager instance, used to get the current theme details.
898-
899- ``screen_list``
900- The list of screens available.
901-
902- ``screen_number``
903- Defaults to *0*. The index of the output/display screen.
904 """
905 log.debug(u'Initilisation started')
906 self.screen_list = screen_list
907
908=== modified file 'openlp/core/lib/serviceitem.py'
909--- openlp/core/lib/serviceitem.py 2009-09-05 13:30:09 +0000
910+++ openlp/core/lib/serviceitem.py 2009-09-06 18:59:21 +0000
911@@ -2,7 +2,9 @@
912 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
913 """
914 OpenLP - Open Source Lyrics Projection
915+
916 Copyright (c) 2008 Raoul Snyman
917+
918 Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley
919
920 This program is free software; you can redistribute it and/or modify it under
921@@ -37,7 +39,7 @@
922 compositor.
923 """
924 global log
925- log=logging.getLogger(u'ServiceItem')
926+ log = logging.getLogger(u'ServiceItem')
927 log.info(u'Service Item created')
928
929 def __init__(self, hostplugin=None):
930
931=== modified file 'openlp/core/lib/settingsmanager.py'
932--- openlp/core/lib/settingsmanager.py 2009-09-06 12:13:09 +0000
933+++ openlp/core/lib/settingsmanager.py 2009-09-06 18:59:21 +0000
934@@ -2,7 +2,9 @@
935 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
936 """
937 OpenLP - Open Source Lyrics Projection
938+
939 Copyright (c) 2008 Raoul Snyman
940+
941 Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley
942
943 This program is free software; you can redistribute it and/or modify it under
944@@ -20,8 +22,9 @@
945
946 class SettingsManager(object):
947 """
948- Class to control the size of the UI components so they size correctly
949- This class is created by the main window and then calculates the size of individual components
950+ Class to control the size of the UI components so they size correctly.
951+ This class is created by the main window and then calculates the size of
952+ individual components.
953 """
954 def __init__(self, screen):
955 self.screen = screen[0]
956
957=== modified file 'openlp/core/lib/settingstab.py'
958--- openlp/core/lib/settingstab.py 2009-08-29 07:17:56 +0000
959+++ openlp/core/lib/settingstab.py 2009-09-06 18:59:21 +0000
960@@ -2,7 +2,9 @@
961 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
962 """
963 OpenLP - Open Source Lyrics Projection
964+
965 Copyright (c) 2008 Raoul Snyman
966+
967 Portions copyright (c) 2008 Martin Thompson, Tim Bentley
968
969 This program is free software; you can redistribute it and/or modify it under
970@@ -19,6 +21,7 @@
971 """
972
973 from PyQt4 import QtCore, QtGui
974+
975 from openlp.core.lib import PluginConfig
976
977 class SettingsTab(QtGui.QWidget):
978
979=== modified file 'openlp/core/lib/songxmlhandler.py'
980--- openlp/core/lib/songxmlhandler.py 2009-07-10 13:16:15 +0000
981+++ openlp/core/lib/songxmlhandler.py 2009-07-14 13:51:27 +0000
982@@ -2,7 +2,9 @@
983 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
984 """
985 OpenLP - Open Source Lyrics Projection
986+
987 Copyright (c) 2008 Raoul Snyman
988+
989 Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten Tinggaard
990
991 This program is free software; you can redistribute it and/or modify it under
992@@ -16,26 +18,25 @@
993 You should have received a copy of the GNU General Public License along with
994 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
995 Place, Suite 330, Boston, MA 02111-1307 USA
996-from xml.dom.minidom import Document
997-from xml.etree.ElementTree import ElementTree, XML, dump
998-
999-<?xml version="1.0" encoding="UTF-8"?>
1000-<song version="1.0">
1001- <lyrics language="en">
1002- <verse type="chorus" label="1">
1003- <![CDATA[ ... ]]>
1004- </verse>
1005- </lyrics>
1006-</song>
1007-
1008 """
1009 import logging
1010 from xml.dom.minidom import Document
1011 from xml.etree.ElementTree import ElementTree, XML, dump
1012
1013-class SongXMLBuilder():
1014+class SongXMLBuilder(object):
1015 """
1016 This class builds the XML used to describe songs.
1017+
1018+ The basic XML looks like this::
1019+
1020+ <?xml version="1.0" encoding="UTF-8"?>
1021+ <song version="1.0">
1022+ <lyrics language="en">
1023+ <verse type="chorus" label="1">
1024+ <![CDATA[ ... ]]>
1025+ </verse>
1026+ </lyrics>
1027+ </song>
1028 """
1029 def __init__(self):
1030 """
1031@@ -97,9 +98,21 @@
1032 """
1033 return self.song_xml.toxml(u'utf-8')
1034
1035-class SongXMLParser():
1036+
1037+class SongXMLParser(object):
1038 """
1039 A class to read in and parse a song's XML.
1040+
1041+ The basic XML looks like this::
1042+
1043+ <?xml version="1.0" encoding="UTF-8"?>
1044+ <song version="1.0">
1045+ <lyrics language="en">
1046+ <verse type="chorus" label="1">
1047+ <![CDATA[ ... ]]>
1048+ </verse>
1049+ </lyrics>
1050+ </song>
1051 """
1052 global log
1053 log = logging.getLogger(u'SongXMLParser')
1054
1055=== modified file 'openlp/core/lib/themexmlhandler.py'
1056--- openlp/core/lib/themexmlhandler.py 2009-09-05 01:27:38 +0000
1057+++ openlp/core/lib/themexmlhandler.py 2009-09-06 18:59:21 +0000
1058@@ -2,7 +2,9 @@
1059 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
1060 """
1061 OpenLP - Open Source Lyrics Projection
1062+
1063 Copyright (c) 2008 Raoul Snyman
1064+
1065 Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten Tinggaard
1066
1067 This program is free software; you can redistribute it and/or modify it under
1068
1069=== modified file 'openlp/core/lib/toolbar.py'
1070--- openlp/core/lib/toolbar.py 2009-08-28 17:40:07 +0000
1071+++ openlp/core/lib/toolbar.py 2009-09-06 18:59:21 +0000
1072@@ -2,7 +2,9 @@
1073 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
1074 """
1075 OpenLP - Open Source Lyrics Projection
1076+
1077 Copyright (c) 2009 Raoul Snyman
1078+
1079 Portions copyright (c) 2009 Martin Thompson, Tim Bentley
1080
1081 This program is free software; you can redistribute it and/or modify it under
1082@@ -109,9 +111,21 @@
1083 return QtGui.QIcon()
1084
1085 def makeWidgetsInvisible(self, widgets):
1086+ """
1087+ Hide a set of widgets.
1088+
1089+ ``widgets``
1090+ The list of names of widgets to be hidden.
1091+ """
1092 for widget in widgets:
1093 self.actions[widget].setVisible(False)
1094
1095 def makeWidgetsVisible(self, widgets):
1096+ """
1097+ Show a set of widgets.
1098+
1099+ ``widgets``
1100+ The list of names of widgets to be shown.
1101+ """
1102 for widget in widgets:
1103 self.actions[widget].setVisible(True)
1104
1105=== modified file 'openlp/core/lib/xmlrootclass.py'
1106--- openlp/core/lib/xmlrootclass.py 2009-07-08 06:55:08 +0000
1107+++ openlp/core/lib/xmlrootclass.py 2009-07-14 13:51:27 +0000
1108@@ -2,7 +2,9 @@
1109 # vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
1110 """
1111 OpenLP - Open Source Lyrics Projection
1112+
1113 Copyright (c) 2008 Raoul Snyman
1114+
1115 Portions copyright (c) 2008 Martin Thompson, Tim Bentley, Carsten Tinggaard
1116
1117 This program is free software; you can redistribute it and/or modify it under
1118
1119=== modified file 'openlp/plugins/songs/songsplugin.py'
1120--- openlp/plugins/songs/songsplugin.py 2009-08-26 05:00:19 +0000
1121+++ openlp/plugins/songs/songsplugin.py 2009-09-02 20:42:57 +0000
1122@@ -28,12 +28,22 @@
1123 OpenSongImportForm, OpenLPExportForm
1124
1125 class SongsPlugin(Plugin):
1126+ """
1127+ This is the number 1 plugin, if importance were placed on any
1128+ plugins. This plugin enables the user to create, edit and display
1129+ songs. Songs are divided into verses, and the verse order can be
1130+ specified. Authors, topics and song books can be assigned to songs
1131+ as well.
1132+ """
1133
1134 global log
1135 log = logging.getLogger(u'SongsPlugin')
1136 log.info(u'Song Plugin loaded')
1137
1138 def __init__(self, plugin_helpers):
1139+ """
1140+ Create and set up the Songs plugin.
1141+ """
1142 # Call the parent constructor
1143 Plugin.__init__(self, u'Songs', u'1.9.0', plugin_helpers)
1144 self.weight = -10
1145@@ -48,11 +58,22 @@
1146 QtGui.QIcon.Normal, QtGui.QIcon.Off)
1147
1148 def get_media_manager_item(self):
1149- # Create the MediaManagerItem object
1150+ """
1151+ Create the MediaManagerItem object, which is displaed in the
1152+ Media Manager.
1153+ """
1154 self.media_item = SongMediaItem(self, self.icon, 'Songs')
1155 return self.media_item
1156
1157 def add_import_menu_item(self, import_menu):
1158+ """
1159+ Give the Songs plugin the opportunity to add items to the
1160+ **Import** menu.
1161+
1162+ ``import_menu``
1163+ The actual **Import** menu item, so that your actions can
1164+ use it as their parent.
1165+ """
1166 self.ImportSongMenu = QtGui.QMenu(import_menu)
1167 self.ImportSongMenu.setObjectName(u'ImportSongMenu')
1168 self.ImportOpenSongItem = QtGui.QAction(import_menu)
1169@@ -88,6 +109,14 @@
1170 QtCore.SIGNAL(u'triggered()'), self.onImportOpenSongItemClick)
1171
1172 def add_export_menu_item(self, export_menu):
1173+ """
1174+ Give the Songs plugin the opportunity to add items to the
1175+ **Export** menu.
1176+
1177+ ``export_menu``
1178+ The actual **Export** menu item, so that your actions can
1179+ use it as their parent.
1180+ """
1181 self.ExportSongMenu = QtGui.QMenu(export_menu)
1182 self.ExportSongMenu.setObjectName(u'ExportSongMenu')
1183 self.ExportOpenSongItem = QtGui.QAction(export_menu)