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

View File

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

View File

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

View File

@ -104,6 +104,7 @@ class PptviewDocument(PresentationDocument):
log.debug(u'Init Presentation PowerPoint') log.debug(u'Init Presentation PowerPoint')
self.presentation = None self.presentation = None
self.pptid = None self.pptid = None
self.blanked = False
self.controller = controller self.controller = controller
self.store_filename(presentation) self.store_filename(presentation)
@ -161,12 +162,21 @@ class PptviewDocument(PresentationDocument):
Blanks the screen Blanks the screen
""" """
self.controller.process.Blank(self.pptid) self.controller.process.Blank(self.pptid)
self.blanked = True
def unblank_screen(self): def unblank_screen(self):
""" """
Unblanks (restores) the presentationn Unblanks (restores) the presentationn
""" """
self.controller.process.Unblank(self.pptid) 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): def stop_presentation(self):
""" """

View File

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