Add new thread at startup time

This commit is contained in:
Tim Bentley 2011-04-30 08:42:20 +01:00
parent 9a88a7fcf7
commit 3b805f6374
3 changed files with 16 additions and 5 deletions

View File

@ -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()
main()

View File

@ -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')

View File

@ -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))