Presentations

This commit is contained in:
Tim Bentley 2014-03-08 21:23:47 +00:00
parent 9773afc61c
commit 0da1b7b5f7
8 changed files with 100 additions and 67 deletions

View File

@ -52,6 +52,7 @@ else:
import uno import uno
from com.sun.star.beans import PropertyValue from com.sun.star.beans import PropertyValue
from com.sun.star.task import ErrorCodeIOException from com.sun.star.task import ErrorCodeIOException
uno_available = True uno_available = True
except ImportError: except ImportError:
uno_available = False uno_available = False
@ -183,9 +184,9 @@ class ImpressController(PresentationController):
docs = desktop.getComponents() docs = desktop.getComponents()
cnt = 0 cnt = 0
if docs.hasElements(): if docs.hasElements():
list = docs.createEnumeration() list_elements = docs.createEnumeration()
while list.hasMoreElements(): while list_elements.hasMoreElements():
doc = list.nextElement() doc = list_elements.nextElement()
if doc.getImplementationName() != 'com.sun.star.comp.framework.BackingComp': if doc.getImplementationName() != 'com.sun.star.comp.framework.BackingComp':
cnt += 1 cnt += 1
if cnt > 0: if cnt > 0:
@ -203,7 +204,7 @@ class ImpressDocument(PresentationDocument):
Class which holds information and controls a single presentation. Class which holds information and controls a single presentation.
""" """
def __init__(self, controller, presentation): def __init__ (self, controller, presentation):
""" """
Constructor, store information about the file and initialise. Constructor, store information about the file and initialise.
""" """
@ -225,10 +226,10 @@ class ImpressDocument(PresentationDocument):
if desktop is None: if desktop is None:
self.controller.start_process() self.controller.start_process()
desktop = self.controller.get_com_desktop() desktop = self.controller.get_com_desktop()
url = 'file:///' + self.filepath.replace('\\', '/').replace(':', '|').replace(' ', '%20') url = 'file:///' + self.file_path.replace('\\', '/').replace(':', '|').replace(' ', '%20')
else: else:
desktop = self.controller.get_uno_desktop() desktop = self.controller.get_uno_desktop()
url = uno.systemPathToFileUrl(self.filepath) url = uno.systemPathToFileUrl(self.file_path)
if desktop is None: if desktop is None:
return False return False
self.desktop = desktop self.desktop = desktop
@ -352,7 +353,7 @@ class ImpressDocument(PresentationDocument):
log.debug('unblank screen OpenOffice') log.debug('unblank screen OpenOffice')
return self.control.resume() return self.control.resume()
def blank_screen(self): def blank_screen (self):
""" """
Blanks the screen. Blanks the screen.
""" """
@ -409,11 +410,13 @@ class ImpressDocument(PresentationDocument):
""" """
return self.document.getDrawPages().getCount() return self.document.getDrawPages().getCount()
def goto_slide(self, slideno): def goto_slide(self, slide_no):
""" """
Go to a specific slide (from 1). Go to a specific slide (from 1).
:param slide_no: The slide the text is required for, starting at 1
""" """
self.control.gotoSlideIndex(slideno-1) self.control.gotoSlideIndex(slide_no - 1)
def next_step(self): def next_step(self):
""" """
@ -435,8 +438,7 @@ class ImpressDocument(PresentationDocument):
""" """
Returns the text on the slide. Returns the text on the slide.
``slide_no`` :param slide_no: The slide the text is required for, starting at 1
The slide the text is required for, starting at 1
""" """
return self.__get_text_from_page(slide_no) return self.__get_text_from_page(slide_no)
@ -444,8 +446,7 @@ class ImpressDocument(PresentationDocument):
""" """
Returns the text in the slide notes. Returns the text in the slide notes.
``slide_no`` :param slide_no: The slide the notes are required for, starting at 1
The slide the notes are required for, starting at 1
""" """
return self.__get_text_from_page(slide_no, True) return self.__get_text_from_page(slide_no, True)
@ -453,8 +454,8 @@ class ImpressDocument(PresentationDocument):
""" """
Return any text extracted from the presentation page. Return any text extracted from the presentation page.
``notes`` :param slide_no: The slide the notes are required for, starting at 1
A boolean. If set the method searches the notes of the slide. :param notes: A boolean. If set the method searches the notes of the slide.
""" """
text = '' text = ''
pages = self.document.getDrawPages() pages = self.document.getDrawPages()

