forked from openlp/openlp
presentation text/notes routines. blanking issues
This commit is contained in:
parent
a33a6d53ca
commit
714135a94f
@ -415,7 +415,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
elif item.is_command():
|
elif item.is_command():
|
||||||
Receiver.send_message(u'%s_start' % item.name.lower(), \
|
Receiver.send_message(u'%s_start' % item.name.lower(), \
|
||||||
[item.title, item.service_item_path,
|
[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)
|
self.displayServiceManagerItems(item, slideno)
|
||||||
|
|
||||||
def displayServiceManagerItems(self, serviceItem, slideno):
|
def displayServiceManagerItems(self, serviceItem, slideno):
|
||||||
@ -678,7 +678,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
if self.isLive:
|
if self.isLive:
|
||||||
Receiver.send_message(u'%s_start' % item.name.lower(), \
|
Receiver.send_message(u'%s_start' % item.name.lower(), \
|
||||||
[item.title, item.service_item_path,
|
[item.title, item.service_item_path,
|
||||||
item.get_frame_title(), self.isLive])
|
item.get_frame_title(), self.isLive, self.blankButton.isChecked()])
|
||||||
else:
|
else:
|
||||||
self.mediaObject.stop()
|
self.mediaObject.stop()
|
||||||
self.mediaObject.clearQueue()
|
self.mediaObject.clearQueue()
|
||||||
|
@ -214,7 +214,7 @@ class ImpressDocument(PresentationDocument):
|
|||||||
self.presentation.Display = self.controller.plugin.render_manager.screens.current_display + 1
|
self.presentation.Display = self.controller.plugin.render_manager.screens.current_display + 1
|
||||||
self.control = None
|
self.control = None
|
||||||
self.create_thumbnails()
|
self.create_thumbnails()
|
||||||
|
|
||||||
def create_thumbnails(self):
|
def create_thumbnails(self):
|
||||||
"""
|
"""
|
||||||
Create thumbnail images for presentation
|
Create thumbnail images for presentation
|
||||||
@ -356,3 +356,38 @@ class ImpressDocument(PresentationDocument):
|
|||||||
return path
|
return path
|
||||||
else:
|
else:
|
||||||
return None
|
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
|
||||||
|
@ -52,17 +52,19 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
self.PluginNameShort = u'Presentation'
|
self.PluginNameShort = u'Presentation'
|
||||||
self.ConfigSection = title
|
self.ConfigSection = title
|
||||||
self.IconPath = u'presentations/presentation'
|
self.IconPath = u'presentations/presentation'
|
||||||
|
self.Automatic = u''
|
||||||
# this next is a class, not an instance of a class - it will
|
# this next is a class, not an instance of a class - it will
|
||||||
# be instanced by the base MediaManagerItem
|
# be instanced by the base MediaManagerItem
|
||||||
self.ListViewWithDnD_class = PresentationListView
|
self.ListViewWithDnD_class = PresentationListView
|
||||||
MediaManagerItem.__init__(self, parent, icon, title)
|
MediaManagerItem.__init__(self, parent, icon, title)
|
||||||
self.message_listener = MessageListener(self)
|
self.message_listener = MessageListener(self)
|
||||||
|
|
||||||
def initPluginNameVisible(self):
|
def initPluginNameVisible(self):
|
||||||
self.PluginNameVisible = self.trUtf8('Presentation')
|
self.PluginNameVisible = self.trUtf8('Presentation')
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
self.OnNewPrompt = self.trUtf8('Select Presentation(s)')
|
self.OnNewPrompt = self.trUtf8('Select Presentation(s)')
|
||||||
|
self.Automatic = self.trUtf8('Automatic')
|
||||||
fileType = u''
|
fileType = u''
|
||||||
for controller in self.controllers:
|
for controller in self.controllers:
|
||||||
if self.controllers[controller].enabled:
|
if self.controllers[controller].enabled:
|
||||||
@ -108,7 +110,7 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
if self.controllers[item].enabled:
|
if self.controllers[item].enabled:
|
||||||
self.DisplayTypeComboBox.addItem(item)
|
self.DisplayTypeComboBox.addItem(item)
|
||||||
if self.DisplayTypeComboBox.count() > 1:
|
if self.DisplayTypeComboBox.count() > 1:
|
||||||
self.DisplayTypeComboBox.insertItem(0, u'Automatic')
|
self.DisplayTypeComboBox.insertItem(0, self.Automatic)
|
||||||
self.DisplayTypeComboBox.setCurrentIndex(0)
|
self.DisplayTypeComboBox.setCurrentIndex(0)
|
||||||
|
|
||||||
def loadList(self, list):
|
def loadList(self, list):
|
||||||
@ -154,7 +156,7 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
for item in items:
|
for item in items:
|
||||||
bitem = self.ListView.item(item.row())
|
bitem = self.ListView.item(item.row())
|
||||||
filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
|
filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())
|
||||||
if shortname==u'Automatic':
|
if shortname == self.Automatic:
|
||||||
service_item.shortname = self.findControllerByType(filename)
|
service_item.shortname = self.findControllerByType(filename)
|
||||||
if not service_item.shortname:
|
if not service_item.shortname:
|
||||||
return False
|
return False
|
||||||
|
@ -44,7 +44,7 @@ class Controller(object):
|
|||||||
self.doc = None
|
self.doc = None
|
||||||
log.info(u'%s controller loaded' % live)
|
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))
|
log.debug(u'Live = %s, addHandler %s' % (self.isLive, file))
|
||||||
self.controller = controller
|
self.controller = controller
|
||||||
if self.doc is not None:
|
if self.doc is not None:
|
||||||
@ -53,6 +53,8 @@ class Controller(object):
|
|||||||
self.doc.load_presentation()
|
self.doc.load_presentation()
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
self.doc.start_presentation()
|
self.doc.start_presentation()
|
||||||
|
if isBlank:
|
||||||
|
self.blank()
|
||||||
Receiver.send_message(u'live_slide_hide')
|
Receiver.send_message(u'live_slide_hide')
|
||||||
self.doc.slidenumber = 0
|
self.doc.slidenumber = 0
|
||||||
|
|
||||||
@ -130,6 +132,7 @@ class Controller(object):
|
|||||||
#self.timer.stop()
|
#self.timer.stop()
|
||||||
|
|
||||||
def blank(self):
|
def blank(self):
|
||||||
|
log.debug(u'Live = %s, blank' % self.isLive)
|
||||||
if not self.isLive:
|
if not self.isLive:
|
||||||
return
|
return
|
||||||
if not self.doc.is_loaded():
|
if not self.doc.is_loaded():
|
||||||
@ -139,6 +142,7 @@ class Controller(object):
|
|||||||
self.doc.blank_screen()
|
self.doc.blank_screen()
|
||||||
|
|
||||||
def unblank(self):
|
def unblank(self):
|
||||||
|
log.debug(u'Live = %s, unblank' % self.isLive)
|
||||||
if not self.isLive:
|
if not self.isLive:
|
||||||
return
|
return
|
||||||
self.activate()
|
self.activate()
|
||||||
@ -188,14 +192,14 @@ class MessageListener(object):
|
|||||||
Save the handler as any new presentations start here
|
Save the handler as any new presentations start here
|
||||||
"""
|
"""
|
||||||
log.debug(u'Startup called with message %s' % message)
|
log.debug(u'Startup called with message %s' % message)
|
||||||
self.handler, file, isLive = self.decodeMessage(message)
|
self.handler, file, isLive, isBlank = self.decodeMessage(message)
|
||||||
if self.handler == u'Automatic':
|
if self.handler == self.mediaitem.Automatic:
|
||||||
self.handler = self.mediaitem.findControllerByType(file)
|
self.handler = self.mediaitem.findControllerByType(file)
|
||||||
if not self.handler:
|
if not self.handler:
|
||||||
return
|
return
|
||||||
|
|
||||||
if isLive:
|
if isLive:
|
||||||
self.liveHandler.addHandler(self.controllers[self.handler], file)
|
self.liveHandler.addHandler(self.controllers[self.handler], file, isBlank)
|
||||||
else:
|
else:
|
||||||
self.previewHandler.addHandler(self.controllers[self.handler], file)
|
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.
|
Message containing Presentaion handler name and file to be presented.
|
||||||
"""
|
"""
|
||||||
file = os.path.join(message[1], message[2])
|
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):
|
def timeout(self):
|
||||||
self.liveHandler.poll()
|
self.liveHandler.poll()
|
||||||
|
@ -77,21 +77,6 @@ class PowerpointController(PresentationController):
|
|||||||
self.process.Visible = True
|
self.process.Visible = True
|
||||||
self.process.WindowState = 2
|
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):
|
def kill(self):
|
||||||
"""
|
"""
|
||||||
Called at system exit to clean up any running presentations
|
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.
|
The file name of the presentations to run.
|
||||||
"""
|
"""
|
||||||
log.debug(u'LoadPresentation')
|
log.debug(u'LoadPresentation')
|
||||||
#try:
|
|
||||||
if not self.controller.process.Visible:
|
if not self.controller.process.Visible:
|
||||||
self.controller.start_process()
|
self.controller.start_process()
|
||||||
#except:
|
|
||||||
# self.controller.start_process()
|
|
||||||
#try:
|
#try:
|
||||||
self.controller.process.Presentations.Open(self.filepath, False, False, True)
|
self.controller.process.Presentations.Open(self.filepath, False, False, True)
|
||||||
#except:
|
#except:
|
||||||
@ -159,7 +141,7 @@ class PowerpointDocument(PresentationDocument):
|
|||||||
if self.check_thumbnails():
|
if self.check_thumbnails():
|
||||||
return
|
return
|
||||||
self.presentation.Export(os.path.join(self.thumbnailpath, '')
|
self.presentation.Export(os.path.join(self.thumbnailpath, '')
|
||||||
, 'png', 600, 480)
|
, 'png', 640, 480)
|
||||||
|
|
||||||
def close_presentation(self):
|
def close_presentation(self):
|
||||||
"""
|
"""
|
||||||
@ -168,7 +150,7 @@ class PowerpointDocument(PresentationDocument):
|
|||||||
being shut down
|
being shut down
|
||||||
"""
|
"""
|
||||||
if self.presentation == None:
|
if self.presentation == None:
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
self.presentation.Close()
|
self.presentation.Close()
|
||||||
except:
|
except:
|
||||||
@ -176,6 +158,22 @@ class PowerpointDocument(PresentationDocument):
|
|||||||
self.presentation = None
|
self.presentation = None
|
||||||
self.controller.remove_doc(self)
|
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):
|
def is_active(self):
|
||||||
"""
|
"""
|
||||||
Returns true if a presentation is currently active
|
Returns true if a presentation is currently active
|
||||||
@ -276,3 +274,33 @@ class PowerpointDocument(PresentationDocument):
|
|||||||
return path
|
return path
|
||||||
else:
|
else:
|
||||||
return None
|
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
|
||||||
|
@ -350,3 +350,21 @@ class PresentationDocument(object):
|
|||||||
prefix = u'preview'
|
prefix = u'preview'
|
||||||
Receiver.send_message(u'%s_slidecontroller_change' % prefix,
|
Receiver.send_message(u'%s_slidecontroller_change' % prefix,
|
||||||
self.slidenumber - 1)
|
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 ''
|
||||||
|
Loading…
Reference in New Issue
Block a user