Fix issues with plugins (inc. bug #605655)

This commit is contained in:
Jon Tibble 2010-07-31 01:05:27 +01:00
parent ee80308997
commit ab3efd2b3b
12 changed files with 14 additions and 24 deletions

View File

@ -77,7 +77,6 @@ class PluginManager(object):
startdepth = len(os.path.abspath(plugin_dir).split(os.sep)) startdepth = len(os.path.abspath(plugin_dir).split(os.sep))
log.debug(u'finding plugins in %s at depth %d', log.debug(u'finding plugins in %s at depth %d',
unicode(plugin_dir), startdepth) unicode(plugin_dir), startdepth)
for root, dirs, files in os.walk(plugin_dir): for root, dirs, files in os.walk(plugin_dir):
for name in files: for name in files:
if name.endswith(u'.py') and not name.startswith(u'__'): if name.endswith(u'.py') and not name.startswith(u'__'):

View File

@ -28,7 +28,7 @@ import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, build_icon, PluginStatus, translate from openlp.core.lib import Plugin, build_icon, translate
from openlp.core.lib.db import Manager from openlp.core.lib.db import Manager
from openlp.plugins.alerts.lib import AlertsManager, AlertsTab from openlp.plugins.alerts.lib import AlertsManager, AlertsTab
from openlp.plugins.alerts.lib.db import init_schema from openlp.plugins.alerts.lib.db import init_schema
@ -46,7 +46,6 @@ class AlertsPlugin(Plugin):
self.alertsmanager = AlertsManager(self) self.alertsmanager = AlertsManager(self)
self.manager = Manager(u'alerts', init_schema) self.manager = Manager(u'alerts', init_schema)
self.alertForm = AlertForm(self.manager, self) self.alertForm = AlertForm(self.manager, self)
self.status = PluginStatus.Active
def getSettingsTab(self): def getSettingsTab(self):
""" """

View File

@ -28,7 +28,7 @@ import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, build_icon, PluginStatus, translate from openlp.core.lib import Plugin, build_icon, translate
from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -41,8 +41,6 @@ class BiblePlugin(Plugin):
self.weight = -9 self.weight = -9
self.icon_path = u':/plugins/plugin_bibles.png' self.icon_path = u':/plugins/plugin_bibles.png'
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)
# Register the bible Manager.
self.status = PluginStatus.Active
self.manager = None self.manager = None
def initialise(self): def initialise(self):

View File

@ -28,7 +28,7 @@ import logging
from forms import EditCustomForm from forms import EditCustomForm
from openlp.core.lib import Plugin, build_icon, PluginStatus, translate from openlp.core.lib import Plugin, build_icon, translate
from openlp.core.lib.db import Manager from openlp.core.lib.db import Manager
from openlp.plugins.custom.lib import CustomMediaItem, CustomTab from openlp.plugins.custom.lib import CustomMediaItem, CustomTab
from openlp.plugins.custom.lib.db import CustomSlide, init_schema from openlp.plugins.custom.lib.db import CustomSlide, init_schema
@ -53,7 +53,6 @@ class CustomPlugin(Plugin):
self.edit_custom_form = EditCustomForm(self.custommanager) self.edit_custom_form = EditCustomForm(self.custommanager)
self.icon_path = u':/plugins/plugin_custom.png' self.icon_path = u':/plugins/plugin_custom.png'
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)
self.status = PluginStatus.Active
def getSettingsTab(self): def getSettingsTab(self):
return CustomTab(self.name) return CustomTab(self.name)

View File

@ -26,7 +26,7 @@
import logging import logging
from openlp.core.lib import Plugin, build_icon, PluginStatus, translate from openlp.core.lib import Plugin, build_icon, translate
from openlp.plugins.images.lib import ImageMediaItem from openlp.plugins.images.lib import ImageMediaItem
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -39,7 +39,6 @@ class ImagePlugin(Plugin):
self.weight = -7 self.weight = -7
self.icon_path = u':/plugins/plugin_images.png' self.icon_path = u':/plugins/plugin_images.png'
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)
self.status = PluginStatus.Active
def getMediaManagerItem(self): def getMediaManagerItem(self):
# Create the MediaManagerItem object # Create the MediaManagerItem object

View File

@ -28,7 +28,7 @@ import logging
from PyQt4.phonon import Phonon from PyQt4.phonon import Phonon
from openlp.core.lib import Plugin, build_icon, PluginStatus, translate from openlp.core.lib import Plugin, build_icon, translate
from openlp.plugins.media.lib import MediaMediaItem from openlp.plugins.media.lib import MediaMediaItem
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -43,7 +43,6 @@ class MediaPlugin(Plugin):
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)
# passed with drag and drop messages # passed with drag and drop messages
self.dnd_id = u'Media' self.dnd_id = u'Media'
self.status = PluginStatus.Active
self.audio_list = u'' self.audio_list = u''
self.video_list = u'' self.video_list = u''
for mimetype in Phonon.BackendCapabilities.availableMimeTypes(): for mimetype in Phonon.BackendCapabilities.availableMimeTypes():

View File

