Cleanup code and fixes

bzr-revno: 558
This commit is contained in:
Jon Tibble 2009-09-20 13:19:47 +01:00
commit 483020e2f4
4 changed files with 15 additions and 10 deletions

View File

@ -85,7 +85,8 @@ class PluginManager(object):
modulename = modulename[len(prefix) + 1:] modulename = modulename[len(prefix) + 1:]
modulename = modulename.replace(os.path.sep, '.') modulename = modulename.replace(os.path.sep, '.')
# import the modules # import the modules
log.debug(u'Importing %s from %s. Depth %d', modulename, path, thisdepth) log.debug(u'Importing %s from %s. Depth %d',
modulename, path, thisdepth)
try: try:
__import__(modulename, globals(), locals(), []) __import__(modulename, globals(), locals(), [])
except ImportError, e: except ImportError, e:
@ -131,8 +132,10 @@ class PluginManager(object):
if plugin.status == PluginStatus.Active: if plugin.status == PluginStatus.Active:
media_manager_item = plugin.get_media_manager_item() media_manager_item = plugin.get_media_manager_item()
if media_manager_item is not None: if media_manager_item is not None:
log.debug(u'Inserting media manager item from %s' % plugin.name) log.debug(u'Inserting media manager item from %s' % \
mediatoolbox.addItem(media_manager_item, plugin.icon, media_manager_item.title) plugin.name)
mediatoolbox.addItem(media_manager_item, plugin.icon,
media_manager_item.title)
def hook_settings_tabs(self, settingsform=None): def hook_settings_tabs(self, settingsform=None):
""" """

View File

@ -31,7 +31,7 @@ from PyQt4 import QtGui, QtCore
class Renderer(object): class Renderer(object):
""" """
Genarates a pixmap image of a array of text. The Text is formatted to Genarates a pixmap image of a array of text. The Text is formatted to
make sure it fits on the screen and if not extra frames a generated. make sure it fits on the screen and if not extra frames are generated.
""" """
global log global log
log = logging.getLogger(u'Renderer') log = logging.getLogger(u'Renderer')

View File

@ -629,23 +629,25 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
if ret == QtGui.QMessageBox.Save: if ret == QtGui.QMessageBox.Save:
self.ServiceManagerContents.onSaveService() self.ServiceManagerContents.onSaveService()
self.mainDisplay.close() self.mainDisplay.close()
self.ServiceManagerContents.cleanUp()
self.cleanUp() self.cleanUp()
event.accept() event.accept()
elif ret == QtGui.QMessageBox.Discard: elif ret == QtGui.QMessageBox.Discard:
self.mainDisplay.close() self.mainDisplay.close()
self.ServiceManagerContents.cleanUp()
self.cleanUp() self.cleanUp()
event.accept() event.accept()
else: else:
event.ignore() event.ignore()
else: else:
self.mainDisplay.close() self.mainDisplay.close()
self.ServiceManagerContents.cleanUp()
self.cleanUp() self.cleanUp()
event.accept() event.accept()
def cleanUp(self): def cleanUp(self):
"""
Runs all the cleanup code before OpenLP shuts down
"""
# Clean temporary files used by services
self.ServiceManagerContents.cleanUp()
# Call the cleanup method to shutdown plugins. # Call the cleanup method to shutdown plugins.
log.info(u'cleanup plugins') log.info(u'cleanup plugins')
self.plugin_manager.finalise_plugins() self.plugin_manager.finalise_plugins()

View File

@ -21,7 +21,7 @@ be able to:
* Render their display (on the projection screen and in a "shrunken form" * Render their display (on the projection screen and in a "shrunken form"
for preview purposes) for preview purposes)
These plugins need to be part of an service. This means they need to These plugins need to be part of a service. This means they need to
* Be able to tell the service manager code what to put in the service for their * Be able to tell the service manager code what to put in the service for their
"bit" "bit"
* Have a "tab" in the media manager, which they can render on request * Have a "tab" in the media manager, which they can render on request
@ -47,7 +47,7 @@ Funnily enough, the core lyrics engine fits those requirements, so could
actually form a plugin... actually form a plugin...
Each service entry may be made up of multiple plugins (to do text on video), so Each service entry may be made up of multiple plugins (to do text on video), so
each plugin that contributes to an service item will need a "layering" each plugin that contributes to a service item will need a "layering"
priority. priority.
Plugin management Plugin management
@ -62,7 +62,7 @@ These plugins are then queried for their capabilities/requirements and
spaces made in the prefs UI as required, and in the media manager. spaces made in the prefs UI as required, and in the media manager.
The service manager can find out what plugins it has available (we need to The service manager can find out what plugins it has available (we need to
report missing plugins when an service is loaded). report missing plugins when a service is loaded).
The display manager will get a ref to a/some plugin(s) from the service The display manager will get a ref to a/some plugin(s) from the service
manager when each service item is made live, and can then call on each to manager when each service item is made live, and can then call on each to