View File

@ -183,7 +183,7 @@ class PresentationMediaItem(MediaManagerItem):
translate('PresentationPlugin.MediaItem', translate('PresentationPlugin.MediaItem',
'A presentation with that filename already exists.')) 'A presentation with that filename already exists.'))
continue continue
controller_name = self.findControllerByType(filename) controller_name = self.find_controller_by_type(filename)
if controller_name: if controller_name:
controller = self.controllers[controller_name] controller = self.controllers[controller_name]
doc = controller.add_document(file) doc = controller.add_document(file)
@ -240,11 +240,16 @@ class PresentationMediaItem(MediaManagerItem):
self.list_view.takeItem(row) self.list_view.takeItem(row)
Settings().setValue(self.settings_section + '/presentations files', self.get_file_list()) Settings().setValue(self.settings_section + '/presentations files', self.get_file_list())
def generate_slide_data(self, service_item, item=None, xml_version=False, def generate_slide_data(self, service_item, item=None, xml_version=False, remote=False,
remote=False, context=ServiceItemContext.Service, presentation_file=None): context=ServiceItemContext.Service, presentation_file=None):
""" """
Load the relevant information for displaying the presentation in the slidecontroller. In the case of Generate the slide data. Needs to be implemented by the plugin.
powerpoints, an image for each slide.
:param service_item: The service item to be built on
:param item: The Song item to be used
:param xml_version: The xml version (not used)
:param remote: Triggered from remote
:param context: Why is it being generated
""" """
if item: if item:
items = [item] items = [item]
@ -272,7 +277,7 @@ class PresentationMediaItem(MediaManagerItem):
(path, name) = os.path.split(filename) (path, name) = os.path.split(filename)
service_item.title = name service_item.title = name
if os.path.exists(filename): if os.path.exists(filename):
processor = self.findControllerByType(filename) processor = self.find_controller_by_type(filename)
if not processor: if not processor:
return False return False
controller = self.controllers[processor] controller = self.controllers[processor]
@ -282,13 +287,13 @@ class PresentationMediaItem(MediaManagerItem):
os.path.join(doc.get_temp_folder(), 'mainslide001.png')): os.path.join(doc.get_temp_folder(), 'mainslide001.png')):
doc.load_presentation() doc.load_presentation()
i = 1 i = 1
imagefile = 'mainslide%03d.png' % i image_file = 'mainslide%03d.png' % i
image = os.path.join(doc.get_temp_folder(), imagefile) image = os.path.join(doc.get_temp_folder(), image_file)
while os.path.isfile(image): while os.path.isfile(image):
service_item.add_from_image(image, name) service_item.add_from_image(image, name)
i += 1 i += 1
imagefile = 'mainslide%03d.png' % i image_file = 'mainslide%03d.png' % i
image = os.path.join(doc.get_temp_folder(), imagefile) image = os.path.join(doc.get_temp_folder(), image_file)
doc.close_presentation() doc.close_presentation()
return True return True
else: else:
@ -307,7 +312,7 @@ class PresentationMediaItem(MediaManagerItem):
service_item.title = name service_item.title = name
if os.path.exists(filename): if os.path.exists(filename):
if service_item.processor == self.automatic: if service_item.processor == self.automatic:
service_item.processor = self.findControllerByType(filename) service_item.processor = self.find_controller_by_type(filename)
if not service_item.processor: if not service_item.processor:
return False return False
controller = self.controllers[service_item.processor] controller = self.controllers[service_item.processor]
@ -340,11 +345,13 @@ class PresentationMediaItem(MediaManagerItem):
'The presentation %s no longer exists.') % filename) 'The presentation %s no longer exists.') % filename)
return False return False
def findControllerByType(self, filename): def find_controller_by_type(self, filename):
""" """
Determine the default application controller to use for the selected file type. This is used if "Automatic" is Determine the default application controller to use for the selected file type. This is used if "Automatic" is
set as the preferred controller. Find the first (alphabetic) enabled controller which "supports" the extension. set as the preferred controller. Find the first (alphabetic) enabled controller which "supports" the extension.
If none found, then look for a controller which "also supports" it instead. If none found, then look for a controller which "also supports" it instead.
:param filename: The file name
""" """
file_type = os.path.splitext(filename)[1][1:] file_type = os.path.splitext(filename)[1][1:]
if not file_type: if not file_type:
@ -360,6 +367,13 @@ class PresentationMediaItem(MediaManagerItem):
return None return None
def search(self, string, show_error): def search(self, string, show_error):
"""
Search in files
:param string: name to be found
:param show_error: not used
:return:
"""
files = Settings().value(self.settings_section + '/presentations files') files = Settings().value(self.settings_section + '/presentations files')
results = [] results = []
string = string.lower() string = string.lower()

