service loading prefix check

This commit is contained in:
Tim Bentley 2010-05-05 19:07:57 +01:00
parent e1f97fc9b9
commit a8bbd540d4
3 changed files with 9 additions and 3 deletions

View File

@ -101,6 +101,7 @@ class ServiceManager(QtGui.QWidget):
self.parent = parent
self.serviceItems = []
self.serviceName = u''
self.suffixes = u''
self.droppos = 0
#is a new service and has not been saved
self.isNew = True
@ -228,6 +229,9 @@ class ServiceManager(QtGui.QWidget):
self.themeMenu = QtGui.QMenu(self.trUtf8(u'&Change Item Theme'))
self.menu.addMenu(self.themeMenu)
def supportedSuffixes(self, suffix):
self.suffixes = u'%s %s' % (self.suffixes, suffix)
def contextMenu(self, point):
item = self.ServiceManagerList.itemAt(point)
if item is None:
@ -678,10 +682,9 @@ class ServiceManager(QtGui.QWidget):
Validates the service item and if the suffix matches an accepted
one it allows the item to be displayed
"""
print serviceItem.title
if serviceItem.is_command():
type = serviceItem._raw_frames[0][u'title'].split(u'.')[1]
if type not in ['odp']:
if type not in self.suffixes:
serviceItem.isValid = False
def cleanUp(self):

View File

@ -45,7 +45,6 @@ class MediaPlugin(Plugin):
self.video_list = u''
for mimetype in Phonon.BackendCapabilities.availableMimeTypes():
mimetype = unicode(mimetype)
print mimetype
type = mimetype.split(u'audio/x-')
self.audio_list, mimetype = self._add_to_list(self.audio_list, type, mimetype)
type = mimetype.split(u'audio/')
@ -54,6 +53,8 @@ class MediaPlugin(Plugin):
self.video_list, mimetype = self._add_to_list(self.video_list, type, mimetype)
type = mimetype.split(u'video/')
self.video_list, mimetype = self._add_to_list(self.video_list, type, mimetype)
self.service_manager.supportedSuffixes(self.audio_list)
self.service_manager.supportedSuffixes(self.video_list)
def _add_to_list(self, list, value, type):
if len(value) == 2:

View File

@ -75,6 +75,8 @@ class PresentationMediaItem(MediaManagerItem):
if fileType.find(type) == -1:
fileType += u'*%s ' % type
self.OnNewFileMasks = self.trUtf8('Presentations (%s)' % fileType)
self.parent.service_manager.supportedSuffixes(fileType)
def requiredIcons(self):
MediaManagerItem.requiredIcons(self)