diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index ff8507f5d..7221e9a21 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -415,7 +415,7 @@ class SlideController(QtGui.QWidget): elif item.is_command(): Receiver.send_message(u'%s_start' % item.name.lower(), \ [item.title, item.service_item_path, - item.get_frame_title(), slideno, self.isLive]) + item.get_frame_title(), slideno, self.isLive, self.blankButton.isChecked()]) self.displayServiceManagerItems(item, slideno) def displayServiceManagerItems(self, serviceItem, slideno): @@ -678,7 +678,7 @@ class SlideController(QtGui.QWidget): if self.isLive: Receiver.send_message(u'%s_start' % item.name.lower(), \ [item.title, item.service_item_path, - item.get_frame_title(), self.isLive]) + item.get_frame_title(), self.isLive, self.blankButton.isChecked()]) else: self.mediaObject.stop() self.mediaObject.clearQueue() diff --git a/openlp/plugins/presentations/lib/impresscontroller.py b/openlp/plugins/presentations/lib/impresscontroller.py index 196763cce..56a223f06 100644 --- a/openlp/plugins/presentations/lib/impresscontroller.py +++ b/openlp/plugins/presentations/lib/impresscontroller.py @@ -214,7 +214,7 @@ class ImpressDocument(PresentationDocument): self.presentation.Display = self.controller.plugin.render_manager.screens.current_display + 1 self.control = None self.create_thumbnails() - + def create_thumbnails(self): """ Create thumbnail images for presentation @@ -356,3 +356,38 @@ class ImpressDocument(PresentationDocument): return path else: return None + + def get_slide_text(self, slide_no): + """ + Returns the text on the slide + + ``slide_no`` + The slide the text is required for, starting at 1 + """ + doc = self.document + pages = doc.getDrawPages() + text = '' + page = pages.getByIndex(slide_no - 1) + for idx in range(page.getCount()): + shape = page.getByIndex(idx) + if shape.supportsService("com.sun.star.drawing.Text"): + text += shape.getString() + '\n' + return text + + def get_slide_notes(self, slide_no): + """ + Returns the text on the slide + + ``slide_no`` + The slide the notes are required for, starting at 1 + """ + doc = self.document + pages = doc.getDrawPages() + text = '' + page = pages.getByIndex(slide_no - 1) + notes = page.getNotesPage() + for idx in range(notes.getCount()): + shape = notes.getByIndex(idx) + if shape.supportsService("com.sun.star.drawing.Text"): + text += shape.getString() + '\n' + return text diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index 7fed27145..37d50d01c 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -52,17 +52,19 @@ class PresentationMediaItem(MediaManagerItem): self.PluginNameShort = u'Presentation' self.ConfigSection = title self.IconPath = u'presentations/presentation' + self.Automatic = u'' # this next is a class, not an instance of a class - it will # be instanced by the base MediaManagerItem self.ListViewWithDnD_class = PresentationListView MediaManagerItem.__init__(self, parent, icon, title) self.message_listener = MessageListener(self) - + def initPluginNameVisible(self): self.PluginNameVisible = self.trUtf8('Presentation') def retranslateUi(self): self.OnNewPrompt = self.trUtf8('Select Presentation(s)') + self.Automatic = self.trUtf8('Automatic') fileType = u'' for controller in self.controllers: if self.controllers[controller].enabled: @@ -108,7 +110,7 @@ class PresentationMediaItem(MediaManagerItem): if self.controllers[item].enabled: self.DisplayTypeComboBox.addItem(item) if self.DisplayTypeComboBox.count() > 1: - self.DisplayTypeComboBox.insertItem(0, u'Automatic') + self.DisplayTypeComboBox.insertItem(0, self.Automatic) self.DisplayTypeComboBox.setCurrentIndex(0) def loadList(self, list): @@ -154,7 +156,7 @@ class PresentationMediaItem(MediaManagerItem): for item in items: bitem = self.ListView.item(item.row()) filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString()) - if shortname==u'Automatic': + if shortname == self.Automatic: service_item.shortname = self.findControllerByType(filename) if not service_item.shortname: return False diff --git a/openlp/plugins/presentations/lib/messagelistener.py b/openlp/plugins/presentations/lib/messagelistener.py index 62f5df56c..17a2492ea 100644 --- a/openlp/plugins/presentations/lib/messagelistener.py +++ b/openlp/plugins/presentations/lib/messagelistener.py @@ -44,7 +44,7 @@ class Controller(object): self.doc = None log.info(u'%s controller loaded' % live) - def addHandler(self, controller, file): + def addHandler(self, controller, file, isBlank): log.debug(u'Live = %s, addHandler %s' % (self.isLive, file)) self.controller = controller if self.doc is not None: @@ -53,6 +53,8 @@ class Controller(object): self.doc.load_presentation() if self.isLive: self.doc.start_presentation() + if isBlank: + self.blank() Receiver.send_message(u'live_slide_hide') self.doc.slidenumber = 0 @@ -130,6 +132,7 @@ class Controller(object): #self.timer.stop() def blank(self): + log.debug(u'Live = %s, blank' % self.isLive) if not self.isLive: return if not self.doc.is_loaded(): @@ -139,6 +142,7 @@ class Controller(object): self.doc.blank_screen() def unblank(self): + log.debug(u'Live = %s, unblank' % self.isLive) if not self.isLive: return self.activate() @@ -188,14 +192,14 @@ class MessageListener(object): Save the handler as any new presentations start here """ log.debug(u'Startup called with message %s' % message) - self.handler, file, isLive = self.decodeMessage(message) - if self.handler == u'Automatic': + self.handler, file, isLive, isBlank = self.decodeMessage(message) + if self.handler == self.mediaitem.Automatic: self.handler = self.mediaitem.findControllerByType(file) if not self.handler: return if isLive: - self.liveHandler.addHandler(self.controllers[self.handler], file) + self.liveHandler.addHandler(self.controllers[self.handler], file, isBlank) else: self.previewHandler.addHandler(self.controllers[self.handler], file) @@ -263,7 +267,7 @@ class MessageListener(object): Message containing Presentaion handler name and file to be presented. """ file = os.path.join(message[1], message[2]) - return message[0], file, message[4] + return message[0], file, message[4], message[5] def timeout(self): self.liveHandler.poll() diff --git a/openlp/plugins/presentations/lib/powerpointcontroller.py b/openlp/plugins/presentations/lib/powerpointcontroller.py index bbd2c528a..838ab6c8c 100644 --- a/openlp/plugins/presentations/lib/powerpointcontroller.py +++ b/openlp/plugins/presentations/lib/powerpointcontroller.py @@ -77,21 +77,6 @@ class PowerpointController(PresentationController): self.process.Visible = True self.process.WindowState = 2 - def is_loaded(self): - """ - Returns true if a presentation is loaded - """ - try: - if not self.process.Visible: - return False - if self.process.Windows.Count == 0: - return False - if self.process.Presentations.Count == 0: - return False - except: - return False - return True - def kill(self): """ Called at system exit to clean up any running presentations @@ -134,11 +119,8 @@ class PowerpointDocument(PresentationDocument): The file name of the presentations to run. """ log.debug(u'LoadPresentation') - #try: if not self.controller.process.Visible: self.controller.start_process() - #except: - # self.controller.start_process() #try: self.controller.process.Presentations.Open(self.filepath, False, False, True) #except: @@ -159,7 +141,7 @@ class PowerpointDocument(PresentationDocument): if self.check_thumbnails(): return self.presentation.Export(os.path.join(self.thumbnailpath, '') - , 'png', 600, 480) + , 'png', 640, 480) def close_presentation(self): """ @@ -168,7 +150,7 @@ class PowerpointDocument(PresentationDocument): being shut down """ if self.presentation == None: - return + return try: self.presentation.Close() except: @@ -176,6 +158,22 @@ class PowerpointDocument(PresentationDocument): self.presentation = None self.controller.remove_doc(self) + def is_loaded(self): + """ + Returns true if a presentation is loaded + """ + try: + if not self.controller.process.Visible: + return False + if self.controller.process.Windows.Count == 0: + return False + if self.controller.process.Presentations.Count == 0: + return False + except: + return False + return True + + def is_active(self): """ Returns true if a presentation is currently active @@ -276,3 +274,33 @@ class PowerpointDocument(PresentationDocument): return path else: return None + + def get_slide_text(self, slide_no): + """ + Returns the text on the slide + + ``slide_no`` + The slide the text is required for, starting at 1 + """ + text = '' + shapes = self.presentation.Slides(slide_no).Shapes + for idx in range(shapes.Count): + shape = shapes(idx + 1) + if shape.HasTextFrame: + text += shape.TextFrame.TextRange.Text + '\n' + return text + + def get_slide_notes(self, slide_no): + """ + Returns the text on the slide + + ``slide_no`` + The slide the notes are required for, starting at 1 + """ + text = '' + shapes = self.presentation.Slides(slide_no).NotesPage.Shapes + for idx in range(shapes.Count): + shape = shapes(idx + 1) + if shape.HasTextFrame: + text += shape.TextFrame.TextRange.Text + '\n' + return text diff --git a/openlp/plugins/presentations/lib/presentationcontroller.py b/openlp/plugins/presentations/lib/presentationcontroller.py index 0783d40f4..5a914e1cc 100644 --- a/openlp/plugins/presentations/lib/presentationcontroller.py +++ b/openlp/plugins/presentations/lib/presentationcontroller.py @@ -350,3 +350,21 @@ class PresentationDocument(object): prefix = u'preview' Receiver.send_message(u'%s_slidecontroller_change' % prefix, self.slidenumber - 1) + + def get_slide_text(self, slide_no): + """ + Returns the text on the slide + + ``slide_no`` + The slide the text is required for, starting at 1 + """ + return '' + + def get_slide_notes(self, slide_no): + """ + Returns the text on the slide + + ``slide_no`` + The slide the notes are required for, starting at 1 + """ + return ''