View File

@ -71,7 +71,7 @@ class Controller(object):
return return
self.doc.slidenumber = slide_no self.doc.slidenumber = slide_no
self.hide_mode = hide_mode self.hide_mode = hide_mode
log.debug('add_handler, slidenumber: %d' % slide_no) log.debug('add_handler, slide_number: %d' % slide_no)
if self.is_live: if self.is_live:
if hide_mode == HideMode.Screen: if hide_mode == HideMode.Screen:
Registry().execute('live_display_hide', HideMode.Screen) Registry().execute('live_display_hide', HideMode.Screen)
@ -342,7 +342,7 @@ class MessageListener(object):
# so handler & processor is set to None, and we skip adding the handler. # so handler & processor is set to None, and we skip adding the handler.
self.handler = None self.handler = None
if self.handler == self.media_item.automatic: if self.handler == self.media_item.automatic:
self.handler = self.media_item.findControllerByType(file) self.handler = self.media_item.find_controller_by_type(file)
if not self.handler: if not self.handler:
return return
if is_live: if is_live:
@ -359,6 +359,8 @@ class MessageListener(object):
def slide(self, message): def slide(self, message):
""" """
React to the message to move to a specific slide. React to the message to move to a specific slide.
:param message: The message {1} is_live {2} slide
""" """
is_live = message[1] is_live = message[1]
slide = message[2] slide = message[2]
@ -370,6 +372,8 @@ class MessageListener(object):
def first(self, message): def first(self, message):
""" """
React to the message to move to the first slide. React to the message to move to the first slide.
:param message: The message {1} is_live
""" """
is_live = message[1] is_live = message[1]
if is_live: if is_live:
@ -380,6 +384,8 @@ class MessageListener(object):
def last(self, message): def last(self, message):
""" """
React to the message to move to the last slide. React to the message to move to the last slide.
:param message: The message {1} is_live
""" """
is_live = message[1] is_live = message[1]
if is_live: if is_live:
@ -390,6 +396,8 @@ class MessageListener(object):
def next(self, message): def next(self, message):
""" """
React to the message to move to the next animation/slide. React to the message to move to the next animation/slide.
:param message: The message {1} is_live
""" """
is_live = message[1] is_live = message[1]
if is_live: if is_live:
@ -400,6 +408,8 @@ class MessageListener(object):
def previous(self, message): def previous(self, message):
""" """
React to the message to move to the previous animation/slide. React to the message to move to the previous animation/slide.
:param message: The message {1} is_live
""" """
is_live = message[1] is_live = message[1]
if is_live: if is_live:
@ -410,6 +420,8 @@ class MessageListener(object):
def shutdown(self, message): def shutdown(self, message):
""" """
React to message to shutdown the presentation. I.e. end the show and close the file. React to message to shutdown the presentation. I.e. end the show and close the file.
:param message: The message {1} is_live
""" """
is_live = message[1] is_live = message[1]
if is_live: if is_live:
@ -420,6 +432,8 @@ class MessageListener(object):
def hide(self, message): def hide(self, message):
""" """
React to the message to show the desktop. React to the message to show the desktop.
:param message: The message {1} is_live
""" """
is_live = message[1] is_live = message[1]
if is_live: if is_live:
@ -428,6 +442,8 @@ class MessageListener(object):
def blank(self, message): def blank(self, message):
""" """
React to the message to blank the display. React to the message to blank the display.
:param message: The message {1} is_live {2} slide
""" """
is_live = message[1] is_live = message[1]
hide_mode = message[2] hide_mode = message[2]
@ -437,6 +453,8 @@ class MessageListener(object):
def unblank(self, message): def unblank(self, message):
""" """
React to the message to unblank the display. React to the message to unblank the display.
:param message: The message {1} is_live
""" """
is_live = message[1] is_live = message[1]
if is_live: if is_live:

View File

