forked from openlp/openlp
Updated the documentation more. Moved the Songs plugin out into it's own file.
This commit is contained in:
parent
d1139653c5
commit
a077fe40eb
@ -96,7 +96,14 @@ html_theme = 'default'
|
|||||||
# Theme options are theme-specific and customize the look and feel of a theme
|
# Theme options are theme-specific and customize the look and feel of a theme
|
||||||
# further. For a list of options available for each theme, see the
|
# further. For a list of options available for each theme, see the
|
||||||
# documentation.
|
# documentation.
|
||||||
#html_theme_options = {}
|
html_theme_options = {
|
||||||
|
'sidebarbgcolor': '#3a60a9',
|
||||||
|
'relbarbgcolor': '#203b6f',
|
||||||
|
'footerbgcolor': '#26437c',
|
||||||
|
'headtextcolor': '#203b6f',
|
||||||
|
'linkcolor': '#26437c',
|
||||||
|
'sidebarlinkcolor': '#ceceff'
|
||||||
|
}
|
||||||
|
|
||||||
# Add any paths that contain custom themes here, relative to this directory.
|
# Add any paths that contain custom themes here, relative to this directory.
|
||||||
#html_theme_path = []
|
#html_theme_path = []
|
||||||
|
@ -6,11 +6,10 @@
|
|||||||
.. automodule:: openlp.plugins
|
.. automodule:: openlp.plugins
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
:mod:`songs` Plugin
|
.. toctree::
|
||||||
-------------------
|
:maxdepth: 2
|
||||||
|
|
||||||
.. automodule:: openlp.plugins.songs
|
songs
|
||||||
:members:
|
|
||||||
|
|
||||||
:mod:`bibles` Plugin
|
:mod:`bibles` Plugin
|
||||||
--------------------
|
--------------------
|
||||||
|
28
documentation/source/plugins/songs.rst
Normal file
28
documentation/source/plugins/songs.rst
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
.. _plugins-songs:
|
||||||
|
|
||||||
|
:mod:`songs` Plugin
|
||||||
|
===================
|
||||||
|
|
||||||
|
.. automodule:: openlp.plugins.songs
|
||||||
|
:members:
|
||||||
|
|
||||||
|
:mod:`SongsPlugin` Class
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
.. autoclass:: openlp.plugins.songs.songsplugin.SongsPlugin
|
||||||
|
:members:
|
||||||
|
|
||||||
|
:mod:`forms` Submodule
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
.. automodule:: openlp.plugins.songs.forms
|
||||||
|
:members:
|
||||||
|
|
||||||
|
:mod:`AuthorsForm` Class
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
.. autoclass:: openlp.plugins.songs.forms.authorsdialog.Ui_AuthorsDialog
|
||||||
|
:members:
|
||||||
|
|
||||||
|
.. autoclass:: openlp.plugins.songs.forms.authorsform.AuthorsForm
|
||||||
|
:members:
|
44
openlp.pyw
44
openlp.pyw
@ -3,7 +3,9 @@
|
|||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||||
"""
|
"""
|
||||||
OpenLP - Open Source Lyrics Projection
|
OpenLP - Open Source Lyrics Projection
|
||||||
|
|
||||||
Copyright (c) 2008 Raoul Snyman
|
Copyright (c) 2008 Raoul Snyman
|
||||||
|
|
||||||
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley,
|
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley,
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it under
|
This program is free software; you can redistribute it and/or modify it under
|
||||||
@ -29,15 +31,7 @@ from openlp.core.lib import Receiver
|
|||||||
from openlp.core.resources import *
|
from openlp.core.resources import *
|
||||||
from openlp.core.ui import MainWindow, SplashScreen
|
from openlp.core.ui import MainWindow, SplashScreen
|
||||||
|
|
||||||
filename=u'openlp.log'
|
|
||||||
log = logging.getLogger()
|
log = logging.getLogger()
|
||||||
log.setLevel(logging.INFO)
|
|
||||||
|
|
||||||
logfile = logging.handlers.RotatingFileHandler(filename ,maxBytes=200000, backupCount=5)
|
|
||||||
logfile.setLevel(logging.DEBUG)
|
|
||||||
logfile.setFormatter(logging.Formatter(u'%(asctime)s %(name)-15s %(levelname)-8s %(message)s'))
|
|
||||||
|
|
||||||
log.addHandler(logfile)
|
|
||||||
|
|
||||||
class OpenLP(QtGui.QApplication):
|
class OpenLP(QtGui.QApplication):
|
||||||
"""
|
"""
|
||||||
@ -78,22 +72,40 @@ class OpenLP(QtGui.QApplication):
|
|||||||
self.mainWindow.show()
|
self.mainWindow.show()
|
||||||
# now kill the splashscreen
|
# now kill the splashscreen
|
||||||
self.splash.finish(self.mainWindow)
|
self.splash.finish(self.mainWindow)
|
||||||
sys.exit(app.exec_())
|
sys.exit(self.exec_())
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
usage = "usage: %prog [options] arg1 arg2"
|
"""
|
||||||
|
The main function which parses command line options and then runs
|
||||||
|
the PyQt4 Application.
|
||||||
|
"""
|
||||||
|
# Set up command line options.
|
||||||
|
usage = u'Usage: %prog [options] [qt-options]'
|
||||||
parser = OptionParser(usage=usage)
|
parser = OptionParser(usage=usage)
|
||||||
parser.add_option("-d", "--debug",dest="debug",action="store_true",
|
parser.add_option("-d", "--debug", dest="debug",
|
||||||
help="Switch on Debugging ")
|
action="store_true", help="set logging to DEBUG level")
|
||||||
|
# Set up logging
|
||||||
|
filename = u'openlp.log'
|
||||||
|
logfile = logging.handlers.RotatingFileHandler(
|
||||||
|
filename, maxBytes=200000, backupCount=5)
|
||||||
|
logfile.setFormatter(
|
||||||
|
logging.Formatter(u'%(asctime)s %(name)-15s %(levelname)-8s %(message)s'))
|
||||||
|
log.addHandler(logfile)
|
||||||
|
# Parse command line options and deal with them.
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
if options.debug is not None:
|
if options.debug is not None:
|
||||||
log.setLevel(logging.DEBUG)
|
log.setLevel(logging.DEBUG)
|
||||||
|
else:
|
||||||
|
log.setLevel(logging.INFO)
|
||||||
|
# Now create and actually run the application.
|
||||||
|
app = OpenLP(sys.argv)
|
||||||
|
app.run()
|
||||||
|
|
||||||
if __name__ == u'__main__':
|
if __name__ == u'__main__':
|
||||||
"""
|
"""
|
||||||
Instantiate and run the application.
|
Instantiate and run the application.
|
||||||
"""
|
"""
|
||||||
main()
|
|
||||||
app = OpenLP(sys.argv)
|
|
||||||
#import cProfile
|
#import cProfile
|
||||||
#cProfile.run("app.run()", "profile.out")
|
#cProfile.run("main()", "profile.out")
|
||||||
app.run()
|
main()
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
"""
|
"""
|
||||||
OpenLP - Open Source Lyrics Projection
|
OpenLP - Open Source Lyrics Projection
|
||||||
|
|
||||||
Copyright (c) 2008 Raoul Snyman
|
Copyright (c) 2008 Raoul Snyman
|
||||||
|
|
||||||
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley
|
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it under
|
This program is free software; you can redistribute it and/or modify it under
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||||
"""
|
"""
|
||||||
OpenLP - Open Source Lyrics Projection
|
OpenLP - Open Source Lyrics Projection
|
||||||
|
|
||||||
Copyright (c) 2008 Raoul Snyman
|
Copyright (c) 2008 Raoul Snyman
|
||||||
|
|
||||||
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley
|
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it under
|
This program is free software; you can redistribute it and/or modify it under
|
||||||
|
@ -24,8 +24,9 @@ from PyQt4 import QtCore
|
|||||||
|
|
||||||
class EventReceiver(QtCore.QObject):
|
class EventReceiver(QtCore.QObject):
|
||||||
"""
|
"""
|
||||||
Class to allow events to be passed from different parts of the system.
|
Class to allow events to be passed from different parts of the
|
||||||
This is a private class and should not be used directly but via the Receiver class
|
system. This is a private class and should not be used directly
|
||||||
|
but rather via the Receiver class.
|
||||||
|
|
||||||
``stop_import``
|
``stop_import``
|
||||||
Stops the Bible Import
|
Stops the Bible Import
|
||||||
@ -59,31 +60,57 @@ class EventReceiver(QtCore.QObject):
|
|||||||
log = logging.getLogger(u'EventReceiver')
|
log = logging.getLogger(u'EventReceiver')
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
"""
|
||||||
|
Initialise the event receiver, calling the parent constructor.
|
||||||
|
"""
|
||||||
QtCore.QObject.__init__(self)
|
QtCore.QObject.__init__(self)
|
||||||
|
|
||||||
def send_message(self, event, msg=None):
|
def send_message(self, event, msg=None):
|
||||||
log.debug(u'Event %s passed with payload %s' % (event, msg))
|
"""
|
||||||
|
Emit a Qt signal.
|
||||||
|
|
||||||
|
``event``
|
||||||
|
The event to that was sent.
|
||||||
|
|
||||||
|
``msg``
|
||||||
|
Defaults to *None*. The message to send with the event.
|
||||||
|
"""
|
||||||
self.emit(QtCore.SIGNAL(event), msg)
|
self.emit(QtCore.SIGNAL(event), msg)
|
||||||
|
|
||||||
|
|
||||||
class Receiver():
|
class Receiver():
|
||||||
"""
|
"""
|
||||||
Class to allow events to be passed from different parts of the system.
|
Class to allow events to be passed from different parts of the
|
||||||
This is a static wrapper around the EventReceiver class.
|
system. This is a static wrapper around the ``EventReceiver``
|
||||||
As there is only one instance of it in the systems the QT signal/slot architecture
|
class. As there is only one instance of it in the system the QT
|
||||||
can send messages across the system
|
signal/slot architecture can send messages across the system.
|
||||||
|
|
||||||
``Send message``
|
To send a message:
|
||||||
Receiver().send_message(u'<<Message ID>>', data)
|
``Receiver().send_message(u'<<Message ID>>', data)``
|
||||||
|
|
||||||
``Receive Message``
|
To receive a Message
|
||||||
QtCore.QObject.connect(Receiver().get_receiver(),QtCore.SIGNAL(u'<<Message ID>>'),<<ACTION>>)
|
``QtCore.QObject.connect(Receiver().get_receiver(), QtCore.SIGNAL(u'<<Message ID>>'), <<ACTION>>)``
|
||||||
"""
|
"""
|
||||||
eventreceiver = EventReceiver()
|
eventreceiver = EventReceiver()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def send_message(event, msg=None):
|
def send_message(event, msg=None):
|
||||||
|
"""
|
||||||
|
Sends a message to the messaging system.
|
||||||
|
|
||||||
|
``event``
|
||||||
|
The event to send.
|
||||||
|
|
||||||
|
``msg``
|
||||||
|
Defaults to *None*. The message to send with the event.
|
||||||
|
"""
|
||||||
Receiver.eventreceiver.send_message(event, msg)
|
Receiver.eventreceiver.send_message(event, msg)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_receiver():
|
def get_receiver():
|
||||||
|
"""
|
||||||
|
Get the global ``eventreceiver`` instance.
|
||||||
|
"""
|
||||||
return Receiver.eventreceiver
|
return Receiver.eventreceiver
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,12 +28,22 @@ from openlp.plugins.songs.forms import OpenLPImportForm, OpenSongExportForm, \
|
|||||||
OpenSongImportForm, OpenLPExportForm
|
OpenSongImportForm, OpenLPExportForm
|
||||||
|
|
||||||
class SongsPlugin(Plugin):
|
class SongsPlugin(Plugin):
|
||||||
|
"""
|
||||||
|
This is the number 1 plugin, if importance were placed on any
|
||||||
|
plugins. This plugin enables the user to create, edit and display
|
||||||
|
songs. Songs are divided into verses, and the verse order can be
|
||||||
|
specified. Authors, topics and song books can be assigned to songs
|
||||||
|
as well.
|
||||||
|
"""
|
||||||
|
|
||||||
global log
|
global log
|
||||||
log = logging.getLogger(u'SongsPlugin')
|
log = logging.getLogger(u'SongsPlugin')
|
||||||
log.info(u'Song Plugin loaded')
|
log.info(u'Song Plugin loaded')
|
||||||
|
|
||||||
def __init__(self, plugin_helpers):
|
def __init__(self, plugin_helpers):
|
||||||
|
"""
|
||||||
|
Create and set up the Songs plugin.
|
||||||
|
"""
|
||||||
# Call the parent constructor
|
# Call the parent constructor
|
||||||
Plugin.__init__(self, u'Songs', u'1.9.0', plugin_helpers)
|
Plugin.__init__(self, u'Songs', u'1.9.0', plugin_helpers)
|
||||||
self.weight = -10
|
self.weight = -10
|
||||||
@ -48,11 +58,22 @@ class SongsPlugin(Plugin):
|
|||||||
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
|
|
||||||
def get_media_manager_item(self):
|
def get_media_manager_item(self):
|
||||||
# Create the MediaManagerItem object
|
"""
|
||||||
|
Create the MediaManagerItem object, which is displaed in the
|
||||||
|
Media Manager.
|
||||||
|
"""
|
||||||
self.media_item = SongMediaItem(self, self.icon, 'Songs')
|
self.media_item = SongMediaItem(self, self.icon, 'Songs')
|
||||||
return self.media_item
|
return self.media_item
|
||||||
|
|
||||||
def add_import_menu_item(self, import_menu):
|
def add_import_menu_item(self, import_menu):
|
||||||
|
"""
|
||||||
|
Give the Songs plugin the opportunity to add items to the
|
||||||
|
**Import** menu.
|
||||||
|
|
||||||
|
``import_menu``
|
||||||
|
The actual **Import** menu item, so that your actions can
|
||||||
|
use it as their parent.
|
||||||
|
"""
|
||||||
self.ImportSongMenu = QtGui.QMenu(import_menu)
|
self.ImportSongMenu = QtGui.QMenu(import_menu)
|
||||||
self.ImportSongMenu.setObjectName(u'ImportSongMenu')
|
self.ImportSongMenu.setObjectName(u'ImportSongMenu')
|
||||||
self.ImportOpenSongItem = QtGui.QAction(import_menu)
|
self.ImportOpenSongItem = QtGui.QAction(import_menu)
|
||||||
@ -88,6 +109,14 @@ class SongsPlugin(Plugin):
|
|||||||
QtCore.SIGNAL(u'triggered()'), self.onImportOpenSongItemClick)
|
QtCore.SIGNAL(u'triggered()'), self.onImportOpenSongItemClick)
|
||||||
|
|
||||||
def add_export_menu_item(self, export_menu):
|
def add_export_menu_item(self, export_menu):
|
||||||
|
"""
|
||||||
|
Give the Songs plugin the opportunity to add items to the
|
||||||
|
**Export** menu.
|
||||||
|
|
||||||
|
``export_menu``
|
||||||
|
The actual **Export** menu item, so that your actions can
|
||||||
|
use it as their parent.
|
||||||
|
"""
|
||||||
self.ExportSongMenu = QtGui.QMenu(export_menu)
|
self.ExportSongMenu = QtGui.QMenu(export_menu)
|
||||||
self.ExportSongMenu.setObjectName(u'ExportSongMenu')
|
self.ExportSongMenu.setObjectName(u'ExportSongMenu')
|
||||||
self.ExportOpenSongItem = QtGui.QAction(export_menu)
|
self.ExportOpenSongItem = QtGui.QAction(export_menu)
|
||||||
|
Loading…
Reference in New Issue
Block a user