This commit is contained in:
Tim Bentley 2011-05-01 14:55:17 +01:00
commit b91a932c62
8 changed files with 36 additions and 15 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

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

@ -71,7 +71,7 @@ class Renderer(object):
log.debug(u'Initilisation started')
self.screens = screens
self.image_manager = ImageManager()
self.display = MainDisplay(self, screens, False, False)
self.display = MainDisplay(self, screens, False)
self.display.imageManager = self.image_manager
self.theme_manager = theme_manager
self.service_theme = u''

View File

@ -60,12 +60,11 @@ class MainDisplay(DisplayWidget):
"""
This is the display screen.
"""
def __init__(self, parent, screens, live, needsPhonon=True):
def __init__(self, parent, screens, live):
DisplayWidget.__init__(self, live, parent=None)
self.parent = parent
self.screens = screens
self.isLive = live
self.needsPhonon = needsPhonon
self.alertTab = None
self.hideMode = None
self.videoHide = False

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

@ -215,6 +215,6 @@ class MediaMediaItem(MediaManagerItem):
self.listView.addItem(item_name)
def createPhonon(self):
log.debug(u'CreatePhonon')
if not self.mediaObject:
self.mediaObject = Phonon.MediaObject(self)

View File

@ -219,7 +219,6 @@ class ImpressDocument(PresentationDocument):
The file name of the presentatios to the run.
"""
log.debug(u'Load Presentation OpenOffice')
#print "s.dsk1 ", self.desktop
if os.name == u'nt':
desktop = self.controller.get_com_desktop()
if desktop is None:
@ -234,7 +233,10 @@ class ImpressDocument(PresentationDocument):
return False
self.desktop = desktop
properties = []
properties.append(self.create_property(u'Minimized', True))
if os.name != u'nt':
# Recent versions of Impress on Windows won't start the presentation
# if it starts as minimized. It seems OK on Linux though.
properties.append(self.create_property(u'Minimized', True))
properties = tuple(properties)
try:
self.document = desktop.loadComponentFromURL(url, u'_blank',
@ -242,6 +244,12 @@ class ImpressDocument(PresentationDocument):
except:
log.exception(u'Failed to load presentation %s' % url)
return False
if os.name == u'nt':
# As we can't start minimized the Impress window gets in the way.
# Either window.setPosSize(0, 0, 200, 400, 12) or .setVisible(False)
window = self.document.getCurrentController().getFrame() \
.getContainerWindow()
window.setVisible(False)
self.presentation = self.document.getPresentation()
self.presentation.Display = \
self.controller.plugin.renderer.screens.current_display + 1
@ -387,14 +395,14 @@ class ImpressDocument(PresentationDocument):
log.debug(u'start presentation OpenOffice')
if self.control is None or not self.control.isRunning():
self.presentation.start()
# start() returns before the getCurrentComponent is ready.
# Try for 5 seconds
self.control = self.presentation.getController()
# start() returns before the Component is ready.
# Try for 15 seconds
i = 1
while self.desktop.getCurrentComponent() is None and i < 50:
while not self.control and i < 150:
time.sleep(0.1)
i = i + 1
self.control = \
self.desktop.getCurrentComponent().Presentation.getController()
self.control = self.presentation.getController()
else:
self.control.activate()
self.goto_slide(1)
@ -463,4 +471,4 @@ class ImpressDocument(PresentationDocument):
shape = page.getByIndex(idx)
if shape.supportsService("com.sun.star.drawing.Text"):
text += shape.getString() + '\n'
return text
return text

View File

@ -293,7 +293,7 @@ class PresentationMediaItem(MediaManagerItem):
"supports" the extension. If none found, then look for a controller
which "also supports" it instead.
"""
filetype = filename.split(u'.')[1]
filetype = os.path.splitext(filename)[1][1:]
if not filetype:
return None
for controller in self.controllers: