From 3b805f63748f6e3014e89a67fa1be05c7a872481 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 30 Apr 2011 08:42:20 +0100 Subject: [PATCH] Add new thread at startup time --- openlp.pyw | 5 +++-- openlp/core/utils/__init__.py | 13 +++++++++++++ openlp/plugins/media/lib/mediaitem.py | 3 --- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index 425d3c874..0d4e8c200 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -46,7 +46,7 @@ from openlp.core.ui.firsttimeform import FirstTimeForm from openlp.core.ui.exceptionform import ExceptionForm from openlp.core.ui import SplashScreen, ScreenList from openlp.core.utils import AppLocation, LanguageManager, VersionThread, \ - get_application_version + get_application_version, DelayStartThread log = logging.getLogger() @@ -130,6 +130,7 @@ class OpenLP(QtGui.QApplication): u'general/update check', QtCore.QVariant(True)).toBool() if update_check: VersionThread(self.mainWindow).start() + DelayStartThread(self.mainWindow).start() return self.exec_() def isAlreadyRunning(self): @@ -250,4 +251,4 @@ if __name__ == u'__main__': """ Instantiate and run the application. """ - main() \ No newline at end of file + main() diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index d08a63c4b..3051301d6 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -99,6 +99,19 @@ class VersionThread(QtCore.QThread): local_version.get(u'revision') and \ remote_version[u'revision'] > local_version[u'revision']: Receiver.send_message(u'openlp_version_check', u'%s' % version) + + +class DelayStartThread(QtCore.QThread): + """ + A special Qt thread class to build things after OpenLP has started + """ + def __init__(self, parent): + QtCore.QThread.__init__(self, parent) + + def run(self): + """ + Run the thread. + """ Receiver.send_message(u'openlp_phonon_creation') diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 70c2bf304..e494b9e5e 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -132,9 +132,6 @@ class MediaMediaItem(MediaManagerItem): unicode(translate('MediaPlugin.MediaItem', 'The file %s no longer exists.')) % filename) return False - # Guard incase the event fails to get object created. - if not self.mediaObject: - self.mediaObject = Phonon.MediaObject(self) self.mediaObject.stop() self.mediaObject.clearQueue() self.mediaObject.setCurrentSource(Phonon.MediaSource(filename))