Clean up Plugin Interface to be more Generic

Clean up Mainwindow for adding plugins
Add ThemeManager to Main window and pass to plugins 
Add event Manager code to plugins and define some listners
Update AlertDialog to send message and allow text to be entered
This commit is contained in:
Tim Bentley 2009-03-22 07:13:34 +00:00
parent b8c0ee1d70
commit 6a0eaa2cfe
15 changed files with 197 additions and 119 deletions

View File

@ -3,7 +3,7 @@
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 Martin Thompson, Tim Bentley, Scott Guerreri,
Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Scott Guerreri,
Carsten Tingaard, Jonathan Corwin
This program is free software; you can redistribute it and/or modify it under
@ -46,6 +46,15 @@ class Event(object):
"""
Provides an Event class to encapsulate events within openlp.org.
"""
def __init__(self, event_type=EventType.Default):
self.type = event_type
self.payload = None
def get_payload(self):
return self.payload
def set_payload(self, payload):
self.payload = payload
def get_type(self):
return self.type

View File

@ -67,7 +67,7 @@ class Plugin(object):
and screen number.
"""
def __init__(self, name=None, version=None, preview_controller=None, live_controller=None):
def __init__(self, name=None, version=None, plugin_helpers=None):
"""
This is the constructor for the plugin object. This provides an easy
way for descendent plugins to populate common data. This method *must*
@ -88,8 +88,9 @@ class Plugin(object):
self.weight = 0
# Set up logging
self.log = logging.getLogger(self.name)
self.preview_controller=preview_controller
self.live_controller=live_controller
if plugin_helpers != None:
self.preview_controller=plugin_helpers[u'preview']
self.live_controller=plugin_helpers[u'preview']
def check_pre_conditions(self):
"""

View File

@ -3,7 +3,7 @@
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 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
the terms of the GNU General Public License as published by the Free Software
@ -22,7 +22,7 @@ import os
import sys
import logging
from openlp.core.lib import Plugin
from openlp.core.lib import Plugin, EventManager
class PluginManager(object):
"""
@ -30,15 +30,15 @@ class PluginManager(object):
and executes all the hooks, as and when necessary.
"""
global log
log=logging.getLogger("PluginMgr")
log.info("Plugin manager loaded")
log=logging.getLogger(u'PluginMgr')
log.info(u'"Plugin manager loaded')
def __init__(self, dir):
"""
The constructor for the plugin manager.
Passes the controllers on to the plugins for them to interact with via their ServiceItems
"""
log.info("Plugin manager initing")
log.info(u'Plugin manager initing')
if not dir in sys.path:
log.debug("Inserting %s into sys.path", dir)
sys.path.insert(0, dir)
@ -48,12 +48,11 @@ class PluginManager(object):
# this has to happen after the UI is sorted self.find_plugins(dir)
log.info("Plugin manager done init")
def find_plugins(self, dir, preview_controller, live_controller): # xxx shouldn't dir come from self.basepath
def find_plugins(self, dir, plugin_helpers, eventmanager): # TODO shouldn't dir come from self.basepath
"""
Scan the directory dir for objects inheriting from openlp.plugin
"""
self.preview_controller=preview_controller
self.live_controller=live_controller
self.plugin_helpers = plugin_helpers
startdepth=len(os.path.abspath(dir).split(os.sep))
log.debug("find plugins %s at depth %d" %( str(dir), startdepth))
@ -80,16 +79,15 @@ class PluginManager(object):
plugin_objects = []
for p in self.plugin_classes:
try:
plugin = p(self.preview_controller, self.live_controller)
log.debug('loaded plugin' + str(p) + ' with controllers'+str(self.preview_controller)+str(self.live_controller))
plugin = p(self.plugin_helpers)
log.debug(u'loaded plugin %s with helpers'%str(p))
except TypeError:
# TODO: need to get rid of this once all plugins are up to date
plugin = p()
log.debug('loaded plugin' + str(p) + ' with no controllers')
log.error(u'loaded plugin %s has no helpers'%str(p))
log.debug("Plugin="+str(p))
if plugin.check_pre_conditions():
log.debug("Appending "+str(p))
plugin_objects.append(plugin)
eventmanager.register(plugin)
self.plugins = sorted(plugin_objects, self.order_by_weight)
def order_by_weight(self, x, y):
@ -106,7 +104,7 @@ class PluginManager(object):
log.debug('Inserting media manager item from %s' % plugin.name)
mediatoolbox.addItem(media_manager_item, plugin.icon, media_manager_item.title)
# TODO: These shouldn't be called here...
plugin.initialise()
#plugin.initialise()
def hook_settings_tabs(self, settingsform=None):
"""
@ -137,5 +135,19 @@ class PluginManager(object):
for plugin in self.plugins:
plugin.add_export_menu_item(export_menu)
def hook_handle_event(self, event):
pass
def hook_handle_event(self, eventmanager):
for plugin in self.plugins:
handle_event = plugin.handle_event(None)
print plugin, handle_event
# if settings_tab is not None:
# log.debug('Inserting settings tab item from %s' % plugin.name)
# settingsform.addTab(settings_tab)
# else:
# log.debug('No settings in %s' % plugin.name)
def initialise_plugins(self):
"""
Loop through all the plugins and give them an opportunity to add an item
to the export menu.
"""
for plugin in self.plugins:
plugin.initialise()

