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
=== modified file 'documentation/source/conf.py'
--- documentation/source/conf.py 2009-07-10 15:45:17 +0000
+++ documentation/source/conf.py 2009-09-03 21:41:34 +0000
@@ -47,7 +47,7 @@
47# The short X.Y version.47# The short X.Y version.
48version = '2.0'48version = '2.0'
49# The full version, including alpha/beta/rc tags.49# The full version, including alpha/beta/rc tags.
50release = '1.9.0'50release = '2.0.pre'
5151
52# The language for content autogenerated by Sphinx. Refer to documentation52# The language for content autogenerated by Sphinx. Refer to documentation
53# for a list of supported languages.53# for a list of supported languages.
@@ -96,7 +96,14 @@
96# Theme options are theme-specific and customize the look and feel of a theme96# Theme options are theme-specific and customize the look and feel of a theme
97# further. For a list of options available for each theme, see the97# further. For a list of options available for each theme, see the
98# documentation.98# documentation.
99#html_theme_options = {}99html_theme_options = {
100 'sidebarbgcolor': '#3a60a9',
101 'relbarbgcolor': '#203b6f',
102 'footerbgcolor': '#26437c',
103 'headtextcolor': '#203b6f',
104 'linkcolor': '#26437c',
105 'sidebarlinkcolor': '#ceceff'
106}
100107
101# Add any paths that contain custom themes here, relative to this directory.108# Add any paths that contain custom themes here, relative to this directory.
102#html_theme_path = []109#html_theme_path = []
103110
=== modified file 'documentation/source/core/index.rst'
--- documentation/source/core/index.rst 2009-07-10 15:45:17 +0000
+++ documentation/source/core/index.rst 2009-09-06 18:59:21 +0000
@@ -3,42 +3,9 @@
3:mod:`core` Module3:mod:`core` Module
4==================4==================
55
6.. automodule:: openlp.core6.. toctree::
7 :members:7 :maxdepth: 2
88
9:mod:`lib` Module9 lib
10-----------------10 theme
11
12.. automodule:: openlp.core.lib
13 :members:
14
15:mod:`baselistwithdnd` Submodule
16^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17
18.. automodule:: openlp.core.lib.baselistwithdnd
19 :members:
20
21:mod:`event` Submodule
22^^^^^^^^^^^^^^^^^^^^^^
23
24.. automodule:: openlp.core.lib.event
25 :members:
26
27:mod:`eventmanager` Submodule
28^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
29
30.. automodule:: openlp.core.lib.eventmanager
31 :members:
32
33:mod:`eventreceiver` Submodule
34^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
35
36.. automodule:: openlp.core.lib.eventreceiver
37 :members:
38
39:mod:`theme` Submodule
40----------------------
41
42.. automodule:: openlp.core.theme
43 :members:
4411
4512
=== added file 'documentation/source/core/lib.rst'
--- documentation/source/core/lib.rst 1970-01-01 00:00:00 +0000
+++ documentation/source/core/lib.rst 2009-09-06 18:59:21 +0000
@@ -0,0 +1,110 @@
1.. _core-lib:
2
3:mod:`lib` Module
4=================
5
6Module Members
7--------------
8
9.. automodule:: openlp.core.lib
10 :members:
11
12Module Classes
13--------------
14
15:mod:`BaseListWithDnD`
16^^^^^^^^^^^^^^^^^^^^^^
17
18.. autoclass:: openlp.core.lib.baselistwithdnd.BaseListWithDnD
19 :members:
20
21:mod:`EventReceiver`
22^^^^^^^^^^^^^^^^^^^^
23
24.. autoclass:: openlp.core.lib.eventreceiver.EventReceiver
25 :members:
26
27:mod:`ListWithPreviews`
28^^^^^^^^^^^^^^^^^^^^^^^
29
30.. autoclass:: openlp.core.lib.listwithpreviews.ListWithPreviews
31 :members:
32
33:mod:`MediaManagerItem`
34^^^^^^^^^^^^^^^^^^^^^^^
35
36.. autoclass:: openlp.core.lib.mediamanageritem.MediaManagerItem
37 :members:
38
39:mod:`Plugin`
40^^^^^^^^^^^^^
41
42.. autoclass:: openlp.core.lib.plugin.Plugin
43 :members:
44
45:mod:`PluginConfig`
46^^^^^^^^^^^^^^^^^^^
47
48.. autoclass:: openlp.core.lib.pluginconfig.PluginConfig
49 :members:
50
51:mod:`PluginManager`
52^^^^^^^^^^^^^^^^^^^^
53
54.. autoclass:: openlp.core.lib.pluginmanager.PluginManager
55 :members:
56
57:mod:`Renderer`
58^^^^^^^^^^^^^^^
59
60.. autoclass:: openlp.core.lib.renderer.Renderer
61 :members:
62
63:mod:`RenderManager`
64^^^^^^^^^^^^^^^^^^^^
65
66.. autoclass:: openlp.core.lib.rendermanager.RenderManager
67 :members:
68
69:mod:`ServiceItem`
70^^^^^^^^^^^^^^^^^^
71
72.. autoclass:: openlp.core.lib.serviceitem.ServiceItem
73 :members:
74
75:mod:`SettingsTab`
76^^^^^^^^^^^^^^^^^^
77
78.. autoclass:: openlp.core.lib.settingstab.SettingsTab
79 :members:
80
81:mod:`SongXMLBuilder`
82^^^^^^^^^^^^^^^^^^^^^
83
84.. autoclass:: openlp.core.lib.songxmlhandler.SongXMLBuilder
85 :members:
86
87:mod:`SongXMLParser`
88^^^^^^^^^^^^^^^^^^^^
89
90.. autoclass:: openlp.core.lib.songxmlhandler.SongXMLParser
91 :members:
92
93:mod:`ThemeXML`
94^^^^^^^^^^^^^^^
95
96.. autoclass:: openlp.core.lib.themexmlhandler.ThemeXML
97 :members:
98
99:mod:`OpenLPToolbar`
100^^^^^^^^^^^^^^^^^^^^
101
102.. autoclass:: openlp.core.lib.toolbar.OpenLPToolbar
103 :members:
104
105:mod:`XmlRootClass`
106^^^^^^^^^^^^^^^^^^^
107
108.. autoclass:: openlp.core.lib.xmlrootclass.XmlRootClass
109 :members:
110
0111
=== added file 'documentation/source/core/theme.rst'
--- documentation/source/core/theme.rst 1970-01-01 00:00:00 +0000
+++ documentation/source/core/theme.rst 2009-09-03 21:41:34 +0000
@@ -0,0 +1,8 @@
1.. _core-theme:
2
3:mod:`theme` Module
4===================
5
6.. automodule:: openlp.core.theme
7 :members:
8
09
=== modified file 'documentation/source/index.rst'
--- documentation/source/index.rst 2009-07-10 15:45:17 +0000
+++ documentation/source/index.rst 2009-09-03 21:41:34 +0000
@@ -3,8 +3,12 @@
3 You can adapt this file completely to your liking, but it should at least3 You can adapt this file completely to your liking, but it should at least
4 contain the root `toctree` directive.4 contain the root `toctree` directive.
55
6Welcome to OpenLP's documentation!6Welcome
7==================================7=======
8
9Welcome to the OpenLP 2.0 API Documentation! In here you will find all
10information relating to OpenLP's core classes, core plugins, and anything else
11deemed necessary or interesting by the developers.
812
9Contents:13Contents:
1014
1115
=== modified file 'documentation/source/plugins/index.rst'
--- documentation/source/plugins/index.rst 2009-07-10 15:45:17 +0000
+++ documentation/source/plugins/index.rst 2009-09-02 20:42:57 +0000
@@ -6,11 +6,10 @@
6.. automodule:: openlp.plugins6.. automodule:: openlp.plugins
7 :members:7 :members:
88
9:mod:`songs` Plugin9.. toctree::
10-------------------10 :maxdepth: 2
1111
12.. automodule:: openlp.plugins.songs12 songs
13 :members:
1413
15:mod:`bibles` Plugin14:mod:`bibles` Plugin
16--------------------15--------------------
1716
=== added file 'documentation/source/plugins/songs.rst'
--- documentation/source/plugins/songs.rst 1970-01-01 00:00:00 +0000
+++ documentation/source/plugins/songs.rst 2009-09-03 21:41:34 +0000
@@ -0,0 +1,46 @@
1.. _plugins-songs:
2
3:mod:`songs` Plugin
4===================
5
6.. automodule:: openlp.plugins.songs
7 :members:
8
9:mod:`SongsPlugin` Class
10------------------------
11
12.. autoclass:: openlp.plugins.songs.songsplugin.SongsPlugin
13 :members:
14
15:mod:`forms` Submodule
16----------------------
17
18.. automodule:: openlp.plugins.songs.forms
19 :members:
20
21:mod:`AuthorsForm`
22^^^^^^^^^^^^^^^^^^
23
24.. autoclass:: openlp.plugins.songs.forms.authorsdialog.Ui_AuthorsDialog
25 :members:
26
27.. autoclass:: openlp.plugins.songs.forms.authorsform.AuthorsForm
28 :members:
29
30:mod:`EditSongForm`
31^^^^^^^^^^^^^^^^^^^
32
33.. autoclass:: openlp.plugins.songs.forms.editsongdialog.Ui_EditSongDialog
34 :members:
35
36.. autoclass:: openlp.plugins.songs.forms.editsongform.EditSongForm
37 :members:
38
39:mod:`EditVerseForm`
40^^^^^^^^^^^^^^^^^^^^
41
42.. autoclass:: openlp.plugins.songs.forms.editversedialog.Ui_EditVerseDialog
43 :members:
44
45.. autoclass:: openlp.plugins.songs.forms.editverseform.EditVerseForm
46 :members:
047
=== modified file 'openlp.pyw'
--- openlp.pyw 2009-09-01 05:17:32 +0000
+++ openlp.pyw 2009-09-02 20:42:57 +0000
@@ -3,7 +3,9 @@
3# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=43# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
4"""4"""
5OpenLP - Open Source Lyrics Projection5OpenLP - Open Source Lyrics Projection
6
6Copyright (c) 2008 Raoul Snyman7Copyright (c) 2008 Raoul Snyman
8
7Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley,9Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley,
810
9This program is free software; you can redistribute it and/or modify it under11This program is free software; you can redistribute it and/or modify it under
@@ -29,15 +31,7 @@
29from openlp.core.resources import *31from openlp.core.resources import *
30from openlp.core.ui import MainWindow, SplashScreen32from openlp.core.ui import MainWindow, SplashScreen
3133
32filename=u'openlp.log'
33log = logging.getLogger()34log = logging.getLogger()
34log.setLevel(logging.INFO)
35
36logfile = logging.handlers.RotatingFileHandler(filename ,maxBytes=200000, backupCount=5)
37logfile.setLevel(logging.DEBUG)
38logfile.setFormatter(logging.Formatter(u'%(asctime)s %(name)-15s %(levelname)-8s %(message)s'))
39
40log.addHandler(logfile)
4135
42class OpenLP(QtGui.QApplication):36class OpenLP(QtGui.QApplication):
43 """37 """
@@ -78,22 +72,40 @@
78 self.mainWindow.show()72 self.mainWindow.show()
79 # now kill the splashscreen73 # now kill the splashscreen
80 self.splash.finish(self.mainWindow)74 self.splash.finish(self.mainWindow)
81 sys.exit(app.exec_())75 sys.exit(self.exec_())
76
8277
83def main():78def main():
84 usage = "usage: %prog [options] arg1 arg2"79 """
80 The main function which parses command line options and then runs
81 the PyQt4 Application.
82 """
83 # Set up command line options.
84 usage = u'Usage: %prog [options] [qt-options]'
85 parser = OptionParser(usage=usage)85 parser = OptionParser(usage=usage)
86 parser.add_option("-d", "--debug",dest="debug",action="store_true",86 parser.add_option("-d", "--debug", dest="debug",
87 help="Switch on Debugging ")87 action="store_true", help="set logging to DEBUG level")
88 # Set up logging
89 filename = u'openlp.log'
90 logfile = logging.handlers.RotatingFileHandler(
91 filename, maxBytes=200000, backupCount=5)
92 logfile.setFormatter(
93 logging.Formatter(u'%(asctime)s %(name)-15s %(levelname)-8s %(message)s'))
94 log.addHandler(logfile)
95 # Parse command line options and deal with them.
88 (options, args) = parser.parse_args()96 (options, args) = parser.parse_args()
89 if options.debug is not None:97 if options.debug is not None:
90 log.setLevel(logging.DEBUG)98 log.setLevel(logging.DEBUG)
99 else:
100 log.setLevel(logging.INFO)
101 # Now create and actually run the application.
102 app = OpenLP(sys.argv)
103 app.run()
104
91if __name__ == u'__main__':105if __name__ == u'__main__':
92 """106 """
93 Instantiate and run the application.107 Instantiate and run the application.
94 """108 """
109 #import cProfile
110 #cProfile.run("main()", "profile.out")
95 main()111 main()
96 app = OpenLP(sys.argv)
97 #import cProfile
98 #cProfile.run("app.run()", "profile.out")
99 app.run()
100112
=== modified file 'openlp/__init__.py'
--- openlp/__init__.py 2009-05-21 05:15:51 +0000
+++ openlp/__init__.py 2009-09-02 20:42:57 +0000
@@ -1,6 +1,8 @@
1"""1"""
2OpenLP - Open Source Lyrics Projection2OpenLP - Open Source Lyrics Projection
3
3Copyright (c) 2008 Raoul Snyman4Copyright (c) 2008 Raoul Snyman
5
4Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley6Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley
57
6This program is free software; you can redistribute it and/or modify it under8This program is free software; you can redistribute it and/or modify it under
79
=== modified file 'openlp/core/__init__.py'
--- openlp/core/__init__.py 2009-07-09 05:15:26 +0000
+++ openlp/core/__init__.py 2009-09-02 20:42:57 +0000
@@ -2,7 +2,9 @@
2# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
3"""3"""
4OpenLP - Open Source Lyrics Projection4OpenLP - Open Source Lyrics Projection
5
5Copyright (c) 2008 Raoul Snyman6Copyright (c) 2008 Raoul Snyman
7
6Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley8Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley
79
8This program is free software; you can redistribute it and/or modify it under10This program is free software; you can redistribute it and/or modify it under
911
=== modified file 'openlp/core/lib/__init__.py'
--- openlp/core/lib/__init__.py 2009-09-05 01:22:05 +0000
+++ openlp/core/lib/__init__.py 2009-09-06 18:59:21 +0000
@@ -2,7 +2,9 @@
2# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
3"""3"""
4OpenLP - Open Source Lyrics Projection4OpenLP - Open Source Lyrics Projection
5
5Copyright (c) 2008 Raoul Snyman6Copyright (c) 2008 Raoul Snyman
7
6Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley,8Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley,
79
8This program is free software; you can redistribute it and/or modify it under10This program is free software; you can redistribute it and/or modify it under
@@ -21,17 +23,51 @@
21from PyQt4 import QtCore, QtGui23from PyQt4 import QtCore, QtGui
2224
23def translate(context, text):25def translate(context, text):
26 """
27 A special shortcut method to wrap around the Qt4 translation functions.
28 This abstracts the translation procedure so that we can change it if at a
29 later date if necessary, without having to redo the whole of OpenLP.
30
31 ``context``
32 The translation context, used to give each string a context or a
33 namespace.
34
35 ``text``
36 The text to put into the translation tables for translation.
37 """
24 return QtGui.QApplication.translate(context, text, None, QtGui.QApplication.UnicodeUTF8)38 return QtGui.QApplication.translate(context, text, None, QtGui.QApplication.UnicodeUTF8)
2539
26def file_to_xml(xmlfile):40def file_to_xml(xmlfile):
41 """
42 Open a file and return the contents of the file.
43
44 ``xmlfile``
45 The name of the file.
46 """
27 return open(xmlfile).read()47 return open(xmlfile).read()
2848
29def str_to_bool(stringvalue):49def str_to_bool(stringvalue):
50 """
51 Convert a string version of a boolean into a real boolean.
52
53 ``stringvalue``
54 The string value to examine and convert to a boolean type.
55 """
30 if stringvalue is True or stringvalue is False:56 if stringvalue is True or stringvalue is False:
31 return stringvalue57 return stringvalue
32 return stringvalue.strip().lower() in (u'true', u'yes', u'y')58 return stringvalue.strip().lower() in (u'true', u'yes', u'y')
3359
34def buildIcon(icon):60def buildIcon(icon):
61 """
62 Build a QIcon instance from an existing QIcon, a resource location, or a
63 physical file location. If the icon is a QIcon instance, that icon is
64 simply returned. If not, it builds a QIcon instance from the resource or
65 file name.
66
67 ``icon``
68 The icon to build. This can be a QIcon, a resource string in the form
69 ``:/resource/file.png``, or a file location like ``/path/to/file.png``.
70 """
35 ButtonIcon = None71 ButtonIcon = None
36 if type(icon) is QtGui.QIcon:72 if type(icon) is QtGui.QIcon:
37 ButtonIcon = icon73 ButtonIcon = icon
@@ -59,6 +95,7 @@
59 action.setSeparator(True)95 action.setSeparator(True)
60 return action96 return action
6197
98from eventreceiver import Receiver
62from settingsmanager import SettingsManager99from settingsmanager import SettingsManager
63from pluginconfig import PluginConfig100from pluginconfig import PluginConfig
64from plugin import Plugin101from plugin import Plugin
@@ -67,12 +104,10 @@
67from mediamanageritem import MediaManagerItem104from mediamanageritem import MediaManagerItem
68from xmlrootclass import XmlRootClass105from xmlrootclass import XmlRootClass
69from serviceitem import ServiceItem106from serviceitem import ServiceItem
70from eventreceiver import Receiver
71from serviceitem import ServiceType107from serviceitem import ServiceType
72from serviceitem import ServiceItem108from serviceitem import ServiceItem
73from toolbar import OpenLPToolbar109from toolbar import OpenLPToolbar
74from songxmlhandler import SongXMLBuilder110from songxmlhandler import SongXMLBuilder, SongXMLParser
75from songxmlhandler import SongXMLParser
76from themexmlhandler import ThemeXML111from themexmlhandler import ThemeXML
77from renderer import Renderer112from renderer import Renderer
78from rendermanager import RenderManager113from rendermanager import RenderManager
79114
=== modified file 'openlp/core/lib/eventreceiver.py'
--- openlp/core/lib/eventreceiver.py 2009-09-05 19:58:02 +0000
+++ openlp/core/lib/eventreceiver.py 2009-09-06 18:47:48 +0000
@@ -24,8 +24,9 @@
2424
25class EventReceiver(QtCore.QObject):25class EventReceiver(QtCore.QObject):
26 """26 """
27 Class to allow events to be passed from different parts of the system.27 Class to allow events to be passed from different parts of the
28 This is a private class and should not be used directly but via the Receiver class28 system. This is a private class and should not be used directly
29 but rather via the Receiver class.
2930
30 ``stop_import``31 ``stop_import``
31 Stops the Bible Import32 Stops the Bible Import
@@ -36,13 +37,13 @@
36 ``process_events``37 ``process_events``
37 Requests the Application to flush the events queue38 Requests the Application to flush the events queue
3839
39 ``{plugin}_add_service_item ``40 ``{plugin}_add_service_item``
40 ask the plugin to push the selected items to the service item41 ask the plugin to push the selected items to the service item
4142
42 ``update_themes ``43 ``update_themes``
43 send out message with new themes44 send out message with new themes
4445
45 ``update_global_theme ``46 ``update_global_theme``
46 Tell the components we have a new global theme47 Tell the components we have a new global theme
4748
48 ``load_song_list``49 ``load_song_list``
@@ -78,31 +79,57 @@
78 log = logging.getLogger(u'EventReceiver')79 log = logging.getLogger(u'EventReceiver')
7980
80 def __init__(self):81 def __init__(self):
82 """
83 Initialise the event receiver, calling the parent constructor.
84 """
81 QtCore.QObject.__init__(self)85 QtCore.QObject.__init__(self)
8286
83 def send_message(self, event, msg=None):87 def send_message(self, event, msg=None):
84 log.debug(u'Event %s passed with payload %s' % (event, msg))88 """
89 Emit a Qt signal.
90
91 ``event``
92 The event to that was sent.
93
94 ``msg``
95 Defaults to *None*. The message to send with the event.
96 """
85 self.emit(QtCore.SIGNAL(event), msg)97 self.emit(QtCore.SIGNAL(event), msg)
8698
99
87class Receiver():100class Receiver():
88 """101 """
89 Class to allow events to be passed from different parts of the system.102 Class to allow events to be passed from different parts of the
90 This is a static wrapper around the EventReceiver class.103 system. This is a static wrapper around the ``EventReceiver``
91 As there is only one instance of it in the systems the QT signal/slot architecture104 class. As there is only one instance of it in the system the QT
92 can send messages across the system105 signal/slot architecture can send messages across the system.
93106
94 ``Send message``107 To send a message:
95 Receiver().send_message(u'<<Message ID>>', data)108 ``Receiver().send_message(u'<<Message ID>>', data)``
96109
97 ``Receive Message``110 To receive a Message
98 QtCore.QObject.connect(Receiver().get_receiver(),QtCore.SIGNAL(u'<<Message ID>>'),<<ACTION>>)111 ``QtCore.QObject.connect(Receiver().get_receiver(), QtCore.SIGNAL(u'<<Message ID>>'), <<ACTION>>)``
99 """112 """
100 eventreceiver = EventReceiver()113 eventreceiver = EventReceiver()
101114
102 @staticmethod115 @staticmethod
103 def send_message(event, msg=None):116 def send_message(event, msg=None):
117 """
118 Sends a message to the messaging system.
119
120 ``event``
121 The event to send.
122
123 ``msg``
124 Defaults to *None*. The message to send with the event.
125 """
104 Receiver.eventreceiver.send_message(event, msg)126 Receiver.eventreceiver.send_message(event, msg)
105127
106 @staticmethod128 @staticmethod
107 def get_receiver():129 def get_receiver():
130 """
131 Get the global ``eventreceiver`` instance.
132 """
108 return Receiver.eventreceiver133 return Receiver.eventreceiver
134
135
109136
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py 2009-08-31 21:53:35 +0000
+++ openlp/core/lib/mediamanageritem.py 2009-09-06 18:59:21 +0000
@@ -31,28 +31,60 @@
31 MediaManagerItem is a helper widget for plugins.31 MediaManagerItem is a helper widget for plugins.
3232
33 None of the following *need* to be used, feel free to override33 None of the following *need* to be used, feel free to override
34 them cmopletely in your plugin's implementation. Alternatively, call them from your34 them cmopletely in your plugin's implementation. Alternatively,
35 plugin before or after you've done etra things that you need to.35 call them from your plugin before or after you've done extra
3636 things that you need to.
37 The plugin will be assigned an icon called u':/media/media_' + 'self.ShortPluginName + u'image.png'37
38 which needs to be available in the main resources in order for them to work, you need to have setup38 **Constructor Parameters**
3939
40 self.TranslationContext40 ``parent``
41 self.PluginTextShort # eg 'Image' for the image plugin41 The parent widget. Usually this will be the *Media Manager*
42 self.ConfigSection - where the items in the media manager are stored42 itself. This needs to be a class descended from ``QWidget``.
43 this could potentially be self.PluginTextShort.lower()43
4444 ``icon``
45 self.OnNewPrompt=u'Select Image(s)'45 Either a ``QIcon``, a resource path, or a file name. This is
46 self.OnNewFileMasks=u'Images (*.jpg *jpeg *.gif *.png *.bmp)'46 the icon which is displayed in the *Media Manager*.
47 assumes that the new action is to load a file. If not, override onnew47
4848 ``title``
49 self.ListViewWithDnD_class - there is a base list class with DnD assigned to it (openlp.core.lib.BaseListWithDnD())49 The title visible on the item in the *Media Manager*.
50 each plugin needs to inherit a class from this and pass that *class* (not an instance) to here50
51 via the ListViewWithDnD_class member51 **Member Variables**
5252
53 self.PreviewFunction - a function which returns a QImage to represent the item (a preview usually)53 When creating a descendant class from this class for your plugin,
54 - no scaling required - that's done later54 the following member variables should be set.
55 If this fn is not defined, a default will be used (treat the filename as an image)55
56 ``self.TranslationContext``
57 This sets the translation context of all the text in the
58 Media Manager item.
59
60 ``self.PluginTextShort``
61 The shortened name for the plugin, e.g. *'Image'* for the
62 image plugin.
63
64 ``self.ConfigSection``
65 The section in the configuration where the items in the media
66 manager are stored. This could potentially be
67 ``self.PluginTextShort.lower()``.
68
69 ``self.OnNewPrompt``
70 Defaults to *'Select Image(s)'*.
71
72 ``self.OnNewFileMasks``
73 Defaults to *'Images (*.jpg *jpeg *.gif *.png *.bmp)'*. This
74 assumes that the new action is to load a file. If not, you
75 need to override the ``OnNew`` method.
76
77 ``self.ListViewWithDnD_class``
78 This must be a **class**, not an object, descended from
79 ``openlp.core.lib.BaseListWithDnD`` that is not used in any
80 other part of OpenLP.
81
82 ``self.PreviewFunction``
83 This must be a method which returns a QImage to represent the
84 item (usually a preview). No scaling is required, that is
85 performed automatically by OpenLP when necessary. If this
86 method is not defined, a default will be used (treat the
87 filename as an image).
56 """88 """
5789
58 global log90 global log
@@ -83,12 +115,17 @@
83 self.initialise()115 self.initialise()
84116
85 def retranslateUi(self):117 def retranslateUi(self):
118 """
119 This method is called automatically to provide OpenLP with the
120 opportunity to translate the ``MediaManagerItem`` to another
121 language.
122 """
86 pass123 pass
87124
88 def addToolbar(self):125 def addToolbar(self):
89 """126 """
90 A method to help developers easily add a toolbar to the media manager127 A method to help developers easily add a toolbar to the media
91 item.128 manager item.
92 """129 """
93 if self.Toolbar is None:130 if self.Toolbar is None:
94 self.Toolbar = OpenLPToolbar(self)131 self.Toolbar = OpenLPToolbar(self)
@@ -97,9 +134,29 @@
97 def addToolbarButton(self, title, tooltip, icon, slot=None, objectname=None):134 def addToolbarButton(self, title, tooltip, icon, slot=None, objectname=None):
98 """135 """
99 A method to help developers easily add a button to the toolbar.136 A method to help developers easily add a button to the toolbar.
137
138 ``title``
139 The title of the button.
140
141 ``tooltip``
142 The tooltip to be displayed when the mouse hovers over the
143 button.
144
145 ``icon``
146 The icon of the button. This can be an instance of QIcon, or a
147 string cotaining either the absolute path to the image, or an
148 internal resource path starting with ':/'.
149
150 ``slot``
151 The method to call when the button is clicked.
152
153 ``objectname``
154 The name of the button.
100 """155 """
101 # NB different order (when I broke this out, I wanted to not break compatability)156 # NB different order (when I broke this out, I didn't want to
102 # but it makes sense for the icon to come before the tooltip (as you have to have an icon, but not neccesarily a tooltip)157 # break compatability), but it makes sense for the icon to
158 # come before the tooltip (as you have to have an icon, but
159 # not neccesarily a tooltip)
103 self.Toolbar.addToolbarButton(title, icon, tooltip, slot, objectname)160 self.Toolbar.addToolbarButton(title, icon, tooltip, slot, objectname)
104161
105 def addToolbarSeparator(self):162 def addToolbarSeparator(self):
@@ -109,6 +166,11 @@
109 self.Toolbar.addSeparator()166 self.Toolbar.addSeparator()
110167
111 def setupUi(self):168 def setupUi(self):
169 """
170 This method sets up the interface on the button. Plugin
171 developers use this to add and create toolbars, and the rest
172 of the interface of the media manager item.
173 """
112 # Add a toolbar174 # Add a toolbar
113 self.addToolbar()175 self.addToolbar()
114 # Create buttons for the toolbar176 # Create buttons for the toolbar
@@ -189,6 +251,11 @@
189 QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onPreviewClick)251 QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onPreviewClick)
190252
191 def initialise(self):253 def initialise(self):
254 """
255 Implement this method in your descendent media manager item to
256 do any UI or other initialisation. This method is called
257 automatically.
258 """
192 pass259 pass
193260
194 def addHeaderBar(self):261 def addHeaderBar(self):
195262
=== modified file 'openlp/core/lib/plugin.py'
--- openlp/core/lib/plugin.py 2009-08-26 05:00:19 +0000
+++ openlp/core/lib/plugin.py 2009-09-06 18:59:21 +0000
@@ -21,17 +21,13 @@
21import logging21import logging
22from PyQt4 import QtCore22from PyQt4 import QtCore
2323
24from openlp.core.lib import PluginConfig24from openlp.core.lib import PluginConfig, Receiver
25# why does this not work???
26# from openlp.core.lib import Event, EventType
27# so I have to do this???
28from eventreceiver import Receiver
2925
30class Plugin(object):26class Plugin(object):
31 """27 """
32 Base class for openlp plugins to inherit from.28 Base class for openlp plugins to inherit from.
3329
34 Basic attributes are:30 **Basic Attributes**
3531
36 ``name``32 ``name``
37 The name that should appear in the plugins list.33 The name that should appear in the plugins list.
@@ -49,7 +45,7 @@
49 ``log``45 ``log``
50 A log object used to log debugging messages. This is pre-instantiated.46 A log object used to log debugging messages. This is pre-instantiated.
5147
52 Hook functions:48 **Hook Functions**
5349
54 ``check_pre_conditions()``50 ``check_pre_conditions()``
55 Provides the Plugin with a handle to check if it can be loaded.51 Provides the Plugin with a handle to check if it can be loaded.
@@ -201,7 +197,7 @@
201197
202 def finalise(self):198 def finalise(self):
203 """199 """
204 Called by the plugin Manager to cleanup things200 Called by the plugin Manager to cleanup things.
205 """201 """
206 pass202 pass
207203
208204
=== modified file 'openlp/core/lib/pluginconfig.py'
--- openlp/core/lib/pluginconfig.py 2009-09-02 01:44:09 +0000
+++ openlp/core/lib/pluginconfig.py 2009-09-06 18:59:21 +0000
@@ -2,7 +2,9 @@
2# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
3"""3"""
4OpenLP - Open Source Lyrics Projection4OpenLP - Open Source Lyrics Projection
5
5Copyright (c) 2008 Raoul Snyman6Copyright (c) 2008 Raoul Snyman
7
6Portions copyright (c) 2008 -2009 Martin Thompson, Tim Bentley8Portions copyright (c) 2008 -2009 Martin Thompson, Tim Bentley
79
8This program is free software; you can redistribute it and/or modify it under10This program is free software; you can redistribute it and/or modify it under
@@ -19,6 +21,7 @@
19"""21"""
2022
21import os23import os
24
22from openlp.core.utils import ConfigHelper25from openlp.core.utils import ConfigHelper
2326
24class PluginConfig(object):27class PluginConfig(object):
2528
=== modified file 'openlp/core/lib/pluginmanager.py'
--- openlp/core/lib/pluginmanager.py 2009-09-05 08:52:01 +0000
+++ openlp/core/lib/pluginmanager.py 2009-09-06 18:59:21 +0000
@@ -2,7 +2,9 @@
2# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
3"""3"""
4OpenLP - Open Source Lyrics Projection4OpenLP - Open Source Lyrics Projection
5
5Copyright (c) 2008 Raoul Snyman6Copyright (c) 2008 Raoul Snyman
7
6Portions copyright (c) 2008 - 2009 Martin Thompson, Tim Bentley,8Portions copyright (c) 2008 - 2009 Martin Thompson, Tim Bentley,
79
8This program is free software; you can redistribute it and/or modify it under10This program is free software; you can redistribute it and/or modify it under
@@ -52,7 +54,8 @@
5254
53 def find_plugins(self, dir, plugin_helpers):55 def find_plugins(self, dir, plugin_helpers):
54 """56 """
55 Scan the directory dir for objects inheriting from ``openlp.plugin``.57 Scan the directory ``dir`` for objects inheriting from the ``Plugin``
58 class.
5659
57 ``dir``60 ``dir``
58 The directory to scan.61 The directory to scan.
5962
=== modified file 'openlp/core/lib/renderer.py'
--- openlp/core/lib/renderer.py 2009-09-03 17:46:46 +0000
+++ openlp/core/lib/renderer.py 2009-09-06 18:59:21 +0000
@@ -2,7 +2,9 @@
2# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
3"""3"""
4OpenLP - Open Source Lyrics Projection4OpenLP - Open Source Lyrics Projection
5
5Copyright (c) 2008 Raoul Snyman6Copyright (c) 2008 Raoul Snyman
7
6Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley8Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley
79
8This program is free software; you can redistribute it and/or modify it under10This program is free software; you can redistribute it and/or modify it under
911
=== modified file 'openlp/core/lib/rendermanager.py'
--- openlp/core/lib/rendermanager.py 2009-09-03 17:46:46 +0000
+++ openlp/core/lib/rendermanager.py 2009-09-06 18:59:21 +0000
@@ -2,7 +2,9 @@
2# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
3"""3"""
4OpenLP - Open Source Lyrics Projection4OpenLP - Open Source Lyrics Projection
5
5Copyright (c) 2008 Raoul Snyman6Copyright (c) 2008 Raoul Snyman
7
6Portions copyright (c) 2008 - 2009Martin Thompson, Tim Bentley8Portions copyright (c) 2008 - 2009Martin Thompson, Tim Bentley
79
8This program is free software; you can redistribute it and/or modify it under10This program is free software; you can redistribute it and/or modify it under
@@ -31,23 +33,23 @@
31 Class to pull all Renderer interactions into one place. The plugins will33 Class to pull all Renderer interactions into one place. The plugins will
32 call helper methods to do the rendering but this class will provide34 call helper methods to do the rendering but this class will provide
33 display defense code.35 display defense code.
36
37 ``theme_manager``
38 The ThemeManager instance, used to get the current theme details.
39
40 ``screen_list``
41 The list of screens available.
42
43 ``screen_number``
44 Defaults to *0*. The index of the output/display screen.
34 """45 """
35 global log46 global log
36 log=logging.getLogger(u'RenderManager')47 log = logging.getLogger(u'RenderManager')
37 log.info(u'RenderManager Loaded')48 log.info(u'RenderManager Loaded')
3849
39 def __init__(self, theme_manager, screen_list, screen_number=0):50 def __init__(self, theme_manager, screen_list, screen_number=0):
40 """51 """
41 Initialise the render manager.52 Initialise the render manager.
42
43 ``theme_manager``
44 The ThemeManager instance, used to get the current theme details.
45
46 ``screen_list``
47 The list of screens available.
48
49 ``screen_number``
50 Defaults to *0*. The index of the output/display screen.
51 """53 """
52 log.debug(u'Initilisation started')54 log.debug(u'Initilisation started')
53 self.screen_list = screen_list55 self.screen_list = screen_list
5456
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2009-09-05 13:30:09 +0000
+++ openlp/core/lib/serviceitem.py 2009-09-06 18:59:21 +0000
@@ -2,7 +2,9 @@
2# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
3"""3"""
4OpenLP - Open Source Lyrics Projection4OpenLP - Open Source Lyrics Projection
5
5Copyright (c) 2008 Raoul Snyman6Copyright (c) 2008 Raoul Snyman
7
6Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley8Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley
79
8This program is free software; you can redistribute it and/or modify it under10This program is free software; you can redistribute it and/or modify it under
@@ -37,7 +39,7 @@
37 compositor.39 compositor.
38 """40 """
39 global log41 global log
40 log=logging.getLogger(u'ServiceItem')42 log = logging.getLogger(u'ServiceItem')
41 log.info(u'Service Item created')43 log.info(u'Service Item created')
4244
43 def __init__(self, hostplugin=None):45 def __init__(self, hostplugin=None):
4446
=== modified file 'openlp/core/lib/settingsmanager.py'
--- openlp/core/lib/settingsmanager.py 2009-09-06 12:13:09 +0000
+++ openlp/core/lib/settingsmanager.py 2009-09-06 18:59:21 +0000
@@ -2,7 +2,9 @@
2# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
3"""3"""
4OpenLP - Open Source Lyrics Projection4OpenLP - Open Source Lyrics Projection
5
5Copyright (c) 2008 Raoul Snyman6Copyright (c) 2008 Raoul Snyman
7
6Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley8Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley
79
8This program is free software; you can redistribute it and/or modify it under10This program is free software; you can redistribute it and/or modify it under
@@ -20,8 +22,9 @@
2022
21class SettingsManager(object):23class SettingsManager(object):
22 """24 """
23 Class to control the size of the UI components so they size correctly25 Class to control the size of the UI components so they size correctly.
24 This class is created by the main window and then calculates the size of individual components26 This class is created by the main window and then calculates the size of
27 individual components.
25 """28 """
26 def __init__(self, screen):29 def __init__(self, screen):
27 self.screen = screen[0]30 self.screen = screen[0]
2831
=== modified file 'openlp/core/lib/settingstab.py'
--- openlp/core/lib/settingstab.py 2009-08-29 07:17:56 +0000
+++ openlp/core/lib/settingstab.py 2009-09-06 18:59:21 +0000
@@ -2,7 +2,9 @@
2# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
3"""3"""
4OpenLP - Open Source Lyrics Projection4OpenLP - Open Source Lyrics Projection
5
5Copyright (c) 2008 Raoul Snyman6Copyright (c) 2008 Raoul Snyman
7
6Portions copyright (c) 2008 Martin Thompson, Tim Bentley8Portions copyright (c) 2008 Martin Thompson, Tim Bentley
79
8This program is free software; you can redistribute it and/or modify it under10This program is free software; you can redistribute it and/or modify it under
@@ -19,6 +21,7 @@
19"""21"""
2022
21from PyQt4 import QtCore, QtGui23from PyQt4 import QtCore, QtGui
24
22from openlp.core.lib import PluginConfig25from openlp.core.lib import PluginConfig
2326
24class SettingsTab(QtGui.QWidget):27class SettingsTab(QtGui.QWidget):
2528
=== modified file 'openlp/core/lib/songxmlhandler.py'
--- openlp/core/lib/songxmlhandler.py 2009-07-10 13:16:15 +0000
+++ openlp/core/lib/songxmlhandler.py 2009-07-14 13:51:27 +0000
@@ -2,7 +2,9 @@
2# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
3"""3"""
4OpenLP - Open Source Lyrics Projection4OpenLP - Open Source Lyrics Projection
5
5Copyright (c) 2008 Raoul Snyman6Copyright (c) 2008 Raoul Snyman
7
6Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten Tinggaard8Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten Tinggaard
79
8This program is free software; you can redistribute it and/or modify it under10This program is free software; you can redistribute it and/or modify it under
@@ -16,26 +18,25 @@
16You should have received a copy of the GNU General Public License along with18You should have received a copy of the GNU General Public License along with
17this program; if not, write to the Free Software Foundation, Inc., 59 Temple19this program; if not, write to the Free Software Foundation, Inc., 59 Temple
18Place, Suite 330, Boston, MA 02111-1307 USA20Place, Suite 330, Boston, MA 02111-1307 USA
19from xml.dom.minidom import Document
20from xml.etree.ElementTree import ElementTree, XML, dump
21
22<?xml version="1.0" encoding="UTF-8"?>
23<song version="1.0">
24 <lyrics language="en">
25 <verse type="chorus" label="1">
26 <![CDATA[ ... ]]>
27 </verse>
28 </lyrics>
29</song>
30
31"""21"""
32import logging22import logging
33from xml.dom.minidom import Document23from xml.dom.minidom import Document
34from xml.etree.ElementTree import ElementTree, XML, dump24from xml.etree.ElementTree import ElementTree, XML, dump
3525
36class SongXMLBuilder():26class SongXMLBuilder(object):
37 """27 """
38 This class builds the XML used to describe songs.28 This class builds the XML used to describe songs.
29
30 The basic XML looks like this::
31
32 <?xml version="1.0" encoding="UTF-8"?>
33 <song version="1.0">
34 <lyrics language="en">
35 <verse type="chorus" label="1">
36 <![CDATA[ ... ]]>
37 </verse>
38 </lyrics>
39 </song>
39 """40 """
40 def __init__(self):41 def __init__(self):
41 """42 """
@@ -97,9 +98,21 @@
97 """98 """
98 return self.song_xml.toxml(u'utf-8')99 return self.song_xml.toxml(u'utf-8')
99100
100class SongXMLParser():101
102class SongXMLParser(object):
101 """103 """
102 A class to read in and parse a song's XML.104 A class to read in and parse a song's XML.
105
106 The basic XML looks like this::
107
108 <?xml version="1.0" encoding="UTF-8"?>
109 <song version="1.0">
110 <lyrics language="en">
111 <verse type="chorus" label="1">
112 <![CDATA[ ... ]]>
113 </verse>
114 </lyrics>
115 </song>
103 """116 """
104 global log117 global log
105 log = logging.getLogger(u'SongXMLParser')118 log = logging.getLogger(u'SongXMLParser')
106119
=== modified file 'openlp/core/lib/themexmlhandler.py'
--- openlp/core/lib/themexmlhandler.py 2009-09-05 01:27:38 +0000
+++ openlp/core/lib/themexmlhandler.py 2009-09-06 18:59:21 +0000
@@ -2,7 +2,9 @@
2# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
3"""3"""
4OpenLP - Open Source Lyrics Projection4OpenLP - Open Source Lyrics Projection
5
5Copyright (c) 2008 Raoul Snyman6Copyright (c) 2008 Raoul Snyman
7
6Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten Tinggaard8Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten Tinggaard
79
8This program is free software; you can redistribute it and/or modify it under10This program is free software; you can redistribute it and/or modify it under
911
=== modified file 'openlp/core/lib/toolbar.py'
--- openlp/core/lib/toolbar.py 2009-08-28 17:40:07 +0000
+++ openlp/core/lib/toolbar.py 2009-09-06 18:59:21 +0000
@@ -2,7 +2,9 @@
2# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
3"""3"""
4OpenLP - Open Source Lyrics Projection4OpenLP - Open Source Lyrics Projection
5
5Copyright (c) 2009 Raoul Snyman6Copyright (c) 2009 Raoul Snyman
7
6Portions copyright (c) 2009 Martin Thompson, Tim Bentley8Portions copyright (c) 2009 Martin Thompson, Tim Bentley
79
8This program is free software; you can redistribute it and/or modify it under10This program is free software; you can redistribute it and/or modify it under
@@ -109,9 +111,21 @@
109 return QtGui.QIcon()111 return QtGui.QIcon()
110112
111 def makeWidgetsInvisible(self, widgets):113 def makeWidgetsInvisible(self, widgets):
114 """
115 Hide a set of widgets.
116
117 ``widgets``
118 The list of names of widgets to be hidden.
119 """
112 for widget in widgets:120 for widget in widgets:
113 self.actions[widget].setVisible(False)121 self.actions[widget].setVisible(False)
114122
115 def makeWidgetsVisible(self, widgets):123 def makeWidgetsVisible(self, widgets):
124 """
125 Show a set of widgets.
126
127 ``widgets``
128 The list of names of widgets to be shown.
129 """
116 for widget in widgets:130 for widget in widgets:
117 self.actions[widget].setVisible(True)131 self.actions[widget].setVisible(True)
118132
=== modified file 'openlp/core/lib/xmlrootclass.py'
--- openlp/core/lib/xmlrootclass.py 2009-07-08 06:55:08 +0000
+++ openlp/core/lib/xmlrootclass.py 2009-07-14 13:51:27 +0000
@@ -2,7 +2,9 @@
2# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=42# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
3"""3"""
4OpenLP - Open Source Lyrics Projection4OpenLP - Open Source Lyrics Projection
5
5Copyright (c) 2008 Raoul Snyman6Copyright (c) 2008 Raoul Snyman
7
6Portions copyright (c) 2008 Martin Thompson, Tim Bentley, Carsten Tinggaard8Portions copyright (c) 2008 Martin Thompson, Tim Bentley, Carsten Tinggaard
79
8This program is free software; you can redistribute it and/or modify it under10This program is free software; you can redistribute it and/or modify it under
911
=== modified file 'openlp/plugins/songs/songsplugin.py'
--- openlp/plugins/songs/songsplugin.py 2009-08-26 05:00:19 +0000
+++ openlp/plugins/songs/songsplugin.py 2009-09-02 20:42:57 +0000
@@ -28,12 +28,22 @@
28 OpenSongImportForm, OpenLPExportForm28 OpenSongImportForm, OpenLPExportForm
2929
30class SongsPlugin(Plugin):30class SongsPlugin(Plugin):
31 """
32 This is the number 1 plugin, if importance were placed on any
33 plugins. This plugin enables the user to create, edit and display
34 songs. Songs are divided into verses, and the verse order can be
35 specified. Authors, topics and song books can be assigned to songs
36 as well.
37 """
3138
32 global log39 global log
33 log = logging.getLogger(u'SongsPlugin')40 log = logging.getLogger(u'SongsPlugin')
34 log.info(u'Song Plugin loaded')41 log.info(u'Song Plugin loaded')
3542
36 def __init__(self, plugin_helpers):43 def __init__(self, plugin_helpers):
44 """
45 Create and set up the Songs plugin.
46 """
37 # Call the parent constructor47 # Call the parent constructor
38 Plugin.__init__(self, u'Songs', u'1.9.0', plugin_helpers)48 Plugin.__init__(self, u'Songs', u'1.9.0', plugin_helpers)
39 self.weight = -1049 self.weight = -10
@@ -48,11 +58,22 @@
48 QtGui.QIcon.Normal, QtGui.QIcon.Off)58 QtGui.QIcon.Normal, QtGui.QIcon.Off)
4959
50 def get_media_manager_item(self):60 def get_media_manager_item(self):
51 # Create the MediaManagerItem object61 """
62 Create the MediaManagerItem object, which is displaed in the
63 Media Manager.
64 """
52 self.media_item = SongMediaItem(self, self.icon, 'Songs')65 self.media_item = SongMediaItem(self, self.icon, 'Songs')
53 return self.media_item66 return self.media_item
5467
55 def add_import_menu_item(self, import_menu):68 def add_import_menu_item(self, import_menu):
69 """
70 Give the Songs plugin the opportunity to add items to the
71 **Import** menu.
72
73 ``import_menu``
74 The actual **Import** menu item, so that your actions can
75 use it as their parent.
76 """
56 self.ImportSongMenu = QtGui.QMenu(import_menu)77 self.ImportSongMenu = QtGui.QMenu(import_menu)
57 self.ImportSongMenu.setObjectName(u'ImportSongMenu')78 self.ImportSongMenu.setObjectName(u'ImportSongMenu')
58 self.ImportOpenSongItem = QtGui.QAction(import_menu)79 self.ImportOpenSongItem = QtGui.QAction(import_menu)
@@ -88,6 +109,14 @@
88 QtCore.SIGNAL(u'triggered()'), self.onImportOpenSongItemClick)109 QtCore.SIGNAL(u'triggered()'), self.onImportOpenSongItemClick)
89110
90 def add_export_menu_item(self, export_menu):111 def add_export_menu_item(self, export_menu):
112 """
113 Give the Songs plugin the opportunity to add items to the
114 **Export** menu.
115
116 ``export_menu``
117 The actual **Export** menu item, so that your actions can
118 use it as their parent.
119 """
91 self.ExportSongMenu = QtGui.QMenu(export_menu)120 self.ExportSongMenu = QtGui.QMenu(export_menu)
92 self.ExportSongMenu.setObjectName(u'ExportSongMenu')121 self.ExportSongMenu.setObjectName(u'ExportSongMenu')
93 self.ExportOpenSongItem = QtGui.QAction(export_menu)122 self.ExportOpenSongItem = QtGui.QAction(export_menu)