forked from openlp/openlp
HEAD
This commit is contained in:
commit
96ad03e753
@ -184,9 +184,8 @@ class OpenLP(QtGui.QApplication):
|
|||||||
# make sure Qt really display the splash screen
|
# make sure Qt really display the splash screen
|
||||||
self.processEvents()
|
self.processEvents()
|
||||||
# start the main app window
|
# start the main app window
|
||||||
self.appClipboard = self.clipboard()
|
self.mainWindow = MainWindow(screens, app_version, self.clipboard(),
|
||||||
self.mainWindow = MainWindow(screens, app_version, self.appClipboard,
|
not has_run_wizard)
|
||||||
has_run_wizard)
|
|
||||||
self.mainWindow.show()
|
self.mainWindow.show()
|
||||||
if show_splash:
|
if show_splash:
|
||||||
# now kill the splashscreen
|
# now kill the splashscreen
|
||||||
|
@ -49,16 +49,13 @@ class PluginManager(object):
|
|||||||
``plugin_dir``
|
``plugin_dir``
|
||||||
The directory to search for plugins.
|
The directory to search for plugins.
|
||||||
"""
|
"""
|
||||||
log.info(u'Plugin manager initing')
|
log.info(u'Plugin manager Initialising')
|
||||||
if not plugin_dir in sys.path:
|
if not plugin_dir in sys.path:
|
||||||
log.debug(u'Inserting %s into sys.path', plugin_dir)
|
log.debug(u'Inserting %s into sys.path', plugin_dir)
|
||||||
sys.path.insert(0, plugin_dir)
|
sys.path.insert(0, plugin_dir)
|
||||||
self.basepath = os.path.abspath(plugin_dir)
|
self.basepath = os.path.abspath(plugin_dir)
|
||||||
log.debug(u'Base path %s ', self.basepath)
|
log.debug(u'Base path %s ', self.basepath)
|
||||||
self.plugin_helpers = []
|
|
||||||
self.plugins = []
|
self.plugins = []
|
||||||
# this has to happen after the UI is sorted
|
|
||||||
# self.find_plugins(plugin_dir)
|
|
||||||
log.info(u'Plugin manager Initialised')
|
log.info(u'Plugin manager Initialised')
|
||||||
|
|
||||||
def find_plugins(self, plugin_dir, plugin_helpers):
|
def find_plugins(self, plugin_dir, plugin_helpers):
|
||||||
@ -73,7 +70,7 @@ class PluginManager(object):
|
|||||||
A list of helper objects to pass to the plugins.
|
A list of helper objects to pass to the plugins.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self.plugin_helpers = plugin_helpers
|
log.info(u'Finding plugins')
|
||||||
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)
|
||||||
@ -102,11 +99,11 @@ class PluginManager(object):
|
|||||||
plugin_objects = []
|
plugin_objects = []
|
||||||
for p in plugin_classes:
|
for p in plugin_classes:
|
||||||
try:
|
try:
|
||||||
plugin = p(self.plugin_helpers)
|
plugin = p(plugin_helpers)
|
||||||
log.debug(u'Loaded plugin %s with helpers', unicode(p))
|
log.debug(u'Loaded plugin %s', unicode(p))
|
||||||
plugin_objects.append(plugin)
|
plugin_objects.append(plugin)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
log.exception(u'loaded plugin %s has no helpers', unicode(p))
|
log.exception(u'Failed to load plugin %s', unicode(p))
|
||||||
plugins_list = sorted(plugin_objects, self.order_by_weight)
|
plugins_list = sorted(plugin_objects, self.order_by_weight)
|
||||||
for plugin in plugins_list:
|
for plugin in plugins_list:
|
||||||
if plugin.checkPreConditions():
|
if plugin.checkPreConditions():
|
||||||
@ -203,6 +200,7 @@ class PluginManager(object):
|
|||||||
Loop through all the plugins and give them an opportunity to
|
Loop through all the plugins and give them an opportunity to
|
||||||
initialise themselves.
|
initialise themselves.
|
||||||
"""
|
"""
|
||||||
|
log.info(u'Initialise Plugins - Started')
|
||||||
for plugin in self.plugins:
|
for plugin in self.plugins:
|
||||||
log.info(u'initialising plugins %s in a %s state'
|
log.info(u'initialising plugins %s in a %s state'
|
||||||
% (plugin.name, plugin.isActive()))
|
% (plugin.name, plugin.isActive()))
|
||||||
@ -211,6 +209,7 @@ class PluginManager(object):
|
|||||||
log.info(u'Initialisation Complete for %s ' % plugin.name)
|
log.info(u'Initialisation Complete for %s ' % plugin.name)
|
||||||
if not plugin.isActive():
|
if not plugin.isActive():
|
||||||
plugin.removeToolboxItem()
|
plugin.removeToolboxItem()
|
||||||
|
log.info(u'Initialise Plugins - Finished')
|
||||||
|
|
||||||
def finalise_plugins(self):
|
def finalise_plugins(self):
|
||||||
"""
|
"""
|
||||||
|
@ -48,7 +48,7 @@ class OpenLPToolbar(QtGui.QToolBar):
|
|||||||
self.icons = {}
|
self.icons = {}
|
||||||
self.setIconSize(QtCore.QSize(20, 20))
|
self.setIconSize(QtCore.QSize(20, 20))
|
||||||
self.actions = {}
|
self.actions = {}
|
||||||
log.debug(u'Init done')
|
log.debug(u'Init done for %s' % parent.__class__.__name__)
|
||||||
|
|
||||||
def addToolbarButton(self, title, icon, tooltip=None, slot=None,
|
def addToolbarButton(self, title, icon, tooltip=None, slot=None,
|
||||||
checkable=False, shortcut=0, alternate=0,
|
checkable=False, shortcut=0, alternate=0,
|
||||||
|
@ -178,8 +178,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||||||
"""
|
"""
|
||||||
Prepare the UI for the process.
|
Prepare the UI for the process.
|
||||||
"""
|
"""
|
||||||
# We start on 9 for the 9 plugins
|
# We start on 2 for plugins status setting plus a "finished" point.
|
||||||
max_progress = 9
|
max_progress = 2
|
||||||
# Loop through the songs list and increase for each selected item
|
# Loop through the songs list and increase for each selected item
|
||||||
for i in xrange(self.songsListWidget.count()):
|
for i in xrange(self.songsListWidget.count()):
|
||||||
if self.songsListWidget.item(i).checkState() == QtCore.Qt.Checked:
|
if self.songsListWidget.item(i).checkState() == QtCore.Qt.Checked:
|
||||||
@ -209,6 +209,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||||||
self.finishButton.setEnabled(True)
|
self.finishButton.setEnabled(True)
|
||||||
self.cancelButton.setVisible(False)
|
self.cancelButton.setVisible(False)
|
||||||
self.nextButton.setVisible(False)
|
self.nextButton.setVisible(False)
|
||||||
|
self.progressLabel.setText(translate('OpenLP.FirstTimeWizard',
|
||||||
|
'Download complete. Click the finish button to start OpenLP.'))
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
|
|
||||||
def _performWizard(self):
|
def _performWizard(self):
|
||||||
@ -219,21 +221,13 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||||||
self._incrementProgressBar(translate('OpenLP.FirstTimeWizard',
|
self._incrementProgressBar(translate('OpenLP.FirstTimeWizard',
|
||||||
'Enabling selected plugins...'))
|
'Enabling selected plugins...'))
|
||||||
self._setPluginStatus(self.songsCheckBox, u'songs/status')
|
self._setPluginStatus(self.songsCheckBox, u'songs/status')
|
||||||
self._incrementProgressBar(None)
|
|
||||||
self._setPluginStatus(self.bibleCheckBox, u'bibles/status')
|
self._setPluginStatus(self.bibleCheckBox, u'bibles/status')
|
||||||
self._incrementProgressBar(None)
|
|
||||||
self._setPluginStatus(self.presentationCheckBox, u'presentations/status')
|
self._setPluginStatus(self.presentationCheckBox, u'presentations/status')
|
||||||
self._incrementProgressBar(None)
|
|
||||||
self._setPluginStatus(self.imageCheckBox, u'images/status')
|
self._setPluginStatus(self.imageCheckBox, u'images/status')
|
||||||
self._incrementProgressBar(None)
|
|
||||||
self._setPluginStatus(self.mediaCheckBox, u'media/status')
|
self._setPluginStatus(self.mediaCheckBox, u'media/status')
|
||||||
self._incrementProgressBar(None)
|
|
||||||
self._setPluginStatus(self.remoteCheckBox, u'remotes/status')
|
self._setPluginStatus(self.remoteCheckBox, u'remotes/status')
|
||||||
self._incrementProgressBar(None)
|
|
||||||
self._setPluginStatus(self.customCheckBox, u'custom/status')
|
self._setPluginStatus(self.customCheckBox, u'custom/status')
|
||||||
self._incrementProgressBar(None)
|
|
||||||
self._setPluginStatus(self.songUsageCheckBox, u'songusage/status')
|
self._setPluginStatus(self.songUsageCheckBox, u'songusage/status')
|
||||||
self._incrementProgressBar(None)
|
|
||||||
self._setPluginStatus(self.alertCheckBox, u'alerts/status')
|
self._setPluginStatus(self.alertCheckBox, u'alerts/status')
|
||||||
# Build directories for downloads
|
# Build directories for downloads
|
||||||
songs_destination = AppLocation.get_section_data_path(u'songs')
|
songs_destination = AppLocation.get_section_data_path(u'songs')
|
||||||
|
@ -45,6 +45,18 @@ 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.additional_extensions = {
|
||||||
|
u'audio/ac3': [u'.ac3'],
|
||||||
|
u'audio/flac': [u'.flac'],
|
||||||
|
u'audio/x-m4a': [u'.m4a'],
|
||||||
|
u'audio/x-mp3': [u'.mp3'],
|
||||||
|
u'audio/mpeg': [u'.mp3', u'.mp2', u'.mpga', u'.mpega', u'.m4a'],
|
||||||
|
u'audio/qcelp': [u'.qcp'],
|
||||||
|
u'audio/x-wma': [u'.wma'],
|
||||||
|
u'audio/x-ms-wma': [u'.wma'],
|
||||||
|
u'video/x-matroska': [u'.mpv', u'.mkv'],
|
||||||
|
u'video/x-wmv': [u'.wmv'],
|
||||||
|
u'video/x-ms-wmv': [u'.wmv']}
|
||||||
self.audio_extensions_list = []
|
self.audio_extensions_list = []
|
||||||
self.video_extensions_list = []
|
self.video_extensions_list = []
|
||||||
mimetypes.init()
|
mimetypes.init()
|
||||||
@ -65,6 +77,17 @@ class MediaPlugin(Plugin):
|
|||||||
self.serviceManager.supportedSuffixes(extension[1:])
|
self.serviceManager.supportedSuffixes(extension[1:])
|
||||||
log.info(u'MediaPlugin: %s extensions: %s' % (mimetype,
|
log.info(u'MediaPlugin: %s extensions: %s' % (mimetype,
|
||||||
u' '.join(extensions)))
|
u' '.join(extensions)))
|
||||||
|
# Add extensions for this mimetype from self.additional_extensions.
|
||||||
|
# This hack clears mimetypes' and operating system's shortcomings
|
||||||
|
# by providing possibly missing extensions.
|
||||||
|
if mimetype in self.additional_extensions.keys():
|
||||||
|
for extension in self.additional_extensions[mimetype]:
|
||||||
|
ext = u'*%s' % extension
|
||||||
|
if ext not in list:
|
||||||
|
list.append(ext)
|
||||||
|
self.serviceManager.supportedSuffixes(extension[1:])
|
||||||
|
log.info(u'MediaPlugin: %s additional extensions: %s' % (mimetype,
|
||||||
|
u' '.join(self.additional_extensions[mimetype])))
|
||||||
|
|
||||||
def about(self):
|
def about(self):
|
||||||
about_text = translate('MediaPlugin', '<strong>Media Plugin</strong>'
|
about_text = translate('MediaPlugin', '<strong>Media Plugin</strong>'
|
||||||
|
Loading…
Reference in New Issue
Block a user