View File

@ -44,8 +44,10 @@ class Renderer:
self._theme=None
self._bg_image_filename=None
self._paint=None
def set_debug(self, debug):
self._debug=debug
def set_theme(self, theme):
self._theme=theme
if theme.BackgroundType == 2:
@ -56,6 +58,7 @@ class Renderer:
self._bg_image_filename=filename
if self._paint is not None:
self.scale_bg_image()
def scale_bg_image(self):
assert self._paint
i=QtGui.QImage(self._bg_image_filename)
@ -81,6 +84,7 @@ class Renderer:
self._paint=p
if self._bg_image_filename is not None:
self.scale_bg_image()
def set_words_openlp(self, words):
# print "set words openlp", words
verses=[]
@ -95,6 +99,7 @@ class Renderer:
verses_text.append('\n'.join(v).lstrip()) # remove first \n
return verses_text
def render_screen(self, screennum):
print "render screen\n", screennum, self.words[screennum]
import time
@ -106,6 +111,7 @@ class Renderer:
def set_text_rectangle(self, rect):
""" Sets the rectangle within which text should be rendered"""
self._rect=rect
def _render_background(self):
# xxx may have to prerender to a memdc when set theme is called for use on slow machines
# takes 26ms on mijiti's machine!
@ -149,6 +155,7 @@ class Renderer:
p.drawPixmap(self.background_offsetx,self.background_offsety, self.img)
p.end()
print "render background done"
def split_set_of_lines(self, lines):
"""Given a list of lines, decide how to split them best if they don't all fit on the screen
@ -212,7 +219,6 @@ class Renderer:
return retval
def _render_lines(self, lines):
"""render a set of lines according to the theme, return bounding box"""
print "_render_lines", lines
@ -234,6 +240,7 @@ class Renderer:
print "render lines DONE"
return bbox
def _render_lines_unaligned(self, lines, tlcorner=(0,0)):
"""Given a list of lines to render, render each one in turn
@ -265,7 +272,6 @@ class Renderer:
return retval
def _render_single_line(self, line, tlcorner=(0,0)):
"""render a single line of words onto the DC, top left corner
@ -402,8 +408,3 @@ class Renderer:
p.drawText(x,y+metrics.height()-metrics.descent()-1, line)
p.end()
return (w, h)

View File

@ -15,6 +15,7 @@ blankstylexml=\
'''<?xml version="1.0" encoding="iso-8859-1"?>
<Theme>
<Name>BlankStyle</Name>
<BackgroundMode>1</BackgroundMode>
<BackgroundType>0</BackgroundType>
<BackgroundParameter1>$000000</BackgroundParameter1>
<BackgroundParameter2/>
@ -37,6 +38,9 @@ class Theme:
attributes:
name : theme name
BackgroundMode : 1 - Transparent
1 - Opaque
BackgroundType : 0 - solid color
1 - gradient color
2 - image

View File

@ -17,22 +17,32 @@ 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
"""
import logging
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QDialog
from openlp.core import translate
from openlp.core.resources import *
from openlp.core.ui import AlertsTab
from openlp.core.lib import EventManager, Event
class AlertForm(QDialog):
global log
log=logging.getLogger(u'AlertForm')
def __init__(self, parent=None):
def __init__(self, eventmanager, parent=None):
QDialog.__init__(self, parent)
self.alertsTab = AlertsTab()
self.eventmanager = eventmanager
self.setupUi(self)
log.info(u'Defined')
def get_settings_tab(self):
return self.alertsTab
def setupUi(self, AlertForm):
AlertForm.setObjectName("AlertForm")
AlertForm.resize(370, 105)
AlertForm.resize(370, 110)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/icon/openlp.org-icon-32.bmp"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
AlertForm.setWindowIcon(icon)
@ -56,7 +66,7 @@ class AlertForm(QDialog):
self.AlertEntryLabel.setSizePolicy(sizePolicy)
self.AlertEntryLabel.setObjectName("AlertEntryLabel")
self.AlertEntryEditItem = QtGui.QLineEdit(self.AlertEntryWidget)
self.AlertEntryEditItem.setGeometry(QtCore.QRect(0, 20, 353, 21))
self.AlertEntryEditItem.setGeometry(QtCore.QRect(0, 20, 353, 26))
self.AlertEntryEditItem.setObjectName("AlertEntryEditItem")
self.AlertFormLayout.addWidget(self.AlertEntryWidget)
self.ButtonBoxWidget = QtGui.QWidget(AlertForm)
@ -83,20 +93,29 @@ class AlertForm(QDialog):
self.retranslateUi(AlertForm)
QtCore.QObject.connect(self.CancelButton, QtCore.SIGNAL("clicked()"), AlertForm.close)
QtCore.QObject.connect(self.DisplayButton, QtCore.SIGNAL("clicked()"), self.onDisplayClicked)
QtCore.QMetaObject.connectSlotsByName(AlertForm)
def retranslateUi(self, AlertForm):
AlertForm.setWindowTitle(translate("AlertForm", "Alert Message"))
self.AlertEntryLabel.setText(translate("AlertForm", "Alert Text:"))
self.DisplayButton.setText(translate("AlertForm", "Display"))
self.CancelButton.setText(translate("AlertForm", "Cancel"))
AlertForm.setWindowTitle(translate("AlertForm", u'Alert Message'))
self.AlertEntryLabel.setText(translate("AlertForm", u'Alert Text:'))
self.DisplayButton.setText(translate("AlertForm", u'Display'))
self.CancelButton.setText(translate("AlertForm", u'Cancel'))
# def show(self):
# self.AlertForm.show()
def handle_event(self, event):
"""
Handle the event contained in the event object.
"""
log.debug(u'Handle event called with event %s' %event.get_type())
def load_settings(self):
pass
def save_settings(self):
pass
def onDisplayClicked(self):
self.eventmanager.post_event(Event())