@ -69,8 +69,8 @@ class ImpressController(PresentationController):
""" """
log.debug(u'Initialising') log.debug(u'Initialising')
PresentationController.__init__(self, plugin, u'Impress') PresentationController.__init__(self, plugin, u'Impress')
self.supports = [u'.odp'] self.supports = [u'odp']
self.alsosupports = [u'.ppt', u'.pps', u'.pptx', u'.ppsx'] self.alsosupports = [u'ppt', u'pps', u'pptx', u'ppsx']
self.process = None self.process = None
self.desktop = None self.desktop = None
self.manager = None self.manager = None

View File

@ -79,7 +79,6 @@ class PresentationMediaItem(MediaManagerItem):
'Select Presentation(s)') 'Select Presentation(s)')
self.Automatic = translate('PresentationPlugin.MediaItem', self.Automatic = translate('PresentationPlugin.MediaItem',
'Automatic') 'Automatic')
self.buildFileMaskString()
def buildFileMaskString(self): def buildFileMaskString(self):
""" """
@ -92,7 +91,7 @@ class PresentationMediaItem(MediaManagerItem):
self.controllers[controller].alsosupports self.controllers[controller].alsosupports
for type in types: for type in types:
if fileType.find(type) == -1: if fileType.find(type) == -1:
fileType += u'*%s ' % type fileType += u'*.%s ' % type
self.parent.serviceManager.supportedSuffixes(type) self.parent.serviceManager.supportedSuffixes(type)
self.OnNewFileMasks = translate('PresentationPlugin.MediaItem', self.OnNewFileMasks = translate('PresentationPlugin.MediaItem',
'Presentations (%s)' % fileType) 'Presentations (%s)' % fileType)
@ -288,7 +287,7 @@ class PresentationMediaItem(MediaManagerItem):
"supports" the extension. If none found, then look for a controller "supports" the extension. If none found, then look for a controller
which "alsosupports" it instead. which "alsosupports" it instead.
""" """
filetype = os.path.splitext(filename)[1] filetype = filename.split(u'.')[1]
if not filetype: if not filetype:
return None return None
for controller in self.controllers: for controller in self.controllers:

View File

@ -54,7 +54,7 @@ class PowerpointController(PresentationController):
""" """
log.debug(u'Initialising') log.debug(u'Initialising')
PresentationController.__init__(self, plugin, u'Powerpoint') PresentationController.__init__(self, plugin, u'Powerpoint')
self.supports = [u'.ppt', u'.pps', u'.pptx', u'.ppsx'] self.supports = [u'ppt', u'pps', u'pptx', u'ppsx']
self.process = None self.process = None
def check_available(self): def check_available(self):

View File

@ -50,7 +50,7 @@ class PptviewController(PresentationController):
log.debug(u'Initialising') log.debug(u'Initialising')
self.process = None self.process = None
PresentationController.__init__(self, plugin, u'Powerpoint Viewer') PresentationController.__init__(self, plugin, u'Powerpoint Viewer')
self.supports = [u'.ppt', u'.pps', u'.pptx', u'.ppsx'] self.supports = [u'ppt', u'pps', u'pptx', u'ppsx']
def check_available(self): def check_available(self):
""" """

View File

@ -30,7 +30,7 @@ presentations from a variety of document formats.
import os import os
import logging import logging
from openlp.core.lib import Plugin, build_icon, PluginStatus, translate from openlp.core.lib import Plugin, build_icon, translate
from openlp.core.utils import AppLocation from openlp.core.utils import AppLocation
from openlp.plugins.presentations.lib import PresentationController, \ from openlp.plugins.presentations.lib import PresentationController, \
PresentationMediaItem, PresentationTab PresentationMediaItem, PresentationTab
@ -55,7 +55,6 @@ class PresentationPlugin(Plugin):
self.weight = -8 self.weight = -8
self.icon_path = u':/plugins/plugin_presentations.png' self.icon_path = u':/plugins/plugin_presentations.png'
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)
self.status = PluginStatus.Active
def getSettingsTab(self): def getSettingsTab(self):
""" """
@ -74,6 +73,7 @@ class PresentationPlugin(Plugin):
for controller in self.controllers: for controller in self.controllers:
if self.controllers[controller].enabled(): if self.controllers[controller].enabled():
self.controllers[controller].start_process() self.controllers[controller].start_process()
self.mediaItem.buildFileMaskString()
def finalise(self): def finalise(self):
""" """

View File

@ -28,8 +28,7 @@ import logging
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, build_icon, PluginStatus, Receiver, \ from openlp.core.lib import Plugin, build_icon, Receiver, translate
translate
from openlp.core.lib.db import Manager from openlp.core.lib.db import Manager
from openlp.plugins.songs.lib import OpenLPSongImport, SongMediaItem, SongsTab from openlp.plugins.songs.lib import OpenLPSongImport, SongMediaItem, SongsTab
from openlp.plugins.songs.lib.db import init_schema, Song from openlp.plugins.songs.lib.db import init_schema, Song
@ -63,7 +62,6 @@ class SongsPlugin(Plugin):
self.manager = Manager(u'songs', init_schema) self.manager = Manager(u'songs', init_schema)
self.icon_path = u':/plugins/plugin_songs.png' self.icon_path = u':/plugins/plugin_songs.png'
self.icon = build_icon(self.icon_path) self.icon = build_icon(self.icon_path)
self.status = PluginStatus.Active
def getSettingsTab(self): def getSettingsTab(self):
return SongsTab(self.name) return SongsTab(self.name)