WE HAVE OUR FIRST INTEGRATING PLUGIN!!

bzr-revno: 144
This commit is contained in:
Raoul Snyman 2008-11-30 18:36:13 +00:00
parent aa55cd9af3
commit dbec7d75b3
11 changed files with 78 additions and 68 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE UserProject SYSTEM "UserProject-4.0.dtd">
<!-- eric4 user project file for project openlp.org 2.0 -->
<!-- Saved: 2008-11-29, 07:33:22 -->
<!-- Saved: 2008-11-30, 20:32:44 -->
<!-- Copyright (C) 2008 Raoul Snyman, raoulsnyman@openlp.org -->
<UserProject version="4.0">
</UserProject>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Tasks SYSTEM "Tasks-4.2.dtd">
<!-- eric4 tasks file for project openlp.org 2.0 -->
<!-- Saved: 2008-11-29, 07:33:22 -->
<!-- Saved: 2008-11-30, 20:32:44 -->
<Tasks version="4.2">
<Task priority="1" completed="False" bugfix="False">
<Summary>TODO: what is the tags for bridge, pre-chorus?</Summary>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Project SYSTEM "Project-4.4.dtd">
<!-- eric4 project file for project openlp.org 2.0 -->
<!-- Saved: 2008-11-28, 23:40:29 -->
<!-- Saved: 2008-11-30, 20:32:44 -->
<!-- Copyright (C) 2008 Raoul Snyman, raoulsnyman@openlp.org -->
<Project version="4.4">
<ProgLanguage mixed="0">Python</ProgLanguage>
@ -73,7 +73,9 @@
<Source>openlp/plugins/biblemanager/bibleCSVImpl.py</Source>
<Source>openlp/plugins/biblemanager/bibleCommon.py</Source>
<Source>openlp/plugins/biblemanager/bibleManager.py</Source>
<Source>resources/__init__.py</Source>
<Source>openlp/plugins/biblemanager/forms/__init__.py</Source>
<Source>openlp/plugins/biblemanager/forms/bibleimportdialog.py</Source>
<Source>openlp/plugins/biblemanager/forms/bibleimportform.py</Source>
</Sources>
<Forms>
<Form>resources/forms/bibleimport.ui</Form>

View File

@ -66,6 +66,9 @@ class MediaManagerItem(QtGui.QWidget):
"""
if self.Toolbar is None:
self.addToolbar()
if item.__class__.__name__ == 'QSpacerItem':
self.ToolbarLayout.addSpacerItem(item)
else:
self.ToolbarLayout.addWidget(item)
def addToolbarButton(self, title, tooltip, icon, slot=None, objectname=None):
@ -73,8 +76,9 @@ class MediaManagerItem(QtGui.QWidget):
A method to help developers easily add a button to the toolbar.
"""
ToolbarButton = QtGui.QToolButton(self.Toolbar)
ToolbarButton.setText(QtCore.QObject.trUtf8(title))
ToolbarButton.setToolTip(QtCore.QObject.trUtf8(tooltip))
ToolbarButton.setText(QtCore.QObject.trUtf8(ToolbarButton, title))
ToolbarButton.setToolTip(QtCore.QObject.trUtf8(ToolbarButton, tooltip))
self.addToolbarItem(ToolbarButton)
if type(icon) is QtGui.QIcon:
ButtonIcon = icon
elif type(icon) is types.StringType:
@ -88,11 +92,11 @@ class MediaManagerItem(QtGui.QWidget):
ToolbarButton.setIcon(ButtonIcon)
ToolbarButton.setIconSize(QtCore.QSize(20, 20))
ToolbarButton.setAutoRaise(True)
ToolbarButton.setMinimumSize(QtCore.QSize(20, 20))
if objectname is not None:
ToolbarButton.setObjectName(objectname)
if slot is not None:
QtCore.QObject.connect(ToolbarButton, QtCore.SIGNAL("clicked()"), slot)
self.addToolbarItem(ToolbarButton)
def addToolbarLine(self):
ToolbarLine = QtGui.QFrame(self.Toolbar)

View File