@ -113,7 +113,7 @@ class PdfController(PresentationController):
self.gsbin = '' self.gsbin = ''
self.also_supports = [] self.also_supports = []
# Use the user defined program if given # Use the user defined program if given
if (Settings().value('presentations/enable_pdf_program')): if Settings().value('presentations/enable_pdf_program'):
pdf_program = Settings().value('presentations/pdf_program') pdf_program = Settings().value('presentations/pdf_program')
program_type = self.check_binary(pdf_program) program_type = self.check_binary(pdf_program)
if program_type == 'gs': if program_type == 'gs':
@ -197,7 +197,7 @@ class PdfDocument(PresentationDocument):
runlog = [] runlog = []
try: try:
runlog = check_output([self.controller.gsbin, '-dNOPAUSE', '-dNODISPLAY', '-dBATCH', runlog = check_output([self.controller.gsbin, '-dNOPAUSE', '-dNODISPLAY', '-dBATCH',
'-sFile=' + self.filepath, gs_resolution_script]) '-sFile=' + self.file_path, gs_resolution_script])
except CalledProcessError as e: except CalledProcessError as e:
log.debug(' '.join(e.cmd)) log.debug(' '.join(e.cmd))
log.debug(e.output) log.debug(e.output)
@ -246,13 +246,13 @@ class PdfDocument(PresentationDocument):
os.makedirs(self.get_temp_folder()) os.makedirs(self.get_temp_folder())
if self.controller.mudrawbin: if self.controller.mudrawbin:
runlog = check_output([self.controller.mudrawbin, '-w', str(size.right()), '-h', str(size.bottom()), runlog = check_output([self.controller.mudrawbin, '-w', str(size.right()), '-h', str(size.bottom()),
'-o', os.path.join(self.get_temp_folder(), 'mainslide%03d.png'), self.filepath]) '-o', os.path.join(self.get_temp_folder(), 'mainslide%03d.png'), self.file_path])
elif self.controller.gsbin: elif self.controller.gsbin:
resolution = self.gs_get_resolution(size) resolution = self.gs_get_resolution(size)
runlog = check_output([self.controller.gsbin, '-dSAFER', '-dNOPAUSE', '-dBATCH', '-sDEVICE=png16m', runlog = check_output([self.controller.gsbin, '-dSAFER', '-dNOPAUSE', '-dBATCH', '-sDEVICE=png16m',
'-r' + str(resolution), '-dTextAlphaBits=4', '-dGraphicsAlphaBits=4', '-r' + str(resolution), '-dTextAlphaBits=4', '-dGraphicsAlphaBits=4',
'-sOutputFile=' + os.path.join(self.get_temp_folder(), 'mainslide%03d.png'), '-sOutputFile=' + os.path.join(self.get_temp_folder(), 'mainslide%03d.png'),
self.filepath]) self.file_path])
created_files = sorted(os.listdir(self.get_temp_folder())) created_files = sorted(os.listdir(self.get_temp_folder()))
for fn in created_files: for fn in created_files:
if os.path.isfile(os.path.join(self.get_temp_folder(), fn)): if os.path.isfile(os.path.join(self.get_temp_folder(), fn)):

View File

