Live/Preview presentation changes for Windows

This commit is contained in:
Jonathan Corwin 2010-03-02 23:15:13 +00:00
parent 743ae230a8
commit aa5f21b50d
4 changed files with 237 additions and 235 deletions

View File

@ -180,7 +180,7 @@ class ImpressDocument(PresentationDocument):
log.debug(u'Load Presentation OpenOffice')
#print "s.dsk1 ", self.desktop
if os.name == u'nt':
desktop = self.get_com_desktop()
desktop = self.controller.get_com_desktop()
if desktop is None:
self.controller.start_process()
desktop = self.controller.get_com_desktop()
@ -226,7 +226,7 @@ class ImpressDocument(PresentationDocument):
for idx in range(pages.getCount()):
page = pages.getByIndex(idx)
doc.getCurrentController().setCurrentPage(page)
path = u'%s/%s%s.png'% (thumbdir, self.thumbnailprefix,
path = u'%s/%s%s.png'% (thumbdir, self.controller.thumbnailprefix,
unicode(idx + 1))
try:
doc.storeToURL(path , props)
@ -236,7 +236,7 @@ class ImpressDocument(PresentationDocument):
def create_property(self, name, value):
log.debug(u'create property OpenOffice')
if os.name == u'nt':
prop = self.manager.Bridge_GetStruct(u'com.sun.star.beans.PropertyValue')
prop = self.controller.manager.Bridge_GetStruct(u'com.sun.star.beans.PropertyValue')
else:
prop = PropertyValue()
prop.Name = name

View File

@ -94,7 +94,7 @@ class Controller(object):
if not self.isLive:
return
self.activate()
self.doc.goto_slide(self.controller.get_slide_count())
self.doc.goto_slide(self.doc.get_slide_count())
self.doc.poll_slidenumber(self.isLive)
def next(self):

View File

@ -108,14 +108,14 @@ class PowerpointController(PresentationController):
def add_doc(self, name):
log.debug(u'Add Doc PowerPoint')
doc = PowerPointDocument(self, name)
doc = PowerpointDocument(self, name)
self.docs.append(doc)
return doc
class PowerPointDocument(PresentationDocument):
class PowerpointDocument(PresentationDocument):
def __init__(self, controller, presentation):
log.debug(u'Init Presentation PowerPoint')
log.debug(u'Init Presentation Powerpoint')
self.presentation = None
self.controller = controller
self.store_filename(presentation)
@ -132,16 +132,17 @@ class PowerpointController(PresentationController):
The file name of the presentations to run.
"""
log.debug(u'LoadPresentation')
try:
#try:
if not self.controller.process.Visible:
self.controller.start_process()
except:
self.controller.start_process()
try:
#except:
# self.controller.start_process()
#try:
self.controller.process.Presentations.Open(self.filepath, False, False, True)
except:
return
self.presentation = self.controller.process.Presentations(self.process.Presentations.Count)
#except:
# return
self.presentation = self.controller.process.Presentations(
self.controller.process.Presentations.Count)
self.create_thumbnails()
def create_thumbnails(self):
@ -177,7 +178,7 @@ class PowerpointController(PresentationController):
"""
Returns true if a presentation is currently active
"""
if not self.is_loaded():
if not self.controller.is_loaded():
return False
try:
if self.presentation.SlideShowWindow == None:
@ -208,6 +209,7 @@ class PowerpointController(PresentationController):
"""
self.presentation.SlideShowWindow.View.Exit()
if os.name == u'nt':
def start_presentation(self):
"""
Starts a presentation from the beginning
@ -222,7 +224,7 @@ class PowerpointController(PresentationController):
dpi = 96
self.presentation.SlideShowSettings.Run()
self.presentation.SlideShowWindow.View.GotoSlide(1)
rendermanager = self.plugin.render_manager
rendermanager = self.controller.plugin.render_manager
rect = rendermanager.screens.current[u'size']
self.presentation.SlideShowWindow.Top = rect.y() * 72 / dpi
self.presentation.SlideShowWindow.Height = rect.height() * 72 / dpi

View File

@ -98,7 +98,7 @@ class PptviewController(PresentationController):
self.docs.append(doc)
return doc
class PptViewDocument(PresentationDocument):
class PptviewDocument(PresentationDocument):
def __init__(self, controller, presentation):
log.debug(u'Init Presentation PowerPoint')
@ -119,13 +119,13 @@ class PptviewController(PresentationController):
log.debug(u'LoadPresentation')
#if self.pptid >= 0:
# self.close_presentation()
rendermanager = self.plugin.render_manager
rendermanager = self.controller.plugin.render_manager
rect = rendermanager.screens.current[u'size']
rect = RECT(rect.x(), rect.y(), rect.right(), rect.bottom())
filepath = str(self.filepath.replace(u'/', u'\\'));
try:
self.pptid = self.controller.process.OpenPPT(filepath, None, rect,
str(os.path.join(self.thumbnailpath, self.thumbnailprefix)))
str(os.path.join(self.thumbnailpath, self.controller.thumbnailprefix)))
self.stop_presentation()
except:
log.exception(u'Failed to load presentation')
@ -136,7 +136,7 @@ class PptviewController(PresentationController):
Triggerent by new object being added to SlideController orOpenLP
being shut down
"""
self.process.ClosePPT(self.pptid)
self.controller.process.ClosePPT(self.pptid)
self.pptid = -1
self.controller.remove_doc(self)
@ -160,55 +160,55 @@ class PptviewController(PresentationController):
"""
Blanks the screen
"""
self.process.Blank(self.pptid)
self.controller.process.Blank(self.pptid)
def unblank_screen(self):
"""
Unblanks (restores) the presentationn
"""
self.process.Unblank(self.pptid)
self.controller.process.Unblank(self.pptid)
def stop_presentation(self):
"""
Stops the current presentation and hides the output
"""
self.process.Stop(self.pptid)
self.controller.process.Stop(self.pptid)
def start_presentation(self):
"""
Starts a presentation from the beginning
"""
self.process.RestartShow(self.pptid)
self.controller.process.RestartShow(self.pptid)
def get_slide_number(self):
"""
Returns the current slide number
"""
return self.process.GetCurrentSlide(self.pptid)
return self.controller.process.GetCurrentSlide(self.pptid)
def get_slide_count(self):
"""
Returns total number of slides
"""
return self.process.GetSlideCount(self.pptid)
return self.controller.process.GetSlideCount(self.pptid)
def goto_slide(self, slideno):
"""
Moves to a specific slide in the presentation
"""
self.process.GotoSlide(self.pptid, slideno)
self.controller.process.GotoSlide(self.pptid, slideno)
def next_step(self):
"""
Triggers the next effect of slide on the running presentation
"""
self.process.NextStep(self.pptid)
self.controller.process.NextStep(self.pptid)
def previous_step(self):
"""
Triggers the previous slide on the running presentation
"""
self.process.PrevStep(self.pptid)
self.controller.process.PrevStep(self.pptid)
def get_slide_preview_file(self, slide_no):
"""