Пример #1
0
 def start_presentation(self):
     """
     Starts a presentation from the beginning.
     """
     log.debug('start_presentation')
     # SlideShowWindow measures its size/position by points, not pixels
     # https://technet.microsoft.com/en-us/library/dn528846.aspx
     try:
         dpi = win32ui.GetActiveWindow().GetDC().GetDeviceCaps(88)
     except win32ui.error:
         try:
             dpi = win32ui.GetForegroundWindow().GetDC().GetDeviceCaps(
                 88)
         except win32ui.error:
             dpi = 96
     size = ScreenList().current['size']
     ppt_window = None
     try:
         ppt_window = self.presentation.SlideShowSettings.Run()
     except (AttributeError, pywintypes.com_error) as e:
         log.exception('Caught exception while in start_presentation')
         log.exception(e)
         trace_error_handler(log)
         self.show_error_msg()
     if ppt_window and not Settings().value(
             'presentations/powerpoint control window'):
         try:
             ppt_window.Top = size.y() * 72 / dpi
             ppt_window.Height = size.height() * 72 / dpi
             ppt_window.Left = size.x() * 72 / dpi
             ppt_window.Width = size.width() * 72 / dpi
         except AttributeError as e:
             log.exception('AttributeError while in start_presentation')
             log.exception(e)
     # Find the presentation window and save the handle for later
     self.presentation_hwnd = None
     if ppt_window:
         log.debug('main display size:  y={y:d}, height={height:d}, '
                   'x={x:d}, width={width:d}'.format(
                       y=size.y(),
                       height=size.height(),
                       x=size.x(),
                       width=size.width()))
         win32gui.EnumWindows(self._window_enum_callback, size)
     # Make sure powerpoint doesn't steal focus, unless we're on a single screen setup
     if len(ScreenList().screen_list) > 1:
         Registry().get('main_window').activateWindow()
Пример #2
0
 def start_presentation(self):
     """
     Starts a presentation from the beginning.
     """
     log.debug('start_presentation')
     # SlideShowWindow measures its size/position by points, not pixels
     # https://technet.microsoft.com/en-us/library/dn528846.aspx
     try:
         dpi = win32ui.GetActiveWindow().GetDC().GetDeviceCaps(88)
     except win32ui.error:
         try:
             dpi = win32ui.GetForegroundWindow().GetDC().GetDeviceCaps(88)
         except win32ui.error:
             dpi = 96
     size = ScreenList().current['size']
     ppt_window = None
     try:
         ppt_window = self.presentation.SlideShowSettings.Run()
     except (AttributeError, pywintypes.com_error) as e:
         log.exception('Caught exception while in start_presentation')
         log.exception(e)
         trace_error_handler(log)
         self.show_error_msg()
     if ppt_window and not Settings().value('presentations/powerpoint control window'):
         try:
             ppt_window.Top = size.y() * 72 / dpi
             ppt_window.Height = size.height() * 72 / dpi
             ppt_window.Left = size.x() * 72 / dpi
             ppt_window.Width = size.width() * 72 / dpi
         except AttributeError as e:
             log.exception('AttributeError while in start_presentation')
             log.exception(e)
     # Find the presentation window and save the handle for later
     self.presentation_hwnd = None
     if ppt_window:
         log.debug('main display size:  y=%d, height=%d, x=%d, width=%d'
                   % (size.y(), size.height(), size.x(), size.width()))
         win32gui.EnumWindows(self._window_enum_callback, size)
     # Make sure powerpoint doesn't steal focus, unless we're on a single screen setup
     if len(ScreenList().screen_list) > 1:
         Registry().get('main_window').activateWindow()
Пример #3
0
 def load_presentation(self):
     """
     Called when a presentation is added to the SlideController. It builds the environment, starts communication with
     the background PptView task started earlier.
     """
     log.debug('LoadPresentation')
     size = ScreenList().current['size']
     rect = RECT(size.x(), size.y(), size.right(), size.bottom())
     filepath = str(self.filepath.replace('/', '\\'))
     if not os.path.isdir(self.get_temp_folder()):
         os.makedirs(self.get_temp_folder())
     self.ppt_id = self.controller.process.OpenPPT(filepath, None, rect, str(self.get_temp_folder()) + '\\slide')
     if self.ppt_id >= 0:
         self.create_thumbnails()
         self.stop_presentation()
         return True
     else:
         return False
Пример #4
0
 def start_presentation(self):
     """
     Starts a presentation from the beginning.
     """
     log.debug('start_presentation')
     #SlideShowWindow measures its size/position by points, not pixels
     try:
         dpi = win32ui.GetActiveWindow().GetDC().GetDeviceCaps(88)
     except win32ui.error:
         try:
             dpi = win32ui.GetForegroundWindow().GetDC().GetDeviceCaps(88)
         except win32ui.error:
             dpi = 96
     size = ScreenList().current['size']
     ppt_window = self.presentation.SlideShowSettings.Run()
     if not ppt_window:
         return
     ppt_window.Top = size.y() * 72 / dpi
     ppt_window.Height = size.height() * 72 / dpi
     ppt_window.Left = size.x() * 72 / dpi
     ppt_window.Width = size.width() * 72 / dpi
Пример #5
0
 def load_presentation(self):
     """
     Called when a presentation is added to the SlideController. It builds the environment, starts communication with
     the background PptView task started earlier.
     """
     log.debug('LoadPresentation')
     temp_folder = self.get_temp_folder()
     size = ScreenList().current['size']
     rect = RECT(size.x(), size.y(), size.right(), size.bottom())
     self.file_path = os.path.normpath(self.file_path)
     preview_path = os.path.join(temp_folder, 'slide')
     # Ensure that the paths are null terminated
     byte_file_path = self.file_path.encode('utf-16-le') + b'\0'
     preview_path = preview_path.encode('utf-16-le') + b'\0'
     if not os.path.isdir(temp_folder):
         os.makedirs(temp_folder)
     self.ppt_id = self.controller.process.OpenPPT(byte_file_path, None, rect, preview_path)
     if self.ppt_id >= 0:
         self.create_thumbnails()
         self.stop_presentation()
         return True
     else:
         return False
Пример #6
0
 def load_presentation(self):
     """
     Called when a presentation is added to the SlideController. It builds the environment, starts communication with
     the background PptView task started earlier.
     """
     log.debug('LoadPresentation')
     temp_folder = self.get_temp_folder()
     size = ScreenList().current['size']
     rect = RECT(size.x(), size.y(), size.right(), size.bottom())
     self.file_path = os.path.normpath(self.file_path)
     preview_path = os.path.join(temp_folder, 'slide')
     # Ensure that the paths are null terminated
     byte_file_path = self.file_path.encode('utf-16-le') + b'\0'
     preview_path = preview_path.encode('utf-16-le') + b'\0'
     if not os.path.isdir(temp_folder):
         os.makedirs(temp_folder)
     self.ppt_id = self.controller.process.OpenPPT(byte_file_path, None, rect, preview_path)
     if self.ppt_id >= 0:
         self.create_thumbnails()
         self.stop_presentation()
         return True
     else:
         return False