View File

@ -3,7 +3,7 @@
"""
OpenLP - Open Source Lyrics Projection
Copyright (c) 2008 Raoul Snyman
Portions copyright (c) 2008 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
the terms of the GNU General Public License as published by the Free Software
@ -18,53 +18,73 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
"""
import os
import logging
from time import sleep
from PyQt4 import *
from PyQt4 import QtCore, QtGui
from openlp.core.resources import *
from openlp.core.ui import AboutForm, SettingsForm, AlertForm, \
SlideController, ServiceManager
from openlp.core.lib import Plugin, MediaManagerItem, SettingsTab
SlideController, ServiceManager, ThemeManager
from openlp.core.lib import Plugin, MediaManagerItem, SettingsTab, EventManager
from openlp.core import PluginManager
import logging
class MainWindow(object):
global log
log=logging.getLogger("MainWindow")
log.info("MainWindow loaded")
log=logging.getLogger(u'MainWindow')
log.info(u'MainWindow loaded')
def __init__(self):
self.main_window = QtGui.QMainWindow()
self.alert_form = AlertForm()
self.EventManager = EventManager()
self.alert_form = AlertForm(self.EventManager)
self.about_form = AboutForm()
self.settings_form = SettingsForm()
self.settings_form.addTab(self.alert_form.get_settings_tab())
pluginpath = os.path.split(os.path.abspath(__file__))[0]
pluginpath = os.path.abspath(os.path.join(pluginpath, '..', '..','plugins'))
self.plugin_manager = PluginManager(pluginpath)
self.plugin_helpers = {}
self.setupUi()
log.info('')
self.plugin_manager.find_plugins(pluginpath, self.PreviewController, self.LiveController)
log.info(u'Load Plugins')
self.plugin_helpers[u'preview'] = self.PreviewController
self.plugin_helpers[u'live'] = self.LiveController
self.plugin_helpers[u'event'] = self.EventManager
self.plugin_helpers[u'theme'] = self.ThemeManagerContents # Theme manger
self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers, self.EventManager)
# hook methods have to happen after find_plugins. Find plugins needs the controllers
# hence the hooks have moved from setupUI() to here
# Find and insert media manager items
log.info("hook media")
log.info(u'hook media')
self.plugin_manager.hook_media_manager(self.MediaToolBox)
# Find and insert settings tabs
log.info("hook settings")
log.info(u'hook settings')
self.plugin_manager.hook_settings_tabs(self.settings_form)
# Call the hook method to pull in import menus.
log.info("hook menus")
log.info(u'hook menus')
self.plugin_manager.hook_import_menu(self.FileImportMenu)
# Call the hook method to pull in export menus.
self.plugin_manager.hook_import_menu(self.FileExportMenu)
self.plugin_manager.hook_export_menu(self.FileExportMenu)
# Call the initialise method to setup plugins.
log.info(u'initialise plugins')
self.plugin_manager.initialise_plugins()
# Register the different UI components with Event Manager
self.EventManager.register(self.ServiceManagerContents)
self.EventManager.register(self.ThemeManagerContents)
self.EventManager.register(self.alert_form)
def setupUi(self):
self.main_window.setObjectName("main_window")
@ -151,7 +171,7 @@ class MainWindow(object):
self.MediaManagerLayout.addWidget(self.MediaToolBox)
self.MediaManagerDock.setWidget(self.MediaManagerContents)
self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.MediaManagerDock)
#Sevice Manager Defined
self.ServiceManagerDock = QtGui.QDockWidget(self.main_window)
ServiceManagerIcon = QtGui.QIcon()
ServiceManagerIcon.addPixmap(QtGui.QPixmap(":/system/system_servicemanager.png"),
@ -162,6 +182,7 @@ class MainWindow(object):
self.ServiceManagerContents = ServiceManager(self)
self.ServiceManagerDock.setWidget(self.ServiceManagerContents)
self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.ServiceManagerDock)
#Theme Manager Defined
self.ThemeManagerDock = QtGui.QDockWidget(self.main_window)
ThemeManagerIcon = QtGui.QIcon()
ThemeManagerIcon.addPixmap(QtGui.QPixmap(":/system/system_thememanager.png"),
@ -169,41 +190,46 @@ class MainWindow(object):
self.ThemeManagerDock.setWindowIcon(ThemeManagerIcon)
self.ThemeManagerDock.setFloating(False)
self.ThemeManagerDock.setObjectName("ThemeManagerDock")
self.ThemeManagerContents = QtGui.QWidget()
self.ThemeManagerContents.setObjectName("ThemeManagerContents")
self.ThemeManagerLayout = QtGui.QVBoxLayout(self.ThemeManagerContents)
self.ThemeManagerLayout.setSpacing(0)
self.ThemeManagerLayout.setMargin(0)
self.ThemeManagerLayout.setObjectName("ThemeManagerLayout")
self.ThemeManagerToolbar = QtGui.QToolBar(self.ThemeManagerContents)
self.ThemeManagerToolbar.setObjectName("ThemeManagerToolbar")
NewThemeIcon = QtGui.QIcon()
NewThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_new.png"),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.ThemeNewItem = self.ThemeManagerToolbar.addAction(NewThemeIcon, 'New theme')
EditThemeIcon = QtGui.QIcon()
EditThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_edit.png"),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.ThemeEditItem = self.ThemeManagerToolbar.addAction(EditThemeIcon, 'Edit theme')
DeleteThemeIcon = QtGui.QIcon()
DeleteThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_delete.png"),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.ThemeDeleteButton = self.ThemeManagerToolbar.addAction(DeleteThemeIcon, 'Delete theme')
self.ThemeManagerToolbar.addSeparator()
ImportThemeIcon = QtGui.QIcon()
ImportThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_import.png"),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.ThemeImportButton = self.ThemeManagerToolbar.addAction(ImportThemeIcon, 'Import theme')
ExportThemeIcon = QtGui.QIcon()
ExportThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_export.png"),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.ThemeExportButton = self.ThemeManagerToolbar.addAction(ExportThemeIcon, 'Export theme')
self.ThemeManagerLayout.addWidget(self.ThemeManagerToolbar)
self.ThemeManagerListView = QtGui.QListView(self.ThemeManagerContents)
self.ThemeManagerListView.setObjectName("ThemeManagerListView")
self.ThemeManagerLayout.addWidget(self.ThemeManagerListView)
self.ThemeManagerContents = ThemeManager(self)
# self.ThemeManagerContents = QtGui.QWidget()
# self.ThemeManagerContents.setObjectName("ThemeManagerContents")
# self.ThemeManagerLayout = QtGui.QVBoxLayout(self.ThemeManagerContents)
# self.ThemeManagerLayout.setSpacing(0)
# self.ThemeManagerLayout.setMargin(0)
# self.ThemeManagerLayout.setObjectName("ThemeManagerLayout")
# self.ThemeManagerToolbar = QtGui.QToolBar(self.ThemeManagerContents)
# self.ThemeManagerToolbar.setObjectName("ThemeManagerToolbar")
# NewThemeIcon = QtGui.QIcon()
# NewThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_new.png"),
# QtGui.QIcon.Normal, QtGui.QIcon.Off)
# self.ThemeNewItem = self.ThemeManagerToolbar.addAction(NewThemeIcon, 'New theme')
# EditThemeIcon = QtGui.QIcon()
# EditThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_edit.png"),
# QtGui.QIcon.Normal, QtGui.QIcon.Off)
# self.ThemeEditItem = self.ThemeManagerToolbar.addAction(EditThemeIcon, 'Edit theme')
# DeleteThemeIcon = QtGui.QIcon()
# DeleteThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_delete.png"),
# QtGui.QIcon.Normal, QtGui.QIcon.Off)
# self.ThemeDeleteButton = self.ThemeManagerToolbar.addAction(DeleteThemeIcon, 'Delete theme')
# self.ThemeManagerToolbar.addSeparator()
# ImportThemeIcon = QtGui.QIcon()
# ImportThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_import.png"),
# QtGui.QIcon.Normal, QtGui.QIcon.Off)
# self.ThemeImportButton = self.ThemeManagerToolbar.addAction(ImportThemeIcon, 'Import theme')
# ExportThemeIcon = QtGui.QIcon()
# ExportThemeIcon.addPixmap(QtGui.QPixmap(":/themes/theme_export.png"),
# QtGui.QIcon.Normal, QtGui.QIcon.Off)
# self.ThemeExportButton = self.ThemeManagerToolbar.addAction(ExportThemeIcon, 'Export theme')
# self.ThemeManagerLayout.addWidget(self.ThemeManagerToolbar)
# self.ThemeManagerListView = QtGui.QListView(self.ThemeManagerContents)
# self.ThemeManagerListView.setObjectName("ThemeManagerListView")
# self.ThemeManagerLayout.addWidget(self.ThemeManagerListView)
self.ThemeManagerDock.setWidget(self.ThemeManagerContents)
self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.ThemeManagerDock)
self.FileNewItem = QtGui.QAction(self.main_window)
self.FileNewItem.setIcon(self.ServiceManagerContents.Toolbar.getIconFromTitle("New Service"))
self.FileNewItem.setObjectName("FileNewItem")
@ -359,11 +385,11 @@ class MainWindow(object):
# self.ServiceManagerContents.ThemeComboBox.setItemText(1, QtGui.QApplication.translate("main_window", "Snowy Mountains", None, QtGui.QApplication.UnicodeUTF8))
# self.ServiceManagerContents.ThemeComboBox.setItemText(2, QtGui.QApplication.translate("main_window", "Wilderness", None, QtGui.QApplication.UnicodeUTF8))
self.ThemeManagerDock.setWindowTitle(QtGui.QApplication.translate("main_window", "Theme Manager", None, QtGui.QApplication.UnicodeUTF8))
self.ThemeNewItem.setText(QtGui.QApplication.translate("main_window", "New Theme", None, QtGui.QApplication.UnicodeUTF8))
self.ThemeEditItem.setText(QtGui.QApplication.translate("main_window", "Edit Theme", None, QtGui.QApplication.UnicodeUTF8))
self.ThemeDeleteButton.setText(QtGui.QApplication.translate("main_window", "Delete Theme", None, QtGui.QApplication.UnicodeUTF8))
self.ThemeImportButton.setText(QtGui.QApplication.translate("main_window", "Import Theme", None, QtGui.QApplication.UnicodeUTF8))
self.ThemeExportButton.setText(QtGui.QApplication.translate("main_window", "Export Theme", None, QtGui.QApplication.UnicodeUTF8))
# self.ThemeNewItem.setText(QtGui.QApplication.translate("main_window", "New Theme", None, QtGui.QApplication.UnicodeUTF8))
# self.ThemeEditItem.setText(QtGui.QApplication.translate("main_window", "Edit Theme", None, QtGui.QApplication.UnicodeUTF8))
# self.ThemeDeleteButton.setText(QtGui.QApplication.translate("main_window", "Delete Theme", None, QtGui.QApplication.UnicodeUTF8))
# self.ThemeImportButton.setText(QtGui.QApplication.translate("main_window", "Import Theme", None, QtGui.QApplication.UnicodeUTF8))
# self.ThemeExportButton.setText(QtGui.QApplication.translate("main_window", "Export Theme", None, QtGui.QApplication.UnicodeUTF8))
self.FileNewItem.setText(QtGui.QApplication.translate("main_window", "&New", None, QtGui.QApplication.UnicodeUTF8))
self.FileNewItem.setToolTip(QtGui.QApplication.translate("main_window", "New Service", None, QtGui.QApplication.UnicodeUTF8))
self.FileNewItem.setStatusTip(QtGui.QApplication.translate("main_window", "Create a new Service", None, QtGui.QApplication.UnicodeUTF8))

