PPTViewer fixes

bzr-revno: 570
This commit is contained in:
Jon Tibble 2009-09-25 15:31:43 +01:00
commit 6c2f3f15eb
2 changed files with 86 additions and 54 deletions

View File

@ -21,6 +21,7 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 # # with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
import os import os
from impresscontroller import ImpressController from impresscontroller import ImpressController

View File

@ -27,6 +27,7 @@ import os, subprocess
import time import time
import sys import sys
import win32api import win32api
from ctypes import * from ctypes import *
from ctypes.wintypes import RECT from ctypes.wintypes import RECT
@ -72,19 +73,16 @@ class PptviewController(object):
and started. and started.
``presentation`` ``presentation``
The file name of the presentatios to the run. The file name of the presentations to run.
""" """
log.debug(u'LoadPresentation') log.debug(u'LoadPresentation')
if(self.pptid>=0): if self.pptid >= 0:
self.CloseClick() self.closePresentation()
rect = RECT() rect = RECT(0, 0, 800, 600) # until such time I can get screen info
rect.left = 0 filename = str(presentation.replace(u'/', u'\\'));
rect.top = 0
rect.width = 0
rect.hight = 0
try: try:
tempfolder = None #r'c:\temp\pptviewlib\' + presentation tempfolder = None #r'c:\temp\pptviewlib\' + filename.split('u\\')[-1]
self.pptid = self.presentation.OpenPPT(presentation, None, rect, tempfolder) self.pptid = self.presentation.OpenPPT(filename, None, rect, tempfolder)
except: except:
log.exception(u'Failed to load presentation') log.exception(u'Failed to load presentation')
#self.slidecount = pptdll.GetSlideCount(self.pptid) #self.slidecount = pptdll.GetSlideCount(self.pptid)
@ -95,62 +93,95 @@ class PptviewController(object):
Triggerent by new object being added to SlideController orOpenLP Triggerent by new object being added to SlideController orOpenLP
being shut down being shut down
""" """
if(self.pptid<0): return if self.pptid < 0:
self.presentation.Close(self.pptid)
self.pptid = -1
def isActive(self):
return self.pptid >= 0
def resume(self):
if(self.pptid<0): return
self.presentation.Resume(self.pptid)
def pause(self):
return return
self.presentation.ClosePPT(self.pptid)
def blankScreen(self): self.pptid = -1
if(self.pptid<0): return
self.presentation.Blank(self.pptid)
def unblankScreen(self):
if(self.pptid<0): return
self.presentation.Unblank(self.pptid)
def stop(self):
if(self.pptid<0): return
self.presentation.Stop(self.pptid)
def go(self):
if(self.pptid<0): return
self.presentation.RestartShow(self.pptid)
def getSlideNumber(self):
if(self.pptid<0): return -1
return self.presentation.GetCurrentSlide(self.pptid)
def setSlideNumber(self, slideno):
if(self.pptid<0): return
self.presentation.GotoSlide(self.pptid, slideno)
slideNumber = property(getSlideNumber, setSlideNumber)
def nextStep(self): def nextStep(self):
""" """
Triggers the next effect of slide on the running presentation Triggers the next effect of slide on the running presentation
""" """
if(self.pptid<0): return if self.pptid < 0:
return
self.presentation.NextStep(self.pptid) self.presentation.NextStep(self.pptid)
def previousStep(self): def previousStep(self):
""" """
Triggers the previous slide on the running presentation Triggers the previous slide on the running presentation
""" """
if self.pptid<0: return if self.pptid < 0:
return
self.presentation.PrevStep(self.pptid) self.presentation.PrevStep(self.pptid)
def NextClick(self): def isActive(self):
if(self.pptid<0): return """
pptdll.NextStep(self.pptid) Returns true if a presentation is currently active
self.slideEdit.setText(pptdll.GetCurrentSlide(self.pptid)) """
return self.pptid >= 0
def resume(self):
"""
Resumes a previously paused presentation
"""
if self.pptid < 0:
return
self.presentation.Resume(self.pptid)
def pause(self):
"""
Not implemented (pauses a presentation)
"""
return
def blankScreen(self):
"""
Blanks the screen
"""
if self.pptid < 0:
return
self.presentation.Blank(self.pptid)
def unblankScreen(self):
"""
Unblanks (restores) the presentationn
"""
if self.pptid < 0:
return
self.presentation.Unblank(self.pptid)
def stop(self):
"""
Stops the current presentation and hides the output
"""
if self.pptid < 0:
return
self.presentation.Stop(self.pptid)
def go(self):
"""
Starts a presentation from the beginning
"""
if self.pptid < 0:
return
self.presentation.RestartShow(self.pptid)
def getSlideNumber(self):
"""
Returns the current slide number
"""
if self.pptid < 0:
return -1
return self.presentation.GetCurrentSlide(self.pptid)
def setSlideNumber(self, slideno):
"""
Moves to a specific slide in the presentation
"""
if self.pptid < 0:
return
self.presentation.GotoSlide(self.pptid, slideno)
slideNumber = property(getSlideNumber, setSlideNumber)