Blanking issues

This commit is contained in:
Jonathan Corwin 2010-03-10 22:24:09 +00:00
parent 714135a94f
commit d48046c0c3
5 changed files with 58 additions and 1 deletions

View File

@ -102,11 +102,14 @@ class ImpressController(PresentationController):
log.debug(u'get UNO Desktop Openoffice')
ctx = None
loop = 0
log.debug(u'get UNO Desktop Openoffice - getComponentContext')
context = uno.getComponentContext()
log.debug(u'get UNO Desktop Openoffice - createInstaneWithContext - UnoUrlResolver')
resolver = context.ServiceManager.createInstanceWithContext(
u'com.sun.star.bridge.UnoUrlResolver', context)
while ctx is None and loop < 3:
try:
log.debug(u'get UNO Desktop Openoffice - resolve')
ctx = resolver.resolve(u'uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext')
except:
log.exception(u'Unable to find running instance ')
@ -114,6 +117,7 @@ class ImpressController(PresentationController):
loop += 1
try:
self.manager = ctx.ServiceManager
log.debug(u'get UNO Desktop Openoffice - createInstanceWithContext - Desktop')
desktop = self.manager.createInstanceWithContext(
"com.sun.star.frame.Desktop", ctx )
return desktop
@ -304,6 +308,13 @@ class ImpressDocument(PresentationDocument):
log.debug(u'blank screen OpenOffice')
self.control.blankScreen(0)
def is_blank(self):
"""
Returns true if screen is blank
"""
log.debug(u'is blank OpenOffice')
return self.control.isPaused()
def stop_presentation(self):
log.debug(u'stop presentation OpenOffice')
self.control.deactivate()

View File

@ -73,6 +73,9 @@ class Controller(object):
log.debug(u'Live = %s, slide' % live)
if not live:
return
if self.doc.is_blank():
self.doc.slidenumber = int(slide) + 1
return
self.activate()
self.doc.goto_slide(int(slide) + 1)
self.doc.poll_slidenumber(live)
@ -84,6 +87,9 @@ class Controller(object):
log.debug(u'Live = %s, first' % self.isLive)
if not self.isLive:
return
if self.doc.is_blank():
self.doc.slidenumber = 1
return
self.activate()
self.doc.start_presentation()
self.doc.poll_slidenumber(self.isLive)
@ -95,6 +101,9 @@ class Controller(object):
log.debug(u'Live = %s, last' % self.isLive)
if not self.isLive:
return
if self.doc.is_blank():
self.doc.slidenumber = self.doc.get_slide_count()
return
self.activate()
self.doc.goto_slide(self.doc.get_slide_count())
self.doc.poll_slidenumber(self.isLive)
@ -106,6 +115,10 @@ class Controller(object):
log.debug(u'Live = %s, next' % self.isLive)
if not self.isLive:
return
if self.doc.is_blank():
if self.doc.slidenumber < self.doc.get_slide_count():
self.doc.slidenumber = self.doc.slidenumber + 1
return
self.activate()
self.doc.next_step()
self.doc.poll_slidenumber(self.isLive)
@ -117,6 +130,10 @@ class Controller(object):
log.debug(u'Live = %s, previous' % self.isLive)
if not self.isLive:
return
if self.doc.is_blank():
if self.doc.slidenumber > 1:
self.doc.slidenumber = self.doc.slidenumber - 1
return
self.activate()
self.doc.previous_step()
self.doc.poll_slidenumber(self.isLive)
@ -126,6 +143,8 @@ class Controller(object):
Based on the handler passed at startup triggers slide show to shut down
"""
log.debug(u'Live = %s, shutdown' % self.isLive)
if self.isLive:
Receiver.send_message(u'live_slide_show')
self.doc.close_presentation()
self.doc = None
#self.doc.slidenumber = 0
@ -146,6 +165,8 @@ class Controller(object):
if not self.isLive:
return
self.activate()
if self.doc.slidenumber and self.doc.slidenumber != self.doc.get_slide_number():
self.doc.goto_slide(self.doc.slidenumber)
self.doc.unblank_screen()
def poll(self):

View File

@ -178,7 +178,7 @@ class PowerpointDocument(PresentationDocument):
"""
Returns true if a presentation is currently active
"""
if not self.controller.is_loaded():
if not self.is_loaded():
return False
try:
if self.presentation.SlideShowWindow == None:
@ -203,6 +203,12 @@ class PowerpointDocument(PresentationDocument):
"""
self.presentation.SlideShowWindow.View.State = 3
def is_blank(self):
"""
Returns true if screen is blank
"""
return self.presentation.SlideShowWindow.View.State == 3
def stop_presentation(self):
"""
Stops the current presentation and hides the output

View File

@ -104,6 +104,7 @@ class PptviewDocument(PresentationDocument):
log.debug(u'Init Presentation PowerPoint')
self.presentation = None
self.pptid = None
self.blanked = False
self.controller = controller
self.store_filename(presentation)
@ -161,12 +162,21 @@ class PptviewDocument(PresentationDocument):
Blanks the screen
"""
self.controller.process.Blank(self.pptid)
self.blanked = True
def unblank_screen(self):
"""
Unblanks (restores) the presentationn
"""
self.controller.process.Unblank(self.pptid)
self.blanked = False
def is_blank(self):
"""
Returns true if screen is blank
"""
log.debug(u'is blank OpenOffice')
return self.blanked
def stop_presentation(self):
"""

View File

@ -172,6 +172,9 @@ class PresentationDocument(object):
``unblank_screen()``
Unblanks the screen, restoring the output
``is_blank``
Returns true if screen is blank
``stop_presentation()``
Stops the presentation, removing it from the output display
@ -279,6 +282,12 @@ class PresentationDocument(object):
"""
pass
def is_blank(self):
"""
Returns true if screen is blank
"""
return False
def stop_presentation(self):
"""
Stops the presentation, removing it from the output display