View File

@ -40,7 +40,7 @@ class ServiceData(QAbstractItemModel):
Root contains a list of ServiceItems
"""
global log
log=logging.getLogger("ServiceData")
log=logging.getLogger(u'ServiceData')
def __init__(self):
QAbstractItemModel.__init__(self)
self.items=[]
@ -108,6 +108,8 @@ class ServiceManager(QWidget):
one lump.
Also handles the UI tasks of moving things up and down etc.
"""
global log
log=logging.getLogger(u'ServiceManager')
def __init__(self, parent):
QWidget.__init__(self)
@ -163,6 +165,7 @@ class ServiceManager(QWidget):
self.service_data.addRow(item)
else:
self.service_data.insertRow(row+1, item)
def removeServiceItem(self):
"""Remove currently selected item"""
pass
@ -186,3 +189,10 @@ class ServiceManager(QWidget):
oosfile.write(self.oos_as_text)
oosfile.write("# END OOS\n")
oosfile.close()
def handle_event(self, event):
"""
Handle the event contained in the event object.
"""
log.debug(u'Handle event called with event %s' %event.get_type())

View File

@ -40,9 +40,6 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
# Themes tab
self.ThemesTab = ThemesTab()
self.addTab(self.ThemesTab)
# Alerts tab
self.AlertsTab = AlertsTab()
self.addTab(self.AlertsTab)
def addTab(self, tab):
log.info(u'Inserting %s' % tab.title())