@ -69,7 +69,7 @@ class Plugin(object):
else:
self.Name = 'Plugin'
if version is not None:
self.__version__ = version
self.Version = version
self.MediaManagerItem = None
self.SettingsTab = None
self.ImportMenuItem = None
@ -113,3 +113,6 @@ class Plugin(object):
Handle the event contained in the event object.
"""
pass
def getName(self):
return self.Name

View File

@ -72,14 +72,16 @@ class PluginManager(object):
self.plugins = Plugin.__subclasses__()
self.plugin_by_name = {}
for p in self.plugins:
self.plugin_by_name[p.Name] = p;
plugin = p()
self.plugin_by_name[plugin.Name] = plugin;
def hook_media_manager(self, MediaToolBox):
"""
Loop through all the plugins. If a plugin has a valid media manager item,
add it to the media manager.
"""
for plugin in self.plugins:
for pname in self.plugin_by_name:
plugin = self.plugin_by_name[pname]
if plugin.MediaManagerItem is not None:
log.debug('Inserting media manager item from %s' % plugin.Name)
MediaToolBox.addItem(plugin.MediaManagerItem, plugin.Icon, plugin.Name)

View File

@ -18,7 +18,10 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
from openlp.core.ui.mainwindow import MainWindow
from openlp.core.ui.splashscreen import SplashScreen
from splashscreen import SplashScreen
from about import AboutForm
from alertform import AlertForm
from settings import SettingsDialog
from mainwindow import MainWindow
__all__ = ['MainWindow', 'SplashScreen']
__all__ = ['SplashScreen', 'AboutForm', 'AlertForm', 'SettingsDialog', 'MainWindow']

View File

@ -22,25 +22,18 @@ from time import sleep
from PyQt4 import QtCore, QtGui
from openlp.core.resources import *
from openlp.core.ui.about import AboutForm
from openlp.core.ui.alertform import AlertForm
from openlp.core.ui.settings import SettingsDialog
from openlp.core.ui import AboutForm, AlertForm, SettingsDialog
from openlp.core import Plugin, PluginManager, MediaManagerItem, SettingsTab
class MainWindow(object):
def __init__(self):
self.main_window = QtGui.QMainWindow()
self.setupUi()
self.about_form = AboutForm()
self.alert_form = AlertForm()
#self.edit_song_form = EditSongForm()
#self.openlpexportform = OpenLPExportForm()
#self.openlpimportform = OpenLPImportForm()
#self.opensongexportform = OpenSongExportForm()
#self.opensongimportform = OpenSongImportForm()
self.settings_form = SettingsDialog()
self.plugin_manager = PluginManager('/home/raoul/Projects/openlp-2/openlp/plugins')
self.setupUi()
def setupUi(self):
self.main_window.setObjectName("main_window")
@ -149,6 +142,7 @@ class MainWindow(object):
self.MediaManagerDock.setWindowIcon(icon)
self.MediaManagerDock.setFloating(False)
self.MediaManagerDock.setObjectName("MediaManagerDock")
self.MediaManagerDock.setMinimumWidth(250)
self.MediaManagerContents = QtGui.QWidget()
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
@ -164,6 +158,8 @@ class MainWindow(object):
self.MediaToolBox.setObjectName("MediaToolBox")
# This is where we will eventually get the Plugin Manager to pull in
# the media manager items.
self.plugin_manager.hook_media_manager(self.MediaToolBox)
# End adding media manager items.
self.MediaManagerLayout.addWidget(self.MediaToolBox)
self.MediaManagerDock.setWidget(self.MediaManagerContents)
self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.MediaManagerDock)

View File

@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
@ -22,8 +22,8 @@ from PyQt4 import QtCore, QtGui
from openlp.core.resources import *
from openlp.core import Plugin
from openlp.plugins.biblemanager.biblemanager import BibleManager
from openlp.plugins.biblemanager.bibleimportform import BibleImportForm
from biblemanager import BibleManager
from bibleimportform import BibleImportForm
class BiblePlugin(Plugin):
def __init__(self):
@ -78,5 +78,3 @@ class BiblePlugin(Plugin):
def onBibleAddClick(self):
pass
s

View File

@ -25,7 +25,7 @@ from openlp.core import Plugin, MediaManagerItem
class SongsPlugin(Plugin):
def __init__(self):
# Call the parent constructor
Plugin.__init__(self, 'Song', '1.9.0')
Plugin.__init__(self, 'Songs', '1.9.0')
# Create the plugin icon
self.Icon = QtGui.QIcon()
self.Icon.addPixmap(QtGui.QPixmap(':/media/media_song.png'),
@ -61,11 +61,11 @@ class SongsPlugin(Plugin):
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.MediaManagerItem.addToolbarItem(self.SongSpacerItem)
# Add the songlist widget
self.SongList = QtGui.QTableWidget(self.MediaManagerItem)
self.SongList.setObjectName("SongList")
self.SongList.setColumnCount(0)
self.SongList.setRowCount(0)
self.MediaManagerItem.PageLayout.addWidget(self.SongList)
#self.SongList = QtGui.QTableWidget(self.MediaManagerItem)
#self.SongList.setObjectName("SongList")
#self.SongList.setColumnCount(0)
#self.SongList.setRowCount(0)
#self.MediaManagerItem.PageLayout.addWidget(self.SongList)
def onSongNewClick(self):
pass