diff --git a/.eric4project/openlp.org 2.0.e4q b/.eric4project/openlp.org 2.0.e4q
index 3269c439c..2d70d504d 100644
--- a/.eric4project/openlp.org 2.0.e4q
+++ b/.eric4project/openlp.org 2.0.e4q
@@ -1,7 +1,7 @@
-
+
\ No newline at end of file
diff --git a/.eric4project/openlp.org 2.0.e4t b/.eric4project/openlp.org 2.0.e4t
index f85dde85e..500f265cc 100644
--- a/.eric4project/openlp.org 2.0.e4t
+++ b/.eric4project/openlp.org 2.0.e4t
@@ -1,7 +1,7 @@
-
+
TODO: what is the tags for bridge, pre-chorus?
diff --git a/openlp.org 2.0.e4p b/openlp.org 2.0.e4p
index b24cdbba6..8e66e1a56 100644
--- a/openlp.org 2.0.e4p
+++ b/openlp.org 2.0.e4p
@@ -1,7 +1,7 @@
-
+
Python
@@ -12,47 +12,30 @@
raoulsnyman@openlp.org
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -71,10 +54,25 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/openlp.pyw b/openlp.pyw
index c4dc3e482..8173b3ccd 100755
--- a/openlp.pyw
+++ b/openlp.pyw
@@ -1,4 +1,4 @@
-#!/usr/bin/env pythonw
+#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80
"""
diff --git a/openlp/core/event.py b/openlp/core/event.py
new file mode 100644
index 000000000..efc67bd41
--- /dev/null
+++ b/openlp/core/event.py
@@ -0,0 +1,51 @@
+# -*- coding: utf-8 -*-
+# vim: autoindent shiftwidth=4 expandtab textwidth=80
+"""
+OpenLP - Open Source Lyrics Projection
+Copyright (c) 2008 Raoul Snyman
+Portions copyright (c) 2008 Martin Thompson, Tim Bentley, Scott Guerreri,
+ Carsten Tingaard, Jonathan Corwin
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation; version 2 of the License.
+
+This program is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place, Suite 330, Boston, MA 02111-1307 USA
+"""
+
+class EventType(object):
+ """
+ Types of events are stored in this class.
+ """
+ # "Default" event - a non-event
+ Default = 0
+ # General application events
+ InitApplication = -1
+ ShowApplication = -2
+ BeforeAppClose = -3
+ ApplicationClose = -4
+ # Service events
+ BeforeLoadService = 1
+ AfterLoadService = 2
+ BeforeSaveService = 3
+ AfterSaveService = 4
+ # Preview events
+ PreviewBeforeLoad = 11
+ PreviewAfterLoad = 12
+ PreviewBeforeShow = 13
+ PreviewAfterShow = 14
+
+
+class Event(object):
+ """
+ Provides an Event class to encapsulate events within openlp.org.
+ """
+
+ def __init__(self, event_type=EventType.Default):
+ self.type = event_type
diff --git a/openlp/core/plugin.py b/openlp/core/plugin.py
index e1175d36e..35c4359d4 100644
--- a/openlp/core/plugin.py
+++ b/openlp/core/plugin.py
@@ -23,15 +23,46 @@ class Plugin(object):
Base class for openlp plugins to inherit from.
Basic attributes are:
- name: the name that should appear in the plugins list
- version: The version number of this iteration of the plugin (just an incrementing integer!)
- paint_context: A list of paint contexts?
+ * Name
+ The name that should appear in the plugins list.
+ * Version
+ The version number of this iteration of the plugin.
+ * MediaManagerItem
+ An instance of the MediaManagerItem class, used in the Media Manager.
+ * SettingsTab
+ An instance of the SettingsTab class, used in the Settings dialog.
+ * ImportMenuItem
+ A menu item to be placed in the Import menu.
+ * ExportMenuItem
+ A menu item to be placed in the Export menu.
+
+ Hook functions:
+ * about()
+ Used in the plugin manager, when a person clicks on the 'About' button.
+ * save(data)
+ A method to convert the plugin's data to a string to be stored in the
+ Service file.
+ * load(string)
+ A method to convert the string from a Service file into the plugin's
+ own data format.
+ * render(theme, screen_number)
+ A method used to render something to the screen, given the current theme
+ and screen number.
+ * addToMenu(menubar)
+ A method to add a menu item to anywhere in the menu, given the menu bar.
+ * handleEvent(event)
+ A method use to handle events, given an Event object.
"""
def __init__(self, name=None, version=None):
"""
This is the constructor for the plugin object. This provides an easy
- way for descendent plugins to populate common data.
+ way for descendent plugins to populate common data. This method *must*
+ be overridden, like so:
+ class MyPlugin(Plugin):
+ def __init__(self):
+ Plugin.__init('MyPlugin', '0.1')
+ ...
"""
if name is not None:
self.Name = name
@@ -39,33 +70,46 @@ class Plugin(object):
self.Name = 'Plugin'
if version is not None:
self.__version__ = version
- # this will be a MediaManagerItem if it needs one
self.MediaManagerItem = None
- # this will be a PrefsPage object if it needs one
self.SettingsTab = None
- #self.paint_context = None
+ self.ImportMenuItem = None
+ self.ExportMenuItem = None
+
+ def about(self):
+ """
+ Show a dialog when the user clicks on the 'About' button in the plugin
+ manager.
+ """
+ pass
def save(self, data):
"""
Service item data is passed to this function, which should return a
- string which can be written to the service file
+ string which can be written to the service file.
"""
pass
- def load(self, str):
+ def load(self, string):
"""
A string from the service file is passed in. This function parses and
- sets up the internals of the plugin
+ sets up the internals of the plugin.
"""
pass
- def render(self, screen=None):
+ def render(self, theme, screen=None):
"""
- Render the screenth screenful of data to self.paint_conext
+ Render the screenth screenful of data using theme settings in theme.
"""
pass
- def __repr__(self):
- return '' % self.__class__.__name__
-
+ def addToMenu(self, menubar):
+ """
+ Add menu items to the menu, given the menubar.
+ """
+ pass
+ def handleEvent(self, event):
+ """
+ Handle the event contained in the event object.
+ """
+ pass