@ -112,6 +112,9 @@ class PowerpointDocument(PresentationDocument):
def __init__(self, controller, presentation): def __init__(self, controller, presentation):
""" """
Constructor, store information about the file and initialise. Constructor, store information about the file and initialise.
:param controller:
:param presentation:
""" """
log.debug('Init Presentation Powerpoint') log.debug('Init Presentation Powerpoint')
super(PowerpointDocument, self).__init__(controller, presentation) super(PowerpointDocument, self).__init__(controller, presentation)
@ -126,7 +129,7 @@ class PowerpointDocument(PresentationDocument):
if not self.controller.process or not self.controller.process.Visible: if not self.controller.process or not self.controller.process.Visible:
self.controller.start_process() self.controller.start_process()
try: try:
self.controller.process.Presentations.Open(self.filepath, False, False, True) self.controller.process.Presentations.Open(self.file_path, False, False, True)
except pywintypes.com_error: except pywintypes.com_error:
log.debug('PPT open failed') log.debug('PPT open failed')
return False return False
@ -275,12 +278,14 @@ class PowerpointDocument(PresentationDocument):
log.debug('get_slide_count') log.debug('get_slide_count')
return self.presentation.Slides.Count return self.presentation.Slides.Count
def goto_slide(self, slideno): def goto_slide(self, slide_no):
""" """
Moves to a specific slide in the presentation. Moves to a specific slide in the presentation.
:param slide_no: The slide the text is required for, starting at 1
""" """
log.debug('goto_slide') log.debug('goto_slide')
self.presentation.SlideShowWindow.View.GotoSlide(slideno) self.presentation.SlideShowWindow.View.GotoSlide(slide_no)
def next_step(self): def next_step(self):
""" """
@ -302,8 +307,7 @@ class PowerpointDocument(PresentationDocument):
""" """
Returns the text on the slide. Returns the text on the slide.
``slide_no`` :param slide_no: The slide the text is required for, starting at 1
The slide the text is required for, starting at 1.
""" """
return _get_text_from_shapes(self.presentation.Slides(slide_no).Shapes) return _get_text_from_shapes(self.presentation.Slides(slide_no).Shapes)
@ -311,8 +315,7 @@ class PowerpointDocument(PresentationDocument):
""" """
Returns the text on the slide. Returns the text on the slide.
``slide_no`` :param slide_no: The slide the text is required for, starting at 1
The slide the notes are required for, starting at 1.
""" """
return _get_text_from_shapes(self.presentation.Slides(slide_no).NotesPage.Shapes) return _get_text_from_shapes(self.presentation.Slides(slide_no).NotesPage.Shapes)
@ -321,8 +324,7 @@ def _get_text_from_shapes(shapes):
""" """
Returns any text extracted from the shapes on a presentation slide. Returns any text extracted from the shapes on a presentation slide.
``shapes`` :param shapes: A set of shapes to search for text.
A set of shapes to search for text.
""" """
text = '' text = ''
for index in range(shapes.Count): for index in range(shapes.Count):

View File

@ -124,7 +124,7 @@ class PptviewDocument(PresentationDocument):
temp_folder = self.get_temp_folder() temp_folder = self.get_temp_folder()
size = ScreenList().current['size'] size = ScreenList().current['size']
rect = RECT(size.x(), size.y(), size.right(), size.bottom()) rect = RECT(size.x(), size.y(), size.right(), size.bottom())
file_path = os.path.normpath(self.filepath) file_path = os.path.normpath(self.file_path)
preview_path = os.path.join(temp_folder, 'slide') preview_path = os.path.join(temp_folder, 'slide')
# Ensure that the paths are null terminated # Ensure that the paths are null terminated
file_path = file_path.encode('utf-16-le') + b'\0' file_path = file_path.encode('utf-16-le') + b'\0'
@ -228,11 +228,13 @@ class PptviewDocument(PresentationDocument):
""" """
return self.controller.process.GetSlideCount(self.ppt_id) return self.controller.process.GetSlideCount(self.ppt_id)
def goto_slide(self, slideno): def goto_slide(self, slide_no):
""" """
Moves to a specific slide in the presentation. Moves to a specific slide in the presentation.
:param slide_no: The slide the text is required for, starting at 1
""" """
self.controller.process.GotoSlide(self.ppt_id, slideno) self.controller.process.GotoSlide(self.ppt_id, slide_no)
def next_step(self): def next_step(self):
""" """

View File

