~trb143/openlp/bug-1516171-24

« back to all changes in this revision

Viewing changes to openlp/plugins/presentations/lib/impresscontroller.py

  • Committer: Raoul Snyman
  • Author(s): Tomas Groth
  • Date: 2015-06-14 18:38:44 UTC
  • mfrom: (2543.1.14 bugfixes21)
  • Revision ID: raoul@snyman.info-20150614183844-wxfg3itu1zu9toiu
Fix path of presentation thumbnail when loading from service files. Fixes bug 1463703.
Fix PDF reader using wrong maindisplay size.
Fix log-traceback when trying to remove servicemanager files before eg. powerpoint has closed the files.
Improve network exception handling.
Fix timer that checks for presentation slide change, remove powerpoint event handler that did the same.
Hide the main impress window when loading a presentation, but make it visible for a moment when starting presentation. Fixes bug 1420356.
Improve the detection of powerpoints presentation window by only looking at the filename root.
Fix traceback when going live with presentation while blanked to desktop.
Set service_item.name to "images" for pdfs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
import os
36
36
import time
37
37
 
38
 
from openlp.core.common import is_win
 
38
from openlp.core.common import is_win, Registry
39
39
 
40
40
if is_win():
41
41
    from win32com.client import Dispatch
231
231
            return False
232
232
        self.desktop = desktop
233
233
        properties = []
234
 
        if not is_win():
235
 
            # Recent versions of Impress on Windows won't start the presentation if it starts as minimized. It seems OK
236
 
            # on Linux though.
237
 
            properties.append(self.create_property('Minimized', True))
 
234
        properties.append(self.create_property('Hidden', True))
238
235
        properties = tuple(properties)
239
236
        try:
240
237
            self.document = desktop.loadComponentFromURL(url, '_blank', 0, properties)
241
238
        except:
242
239
            log.warning('Failed to load presentation %s' % url)
243
240
            return False
244
 
        if is_win():
245
 
            # As we can't start minimized the Impress window gets in the way.
246
 
            # Either window.setPosSize(0, 0, 200, 400, 12) or .setVisible(False)
247
 
            window = self.document.getCurrentController().getFrame().getContainerWindow()
248
 
            window.setVisible(False)
249
241
        self.presentation = self.document.getPresentation()
250
242
        self.presentation.Display = ScreenList().current['number'] + 1
251
243
        self.control = None
382
374
        """
383
375
        log.debug('start presentation OpenOffice')
384
376
        if self.control is None or not self.control.isRunning():
 
377
            window = self.document.getCurrentController().getFrame().getContainerWindow()
 
378
            window.setVisible(True)
385
379
            self.presentation.start()
386
380
            self.control = self.presentation.getController()
387
381
            # start() returns before the Component is ready. Try for 15 seconds.
390
384
                time.sleep(0.1)
391
385
                sleep_count += 1
392
386
                self.control = self.presentation.getController()
 
387
            window.setVisible(False)
393
388
        else:
394
389
            self.control.activate()
395
390
            self.goto_slide(1)
 
391
        # Make sure impress doesn't steal focus, unless we're on a single screen setup
 
392
        if len(ScreenList().screen_list) > 1:
 
393
            Registry().get('main_window').activateWindow()
396
394
 
397
395
    def get_slide_number(self):
398
396
        """