diff --git a/.eric4project/openlp.org 2.0.e4q b/.eric4project/openlp.org 2.0.e4q
index fd2f0c2d1..c28395f1e 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 94c9a1a98..72e817567 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 8c296e149..a6b703b46 100644
--- a/openlp.org 2.0.e4p
+++ b/openlp.org 2.0.e4p
@@ -1,7 +1,7 @@
-
+
Python
@@ -80,8 +80,6 @@
-
-
diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py
index 9377e7491..b8d930450 100644
--- a/openlp/core/lib/plugin.py
+++ b/openlp/core/lib/plugin.py
@@ -74,6 +74,7 @@ class Plugin(object):
self.SettingsTab = None
self.ImportMenuItem = None
self.ExportMenuItem = None
+ self.Weight = 0
def about(self):
"""
diff --git a/openlp/core/pluginmanager.py b/openlp/core/pluginmanager.py
index fe76dd470..778e620d2 100644
--- a/openlp/core/pluginmanager.py
+++ b/openlp/core/pluginmanager.py
@@ -18,15 +18,12 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
-import os, sys
+import os
+import sys
import logging
from openlp.core.lib import Plugin
-# Not sure what this is for. I prefer keeping as much code in the class as possible.
-mypath=os.path.split(os.path.abspath(__file__))[0]
-sys.path.insert(0,(os.path.join(mypath, '..' ,'..')))
-
class PluginManager(object):
"""
This is the Plugin manager, which loads all the plugins,
@@ -70,23 +67,27 @@ class PluginManager(object):
__import__(modulename, globals(), locals(), [])
except ImportError:
pass
- self.plugins = Plugin.__subclasses__()
- self.plugin_by_name = {}
- for p in self.plugins:
+ self.plugin_classes = Plugin.__subclasses__()
+ self.plugins = []
+ plugin_objects = []
+ for p in self.plugin_classes:
plugin = p()
- self.plugin_by_name[plugin.Name] = plugin;
+ plugin_objects.append(plugin)
+ self.plugins = sorted(plugin_objects, self.orderByWeight)
+
+ def orderByWeight(self, x, y):
+ return cmp(x.Weight, y.Weight)
def hookMediaManager(self, mediatoolbox):
"""
Loop through all the plugins. If a plugin has a valid media manager item,
add it to the media manager.
"""
- for pname in self.plugin_by_name:
- plugin = self.plugin_by_name[pname]
+ for plugin in self.plugins:
media_manager_item = plugin.getMediaManagerItem()
if media_manager_item is not None:
log.debug('Inserting media manager item from %s' % plugin.Name)
- mediatoolbox.addItem(media_manager_item, plugin.Icon, plugin.Name)
+ mediatoolbox.addItem(media_manager_item, plugin.Icon, media_manager_item.Title)
def hookHandleEvent(self, event):
pass
diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py
index 7719963e9..110ac462d 100644
--- a/openlp/core/ui/mainwindow.py
+++ b/openlp/core/ui/mainwindow.py
@@ -22,9 +22,9 @@ from time import sleep
from PyQt4 import QtCore, QtGui
from openlp.core.resources import *
-from openlp.core import PluginManager
from openlp.core.ui import AboutForm, AlertForm, SettingsDialog
from openlp.core.lib import Plugin, MediaManagerItem, SettingsTab
+from openlp.core import PluginManager
class MainWindow(object):
diff --git a/openlp/plugins/biblemanager/bibleplugin.py b/openlp/plugins/biblemanager/bibleplugin.py
index fb3c1901f..207fc496e 100644
--- a/openlp/plugins/biblemanager/bibleplugin.py
+++ b/openlp/plugins/biblemanager/bibleplugin.py
@@ -20,32 +20,34 @@ Place, Suite 330, Boston, MA 02111-1307 USA
from PyQt4 import QtCore, QtGui
from openlp.core.resources import *
-from openlp.core import Plugin
+from openlp.core.lib import Plugin, MediaManagerItem
-from biblemanager import BibleManager
-from bibleimportform import BibleImportForm
+#from bibleManager import BibleManager
+#from forms.bibleimportform import BibleImportForm
class BiblePlugin(Plugin):
def __init__(self):
# Call the parent constructor
Plugin.__init__(self, 'Bible', '1.9.0')
+ self.Weight = -9
#Register the bible Manager
- self.biblemanager = BibleManager()
+ #self.biblemanager = BibleManager()
+ def getMediaManagerItem(self):
# Create the plugin icon
self.Icon = QtGui.QIcon()
- self.Icon.addPixmap(QtGui.QPixmap(':/media/media_Bible.png'),
+ self.Icon.addPixmap(QtGui.QPixmap(':/media/media_verse.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
# Create the MediaManagerItem object
- self.MediaManagerItem = MediaManagerItem(self.Icon, 'Bibles')
+ self.MediaManagerItem = MediaManagerItem(self.Icon, 'Bible Verses')
# Add a toolbar
self.MediaManagerItem.addToolbar()
# Create buttons for the toolbar
## New Bible Button ##
- self.MediaManagerItem.addToolbarButton('New Bible', 'Register a new Bible',
- ':/Bibles/Bible_new.png', self.onBibleNewClick, 'BibleNewItem')
- ## Separator Line ##
- self.MediaManagerItem.addToolbarSeparator()
+ #self.MediaManagerItem.addToolbarButton('New Bible', 'Register a new Bible',
+ # ':/bibles/bible_new.png', self.onBibleNewClick, 'BibleNewItem')
+ ## Separator Line ##
+ #self.MediaManagerItem.addToolbarSeparator()
## Preview Bible Button ##
self.MediaManagerItem.addToolbarButton('Preview Bible', 'Preview the selected Bible Verse',
':/system/system_preview.png', self.onBiblePreviewClick, 'BiblePreviewItem')
@@ -62,12 +64,11 @@ class BiblePlugin(Plugin):
self.BibleList.setColumnCount(0)
self.BibleList.setRowCount(0)
self.MediaManagerItem.PageLayout.addWidget(self.BibleList)
-
- def getMediaManagerItem(self):
return self.MediaManagerItem
def onBibleNewClick(self):
- self.bibleimportform(self.biblemanager)
+ #self.bibleimportform(self.biblemanager)
+ pass
def onBiblePreviewClick(self):
pass
diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py
index 6ec5fdc74..38d8535b8 100644
--- a/openlp/plugins/songs/songsplugin.py
+++ b/openlp/plugins/songs/songsplugin.py
@@ -20,13 +20,14 @@ Place, Suite 330, Boston, MA 02111-1307 USA
from PyQt4 import QtCore, QtGui
from openlp.core.resources import *
-from openlp.core import Plugin, MediaManagerItem
+from openlp.core.lib import Plugin, MediaManagerItem
from forms import EditSongForm
class SongsPlugin(Plugin):
def __init__(self):
# Call the parent constructor
Plugin.__init__(self, 'Songs', '1.9.0')
+ self.Weight = -10
self.edit_song_form = EditSongForm()
def getMediaManagerItem(self):