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 openlp.pyw - openlp/theme/test/test_theme.py - openlp/theme/__init__.py - openlp/theme/theme.py openlp/controls/__init__.py openlp/core/test/test_render_theme.py openlp/core/test/test_render.py openlp/core/interpolate.py openlp/core/__init__.py openlp/core/render.py - openlp/ui/__init__.py - openlp/ui/forms/__init__.py openlp/__init__.py - openlp/utils/ConfigHelper.py - openlp/utils/__init__.py demo.py openlp/core/settingsmanager.py openlp/resources/openlp_rc.py openlp/resources/__init__.py openlp/core/plugin.py openlp/core/xmlrootclass.py - openlp/song/__init__.py - openlp/song/test/test_song_opensong.py - openlp/song/test/test_song_basic.py - openlp/song/test/test_song_text.py openlp/plugins/biblemanager/__init__.py openlp/plugins/biblemanager/BibleDBImpl.py openlp/plugins/biblemanager/BibleManager.py openlp/plugins/biblemanager/BibleHTTPImpl.py openlp/plugins/biblemanager/test/__init__.py openlp/plugins/biblemanager/test/test_bibleManager.py - openlp/song/test/test_song_verse.py openlp/plugins/__init__.py openlp/plugins/testplugin1.py openlp/plugins/testplugin2/__init__.py openlp/plugins/testplugin2/testplugin2.py openlp/plugins/test/test_plugin_manager.py - openlp/ui/forms/editsongform.py - openlp/ui/forms/openlpexportform.py - openlp/ui/forms/openlpimportform.py - openlp/ui/forms/opensongexportform.py - openlp/ui/forms/opensongimportform.py openlp/plugins/biblemanager/BibleCommon.py openlp/libraries/pptviewlib/ppttest.py openlp/plugins/biblemanager/BibleCSVImpl.py @@ -71,10 +54,25 @@ openlp/core/ui/settings.py openlp/core/ui/alertform.py openlp/core/ui/about.py - openlp/song/songxml.py openlp/plugins/songs/songsplugin.py openlp/plugins/songs/__init__.py openlp/plugins/songs/forms/__init__.py + openlp/plugins/songs/songxml.py + openlp/plugins/songs/forms/openlpimportform.py + openlp/plugins/songs/forms/editsongform.py + openlp/plugins/songs/forms/opensongexportform.py + openlp/plugins/songs/forms/openlpexportform.py + openlp/plugins/songs/forms/opensongimportform.py + openlp/core/utils/__init__.py + openlp/core/utils/ConfigHelper.py + openlp/core/theme/__init__.py + openlp/core/theme/theme.py + openlp/plugins/songs/test/test_song_opensong.py + openlp/plugins/songs/test/test_song_basic.py + openlp/plugins/songs/test/test_song_verse.py + openlp/plugins/songs/test/test_song_text.py + openlp/core/theme/test/test_theme.py + openlp/core/event.py
openlp/resources/forms/mainwindow.ui
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