Minimized impress troubles

This commit is contained in:
Jonathan Corwin 2011-04-29 23:29:29 +01:00
parent ebf5777a02
commit a9df8468aa
2 changed files with 13 additions and 9 deletions

View File

@ -38,6 +38,8 @@ import logging
import os import os
import time import time
from openlp.core.lib import Receiver
if os.name == u'nt': if os.name == u'nt':
from win32com.client import Dispatch from win32com.client import Dispatch
import pywintypes import pywintypes
@ -219,7 +221,6 @@ class ImpressDocument(PresentationDocument):
The file name of the presentatios to the run. The file name of the presentatios to the run.
""" """
log.debug(u'Load Presentation OpenOffice') log.debug(u'Load Presentation OpenOffice')
#print "s.dsk1 ", self.desktop
if os.name == u'nt': if os.name == u'nt':
desktop = self.controller.get_com_desktop() desktop = self.controller.get_com_desktop()
if desktop is None: if desktop is None:
@ -234,7 +235,6 @@ class ImpressDocument(PresentationDocument):
return False return False
self.desktop = desktop self.desktop = desktop
properties = [] properties = []
properties.append(self.create_property(u'Minimized', True))
properties = tuple(properties) properties = tuple(properties)
try: try:
self.document = desktop.loadComponentFromURL(url, u'_blank', self.document = desktop.loadComponentFromURL(url, u'_blank',
@ -242,6 +242,9 @@ class ImpressDocument(PresentationDocument):
except: except:
log.exception(u'Failed to load presentation %s' % url) log.exception(u'Failed to load presentation %s' % url)
return False return False
window = self.document.getCurrentController().getFrame() \
.getContainerWindow()
window.setPosSize(0, 0, 200, 400, 12)
self.presentation = self.document.getPresentation() self.presentation = self.document.getPresentation()
self.presentation.Display = \ self.presentation.Display = \
self.controller.plugin.renderer.screens.current_display + 1 self.controller.plugin.renderer.screens.current_display + 1
@ -387,14 +390,15 @@ class ImpressDocument(PresentationDocument):
log.debug(u'start presentation OpenOffice') log.debug(u'start presentation OpenOffice')
if self.control is None or not self.control.isRunning(): if self.control is None or not self.control.isRunning():
self.presentation.start() self.presentation.start()
# start() returns before the getCurrentComponent is ready. self.control = self.presentation.getController()
# Try for 5 seconds # start() returns before the Component is ready.
# Try for 30 seconds
i = 1 i = 1
while self.desktop.getCurrentComponent() is None and i < 50: while not self.control and i < 300:
Receiver.send_message(u'openlp_process_events')
time.sleep(0.1) time.sleep(0.1)
i = i + 1 i = i + 1
self.control = \ self.control = self.presentation.getController()
self.desktop.getCurrentComponent().Presentation.getController()
else: else:
self.control.activate() self.control.activate()
self.goto_slide(1) self.goto_slide(1)
@ -463,4 +467,4 @@ class ImpressDocument(PresentationDocument):
shape = page.getByIndex(idx) shape = page.getByIndex(idx)
if shape.supportsService("com.sun.star.drawing.Text"): if shape.supportsService("com.sun.star.drawing.Text"):
text += shape.getString() + '\n' text += shape.getString() + '\n'
return text return text

View File

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