View File

@ -35,9 +35,9 @@ class BiblePlugin(Plugin):
log=logging.getLogger(u'BiblePlugin')
log.info(u'Bible Plugin loaded')
def __init__(self):
def __init__(self, plugin_helpers):
# Call the parent constructor
Plugin.__init__(self, u'Bibles', u'1.9.0')
Plugin.__init__(self, u'Bibles', u'1.9.0', plugin_helpers)
self.weight = -9
# Create the plugin icon
self.icon = QtGui.QIcon()

View File

@ -22,7 +22,7 @@ import logging
from PyQt4 import QtCore, QtGui
from openlp.core.resources import *
from openlp.core.lib import Plugin
from openlp.core.lib import Plugin, Event
from forms import EditCustomForm
from openlp.plugins.custom.lib import CustomManager, CustomTab, CustomMediaItem, CustomServiceItem
@ -32,9 +32,9 @@ class CustomPlugin(Plugin):
log=logging.getLogger(u'CustomPlugin')
log.info(u'Custom Plugin loaded')
def __init__(self, preview_controller, live_controller):
def __init__(self, plugin_helpers):
# Call the parent constructor
Plugin.__init__(self, u'Custom', u'1.9.0', preview_controller, live_controller)
Plugin.__init__(self, u'Custom', u'1.9.0', plugin_helpers)
self.weight = -5
self.custommanager = CustomManager(self.config)
self.edit_custom_form = EditCustomForm(self.custommanager)
@ -43,17 +43,16 @@ class CustomPlugin(Plugin):
self.icon.addPixmap(QtGui.QPixmap(':/media/media_custom.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.preview_service_item = CustomServiceItem(preview_controller)
self.live_service_item = CustomServiceItem(live_controller)
self.preview_service_item = CustomServiceItem(self.preview_controller)
self.live_service_item = CustomServiceItem(self.live_controller)
def get_media_manager_item(self):
# Create the CustomManagerItem object
self.media_item = CustomMediaItem(self, self.icon, u'Custom Slides')
return self.media_item
def get_settings_tab(self):
pass
def initialise(self):
pass
def handle_event(self, event):
"""
Handle the event contained in the event object.
"""
log.debug(u'Handle event called with event %s' %event.get_type())

View File

@ -31,17 +31,17 @@ class ImagePlugin(Plugin):
log=logging.getLogger(u'ImagePlugin')
log.info(u'Image Plugin loaded')
def __init__(self, preview_controller, live_controller):
def __init__(self, plugin_helpers):
# Call the parent constructor
Plugin.__init__(self, u'Images', u'1.9.0', preview_controller, live_controller)
Plugin.__init__(self, u'Images', u'1.9.0', plugin_helpers)
self.weight = -7
# Create the plugin icon
self.icon = QtGui.QIcon()
self.icon.addPixmap(QtGui.QPixmap(':/media/media_image.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.preview_service_item = ImageServiceItem(preview_controller)
self.live_service_item = ImageServiceItem(live_controller)
self.preview_service_item = ImageServiceItem(self.preview_controller)
self.live_service_item = ImageServiceItem(self.live_controller)
def get_media_manager_item(self):
# Create the MediaManagerItem object

View File

@ -28,9 +28,9 @@ from openlp.plugins.presentations.lib import PresentationMediaItem
class PresentationPlugin(Plugin):
def __init__(self):
def __init__(self, plugin_helpers):
# Call the parent constructor
Plugin.__init__(self, u'Presentations', u'1.9.0')
Plugin.__init__(self, u'Presentations', u'1.9.0', plugin_helpers)
self.weight = -8
# Create the plugin icon
self.icon = QtGui.QIcon()

View File

@ -33,9 +33,9 @@ class SongsPlugin(Plugin):
log=logging.getLogger(u'SongsPlugin')
log.info(u'Song Plugin loaded')
def __init__(self):
def __init__(self, plugin_helpers):
# Call the parent constructor
Plugin.__init__(self, u'Songs', u'1.9.0')
Plugin.__init__(self, u'Songs', u'1.9.0', plugin_helpers)
self.weight = -10
self.songmanager = SongManager(self.config)
self.openlp_import_form = OpenLPImportForm()

View File

@ -26,9 +26,9 @@ from openlp.plugins.videos.lib import VideoTab, VideoMediaItem
class VideoPlugin(Plugin):
def __init__(self):
def __init__(self, plugin_helpers):
# Call the parent constructor
Plugin.__init__(self, u'Videos', u'1.9.0')
Plugin.__init__(self, u'Videos', u'1.9.0', plugin_helpers)
self.weight = -6
# Create the plugin icon
self.icon = QtGui.QIcon()