forked from openlp/openlp
Fix mimetype issues
bzr-revno: 1109 Fixes: https://launchpad.net/bugs/657465
This commit is contained in:
commit
a1d2e8390b
@ -602,7 +602,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
QtCore.QObject.connect(self.FileSaveAsItem,
|
QtCore.QObject.connect(self.FileSaveAsItem,
|
||||||
QtCore.SIGNAL(u'triggered()'),
|
QtCore.SIGNAL(u'triggered()'),
|
||||||
self.ServiceManagerContents.onSaveService)
|
self.ServiceManagerContents.onSaveService)
|
||||||
#i18n set signals for languages
|
# i18n set signals for languages
|
||||||
QtCore.QObject.connect(self.AutoLanguageItem,
|
QtCore.QObject.connect(self.AutoLanguageItem,
|
||||||
QtCore.SIGNAL(u'toggled(bool)'), self.setAutoLanguage)
|
QtCore.SIGNAL(u'toggled(bool)'), self.setAutoLanguage)
|
||||||
self.LanguageGroup.triggered.connect(LanguageManager.set_language)
|
self.LanguageGroup.triggered.connect(LanguageManager.set_language)
|
||||||
@ -622,15 +622,15 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
QtCore.SIGNAL(u'config_screen_changed'), self.screenChanged)
|
QtCore.SIGNAL(u'config_screen_changed'), self.screenChanged)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'maindisplay_status_text'), self.showStatusMessage)
|
QtCore.SIGNAL(u'maindisplay_status_text'), self.showStatusMessage)
|
||||||
#warning cyclic dependency
|
# warning cyclic dependency
|
||||||
#RenderManager needs to call ThemeManager and
|
# RenderManager needs to call ThemeManager and
|
||||||
#ThemeManager needs to call RenderManager
|
# ThemeManager needs to call RenderManager
|
||||||
self.RenderManager = RenderManager(
|
self.RenderManager = RenderManager(
|
||||||
self.ThemeManagerContents, self.screens)
|
self.ThemeManagerContents, self.screens)
|
||||||
#Define the media Dock Manager
|
# Define the media Dock Manager
|
||||||
self.mediaDockManager = MediaDockManager(self.MediaToolBox)
|
self.mediaDockManager = MediaDockManager(self.MediaToolBox)
|
||||||
log.info(u'Load Plugins')
|
log.info(u'Load Plugins')
|
||||||
#make the controllers available to the plugins
|
# make the controllers available to the plugins
|
||||||
self.plugin_helpers[u'preview'] = self.PreviewController
|
self.plugin_helpers[u'preview'] = self.PreviewController
|
||||||
self.plugin_helpers[u'live'] = self.LiveController
|
self.plugin_helpers[u'live'] = self.LiveController
|
||||||
self.plugin_helpers[u'render'] = self.RenderManager
|
self.plugin_helpers[u'render'] = self.RenderManager
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import mimetypes
|
||||||
|
|
||||||
from PyQt4.phonon import Phonon
|
from PyQt4.phonon import Phonon
|
||||||
|
|
||||||
@ -45,6 +46,7 @@ class MediaPlugin(Plugin):
|
|||||||
self.dnd_id = u'Media'
|
self.dnd_id = u'Media'
|
||||||
self.audio_list = u''
|
self.audio_list = u''
|
||||||
self.video_list = u''
|
self.video_list = u''
|
||||||
|
mimetypes.init()
|
||||||
for mimetype in Phonon.BackendCapabilities.availableMimeTypes():
|
for mimetype in Phonon.BackendCapabilities.availableMimeTypes():
|
||||||
mimetype = unicode(mimetype)
|
mimetype = unicode(mimetype)
|
||||||
type = mimetype.split(u'audio/x-')
|
type = mimetype.split(u'audio/x-')
|
||||||
@ -60,13 +62,18 @@ class MediaPlugin(Plugin):
|
|||||||
self.video_list, mimetype = self._addToList(self.video_list,
|
self.video_list, mimetype = self._addToList(self.video_list,
|
||||||
type, mimetype)
|
type, mimetype)
|
||||||
|
|
||||||
def _addToList(self, list, value, type):
|
def _addToList(self, list, value, mimetype):
|
||||||
|
# Is it a media type
|
||||||
if len(value) == 2:
|
if len(value) == 2:
|
||||||
if list.find(value[1]) == -1:
|
extensions = mimetypes.guess_all_extensions(unicode(mimetype))
|
||||||
list += u'*.%s ' % value[1]
|
# we have an extension
|
||||||
self.serviceManager.supportedSuffixes(value[1])
|
if extensions:
|
||||||
type = u''
|
for extension in extensions:
|
||||||
return list, type
|
if list.find(extension) == -1:
|
||||||
|
list += u'*%s ' % extension
|
||||||
|
self.serviceManager.supportedSuffixes(extension[1:])
|
||||||
|
mimetype = u''
|
||||||
|
return list, mimetype
|
||||||
|
|
||||||
def getSettingsTab(self):
|
def getSettingsTab(self):
|
||||||
return MediaTab(self.name)
|
return MediaTab(self.name)
|
||||||
@ -97,42 +104,42 @@ class MediaPlugin(Plugin):
|
|||||||
## Load Button ##
|
## Load Button ##
|
||||||
self.textStrings[StringContent.Load] = {
|
self.textStrings[StringContent.Load] = {
|
||||||
u'title': translate('MediaPlugin', 'Load'),
|
u'title': translate('MediaPlugin', 'Load'),
|
||||||
u'tooltip': translate('MediaPlugin',
|
u'tooltip': translate('MediaPlugin',
|
||||||
'Load a new Media')
|
'Load a new Media')
|
||||||
}
|
}
|
||||||
## New Button ##
|
## New Button ##
|
||||||
self.textStrings[StringContent.New] = {
|
self.textStrings[StringContent.New] = {
|
||||||
u'title': translate('MediaPlugin', 'Add'),
|
u'title': translate('MediaPlugin', 'Add'),
|
||||||
u'tooltip': translate('MediaPlugin',
|
u'tooltip': translate('MediaPlugin',
|
||||||
'Add a new Media')
|
'Add a new Media')
|
||||||
}
|
}
|
||||||
## Edit Button ##
|
## Edit Button ##
|
||||||
self.textStrings[StringContent.Edit] = {
|
self.textStrings[StringContent.Edit] = {
|
||||||
u'title': translate('MediaPlugin', 'Edit'),
|
u'title': translate('MediaPlugin', 'Edit'),
|
||||||
u'tooltip': translate('MediaPlugin',
|
u'tooltip': translate('MediaPlugin',
|
||||||
'Edit the selected Media')
|
'Edit the selected Media')
|
||||||
}
|
}
|
||||||
## Delete Button ##
|
## Delete Button ##
|
||||||
self.textStrings[StringContent.Delete] = {
|
self.textStrings[StringContent.Delete] = {
|
||||||
u'title': translate('MediaPlugin', 'Delete'),
|
u'title': translate('MediaPlugin', 'Delete'),
|
||||||
u'tooltip': translate('MediaPlugin',
|
u'tooltip': translate('MediaPlugin',
|
||||||
'Delete the selected Media')
|
'Delete the selected Media')
|
||||||
}
|
}
|
||||||
## Preview ##
|
## Preview ##
|
||||||
self.textStrings[StringContent.Preview] = {
|
self.textStrings[StringContent.Preview] = {
|
||||||
u'title': translate('MediaPlugin', 'Preview'),
|
u'title': translate('MediaPlugin', 'Preview'),
|
||||||
u'tooltip': translate('MediaPlugin',
|
u'tooltip': translate('MediaPlugin',
|
||||||
'Preview the selected Media')
|
'Preview the selected Media')
|
||||||
}
|
}
|
||||||
## Live Button ##
|
## Live Button ##
|
||||||
self.textStrings[StringContent.Live] = {
|
self.textStrings[StringContent.Live] = {
|
||||||
u'title': translate('MediaPlugin', 'Live'),
|
u'title': translate('MediaPlugin', 'Live'),
|
||||||
u'tooltip': translate('MediaPlugin',
|
u'tooltip': translate('MediaPlugin',
|
||||||
'Send the selected Media live')
|
'Send the selected Media live')
|
||||||
}
|
}
|
||||||
## Add to service Button ##
|
## Add to service Button ##
|
||||||
self.textStrings[StringContent.Service] = {
|
self.textStrings[StringContent.Service] = {
|
||||||
u'title': translate('MediaPlugin', 'Service'),
|
u'title': translate('MediaPlugin', 'Service'),
|
||||||
u'tooltip': translate('MediaPlugin',
|
u'tooltip': translate('MediaPlugin',
|
||||||
'Add the selected Media to the service')
|
'Add the selected Media to the service')
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user