@ -103,8 +103,8 @@ class PresentationDocument(object):
""" """
Run some initial setup. This method is separate from __init__ in order to mock it out in tests. Run some initial setup. This method is separate from __init__ in order to mock it out in tests.
""" """
self.slidenumber = 0 self.slide_number = 0
self.filepath = name self.file_path = name
check_directory_exists(self.get_thumbnail_folder()) check_directory_exists(self.get_thumbnail_folder())
def load_presentation(self): def load_presentation(self):
@ -131,7 +131,7 @@ class PresentationDocument(object):
""" """
Return just the filename of the presentation, without the directory Return just the filename of the presentation, without the directory
""" """
return os.path.split(self.filepath)[1] return os.path.split(self.file_path)[1]
def get_thumbnail_folder(self): def get_thumbnail_folder(self):
""" """
@ -149,10 +149,10 @@ class PresentationDocument(object):
""" """
Returns ``True`` if the thumbnail images exist and are more recent than the powerpoint file. Returns ``True`` if the thumbnail images exist and are more recent than the powerpoint file.
""" """
lastimage = self.get_thumbnail_path(self.get_slide_count(), True) last_image = self.get_thumbnail_path(self.get_slide_count(), True)
if not (lastimage and os.path.isfile(lastimage)): if not (last_image and os.path.isfile(last_image)):
return False return False
return validate_thumb(self.filepath, lastimage) return validate_thumb(self.file_path, last_image)
def close_presentation(self): def close_presentation(self):
""" """
@ -253,8 +253,7 @@ class PresentationDocument(object):
``slide_no`` ``slide_no``
The slide an image is required for, starting at 1 The slide an image is required for, starting at 1
""" """
path = os.path.join(self.get_thumbnail_folder(), path = os.path.join(self.get_thumbnail_folder(), self.controller.thumbnail_prefix + str(slide_no) + '.png')
self.controller.thumbnail_prefix + str(slide_no) + '.png')
if os.path.isfile(path) or not check_exists: if os.path.isfile(path) or not check_exists:
return path return path
else: else:
@ -268,21 +267,20 @@ class PresentationDocument(object):
return return
if not hide_mode: if not hide_mode:
current = self.get_slide_number() current = self.get_slide_number()
if current == self.slidenumber: if current == self.slide_number:
return return
self.slidenumber = current self.slide_number = current
if is_live: if is_live:
prefix = 'live' prefix = 'live'
else: else:
prefix = 'preview' prefix = 'preview'
Registry().execute('slidecontroller_%s_change' % prefix, self.slidenumber - 1) Registry().execute('slidecontroller_%s_change' % prefix, self.slide_number - 1)
def get_slide_text(self, slide_no): def get_slide_text(self, slide_no):
""" """
Returns the text on the slide Returns the text on the slide
``slide_no`` :param slide_no: The slide the text is required for, starting at 1
The slide the text is required for, starting at 1
""" """
return '' return ''
@ -290,8 +288,7 @@ class PresentationDocument(object):
""" """
Returns the text on the slide Returns the text on the slide
``slide_no`` :param slide_no: The slide the text is required for, starting at 1
The slide the notes are required for, starting at 1
""" """
return '' return ''
@ -350,6 +347,7 @@ class PresentationController(object):
def __init__(self, plugin=None, name='PresentationController', document_class=PresentationDocument): def __init__(self, plugin=None, name='PresentationController', document_class=PresentationDocument):
""" """
This is the constructor for the presentationcontroller object. This provides an easy way for descendent plugins This is the constructor for the presentationcontroller object. This provides an easy way for descendent plugins
to populate common data. This method *must* be overridden, like so:: to populate common data. This method *must* be overridden, like so::
class MyPresentationController(PresentationController): class MyPresentationController(PresentationController):
@ -357,11 +355,9 @@ class PresentationController(object):
PresentationController.__init( PresentationController.__init(
self, plugin, u'My Presenter App') self, plugin, u'My Presenter App')
``plugin`` :param plugin: Defaults to *None*. The presentationplugin object
Defaults to *None*. The presentationplugin object :param name: Name of the application, to appear in the application
:param document_class:
``name``
Name of the application, to appear in the application
""" """
self.supports = [] self.supports = []
self.also_supports = [] self.also_supports = []

View File

@ -118,7 +118,7 @@ class TestPptviewDocument(TestCase):
self.mock_os.path.isdir.return_value = True self.mock_os.path.isdir.return_value = True
self.mock_controller.process.OpenPPT.return_value = 0 self.mock_controller.process.OpenPPT.return_value = 0
instance = PptviewDocument(self.mock_controller, self.mock_presentation) instance = PptviewDocument(self.mock_controller, self.mock_presentation)
instance.filepath = 'test\path.ppt' instance.file_path = 'test\path.ppt'
if os.name == 'nt': if os.name == 'nt':
result = instance.load_presentation() result = instance.load_presentation()
@ -138,7 +138,7 @@ class TestPptviewDocument(TestCase):
self.mock_os.path.isdir.return_value = False self.mock_os.path.isdir.return_value = False
self.mock_controller.process.OpenPPT.return_value = -1 self.mock_controller.process.OpenPPT.return_value = -1
instance = PptviewDocument(self.mock_controller, self.mock_presentation) instance = PptviewDocument(self.mock_controller, self.mock_presentation)
instance.filepath = 'test\path.ppt' instance.file_path = 'test\path.ppt'
if os.name == 'nt': if os.name == 'nt':
result = instance.load_presentation() result = instance.load_presentation()